about summary refs log tree commit diff
path: root/tests/search.sh
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2018-03-14T00·43-0600
committerGitHub <noreply@github.com>2018-03-14T00·43-0600
commit56f2ed00813f49e2834076787f98438a976eebb1 (patch)
treeea268ddc8d183563ea03d1b9f209f48efbbe5998 /tests/search.sh
parent7afdc8d4a100d26cd09f7d63c0fe915b4d6a53c9 (diff)
parentc577186f5916c90193368492f1c4180a1386febc (diff)
Merge pull request #1906 from dtzWill/fix/nix-search
nix search: tests and fix #1893 and part of #1892
Diffstat (limited to 'tests/search.sh')
-rw-r--r--tests/search.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/search.sh b/tests/search.sh
new file mode 100644
index 000000000000..d83427247d3e
--- /dev/null
+++ b/tests/search.sh
@@ -0,0 +1,38 @@
+source common.sh
+
+clearStore
+clearCache
+
+# No packages
+(( $(NIX_PATH= nix search -u|wc -l) == 0 ))
+
+# Haven't updated cache, still nothing
+(( $(nix search -f search.nix hello|wc -l) == 0 ))
+(( $(nix search -f search.nix |wc -l) == 0 ))
+
+# Update cache, search should work
+(( $(nix search -f search.nix -u hello|wc -l) > 0 ))
+
+# Use cache
+(( $(nix search -f search.nix foo|wc -l) > 0 ))
+(( $(nix search foo|wc -l) > 0 ))
+
+# Test --no-cache works
+# No results from cache
+(( $(nix search --no-cache foo |wc -l) == 0 ))
+# Does find results from file pointed at
+(( $(nix search -f search.nix --no-cache foo |wc -l) > 0 ))
+
+# Check descriptions are searched
+(( $(nix search broken | wc -l) > 0 ))
+
+# Check search that matches nothing
+(( $(nix search nosuchpackageexists | wc -l) == 0 ))
+
+
+## Search expressions
+
+# Check that empty search string matches all
+nix search|grep -q foo
+nix search|grep -q bar
+nix search|grep -q hello