fisher/test/search.fish
Jorge Bucaran 4b15cf374f
Ahoy! We are getting close to 0.8.0
* Move AUTHORS -> THANKS and remove automatic generation.

THANKS is more sensible than AUTHORS. CREDITS was second best.
Also, after perusing similar files in other projects I noticed
some entries lacking a valid email address and decided fow now
this file should be curated manually to make sure each entry
contains a useful link. This allows users who have contributed
to the project ways other than committing code to be added to
the list as well.

* Rename wait -> spin.

* Remove extra padding in links. (Cosmetic)

* Update to reflect API refactorings.

* Fix bug causing brackets to show up in description.

* Implement using spin function.

* __fisher_gist_to_name uses curl to query the GitHub API which will
return a JSON stream even if the Gist could not be found. So, it's
not possible to determine whether we failed or not using our spin
function and actually need to check the returned string to see if
it contains a valid name or not.

* Let git pull write errors to stderr.

* Use new internal __fisher_spin.

* Extract spin to independent / external module and tweak Makefile
to better integrate with new install process.
2016-02-14 13:17:47 +09:00

107 lines
2.8 KiB
Fish

set -l path $DIRNAME/.t-$TESTNAME-(random)
function -S setup
mkdir -p $path
set -g fisher_cache $path
set -g fisher_index file://$DIRNAME/fixtures/plugins/index
__fisher_index_update
function spin -a commands
eval "$commands"
end
end
function -S teardown
rm -rf $path
functions -e spin
end
test "$TESTNAME - Get only names from index"
foo bar baz foobar = (fisher search --name)
end
test "$TESTNAME - Get only URLs from index"
"https://github.com/foo" \
"https://github.com/bar" \
"https://github.com/baz" \
"https://github.com/foobar" = (fisher search --url)
end
test "$TESTNAME - Get only info from index"
"about foo" "about bar" "about baz" "about foobar" = (fisher search --info)
end
test "$TESTNAME - Get only tags from index"
foo bar baz = (fisher search --tag)
end
test "$TESTNAME - Get only authors from index"
foosmith barsmith bazsmith foobarson = (fisher search --author)
end
test "$TESTNAME - Get full record"
"foo" "https://github.com/foo" "about foo" "foo" "foosmith" = (fisher search --name=foo)
end
test "$TESTNAME - Match name and get name"
"foo" = (fisher search --name=foo --name)
end
test "$TESTNAME - Match name and get URL"
"https://github.com/foo" = (fisher search --name=foo --url)
end
test "$TESTNAME - Match name and get info"
"about foo" = (fisher search --name=foo --info)
end
test "$TESTNAME - Match name and get tag/s"
"foo" "bar" = (fisher search --name=foobar --tag)
end
test "$TESTNAME - Match name and get author"
"foosmith" = (fisher search --name=foo --author)
end
test "$TESTNAME - Match tag and get author #1"
"foosmith" "foobarson" = (fisher search --tag=foo --author)
end
test "$TESTNAME - Match tag and get author #2"
"barsmith" "foobarson" = (fisher search --tag=bar --author)
end
test "$TESTNAME - Match name regex and get author"
"barsmith" "bazsmith" = (fisher search --name~/^b/ --author)
end
test "$TESTNAME - Match author regex and get url"
"https://github.com/foo" \
"https://github.com/bar" \
"https://github.com/baz" \
"https://github.com/foobar" = (fisher search --author~/^[fb]/ --url)
end
test "$TESTNAME - Match multiple tags with OR join (default) and get name"
foobar foo bar = (fisher search --tag={foo,bar} --name)
end
test "$TESTNAME - Match multiple tags with AND join and get name"
foobar = (fisher search --and --tag={foo,bar} --name)
end
test "$TESTNAME - Match field and get multiple fields #1"
"bar;https://github.com/bar" "baz;https://github.com/baz" = (
fisher search --name~/^b/ --name --url)
end
test "$TESTNAME - Match field and get multiple fields #2"
"foosmith;foo" "foobarson;bar" = (fisher search --name~/^f/ --author --tags)
end
test "$TESTNAME - Get full index"
(fisher search) = (cat $fisher_cache/.index)
end