fisher/test/search.fish
Jorge Bucaran 5dc1eea953
Ahoy! an early v0.7.0 is here!
+ Add  the ability  to install plugins  from Gists.  You can
distribute a very simple,  one-single function plugin in the
form  of a  Gist. Your  users  can install  it using  fisher
install  url and  Fisherman will  query the  Gist using  the
GitHub API to get a list of  the Gist files and use the name
of the  first identified *.fish  file to name the  plugin in
your system.  Since there is no  formal way to name  a Gist,
and you may  prefer to keep the "description"  field for the
actual description  and not a name,  Fisherman supports only
one fish file per Gist. Closes #75.

+ Use command(1) when calling non-builtins. Thanks @daenney.
Closes #79.

+  Add  __fisher_plugin_can_enable  to detect  installing  a
prompt that is not the current one. Closes #78.

+  Remove  the ability  to  install  a  plugin in  a  parent
directory using ..  or ../ or even worse, ../../  as well as
other combinations  that navigate  to a parent  directory. I
find  the use  case odd  at  best, and  more dangerous  that
useful.  If you  want  to  install a  local  plugin use  the
full  path  or a  relative  path,  always top  down.  fisher
install  . or  fisher  install my/plugin  or fisher  install
/Users/$USER/path/to/plugin. Closes #81.
2016-02-11 09:40:03 +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 wait
eval $argv
end
end
function -S teardown
rm -rf $path
functions -e wait
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