diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-06-25 22:59:58 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-06-27 11:14:40 +0200 |
| commit | 8874faaaac665100a095ef25e39c9a389f5a397f (patch) | |
| tree | 2637ca9b5f10a73f799c87792b3ba00d03921ad2 /tests/ui.scm | |
| parent | c25b44d640f709599e3c484a458ae452d99108e1 (diff) | |
ui: 'relevance' considers regexps connected with a logical and.
* guix/ui.scm (relevance)[score]: Change to return 0 when one of REGEXPS
doesn't match.
* tests/ui.scm ("package-relevance"): New test.
Diffstat (limited to 'tests/ui.scm')
| -rw-r--r-- | tests/ui.scm | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/ui.scm b/tests/ui.scm index 1e98e3534be..2138e23369b 100644 --- a/tests/ui.scm +++ b/tests/ui.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -22,10 +22,12 @@ | |||
| 22 | #:use-module (guix profiles) | 22 | #:use-module (guix profiles) |
| 23 | #:use-module (guix store) | 23 | #:use-module (guix store) |
| 24 | #:use-module (guix derivations) | 24 | #:use-module (guix derivations) |
| 25 | #:use-module ((gnu packages) #:select (specification->package)) | ||
| 25 | #:use-module (guix tests) | 26 | #:use-module (guix tests) |
| 26 | #:use-module (srfi srfi-1) | 27 | #:use-module (srfi srfi-1) |
| 27 | #:use-module (srfi srfi-11) | 28 | #:use-module (srfi srfi-11) |
| 28 | #:use-module (srfi srfi-19) | 29 | #:use-module (srfi srfi-19) |
| 30 | #:use-module (srfi srfi-26) | ||
| 29 | #:use-module (srfi srfi-64) | 31 | #:use-module (srfi srfi-64) |
| 30 | #:use-module (ice-9 regex)) | 32 | #:use-module (ice-9 regex)) |
| 31 | 33 | ||
| @@ -260,4 +262,27 @@ Second line" 24)) | |||
| 260 | "ISO-8859-1") | 262 | "ISO-8859-1") |
| 261 | (show-manifest-transaction store m t)))))))) | 263 | (show-manifest-transaction store m t)))))))) |
| 262 | 264 | ||
| 265 | (test-assert "package-relevance" | ||
| 266 | (let ((guile (specification->package "guile")) | ||
| 267 | (gcrypt (specification->package "guile-gcrypt")) | ||
| 268 | (go (specification->package "go")) | ||
| 269 | (gnugo (specification->package "gnugo")) | ||
| 270 | (rx (cut make-regexp <> regexp/icase)) | ||
| 271 | (>0 (cut > <> 0)) | ||
| 272 | (=0 zero?)) | ||
| 273 | (and (>0 (package-relevance guile | ||
| 274 | (map rx '("scheme")))) | ||
| 275 | (>0 (package-relevance guile | ||
| 276 | (map rx '("scheme" "implementation")))) | ||
| 277 | (>0 (package-relevance gcrypt | ||
| 278 | (map rx '("guile" "crypto")))) | ||
| 279 | (=0 (package-relevance guile | ||
| 280 | (map rx '("guile" "crypto")))) | ||
| 281 | (>0 (package-relevance go | ||
| 282 | (map rx '("go")))) | ||
| 283 | (=0 (package-relevance go | ||
| 284 | (map rx '("go" "game")))) | ||
| 285 | (>0 (package-relevance gnugo | ||
| 286 | (map rx '("go" "game"))))))) | ||
| 287 | |||
| 263 | (test-end "ui") | 288 | (test-end "ui") |
