You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fisher/test/validate-path.fish

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