mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-15 01:17:45 +00:00
Port parameter_expansion test to littlecheck
Just put it in expansion.fish.
This commit is contained in:
parent
e9b4f5f0ab
commit
849f27912e
4 changed files with 43 additions and 43 deletions
|
@ -17,3 +17,46 @@ set aa AA
|
|||
set aaa AAA
|
||||
echo {$aa}a{1,2,3}(for a in 1 2 3; echo $a; end)
|
||||
#CHECK: AAa11 AAa21 AAa31 AAa12 AAa22 AAa32 AAa13 AAa23 AAa33
|
||||
|
||||
# basic expansion test
|
||||
echo {}
|
||||
echo {apple}
|
||||
echo {apple,orange}
|
||||
#CHECK: {}
|
||||
#CHECK: {apple}
|
||||
#CHECK: apple orange
|
||||
|
||||
# expansion tests with spaces
|
||||
echo {apple, orange}
|
||||
echo { apple, orange, banana }
|
||||
#CHECK: apple orange
|
||||
#CHECK: apple orange banana
|
||||
|
||||
# expansion with spaces and cartesian products
|
||||
echo \'{ hello , world }\'
|
||||
#CHECK: '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;
|
||||
#CHECK: good, beautiful morning
|
||||
#CHECK: goodbye, cruel world
|
||||
|
||||
# dual expansion cartesian product
|
||||
echo { alpha, beta }\ {lambda, gamma }, | string replace -r ',$' ''
|
||||
#CHECK: alpha lambda, beta lambda, alpha gamma, beta gamma
|
||||
|
||||
# expansion with subshells
|
||||
for name in { (echo Meg), (echo Jo) }
|
||||
echo $name
|
||||
end
|
||||
#CHECK: Meg
|
||||
#CHECK: Jo
|
||||
|
||||
# subshells with expansion
|
||||
for name in (for name in {Beth, Amy}; printf "$name\n"; end); printf "$name\n"; end
|
||||
#CHECK: Beth
|
||||
#CHECK: Amy
|
||||
|
||||
echo {{a,b}}
|
||||
#CHECK: {a} {b}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
# 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;
|
||||
|
||||
# dual expansion cartesian product
|
||||
echo { alpha, beta }\ {lambda, gamma }, | string replace -r ',$' ''
|
||||
|
||||
# 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
|
||||
|
||||
echo {{a,b}}
|
||||
# vim: set ft=fish:
|
|
@ -1,14 +0,0 @@
|
|||
{}
|
||||
{apple}
|
||||
apple orange
|
||||
apple orange
|
||||
apple orange banana
|
||||
'hello' 'world'
|
||||
good, beautiful morning
|
||||
goodbye, cruel world
|
||||
alpha lambda, beta lambda, alpha gamma, beta gamma
|
||||
Meg
|
||||
Jo
|
||||
Beth
|
||||
Amy
|
||||
{a} {b}
|
Loading…
Reference in a new issue