From 849f27912e9a232902de0d6f939e6c39ad12c7b1 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 8 Feb 2020 11:16:53 +0100 Subject: [PATCH] Port parameter_expansion test to littlecheck Just put it in expansion.fish. --- tests/checks/expansion.fish | 43 +++++++++++++++++++++++++++++++++++ tests/parameter_expansion.err | 0 tests/parameter_expansion.in | 29 ----------------------- tests/parameter_expansion.out | 14 ------------ 4 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 tests/parameter_expansion.err delete mode 100644 tests/parameter_expansion.in delete mode 100644 tests/parameter_expansion.out diff --git a/tests/checks/expansion.fish b/tests/checks/expansion.fish index 5c2b26d04..c9aa0bf48 100644 --- a/tests/checks/expansion.fish +++ b/tests/checks/expansion.fish @@ -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} diff --git a/tests/parameter_expansion.err b/tests/parameter_expansion.err deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/parameter_expansion.in b/tests/parameter_expansion.in deleted file mode 100644 index 31c89a690..000000000 --- a/tests/parameter_expansion.in +++ /dev/null @@ -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: diff --git a/tests/parameter_expansion.out b/tests/parameter_expansion.out deleted file mode 100644 index 4717848c7..000000000 --- a/tests/parameter_expansion.out +++ /dev/null @@ -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}