aboutsummaryrefslogtreecommitdiff
path: root/tests/guix-package.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-01-04 22:27:38 +0100
committerLudovic Courtès <ludo@gnu.org>2016-01-05 00:28:42 +0100
commitdb5a94445f3b21b307c73ea72ed495bda891ef28 (patch)
tree8a9367de0e41b6742a47f46a36e751d102b5f934 /tests/guix-package.sh
parentd28ef4393719692371aee085d5723f5779cb6049 (diff)
downloadguix-db5a94445f3b21b307c73ea72ed495bda891ef28.tar
guix-db5a94445f3b21b307c73ea72ed495bda891ef28.tar.gz
guix package: Allow multiple '--search' flags.
* guix/scripts/package.scm (find-packages-by-description): Change 'rx' parameter to 'regexps'. [matches-all?, matches-one?]: New procedures. Use them. (process-query): Collect regexps from all 'search' queries, and pass them to 'find-packages-by-description'. * tests/guix-package.sh: Add tests. * doc/guix.texi (Invoking guix package): Document it.
Diffstat (limited to 'tests/guix-package.sh')
-rw-r--r--tests/guix-package.sh20
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 5e6ff8b012..cf1a185590 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU
-# Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
#
# This file is part of GNU Guix.
@@ -30,9 +30,10 @@ readlink_base ()
module_dir="t-guix-package-$$"
profile="t-profile-$$"
-rm -f "$profile"
+tmpfile="t-guix-package-file-$$"
+rm -f "$profile" "$tmpfile"
-trap 'rm -f "$profile" "$profile-"[0-9]* ; rm -rf "$module_dir" t-home-'"$$" EXIT
+trap 'rm -f "$profile" "$profile-"[0-9]* "$tmpfile"; rm -rf "$module_dir" t-home-'"$$" EXIT
# Use `-e' with a non-package expression.
if guix package --bootstrap -e +;
@@ -96,6 +97,19 @@ test "`guix package -s "An example GNU package" | grep ^name:`" = \
"name: hello"
test -z "`guix package -s "n0t4r341p4ck4g3"`"
+# Search with one and then two regexps.
+# First we get printed circuit boards *and* board games.
+guix package -s '\<board\>' > "$tmpfile"
+grep '^name: pcb' "$tmpfile"
+grep '^name: gnubg' "$tmpfile"
+
+# Second we get only board games.
+guix package -s '\<board\>' -s game > "$tmpfile"
+grep -v '^name: pcb' "$tmpfile" > /dev/null
+grep '^name: gnubg' "$tmpfile"
+
+rm -f "$tmpfile"
+
# Make sure `--search' can display all the packages.
guix package --search="" > /dev/null