mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 04:58:57 +00:00
Add tests for new parameter expansion features
This commit is contained in:
parent
24afff1c77
commit
1e5d7d98a8
3 changed files with 48 additions and 0 deletions
0
tests/parameter_expansion.err
Normal file
0
tests/parameter_expansion.err
Normal file
34
tests/parameter_expansion.in
Normal file
34
tests/parameter_expansion.in
Normal file
|
@ -0,0 +1,34 @@
|
|||
# basic expansion test
|
||||
echo {}
|
||||
echo {apple}
|
||||
echo {apple,orange}
|
||||
|
||||
# expansion tests with spaces
|
||||
echo {apple, orange}
|
||||
echo { apple, orange, banana }
|
||||
|
||||
# expansion with spaces and cartesian products
|
||||
echo \'{ hello , world }\'
|
||||
|
||||
# expansion with escapes
|
||||
for phrase in {good\,, beautiful ,morning}; echo -n "$phrase "; end | string trim;
|
||||
for phrase in {goodbye\,,\ cruel\ ,world\n}; echo -n $phrase; end;
|
||||
|
||||
# whitespace within entries converted to spaces in a single entry
|
||||
for foo in { hello
|
||||
world }
|
||||
echo \'$foo\'
|
||||
end
|
||||
|
||||
# dual expansion cartesian product
|
||||
echo { alpha, beta }\ {lambda, gamma }, | sed -r 's/(.*),/\1/'
|
||||
|
||||
# expansion with subshells
|
||||
for name in { (echo Meg), (echo Jo) }
|
||||
echo $name
|
||||
end
|
||||
|
||||
# subshells with expansion
|
||||
for name in (for name in {Beth, Amy}; printf "$name\n"; end); printf "$name\n"; end
|
||||
|
||||
# vim: set ft=fish:
|
14
tests/parameter_expansion.out
Normal file
14
tests/parameter_expansion.out
Normal file
|
@ -0,0 +1,14 @@
|
|||
{}
|
||||
apple
|
||||
apple orange
|
||||
apple orange
|
||||
apple orange banana
|
||||
'hello' 'world'
|
||||
good, beautiful morning
|
||||
goodbye, cruel world
|
||||
'hello world'
|
||||
alpha lambda, beta lambda, alpha gamma, beta gamma
|
||||
Meg
|
||||
Jo
|
||||
Beth
|
||||
Amy
|
Loading…
Reference in a new issue