fisher/test/validate-path.fish
Jorge Bucaran 2cbbb00dcb Fisherman 1.0 RC
* Deprecate fisher --list in favor of a new command fisher list.
  The behavior is roughly the same. See fisher help list for
  usage. tl;dr: Use list to query the local system / cache and
  search to query the index.

* Teach fisher_plugin_walk about fish_postexec,
  fish_command_not_found and fish_preexec event emitters and
  erase them during uninstall if they were defined in a snippet.

* Fisherman now recognizes the following aliases by default:
  i for install, u for update, l for list, s for search and h
  for help.

* Large documentation rewrite. Better, simpler, more concise
  and more consistent.

* Fisherman now detects if users have modified their fish
  prompt using fish_config and if so, uninstalls $fisher_prompt.
2016-02-29 23:13:29 +09:00

48 lines
995 B
Fish

set -l path $DIRNAME/.t-$TESTNAME-(random)
function -S setup
mkdir -p $path
touch $path/file
end
function -S teardown
rm -rf $path
end
test "$TESTNAME - Get a valid path"
"$path" = (__fisher_plugin_validate $path)
end
test "$TESTNAME - Get absolute path if not given a full path"
"$path" = (
pushd $path
__fisher_plugin_validate .
popd
)
end
test "$TESTNAME - Remove trailing slashes"
"$path" = (__fisher_plugin_validate $path/)
end
test "$TESTNAME - Clean up unusual paths"
"$path" = (
pushd $path/../../
__fisher_plugin_validate ./test/.//////(basename $path)
popd
)
end
test "$TESTNAME - Fail phoney paths"
1 -eq (
__fisher_plugin_validate /(random)/(random) > /dev/null
echo $status
)
end
for invalid_path in ".." "../"
test "$TESTNAME - Do not allow to install '$invalid_path' like paths"
"../" = (__fisher_plugin_validate $invalid_path)
end
end