mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-27 19:53:36 +08:00
e13d423b68
Update the test runners so they set up their own environment in test_util.fish. This simplifies the Makefile and paves the way for adding utility functions for use in the tests themselves.
47 lines
1.1 KiB
Fish
47 lines
1.1 KiB
Fish
# vim: set filetype=fish sw=4 ts=4 et:
|
|
|
|
set -g prompt_counter 0
|
|
set -g prompt_counter_incr 0
|
|
function fish_prompt
|
|
if test $prompt_counter_incr -eq 1
|
|
set -g prompt_counter (expr $prompt_counter + 1)
|
|
set -g prompt_counter_incr 0
|
|
end
|
|
echo "prompt $prompt_counter>"
|
|
end
|
|
function fish_prompt_event --on-event fish_prompt
|
|
set -g prompt_counter_incr 1
|
|
end
|
|
|
|
set -g fish_greeting ''
|
|
|
|
function fish_title
|
|
end
|
|
|
|
function _quote
|
|
echo \'(echo $argv[1] | sed -e 's/\'/\\\\\'/g')\'
|
|
end
|
|
|
|
function _echo_var --no-scope-shadowing -d '_echo_var varname [guardval]'
|
|
if set -q argv[2]; echo "@GUARD:$argv[2]@"; end
|
|
set -l var $argv[1]
|
|
switch (count $$var)
|
|
case 0
|
|
echo "\$$var has no value"
|
|
case 1
|
|
set -l IFS ''
|
|
echo "\$$var:" (_quote $$var)
|
|
case \*
|
|
echo "\$$var:"
|
|
for i in (seq (count $$var))
|
|
set -l IFS ''
|
|
echo "$i:" (_quote $$var[1][$i])
|
|
end
|
|
end
|
|
if set -q argv[2]; echo "@/GUARD:$argv[2]@"; end
|
|
end
|
|
|
|
function _marker -d '_marker string - prints @MARKER:$string@'
|
|
echo "@MARKER:$argv[1]@"
|
|
end
|