diff --git a/spec/var-op-bash.test.sh b/spec/var-op-bash.test.sh index 0eddb6a97..62cee0ef6 100644 --- a/spec/var-op-bash.test.sh +++ b/spec/var-op-bash.test.sh @@ -460,12 +460,10 @@ A ## END -#### Array expansion with nullary var ops - +#### Array expansion with nullary var op @Q declare -a a=({1..9}) declare -A A=(['a']=hello ['b']=world ['c']=osh ['d']=ysh) -echo "@Q" argv.py "${a[@]@Q}" argv.py "${a[*]@Q}" argv.py "${A[@]@Q}" @@ -473,7 +471,29 @@ argv.py "${A[*]@Q}" argv.py "${u[@]@Q}" argv.py "${u[*]@Q}" -echo "@P" +## STDOUT: +['1', '2', '3', '4', '5', '6', '7', '8', '9'] +['1 2 3 4 5 6 7 8 9'] +['hello', 'world', 'osh', 'ysh'] +['hello world osh ysh'] +[] +[''] +## END + +## OK bash STDOUT: +["'1'", "'2'", "'3'", "'4'", "'5'", "'6'", "'7'", "'8'", "'9'"] +["'1' '2' '3' '4' '5' '6' '7' '8' '9'"] +["'ysh'", "'osh'", "'world'", "'hello'"] +["'ysh' 'osh' 'world' 'hello'"] +[] +[''] +## END + + +#### Array expansion with nullary var op @P +declare -a a=({1..9}) +declare -A A=(['a']=hello ['b']=world ['c']=osh ['d']=ysh) + argv.py "${a[@]@P}" argv.py "${a[*]@P}" argv.py "${A[@]@P}" @@ -481,54 +501,37 @@ argv.py "${A[*]@P}" argv.py "${u[@]@P}" argv.py "${u[*]@P}" -echo "@a" -argv.py "${a[@]@a}" -argv.py "${a[*]@a}" -argv.py "${A[@]@a}" -argv.py "${A[*]@a}" -argv.py "${u[@]@a}" -argv.py "${u[*]@a}" - ## STDOUT: -@Q -['1', '2', '3', '4', '5', '6', '7', '8', '9'] -['1 2 3 4 5 6 7 8 9'] -['hello', 'world', 'osh', 'ysh'] -['hello world osh ysh'] -[] -[''] -@P ['1', '2', '3', '4', '5', '6', '7', '8', '9'] ['1 2 3 4 5 6 7 8 9'] ['hello', 'world', 'osh', 'ysh'] ['hello world osh ysh'] [] [''] -@a -['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] -['a a a a a a a a a'] -['A', 'A', 'A', 'A'] -['A A A A'] -[] -[''] ## END ## OK bash STDOUT: -@Q -["'1'", "'2'", "'3'", "'4'", "'5'", "'6'", "'7'", "'8'", "'9'"] -["'1' '2' '3' '4' '5' '6' '7' '8' '9'"] -["'ysh'", "'osh'", "'world'", "'hello'"] -["'ysh' 'osh' 'world' 'hello'"] -[] -[''] -@P ['1', '2', '3', '4', '5', '6', '7', '8', '9'] ['1 2 3 4 5 6 7 8 9'] ['ysh', 'osh', 'world', 'hello'] ['ysh osh world hello'] [] [''] -@a +## END + + +#### Array expansion with nullary var op @a +declare -a a=({1..9}) +declare -A A=(['a']=hello ['b']=world ['c']=osh ['d']=ysh) + +argv.py "${a[@]@a}" +argv.py "${a[*]@a}" +argv.py "${A[@]@a}" +argv.py "${A[*]@a}" +argv.py "${u[@]@a}" +argv.py "${u[*]@a}" + +## STDOUT: ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] ['a a a a a a a a a'] ['A', 'A', 'A', 'A']