use new logmsg and set --show in tests

This commit is contained in:
Kurtis Rader 2017-08-03 21:37:02 -07:00
parent 7619e62b70
commit 864dbaeb43
3 changed files with 72 additions and 61 deletions

View file

@ -7,6 +7,12 @@ echo $foo[d]
fish: Invalid index value fish: Invalid index value
echo ()[d] echo ()[d]
^ ^
####################
# Catch your breath
fish: $) is not a valid variable in fish. fish: $) is not a valid variable in fish.
echo $$paren echo $$paren
^ ^
####################
# Test tilde expansion

View file

@ -3,90 +3,90 @@
# We don't use the test utility function of the same name because we want # We don't use the test utility function of the same name because we want
# different behavior. Specifically, that the expansion of any variables or # different behavior. Specifically, that the expansion of any variables or
# other strings before we are invoked produce the expected expansion. # other strings before we are invoked produce the expected expansion.
function show --description 'Prints argument count followed by arguments' function expansion --description 'Prints argument count followed by arguments'
echo (count $argv) $argv echo (count $argv) $argv
end end
set -l foo set -l foo
show "$foo" expansion "$foo"
show $foo expansion $foo
show "prefix$foo" expansion "prefix$foo"
show prefix$foo expansion prefix$foo
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l foo '' set -l foo ''
show "$foo" expansion "$foo"
show $foo expansion $foo
show "prefix$foo" expansion "prefix$foo"
show prefix$foo expansion prefix$foo
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l foo bar set -l foo bar
set -l bar set -l bar
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l bar baz set -l bar baz
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l bar baz quux set -l bar baz quux
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l foo bar fooer fooest set -l foo bar fooer fooest
set -l fooer set -l fooer
set -l fooest set -l fooest
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
set -l fooer '' set -l fooer ''
show $$foo expansion $$foo
show prefix$$foo expansion prefix$$foo
set -l foo bar '' fooest set -l foo bar '' fooest
show "$$foo" expansion "$$foo"
show $$foo expansion $$foo
show "prefix$$foo" expansion "prefix$$foo"
show prefix$$foo expansion prefix$$foo
show $foo[-5..2] expansion $foo[-5..2]
show $foo[-2..-1] expansion $foo[-2..-1]
show $foo[-10..-5] expansion $foo[-10..-5]
show (printf '%s\n' $foo)[-5..2] expansion (printf '%s\n' $foo)[-5..2]
show (printf '%s\n' $foo)[-2..-1] expansion (printf '%s\n' $foo)[-2..-1]
show (printf '%s\n' $foo)[-10..-5] expansion (printf '%s\n' $foo)[-10..-5]
set -l foo set -l foo
show "$foo[1]" expansion "$foo[1]"
show $foo[1] expansion $foo[1]
show "$foo[-1]" expansion "$foo[-1]"
show $foo[-1] expansion $foo[-1]
show "$foo[2]" expansion "$foo[2]"
show $foo[2] expansion $foo[2]
show "$foo[1 2]" expansion "$foo[1 2]"
show $foo[1 2] expansion $foo[1 2]
show "$foo[2 1]" expansion "$foo[2 1]"
show $foo[2 1] expansion $foo[2 1]
set -l foo a b c set -l foo a b c
show $foo[17] expansion $foo[17]
show $foo[-17] expansion $foo[-17]
show $foo[17..18] expansion $foo[17..18]
echo "$foo[d]" echo "$foo[d]"
echo $foo[d] echo $foo[d]
@ -94,11 +94,11 @@ echo $foo[d]
echo ()[1] echo ()[1]
echo ()[d] echo ()[d]
echo "Catch your breath" logmsg Catch your breath
set paren ')' set paren ')'
echo $$paren echo $$paren
# Test tilde expansion logmsg Test tilde expansion
# On OS X, /tmp is symlinked to /private/tmp # On OS X, /tmp is symlinked to /private/tmp
# $PWD is our best bet for resolving it # $PWD is our best bet for resolving it
set -l saved $PWD set -l saved $PWD

View file

@ -56,4 +56,9 @@
0 0
0 0
Catch your breath
####################
# Catch your breath
####################
# Test tilde expansion