fisher/test/validate.fish
Jorge Bucaran 707855203a Ahoy! Fisherman gets a super patch v0.3.1
This patch contains several amends for 0.3.0 and
other minor documentation corrections.  Major
documentation revision and rewrite.

fisher help shows fisher(1) by default now.

Fix a critical bug that was causing fisher uninstall
--force to remove not the symbolic link, but the
actual files. Closes #24

Rename orphan tag to custom for plugins installed
using a custom URL.

warning Remove fisher --link flag and create symbolic
links by default for local paths. The user does not
have to worry about symbolic links or whether the
copy is as symbolic link or not anymore. If the user
tries to install a local path, then the best thing
to do is to create a symbolic link. This also
eliminates the need to call update.

warning Remove fisher --cache and fisher --validate.
Now, that these options are separated into their own
function and they are intentionally private, there
is no need for them.
2016-01-10 16:13:46 +09:00

82 lines
2.0 KiB
Fish

set -l id foo bar
set -l host baz
set -l tld org
function -S setup
set -g fisher_default_host https://$host.$tld
end
test "validate names"
$id[1] = (printf "%s\n" $id[1] | __fisher_validate)
end
test "validate uris"
$fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2] | __fisher_validate)
end
test "validate names may end with a number"
"a0" = (printf "%s\n" a0 | __fisher_validate)
end
test "validate names may start in uppercase"
-z (printf "%s\n" A | __fisher_validate)
end
test "validate names may not start with a number"
-z (printf "%s\n" 0abc | __fisher_validate)
end
test "remove `/' from uris"
$fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2]/ | __fisher_validate)
end
test "remove `.git' from uris"
$fisher_default_host/$id[1]/$id[2] = (
printf "%s\n" $id[1]/$id[2].git | __fisher_validate)
end
test "file:/// uris"
! -z (printf "%s\n" file:///$id[1]/$id[2].git | __fisher_validate)
end
test "id/id uris"
! -z (printf "%s\n" $id[1]/$id[2].git | __fisher_validate)
end
test "short owner/repo uris"
https://github.com/$id[1]/$id[2] = (
printf "%s\n" github/$id[1]/$id[2] | __fisher_validate)
end
test "short $short:owner/repo uris"
https://github.com/$id[1]/$id[2] = (
printf "%s\n" gh:$id[1]/$id[2] | __fisher_validate)
end
test "short bitbucket urls uris"
https://bitbucket.org/$id[1]/$id[2] = (
printf "%s\n" bb:$id[1]/$id[2] | __fisher_validate)
end
test "short gitlab urls uris"
https://gitlab.com/$id[1]/$id[2] = (
printf "%s\n" gl:$id[1]/$id[2] | __fisher_validate)
end
test "omf: urls"
https://github.com/oh-my-fish/theme-default = (
printf "%s\n" omf:theme-default | __fisher_validate)
end
test "omf/ urls"
https://github.com/oh-my-fish/theme-default = (
printf "%s\n" omf/theme-default | __fisher_validate)
end
test "urls with a period"
https://github.com/oh-my-fish/theme-cmorrell.com = (
printf "%s\n" omf/theme-cmorrell.com | __fisher_validate)
end