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/path-is-prompt.fish

35 lines
1.1 KiB
Fish

set -l path $DIRNAME/.t-$TESTNAME-(random)
function -S setup
mkdir -p $path/{left,right,both,none}
# In Fisherman everything is a plugin, but prompts are handled with special care behind
# the scenes. A plugin is called a prompt if it has either a fish_prompt or fish_right_
# prompt. Other files often included with prompt plugins such as fish_greeting or fish_
# title are not taken into account.
touch $path/left/fish_prompt.fish
touch $path/right/fish_right_prompt.fish
touch $path/both/fish_{,right_}prompt.fish
end
function -S teardown
rm -rf $path
end
test "$TESTNAME - Fail if neither fish_prompt / fish_right_prompt exists"
(__fisher_path_is_prompt $path/none; printf $status) -eq 1
end
test "$TESTNAME - Succeed if fish_prompt exists"
(__fisher_path_is_prompt $path/left; printf $status) -eq 0
end
test "$TESTNAME - Succeed if fish_right_prompt exists"
(__fisher_path_is_prompt $path/right; printf $status) -eq 0
end
test "$TESTNAME - Succeed if both fish_{,right_}prompt exist"
(__fisher_path_is_prompt $path/both; printf $status) -eq 0
end