2018-02-26 00:33:17 +02:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
clearStore
|
|
|
|
clearCache
|
|
|
|
|
2019-04-08 17:11:36 +03:00
|
|
|
exit 0 # FIXME
|
|
|
|
|
2018-02-26 00:33:17 +02:00
|
|
|
# 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 ))
|
|
|
|
|
2018-04-18 22:45:46 +03:00
|
|
|
# Search for multiple arguments
|
2018-07-03 23:36:20 +03:00
|
|
|
(( $(nix search hello empty | wc -l) == 3 ))
|
2018-04-18 22:45:46 +03:00
|
|
|
|
|
|
|
# Multiple arguments will not exist
|
|
|
|
(( $(nix search hello broken | wc -l) == 0 ))
|
2018-02-26 00:33:17 +02:00
|
|
|
|
|
|
|
## Search expressions
|
|
|
|
|
|
|
|
# Check that empty search string matches all
|
2018-03-01 21:24:03 +02:00
|
|
|
nix search|grep -q foo
|
|
|
|
nix search|grep -q bar
|
|
|
|
nix search|grep -q hello
|