diff options
Diffstat (limited to '')
-rw-r--r-- | tests/quotearray.right | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/tests/quotearray.right b/tests/quotearray.right new file mode 100644 index 0000000..e689365 --- /dev/null +++ b/tests/quotearray.right @@ -0,0 +1,152 @@ +declare -A assoc=(["x],b[\$(echo uname >&2)"]="1" ) +declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="1" ) +declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" ) +./quotearray.tests: line 31: ((: 'assoc[x\],b\[\$(echo uname >&2)]++' : syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]++' ") +declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" ) +./quotearray.tests: line 34: ((: 'assoc[x\],b\[\$(echo uname >&2)]'++ : syntax error: operand expected (error token is "'assoc[x\],b\[\$(echo uname >&2)]'++ ") +declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="2" ) +declare -A assoc=(["\$key"]="1" ["x],b[\$(echo uname >&2)"]="3" ) +4 +klmnopqrst +klmnopqrst +klmno +klmnopqrst +declare -A A=(["\$(echo %)"]="5" [%]="10" ["]"]="10" ) +declare -A A=(["~"]="42" ) +42 +declare -A A=(["~"]="43" ) +42 +declare -A A=(["~"]="43" ["~0"]="43" ) +12 +declare -a a=([0]="12" [1]="42") +2 +2 +declare -Ai assoc=(["']"]="3" ["\$var"]="1" ) +105 +declare -A assoc=(["\` echo >&2 foo\`"]="42" ["\$( echo >&2 bar)"]="63" ) +./quotearray.tests: line 140: x],b[$(echo uname >&2): syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)") +./quotearray.tests: line 144: x],b[$(echo uname >&2): syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)") +1 +./quotearray.tests: line 147: x],b[$(echo uname >&2): syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)") +1 +./quotearray.tests: line 150: x],b[$(echo uname >&2): syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)") +1 +./quotearray.tests: line 153: x],b[$(echo uname >&2): syntax error: invalid arithmetic operator (error token is "],b[$(echo uname >&2)") +1 +declare -A assoc +0 +0 +1 +0 +0 +0 +declare -A assoc=(["\` echo >&2 foo\`"]="128" [0]="0" ["]"]="12" ["x],b[\$(echo uname >&2)"]="42" ["~"]="42" ["\$( echo 2>& date)"]="foo" ) +foo +0 +0 +./quotearray1.sub: line 68: 0\],b\[1: syntax error: invalid arithmetic operator (error token is "\],b\[1") +declare -a array +0 +0 +0 +0 +1 +1 +declare -A aa=(["\$( echo 2>& date)"]="foo" ) +foo +0 +1 +1 +./quotearray1.sub: line 113: test: aa[$(echo: binary operator expected +2 +[[ -v assoc[a] ]]; $?=0 +[[ -v assoc["] ]]; $?=0 +declare -A assoc=(["\""]="123" [a]="123" ) +declare -A a=([1]="1" [0]="0" [" "]="11" ) +7 +7 +declare -A A=([$'\t']="2" [" "]="2" ) +declare -A A=([$'\t']="2" ["*"]="2" [" "]="2" ["]"]="2" ["@"]="2" ) +./quotearray2.sub: line 54: read: `A[]]': not a valid identifier +declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" ) +./quotearray2.sub: line 62: printf: `A[]]': not a valid identifier +declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" ) +./quotearray2.sub: line 70: declare: `A[]]=X': not a valid identifier +declare -A A=(["*"]="X" ["@"]="X" ) +./quotearray2.sub: line 78: declare: `A[]]=X': not a valid identifier +declare -A A=(["*"]="X" ["@"]="X" ) +./quotearray2.sub: line 89: let: assoc[x],b[$(echo: bad array subscript (error token is "b[$(echo") +declare -A assoc +declare -A assoc=(["\$(echo foo)"]="1" ) +0 +declare -A assoc=(["\$var"]="value" ) +declare -A assoc=(["\$var"]="value" ) +declare -A assoc=(["\$var"]="value" ) +declare -A assoc=() +declare -A a=(["\$(echo foo)"]="1" ) +declare -A a=() +declare -A a=(["\$(echo foo)"]="1" ) +declare -A a=(["\$(echo foo)"]="1" ) +declare -A assoc=(["!"]="bang" ) +1 +1 +declare -A assoc=(["!"]="bang" ["@"]="at" ) +declare -A assoc=(["!"]="bang" ) +declare -a array=([0]="1" [1]="2" [2]="3") +declare -a array=() +./quotearray3.sub: line 98: declare: array: not found +declare -A map=(["foo\$(uname >/dev/tty)bar"]="1" ) +1 +declare -A map=() +$(DOESNOTEXIST) +declare -A blah=() +declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" ) +declare -A assoc=(["*"]="star" ["!"]="bang" ) +declare -A assoc=(["!"]="bang" ) +./quotearray4.sub: line 41: declare: assoc: not found +declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" ) +declare -A assoc=(["*"]="star" ["!"]="bang" ) +declare -A assoc=(["!"]="bang" ) +declare -A assoc=(["*"]="star" ["!"]="bang" ) +declare -A assoc=(["!"]="bang" ) +star bang at +star bang at +0 +0 +0 +1 +1 +declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]=" key" ) +=== +1 +1 +declare -a array=([0]="1" [1]="2" [2]="3") +1 2 3 +1 2 3 +0 +0 +./quotearray4.sub: line 115: array[@]: bad array subscript +declare -a array=([0]="1" [1]="2" [2]="3") +./quotearray5.sub: line 27: unset: `a[$(echo': not a valid identifier +./quotearray5.sub: line 27: unset: `foo)]': not a valid identifier +declare -A a=() +declare -A a=() +declare -A a=() +----- +declare -A a=(["\$(echo foo)"]="1" ) +declare -A a=() +declare -A a=() +declare -A a=() +----- +declare -A a=() +declare -A a=() +declare -A a=() +---------- +declare -A a=([.]="v1" ) +declare -A a=([.]="v1" ) +----- +declare -A a=([.]="v1" ) +declare -A a=([.]="v1" ) +----- +declare -A a=([.]="v1" ) +declare -A a=([.]="v1" ) |