aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
committerChet Ramey <chet.ramey@case.edu>2014-02-26 09:36:43 -0500
commitac50fbac377e32b98d2de396f016ea81e8ee9961 (patch)
treef71882366b98fedf1a88a063103219a4935de926 /tests
parent4539d736f1aff232857a854fd2a68df0c98d9f34 (diff)
downloadandroid_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.tar.gz
android_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.tar.bz2
android_external_bash-ac50fbac377e32b98d2de396f016ea81e8ee9961.zip
Bash-4.3 distribution sources and documentation
Diffstat (limited to 'tests')
-rw-r--r--tests/COPYRIGHT5
-rw-r--r--tests/appendop.right14
-rw-r--r--tests/appendop.tests6
-rw-r--r--tests/appendop1.sub15
-rw-r--r--tests/appendop2.sub18
-rw-r--r--tests/arith-for.right12
-rw-r--r--tests/arith-for.tests19
-rw-r--r--tests/arith.right37
-rw-r--r--tests/arith.tests7
-rw-r--r--tests/arith5.sub56
-rw-r--r--tests/arith6.sub52
-rw-r--r--tests/array.right75
-rw-r--r--tests/array.tests12
-rw-r--r--tests/array11.sub35
-rw-r--r--tests/array12.sub21
-rw-r--r--tests/array13.sub13
-rw-r--r--tests/array14.sub30
-rw-r--r--tests/array15.sub24
-rw-r--r--tests/array16.sub21
-rw-r--r--tests/array2.sub3
-rw-r--r--tests/array6.sub6
-rw-r--r--tests/assoc.right3
-rw-r--r--tests/assoc.tests2
-rw-r--r--tests/assoc7.sub16
-rw-r--r--tests/builtins.right33
-rw-r--r--tests/builtins.tests6
-rw-r--r--tests/builtins4.sub44
-rw-r--r--tests/case.right14
-rw-r--r--tests/case.tests15
-rw-r--r--tests/case1.sub64
-rw-r--r--tests/cond-regexp1.sub56
-rw-r--r--tests/cond-regexp2.sub30
-rw-r--r--tests/cond-regexp3.sub73
-rw-r--r--tests/cond.right70
-rwxr-xr-xtests/cond.tests6
-rwxr-xr-xtests/dollar-at-star22
-rw-r--r--tests/dollar-at-star1.sub23
-rw-r--r--tests/dollar-at4.sub10
-rw-r--r--tests/dollar-at5.sub82
-rw-r--r--tests/dollar-at6.sub30
-rw-r--r--tests/dollar-star6.sub19
-rw-r--r--tests/dollar-star7.sub30
-rw-r--r--tests/dollar.right116
-rw-r--r--tests/errors.right18
-rw-r--r--tests/errors.tests9
-rw-r--r--tests/errors1.sub27
-rw-r--r--tests/errors2.sub3
-rw-r--r--tests/errors3.sub7
-rw-r--r--tests/exec.right13
-rw-r--r--tests/execscript1
-rw-r--r--tests/exp.right55
-rw-r--r--tests/exp.tests46
-rw-r--r--tests/exp5.sub22
-rw-r--r--tests/exp6.sub30
-rw-r--r--tests/extglob.right4
-rw-r--r--tests/extglob.tests2
-rw-r--r--tests/extglob1a.sub16
-rw-r--r--tests/globstar.right430
-rw-r--r--tests/globstar.tests1
-rw-r--r--tests/globstar2.sub80
-rw-r--r--tests/heredoc.right29
-rw-r--r--tests/heredoc.tests5
-rw-r--r--tests/heredoc2.sub9
-rw-r--r--tests/heredoc3.sub74
-rw-r--r--tests/histexp.tests2
-rw-r--r--tests/history.right4
-rw-r--r--tests/history.tests1
-rw-r--r--tests/history1.sub2
-rw-r--r--tests/intl.right32
-rw-r--r--tests/intl.tests5
-rw-r--r--tests/iquote.right31
-rw-r--r--tests/iquote.tests2
-rw-r--r--tests/iquote1.sub43
-rw-r--r--tests/jobs.right33
-rw-r--r--tests/jobs.tests3
-rw-r--r--tests/jobs5.sub12
-rw-r--r--tests/nameref.right129
-rw-r--r--tests/nameref.tests118
-rw-r--r--tests/nameref1.sub13
-rw-r--r--tests/nameref2.sub7
-rw-r--r--tests/nameref3.sub37
-rw-r--r--tests/nameref4.sub212
-rw-r--r--tests/nameref5.sub50
-rw-r--r--tests/nameref6.sub44
-rw-r--r--tests/nameref7.sub18
-rw-r--r--tests/nameref8.sub57
-rw-r--r--tests/new-exp.right13
-rw-r--r--tests/new-exp.tests4
-rw-r--r--tests/new-exp2.sub6
-rw-r--r--tests/new-exp9.sub31
-rw-r--r--tests/nquote.right18
-rw-r--r--tests/nquote.tests1
-rw-r--r--tests/nquote2.sub29
-rw-r--r--tests/posix2.tests2
-rw-r--r--tests/printf.rightbin3079 -> 3528 bytes
-rw-r--r--tests/printf.tests3
-rw-r--r--tests/printf2.sub1
-rw-r--r--tests/printf3.sub11
-rw-r--r--tests/printf4.sub69
-rw-r--r--tests/quote.right14
-rw-r--r--tests/quote.tests1
-rw-r--r--tests/quote1.sub49
-rw-r--r--tests/read.right1
-rw-r--r--tests/read3.sub5
-rw-r--r--tests/redir.right3
-rw-r--r--tests/redir.tests2
-rw-r--r--tests/redir10.sub25
-rw-r--r--tests/rhs-exp.right31
-rw-r--r--tests/rhs-exp.tests2
-rw-r--r--tests/rhs-exp1.sub103
-rw-r--r--tests/run-heredoc4
-rw-r--r--tests/run-nameref4
-rw-r--r--tests/run-printf8
-rw-r--r--tests/set-e.right5
-rw-r--r--tests/set-e.tests1
-rw-r--r--tests/set-e3.sub10
-rw-r--r--tests/set-e3a.sub7
-rw-r--r--tests/shopt.right8
-rw-r--r--tests/source7.sub40
-rw-r--r--tests/tilde.right1
-rw-r--r--tests/tilde.tests2
-rw-r--r--tests/trap.right18
-rw-r--r--tests/trap.tests5
-rw-r--r--tests/trap4.sub42
-rw-r--r--tests/trap5.sub18
-rw-r--r--tests/type.right37
-rw-r--r--tests/type.tests2
-rw-r--r--tests/type4.sub43
-rw-r--r--tests/unicode1.sub583
-rw-r--r--tests/unicode2.sub22
-rw-r--r--tests/unicode3.sub7
-rw-r--r--tests/varenv.right15
-rw-r--r--tests/varenv.sh13
-rw-r--r--tests/varenv3.sub32
-rw-r--r--tests/varenv4.sub44
-rw-r--r--tests/varenv5.sub16
-rw-r--r--tests/varenv6.sub28
-rw-r--r--tests/vredir.right12
138 files changed, 4333 insertions, 99 deletions
diff --git a/tests/COPYRIGHT b/tests/COPYRIGHT
index c69f297..43b39df 100644
--- a/tests/COPYRIGHT
+++ b/tests/COPYRIGHT
@@ -1,6 +1,9 @@
Unless otherwise stated, all files in this directory are Copyright (C)
1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,
-2004,2005,2006,2007,2008,2009
+2004,2005,2006,2007,2008,2009,2010,2011
Free Software Foundation, Inc.
+See the file COPYING in the bash distribution root directory for copying
+and usage restrictions.
+
The file ifs-posix.tests is Copyright (C) 2005 Glen Fowler.
diff --git a/tests/appendop.right b/tests/appendop.right
index 1e24333..9c86792 100644
--- a/tests/appendop.right
+++ b/tests/appendop.right
@@ -1,7 +1,7 @@
14
1 2 3 4 5 6
1 2 3 4 51 6
-5
+145
14
7
42
@@ -15,4 +15,14 @@
4
9
16
-./appendop.tests: line 83: x: readonly variable
+./appendop.tests: line 84: x: readonly variable
+declare -A foo='([one]="bar" [two]="baz" [three]="quux" )'
+declare -A foo='([one]="bar" [two]="baz" [0]="zero" [three]="quux" )'
+declare -A foo='([four]="four" [one]="bar" [two]="baz" [0]="zero" [three]="quux" )'
+declare -ai iarr='([0]="3" [1]="2" [2]="3")'
+declare -ai iarr='([0]="3" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6")'
+25 25
+7 7
+14
+145
+145 145
diff --git a/tests/appendop.tests b/tests/appendop.tests
index 7b61f3f..e4e52c2 100644
--- a/tests/appendop.tests
+++ b/tests/appendop.tests
@@ -12,7 +12,8 @@ x[4]+=1
echo ${x[@]}
# trickier cases
-
+# post-bash-4.2: bash understands += in environment assignments preceding
+# command names
a+=5 printenv a
echo $a
@@ -81,3 +82,6 @@ readonly x+=7
echo $x
x+=5
+
+${THIS_SH} ./appendop1.sub
+${THIS_SH} ./appendop2.sub
diff --git a/tests/appendop1.sub b/tests/appendop1.sub
new file mode 100644
index 0000000..7101d0c
--- /dev/null
+++ b/tests/appendop1.sub
@@ -0,0 +1,15 @@
+typeset -A foo=([one]=bar [two]=baz [three]=quux)
+typeset -p foo
+
+foo+=zero
+typeset -p foo
+
+foo+=([four]=four)
+typeset -p foo
+
+typeset -ia iarr=(2 2 3)
+iarr+=1
+typeset -p iarr
+
+iarr+=(4 5 6)
+typeset -p iarr
diff --git a/tests/appendop2.sub b/tests/appendop2.sub
new file mode 100644
index 0000000..4225ba3
--- /dev/null
+++ b/tests/appendop2.sub
@@ -0,0 +1,18 @@
+POSIXLY_CORRECT=1
+x=2
+x+=5 eval printf '"$x "'
+echo "$x"
+
+unset x
+typeset -i x=2
+x+=5 eval printf '"$x "'
+echo "$x"
+
+a=1
+a+=4
+echo $a
+
+# idiotically, ksh93 makes these two cases differ (?)
+a+=5 printenv a
+a+=5 eval printf '"$a "'
+echo $a
diff --git a/tests/arith-for.right b/tests/arith-for.right
index 4494110..5b25c5e 100644
--- a/tests/arith-for.right
+++ b/tests/arith-for.right
@@ -72,3 +72,15 @@ fx ()
2
20
20
+12345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678
+12345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678 987654321 012345678
+4
+3
+2
+1
+0
+4
+3
+2
+1
+0
diff --git a/tests/arith-for.tests b/tests/arith-for.tests
index 585aa51..00e2d4a 100644
--- a/tests/arith-for.tests
+++ b/tests/arith-for.tests
@@ -92,3 +92,22 @@ echo $i
for ((i=0; i < 20; i++)) { : ; }
echo $i
+
+# added post-bash-4.2
+for (( i = j = k = 1; i % 9 || (j *= -1, $( ((i%9)) || printf " " >&2; echo 0), k++ <= 10); i += j ))
+do
+printf "$i"
+done
+
+echo
+
+( for (( i = j = k = 1; i % 9 || (j *= -1, $( ((i%9)) || printf " " >&2; echo 0), k++ <= 10); i += j ))
+do
+printf "$i"
+done )
+
+echo
+
+for (( i = 4; ;i--)) ; do echo $i; if (( $i == 0 )); then break; fi; done
+
+for (( i = 4;;i--)) ; do echo $i; if (( $i == 0 )); then break; fi; done
diff --git a/tests/arith.right b/tests/arith.right
index 94e5f61..680d9a9 100644
--- a/tests/arith.right
+++ b/tests/arith.right
@@ -205,14 +205,43 @@ ok
0
1
2147483649
+0
+0
+0
+0
+0
+0
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+-9223372036854775808
+9223372036854775805 9223372036854775806 9223372036854775807
+123 456
+123 456
+123 456
+123 456
+123 456
+123 456
+1
+1 2 3 4 5 6 7
+0 1 2 3 4 5 6 7
+0
+0, 0
+0, 1
8 12
-./arith.tests: line 279: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
-./arith.tests: line 283: a b: syntax error in expression (error token is "b")
-./arith.tests: line 284: ((: a b: syntax error in expression (error token is "b")
+./arith.tests: line 286: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
+./arith.tests: line 290: a b: syntax error in expression (error token is "b")
+./arith.tests: line 291: ((: a b: syntax error in expression (error token is "b")
42
42
42
42
42
42
-./arith.tests: line 295: b[c]d: syntax error in expression (error token is "d")
+./arith.tests: line 302: b[c]d: syntax error in expression (error token is "d")
diff --git a/tests/arith.tests b/tests/arith.tests
index 86c24a4..7dcc36d 100644
--- a/tests/arith.tests
+++ b/tests/arith.tests
@@ -268,6 +268,13 @@ ${THIS_SH} ./arith4.sub
# make sure arithmetic expansion handles ints > 2**31 - 1 using intmax_t
echo $(( 2147483645 + 4 ))
+# other tests using INTMAX_MIN and INTMAX_MAX that cause exceptions if not
+# handled correctly -- problem through bash-4.2
+${THIS_SH} ./arith5.sub
+
+# problems with suppressing evaluation present through bash-4.2
+${THIS_SH} ./arith6.sub
+
x=4
y=7
diff --git a/tests/arith5.sub b/tests/arith5.sub
new file mode 100644
index 0000000..c8fdb5a
--- /dev/null
+++ b/tests/arith5.sub
@@ -0,0 +1,56 @@
+intmax_max=$((2**63 - 1))
+intmax_min1=$((2**63))
+intmax_min2=$((-2**63))
+
+case $intmax_max in
+9223372036854775807) ;;
+*) echo "warning: your machine does not support 64-bit arithmetic using intmax_t" 2>&1 ;;
+esac
+
+# these are actually the same
+echo $(( $intmax_min1 % -1 ))
+echo $(( $intmax_min2 % -1 ))
+
+echo $(( $intmax_max % -1 ))
+
+lvalue=$intmax_min1
+(( lvalue%= -1 ))
+echo $lvalue
+
+lvalue=$intmax_min2
+(( lvalue%= -1 ))
+echo $lvalue
+
+lvalue=$intmax_max
+(( lvalue%= -1 ))
+echo $lvalue
+
+# and these
+echo $(( $intmax_min1 / -1 ))
+echo $(( $intmax_min2 / -1 ))
+
+lvalue=$intmax_min1
+(( lvalue /= -1 ))
+echo $lvalue
+
+lvalue=$intmax_min2
+(( lvalue /= -1 ))
+echo $lvalue
+
+echo $(( $intmax_min1 * -1 ))
+echo $(( $intmax_min2 * -1 ))
+
+lvalue=$intmax_min1
+(( lvalue *= -1 ))
+echo $lvalue
+
+lvalue=$intmax_min2
+(( lvalue *= -1 ))
+echo $lvalue
+
+echo $(( -${intmax_min1} ))
+echo $(( -${intmax_min2} ))
+
+foo1=$(( $intmax_max - 2 ))
+
+eval echo \{${foo1}..${intmax_max}\}
diff --git a/tests/arith6.sub b/tests/arith6.sub
new file mode 100644
index 0000000..630e917
--- /dev/null
+++ b/tests/arith6.sub
@@ -0,0 +1,52 @@
+function reorder
+{
+ (( x[1] < x && (x=x[1], x[1]=$x) ))
+ echo "${x[@]}"
+}
+
+x=(123 456)
+reorder
+x=(456 123)
+reorder
+
+unset x
+unset -f reorder
+
+function reorder
+{
+ (( x[1] < x[0] && (x=x[1], x[1]=$x) ))
+ echo "${x[@]}"
+}
+
+x=(123 456)
+reorder
+x=(456 123)
+reorder
+
+unset x
+unset -f reorder
+
+function reorder
+{
+ (( x[1] < x[0] && (x[0]=x[1], x[1]=$x) ))
+ echo "${x[@]}"
+}
+
+x=(123 456)
+reorder
+x=(456 123)
+reorder
+
+unset -f reorder
+
+n=0 ; (( (a[n]=++n)<7&&a[0])); echo "${a[@]:1}"
+
+n=0 a="(a[n]=++n)<7&&a[0]"; ((a[0])); echo "${a[@]:1}"
+
+n=0 a="(a[n]=n++)<7&&a"; ((a)); echo "${a[@]:1}"
+
+# bugs with lvalue caching and pointer aliasing through bash-4.2
+echo $(( a=(y[0] + y[1]) & 0xff, b=(y[2] + y[3]) & 0xff, a << 8 | b))
+echo $a, $b
+((a = y[0], b = 1 ))
+echo $a, $b
diff --git a/tests/array.right b/tests/array.right
index 94c64a7..0307d6b 100644
--- a/tests/array.right
+++ b/tests/array.right
@@ -130,8 +130,10 @@ value = new1 new2 new3
./array.tests: line 239: narray: unbound variable
./array1.sub: line 1: syntax error near unexpected token `('
./array1.sub: line 1: `printf "%s\n" -a a=(a 'b c')'
-./array2.sub: line 1: syntax error near unexpected token `('
-./array2.sub: line 1: `declare -a ''=(a 'b c')'
+./array2.sub: line 1: declare: `[]=asdf': not a valid identifier
+./array2.sub: line 2: a[]: bad array subscript
+./array2.sub: line 4: syntax error near unexpected token `('
+./array2.sub: line 4: `declare -a ''=(a 'b c')'
9
9
@@ -207,9 +209,9 @@ e
9
2
a b c
-argv[1] = <"-iname '"a>
-argv[2] = <"-iname '"b>
-argv[3] = <"-iname '"c>
+argv[1] = <-iname 'a>
+argv[2] = <-iname 'b>
+argv[3] = <-iname 'c>
'hey'
hey
''hey
@@ -224,20 +226,22 @@ argv[1] = <c d>
argv[2] = <e f>
argv[1] = <c d>
argv[2] = <e f>
-argv[1] = <"-iname '"abc>
-argv[2] = <"-iname '"def>
argv[1] = <-iname 'abc>
argv[2] = <-iname 'def>
-argv[1] = <-iname \'abc>
-argv[2] = <-iname \'def>
+argv[1] = <-iname 'abc>
+argv[2] = <-iname 'def>
argv[1] = <-iname>
-argv[2] = <'abc>
-argv[3] = <-iname>
-argv[4] = <'def>
-argv[1] = <"-iname '"abc>
-argv[2] = <"-iname '"def>
+argv[2] = <abc -iname def>
+argv[1] = <-iname 'abc>
+argv[2] = <-iname 'def>
+argv[1] = <-iname>
+argv[2] = <abc -iname def>
+argv[1] = <-iname 'abc>
+argv[2] = <-iname 'def>
argv[1] = <-iname 'abc>
argv[2] = <-iname 'def>
+argv[1] = <-iname>
+argv[2] = <abc -iname def>
*.* OK
1
a1 2 3c
@@ -341,3 +345,46 @@ ednesday
onday
uesday
ednesday
+version[agent]
+version.agent
+version[agent]
+version.agent
+version[agent] foo[bar]
+version.agent bowl
+foobar] foo foo[bar]
+bleh bbb bleh
+ab]
+bar
+1
+1
+1
+1
+1
+1
+main main
+function function
+function function
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")'
+declare -a x='([0]="0" [1]="1" [2]="2" [4]="4")'
+./array14.sub: line 11: [-10]: bad array subscript
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="five")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5foo")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4" [5]="5")'
+declare -a x='([0]="0" [1]="1" [2]="2" [3]="3" [4]="4four" [5]="5")'
+strlen(4four) = 5
+1 2 xx 3
+1 2 0 3
+1 2 xx 3
+1 2 0 3
+1 2 xx 3
+foo index 1: ok
+foo index 2: ok
+foo: implicit reference to element 0: ok
+foo: arithmetic evaluation: ok
+bar: array with element zero unset: ok
+bar: element zero: ok
+qux: unset array: ok
+qux: unset array element 0: ok
diff --git a/tests/array.tests b/tests/array.tests
index 3b6996d..4c17651 100644
--- a/tests/array.tests
+++ b/tests/array.tests
@@ -388,3 +388,15 @@ ${THIS_SH} ./array8.sub
${THIS_SH} ./array9.sub
${THIS_SH} ./array10.sub
+
+${THIS_SH} ./array11.sub
+
+${THIS_SH} ./array12.sub
+
+${THIS_SH} ./array13.sub
+
+${THIS_SH} ./array14.sub
+
+${THIS_SH} ./array15.sub
+
+${THIS_SH} ./array16.sub
diff --git a/tests/array11.sub b/tests/array11.sub
new file mode 100644
index 0000000..c4f8cad
--- /dev/null
+++ b/tests/array11.sub
@@ -0,0 +1,35 @@
+# problems with associative array keys with ] and unbalanced [ ]
+# fixed after bash-4.2
+
+declare -A foo
+
+foo=(["version[agent]"]=version.agent)
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+unset foo
+declare -A foo
+foo["version[agent]"]=version.agent
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+declare foo["foo[bar]"]=bowl
+
+echo ${!foo[@]}
+echo ${foo[@]}
+
+declare -A array2["foo[bar]"]=bleh
+
+array2["foobar]"]=bleh
+array2["foo"]=bbb
+
+echo ${!array2[@]}
+echo ${array2[@]}
+
+declare -A foo
+foo=( ['ab]']=bar )
+
+echo ${!foo[@]}
+echo ${foo[@]}
diff --git a/tests/array12.sub b/tests/array12.sub
new file mode 100644
index 0000000..6571138
--- /dev/null
+++ b/tests/array12.sub
@@ -0,0 +1,21 @@
+# problems with fix for posix interp 217 introduced in bash-4.2
+
+declare -ax array
+array[$(( $( echo -n 1001 ) - 1001 ))]=1
+
+echo ${array[0]}
+echo ${array[@]}
+
+unset 'array[0]'
+array[$( echo -n 1001 ) - 1001 ]=1
+echo ${array[0]}
+
+unset 'array[0]'
+array[$(( 1001 - $( echo -n 1001 ) ))]=1
+echo ${array[0]}
+array[$(( 1001 - $( echo -n 1001 ) ))]=1
+echo ${array[0]}
+
+unset 'array[0]'
+array[1001 - $( echo -n 1001 )]=1
+echo ${array[0]}
diff --git a/tests/array13.sub b/tests/array13.sub
new file mode 100644
index 0000000..736f210
--- /dev/null
+++ b/tests/array13.sub
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+func1(){
+declare -g variable='function'
+declare -g -a array=(function)
+echo ${variable} ${array[@]}
+}
+
+declare -g variable='main'
+declare -g -a array=(main)
+echo ${variable} ${array[@]}
+func1
+echo ${variable} ${array[@]}
diff --git a/tests/array14.sub b/tests/array14.sub
new file mode 100644
index 0000000..7715169
--- /dev/null
+++ b/tests/array14.sub
@@ -0,0 +1,30 @@
+# start at a test suite for negative indexed array subscripts -- post bash-4.2
+x=( 0 1 2 3 4 5)
+declare -p x
+
+unset 'x[-1]'
+declare -p x
+
+unset 'x[-2]'
+declare -p x
+
+unset 'x[-10]'
+
+x[-2]=3
+declare -p x
+
+x+=( five )
+declare -p x
+x[-1]=5
+declare -p x
+
+x+=( [-1]=foo )
+declare -p x
+
+x[-1]=5
+declare -p x
+
+x[-2]+=four
+declare -p x
+
+echo "strlen(${x[-2]})" = ${#x[-2]}
diff --git a/tests/array15.sub b/tests/array15.sub
new file mode 100644
index 0000000..b056ccb
--- /dev/null
+++ b/tests/array15.sub
@@ -0,0 +1,24 @@
+# fixes for make_internal_declare not handling integer attribute for arrays
+declare -ai -g foo=(1 2 xx 3)
+echo "${foo[@]}"
+
+unset foo
+declare -ai -g foo='(1 2 xx 3)'
+echo "${foo[@]}"
+
+unset foo
+declare -ia -g foo=(1 2 xx 3)
+echo "${foo[@]}"
+
+unset foo
+declare -ia -g foo='(1 2 xx 3)'
+echo "${foo[@]}"
+
+unset foo
+func()
+{
+ declare -ai -g foo=(1 2 xx 3)
+}
+
+func
+echo "${foo[@]}"
diff --git a/tests/array16.sub b/tests/array16.sub
new file mode 100644
index 0000000..10024bc
--- /dev/null
+++ b/tests/array16.sub
@@ -0,0 +1,21 @@
+foo[0]=a
+foo[1]=b
+
+[[ -v foo[1] ]] && echo foo index 1: ok
+[[ -v foo[2] ]] || echo foo index 2: ok
+
+[[ -v foo ]] && echo foo: implicit reference to element 0: ok
+
+typeset -i foo
+
+[[ -v foo[1] ]] && echo foo: arithmetic evaluation: ok
+
+typeset -a bar
+bar[1]=set
+
+[[ -v bar ]] || echo bar: array with element zero unset: ok
+[[ -v bar[0] ]] || echo bar: element zero: ok
+
+typeset -a qux
+[[ -v qux ]] || echo qux: unset array: ok
+[[ -v qux[0] ]] || echo qux: unset array element 0: ok
diff --git a/tests/array2.sub b/tests/array2.sub
index 0e6417d..44bb7c5 100644
--- a/tests/array2.sub
+++ b/tests/array2.sub
@@ -1 +1,4 @@
+declare -r []=asdf
+declare -r a[]=asdf
+
declare -a ''=(a 'b c')
diff --git a/tests/array6.sub b/tests/array6.sub
index 5901326..0017f4c 100644
--- a/tests/array6.sub
+++ b/tests/array6.sub
@@ -42,6 +42,9 @@ a=(abc def)
a2=("${a[@]/#/"-iname '"}")
recho "${a2[@]}"
+eval a2=("${a[@]/#/\"-iname \'\"}")
+recho "${a2[@]}"
+
eval a2=("${a[@]/#/"-iname '"}")
recho "${a2[@]}"
@@ -56,6 +59,9 @@ set -- abc def
a2=("${@/#/"-iname '"}")
recho "${a2[@]}"
+eval a2=("${@/#/\"-iname \'\"}")
+recho "${a2[@]}"
+
eval a2=("${@/#/"-iname '"}")
recho "${a2[@]}"
diff --git a/tests/assoc.right b/tests/assoc.right
index 8615519..b9fd001 100644
--- a/tests/assoc.right
+++ b/tests/assoc.right
@@ -187,3 +187,6 @@ declare -A foo='(["bar\\]bie"]="doll" )'
bar${foo}bie
doll
declare -A foo='(["bar\${foo}bie"]="doll" )'
+bar
+after printf
+after use: 0
diff --git a/tests/assoc.tests b/tests/assoc.tests
index 8b6fd55..c3fb18e 100644
--- a/tests/assoc.tests
+++ b/tests/assoc.tests
@@ -184,3 +184,5 @@ ${THIS_SH} ./assoc4.sub
${THIS_SH} ./assoc5.sub
${THIS_SH} ./assoc6.sub
+
+${THIS_SH} ./assoc7.sub
diff --git a/tests/assoc7.sub b/tests/assoc7.sub
new file mode 100644
index 0000000..5bc5150
--- /dev/null
+++ b/tests/assoc7.sub
@@ -0,0 +1,16 @@
+# problem with bash versions through bash-4.2
+foo()
+{
+ declare -A hash
+ declare hash[baz]=bar #bash crashes here
+
+ echo ${hash[@]}
+}
+
+foo
+
+declare -a ary
+printf -v ary[0] "%b" ""
+echo "after printf"
+x="${ary[*]}" # segfaults here
+echo "after use: $?"
diff --git a/tests/builtins.right b/tests/builtins.right
index 38f196a..bafc53f 100644
--- a/tests/builtins.right
+++ b/tests/builtins.right
@@ -117,6 +117,23 @@ three - OK
0
four - OK
0
+abc
+def
+ghi
+after
+one.1 subshell
+two.1 subshell
+three.1 subshell
+four.1 subshell
+one.2 subshell
+two.2 subshell
+three.2 subshell
+four.2 subshell
+x29 - done
+abc
+def
+ghi
+ok
AVAR
foo
foo
@@ -127,11 +144,11 @@ AVAR
foo
declare -x foo=""
declare -x FOO="\$\$"
-./builtins.tests: line 210: declare: FOO: not found
+./builtins.tests: line 213: declare: FOO: not found
declare -x FOO="\$\$"
ok
ok
-./builtins.tests: line 242: kill: 4096: invalid signal specification
+./builtins.tests: line 245: kill: 4096: invalid signal specification
1
a\n\n\nb
a
@@ -141,4 +158,14 @@ b
before: f = 4
inside
after: f = 8 bar = 4
-./builtins.tests: line 254: exit: status: numeric argument required
+./builtins4.sub: line 2: declare: c: not found
+./builtins4.sub: line 5: declare: d: not found
+declare -a c='([0]="4")'
+declare -A c='([0]="4" )'
+declare -a c='([0]="1" [1]="2" [2]="3")'
+declare -A c='([one]="1" [two]="2" [three]="3" )'
+declare -a c='([0]="1" [1]="2" [2]="3")'
+declare -a c='([0]="1" [1]="2" [2]="3")'
+unset
+unset
+./builtins.tests: line 260: exit: status: numeric argument required
diff --git a/tests/builtins.tests b/tests/builtins.tests
index 7ce378e..9d77520 100644
--- a/tests/builtins.tests
+++ b/tests/builtins.tests
@@ -179,6 +179,9 @@ ${THIS_SH} ./source5.sub
# test bugs in sourcing non-regular files, fixed post-bash-3.2
${THIS_SH} ./source6.sub
+# test bugs with source called from multiline aliases and other contexts
+${THIS_SH} ./source7.sub
+
# in posix mode, assignment statements preceding special builtins are
# reflected in the shell environment. `.' and `eval' need special-case
# code.
@@ -250,6 +253,9 @@ ${THIS_SH} ./builtins2.sub
# test behavior of declare -g
${THIS_SH} ./builtins3.sub
+# test behavior of using declare to create variables without assigning values
+${THIS_SH} ./builtins4.sub
+
# this must be last -- it is a fatal error
exit status
diff --git a/tests/builtins4.sub b/tests/builtins4.sub
new file mode 100644
index 0000000..b7d0c0c
--- /dev/null
+++ b/tests/builtins4.sub
@@ -0,0 +1,44 @@
+declare -a c
+declare -p c
+
+declare -A d
+declare -p d
+unset c d
+
+declare -a c
+c=4
+declare -p c
+unset c
+
+declare -A c
+c=4
+declare -p c
+unset c
+
+declare -a c
+c=(1 2 3)
+declare -p c
+unset c
+
+declare -A c
+c=([one]=1 [two]=2 [three]=3)
+declare -p c
+unset c
+
+declare -a c
+read -a c < <(echo 1 2 3)
+declare -p c
+unset c
+
+declare -a c
+mapfile -t c < <(echo 1$'\n'2$'\n'3)
+declare -p c
+unset c
+
+unset foo
+declare -A foo
+echo ${foo-unset}
+
+unset foo
+declare -a foo
+echo ${foo-unset}
diff --git a/tests/case.right b/tests/case.right
index d579253..58ab2a4 100644
--- a/tests/case.right
+++ b/tests/case.right
@@ -4,3 +4,17 @@ and here
retest
and match
no more clauses
+1.0
+./case.tests: line 29: xx: readonly variable
+1.1
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+ok 7
+ok 8
+ok 9
+mysterious 1
+mysterious 2
diff --git a/tests/case.tests b/tests/case.tests
index 7c50165..547e8cc 100644
--- a/tests/case.tests
+++ b/tests/case.tests
@@ -16,3 +16,18 @@ esac
case a in
a) echo no more clauses;&
esac
+
+x=0 y=1
+case 1 in
+ $((y=0)) ) ;;
+ $((x=1)) ) ;&
+ $((x=2)) ) echo $x.$y ;;
+esac
+
+unset x
+readonly xx=1
+case 1 in $((xx++)) ) echo hi1 ;; *) echo hi2; esac
+echo ${xx}.$?
+
+# tests of quote removal and pattern matching
+${THIS_SH} ./case1.sub
diff --git a/tests/case1.sub b/tests/case1.sub
new file mode 100644
index 0000000..7db09ab
--- /dev/null
+++ b/tests/case1.sub
@@ -0,0 +1,64 @@
+x='\x'
+
+case x in
+\x) echo ok 1;;
+*) echo bad 1;;
+esac
+
+case x in
+$x) echo ok 2;;
+*) echo bad 2;;
+esac
+
+case $x in
+\x) echo bad 3;;
+\\x) echo ok 3 ;;
+*) echo bad 3.1 ;;
+esac
+
+case $x in
+\\$x) echo ok 4 ;;
+x) echo bad 4;;
+$x) echo bad 4.1 ;;
+*) echo bad 4.2;;
+esac
+
+case x in
+\\x) echo bad 5;;
+\x) echo ok 5;;
+*) echo bad 5.1;;
+esac
+
+case x in
+\\x) echo bad 6;;
+x) echo ok 6;;
+*) echo bad 6.1;;
+esac
+
+case x in
+$x) echo ok 7 ;;
+\\$x) echo bad 7 ;;
+*) echo bad 7.1 ;;
+esac
+
+case x in
+\x) echo ok 8 ;;
+\\x) echo bad 8 ;;
+*) echo bad 8.1 ;;
+esac
+
+case \x in
+\x) echo ok 9 ;;
+\\x) echo bad 9 ;;
+*) echo bad 9.1 ;;
+esac
+
+case $x in
+$x) echo oops 1 ;;
+*) echo mysterious 1 ;;
+esac
+
+case \x in
+\x) echo mysterious 2 ;;
+*) echo oops 2 ;;
+esac
diff --git a/tests/cond-regexp1.sub b/tests/cond-regexp1.sub
new file mode 100644
index 0000000..dd287cb
--- /dev/null
+++ b/tests/cond-regexp1.sub
@@ -0,0 +1,56 @@
+VAR='[[:alpha:]]'
+
+[[ $VAR =~ '[[:alpha:]]' ]] && echo match 1
+
+[[ a =~ '[[:alpha:]]' ]] || echo match 2
+
+[[ a =~ [[:alpha:]] ]] && echo match 3
+
+[[ a =~ $VAR ]] && echo match 4
+
+[[ a =~ "$VAR" ]] || echo match 5
+
+line=aab
+[[ $line =~ [[:space:]]*(a)?b ]] && echo match 6
+
+V="alphabet"
+[[ $V == alphabet ]] && echo yes 1
+[[ $V == "alphabet" ]] && echo yes 2
+[[ $V == 'alphabet' ]] && echo yes 3
+[[ $V =~ alphabet ]] && echo yes 4
+[[ $V =~ "alphabet" ]] && echo yes 5
+[[ $V =~ 'alphabet' ]] && echo yes 6
+
+DOG="Dog name - 01 - Wiggles"
+REPAT='([[:alpha:][:blank:]]*)- ([[:digit:]]*) - (.*)$'
+if [[ $DOG =~ ([[:alpha:][:blank:]]*)-\ ([[:digit:]]*)\ -\ (.*)$ ]]
+then
+ echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
+fi
+if [[ $DOG =~ $REPAT ]]
+then
+ echo Dog ${BASH_REMATCH[2]} is ${BASH_REMATCH[3]}
+fi
+
+[[ $REPAT =~ "$REPAT" ]] && echo rematch 1
+
+v="one two buckle my shoe"
+[[ ${v} =~ "one two" ]] && echo matches 7
+
+[[ ${v} =~ (one two) ]] && echo matches 8
+
+[[ ${v} =~ one\ two ]] && echo matches 9
+
+unset pattern string
+pattern="xxx.yyy"
+string=xxxAyyy
+
+[[ $string =~ $pattern ]] && echo unquoted matches
+[[ $string =~ "$pattern" ]] && echo quoted matches
+
+# problems in pre-patched bash-4.2
+[[ "helloworld" =~ llo ]] && echo match control-a 1
+[[ "helloworld" =~ world ]] && echo match control-a 2
+[[ "helloworld" =~ world$ ]] && echo match control-a 3
+[[ "helloworld" =~  ]] && echo match control-a 4
+[[ "helloworld" =~ oworld$ ]] && echo match control-a 5
diff --git a/tests/cond-regexp2.sub b/tests/cond-regexp2.sub
new file mode 100644
index 0000000..71abfb7
--- /dev/null
+++ b/tests/cond-regexp2.sub
@@ -0,0 +1,30 @@
+[[ "\\" =~ ["."] ]] && echo bad 1
+
+[[ "\\" =~ "[.]" ]] && echo bad 2
+
+[[ "\\" =~ [\. ]] && echo bad 3
+
+[[ "\\" =~ [\.] ]] && echo bad 4
+
+[[ "\\" =~ [\\] ]] || echo bad 5
+
+[[ dog =~ [[=d=]].. ]] && echo ok 1
+[[ d.. =~ [[=d=]]\.\. ]] && echo ok 2
+[[ dog =~ ['[=d=]'].. ]] && echo ok 3 # dubious
+
+[[ dog =~ [[=d=]].[[=G=][=g=]] ]] && echo ok 4
+[[ dog =~ [[=d=]].[\[=G=][=g=]] ]] && echo ok 4a
+
+[[ dog =~ "d.." ]] || echo ok 5
+
+[[ dog =~ [[.d.][.D.]]o. ]] && echo ok 6
+
+[[ dog =~ ([[.d.][.D.]])o(.) ]] && echo ok 7 -- ${BASH_REMATCH[1]}
+[[ dog =~ d([[.o.][.O.]])(.) ]] && echo ok 8 -- ${BASH_REMATCH[1]}
+[[ dog =~ .([[.o.][.O.]])(.) ]] && echo ok 9
+
+[[ dog =~ 'd''o''g' ]] && echo ok 10
+
+[[ ']' =~ [']'] ]] && echo ok 11
+
+[[ a =~ ['a]'] ]] || echo ok 12
diff --git a/tests/cond-regexp3.sub b/tests/cond-regexp3.sub
new file mode 100644
index 0000000..8f09841
--- /dev/null
+++ b/tests/cond-regexp3.sub
@@ -0,0 +1,73 @@
+# simple expansion -- no problem, it's quote_string_for_globbing that was flawed
+c=$'\177'
+r="\\$c"
+
+recho $r
+
+# first, match some regular expressions containing ^A, ^G, ^?
+[[ $'\001' =~ $'\001' ]] ; echo $?
+[[ $'\001' =~ $'\\\001' ]] ; echo $?
+[[ $'\001' =~ $'\\[\001]' ]] ; echo $?
+
+[[ $'\a' =~ $'\a' ]] ; echo $?
+[[ $'\a' =~ $'\\\a' ]] ; echo $?
+[[ $'\a' =~ $'\\[\a]' ]] ; echo $?
+
+[[ $'\177' =~ $'\177' ]] ; echo $?
+[[ $'\177' =~ $'\\\177' ]] ; echo $?
+[[ $'\177' =~ $'\\[\177]' ]] ; echo $?
+
+# Now let's try it with variables expanding to those values
+for c in $'\001' $'\a' $'\177' ; do
+ for r in "$c" "\\$c" "\\[$c]"; do
+ [[ $c =~ $r ]];
+ printf '[[ %q =~ %q ]] -> %d\n' "$c" "$r" "$?";
+ done;
+ printf %s\\n ---
+done
+
+# try again with literals
+
+[[ '' =~ $'' ]] ; echo $?
+[[ '' =~ '\' ]] ; echo $?
+[[ '' =~ '\[]' ]] ; echo $?
+
+[[ '' =~ '' ]] ; echo $?
+[[ '' =~ '\' ]] ; echo $?
+[[ '' =~ '\[]' ]] ; echo $?
+
+[[ '' =~ $'' ]] ; echo $?
+[[ '' =~ '\' ]] ; echo $?
+[[ '' =~ '\[]' ]] ; echo $?
+
+# more expansions, but with literal non-special characters
+[[ x =~ \x ]] ; echo $?
+[[ x =~ \\x ]] ; echo $?
+
+bs='\'
+[[ x =~ ${bs}x ]] ; echo $?
+
+[[ x =~ $'\\'x ]] ; echo $?
+[[ x =~ '\'x ]] ; echo $?
+
+v='a\-b'
+[[ a-b =~ ${v} ]] ; echo $?
+[[ a-b =~ a\-b ]]; echo $?
+[[ a-b =~ a${bs}-b ]]; echo $?
+[[ a-b =~ a\\-b ]] ; echo $?
+[[ a-b =~ "a\-b" ]] ; echo $?
+
+c=$'\001'
+
+recho $c "$c"
+
+[[ $c == $c ]] && echo ok 1
+[[ $c =~ $c ]] && echo ok 2
+[[ $c =~ \\$c ]] || echo ok 3
+[[ $c =~ \\"$c" ]] || echo ok 4
+
+[[ $c =~ "\\"$c ]] || echo ok 5
+[[ $c =~ '\'$c ]] || echo ok 6
+
+[[ $c =~ "\\""$c" ]] || echo ok 7
+[[ $c =~ '\'"$c" ]] || echo ok 8
diff --git a/tests/cond.right b/tests/cond.right
index 3775230..80bb5ce 100644
--- a/tests/cond.right
+++ b/tests/cond.right
@@ -59,3 +59,73 @@ rematch 1
matches 7
matches 8
matches 9
+unquoted matches
+match control-a 1
+match control-a 2
+match control-a 3
+match control-a 4
+match control-a 5
+ok 1
+ok 2
+ok 3
+ok 4
+ok 4a
+ok 5
+ok 6
+ok 7 -- d
+ok 8 -- o
+ok 9
+ok 10
+ok 11
+ok 12
+argv[1] = <\^?>
+0
+1
+1
+0
+1
+1
+0
+1
+1
+[[ $'\001' =~ $'\001' ]] -> 0
+[[ $'\001' =~ $'\\\001' ]] -> 0
+[[ $'\001' =~ $'\\[\001]' ]] -> 1
+---
+[[ $'\a' =~ $'\a' ]] -> 0
+[[ $'\a' =~ $'\\\a' ]] -> 0
+[[ $'\a' =~ $'\\[\a]' ]] -> 1
+---
+[[ $'\177' =~ $'\177' ]] -> 0
+[[ $'\177' =~ $'\\\177' ]] -> 0
+[[ $'\177' =~ $'\\[\177]' ]] -> 1
+---
+0
+1
+1
+0
+1
+1
+0
+1
+1
+0
+1
+0
+1
+1
+0
+0
+0
+1
+1
+argv[1] = <^A>
+argv[2] = <^A>
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+ok 7
+ok 8
diff --git a/tests/cond.tests b/tests/cond.tests
index b053e48..d91dddd 100755
--- a/tests/cond.tests
+++ b/tests/cond.tests
@@ -180,4 +180,8 @@ echo ${BASH_REMATCH[@]}
if [[ "123abc" == *?(a)bc ]]; then echo ok 42; else echo bad 42; fi
if [[ "123abc" == *?(a)bc ]]; then echo ok 43; else echo bad 43; fi
-${THIS_SH} ./cond-regexp.sub
+${THIS_SH} ./cond-regexp1.sub
+
+${THIS_SH} ./cond-regexp2.sub
+
+${THIS_SH} ./cond-regexp3.sub
diff --git a/tests/dollar-at-star b/tests/dollar-at-star
index 54e499d..9a5d402 100755
--- a/tests/dollar-at-star
+++ b/tests/dollar-at-star
@@ -207,6 +207,10 @@ case "$@" in
*) echo bad 4;;
esac
+# tests for the effect of quoting $* and $@ in an assignment context (plus
+# arrays) -- bugs through bash 4.2
+${THIS_SH} ./dollar-at-star1.sub
+
# tests for special expansion of "$*" and "${array[*]}" when used with other
# expansions -- bugs through bash-2.05b
${THIS_SH} ./dollar-star1.sub
@@ -235,4 +239,22 @@ ${THIS_SH} ./dollar-star4.sub
# tests for expansions of $* when IFS is null
${THIS_SH} ./dollar-star5.sub
+# tests for inappropriate word splitting through bash-4.2
+${THIS_SH} ./dollar-at4.sub
+
+# tests for problems with "$@" preceded and followed by other quoted expansions
+# through bash-4.2
+${THIS_SH} ./dollar-at5.sub
+
+# tests for problems with "${@:1}" and other expansions with null entries
+# in positional parameters
+${THIS_SH} ./dollar-at6.sub
+
+# tests for expansions of $* when $1 == ""; problem through bash-4.2
+${THIS_SH} ./dollar-star6.sub
+
+# tests for expansions of $* (unquoted) when IFS changes (e.g., ${IFS:=-})
+# problem through bash-4.2
+${THIS_SH} ./dollar-star7.sub
+
exit 0
diff --git a/tests/dollar-at-star1.sub b/tests/dollar-at-star1.sub
new file mode 100644
index 0000000..0036915
--- /dev/null
+++ b/tests/dollar-at-star1.sub
@@ -0,0 +1,23 @@
+# from dan douglas
+expassign()
+{
+ typeset -a a
+ a=("$@")
+ typeset var asn
+
+ while IFS= read -r asn; do
+ IFS=: command eval "$asn"
+ printf '%-14s... %s\n' "$asn" "$var"
+ done <<\EOF
+var=${a[*]}
+var="${a[*]}"
+var=$*
+var="$*"
+var=${a[@]}
+var="${a[@]}"
+var=$@
+var="$@"
+EOF
+}
+
+expassign one:::two three:::four
diff --git a/tests/dollar-at4.sub b/tests/dollar-at4.sub
new file mode 100644
index 0000000..c8de866
--- /dev/null
+++ b/tests/dollar-at4.sub
@@ -0,0 +1,10 @@
+set 'a b' 'c d'
+
+recho "$@"
+recho $@
+
+quoted="$@"
+unquoted=$@
+
+recho "$quoted"
+recho "$unquoted"
diff --git a/tests/dollar-at5.sub b/tests/dollar-at5.sub
new file mode 100644
index 0000000..75e2249
--- /dev/null
+++ b/tests/dollar-at5.sub
@@ -0,0 +1,82 @@
+args() { printf '<%s> ' "$@"; echo; }
+
+set -- 1 2 3 4 5
+
+args "${@} ${1}"
+args "${1} ${@}"
+args "${1}${@}${1}"
+args "${1} ${@} ${1}"
+args ${1}"$@"${1}
+args "$@"${1}
+args ${1}"$@"
+
+args "$@""${1}"
+args "${1}""$@"
+
+args "${@}foo"
+args ${@}${1}
+args ${@}foo
+
+IFS=
+args "$@""${1}"
+args "${1}""$@"
+
+args ${@}${1}
+args ${1}${@}
+args ${@}foo
+
+echo second set:
+IFS=$' \t\n'
+set -- '1 2' 3 4 5
+
+args "${@} ${1}"
+args "${1} ${@}"
+
+args "${1}${@}${1}"
+args "${1} ${@} ${1}"
+args ${1}"$@"${1}
+args "$@"${1}
+args ${1}"$@"
+
+args "$@""${1}"
+args "${1}""$@"
+
+args "${@}foo"
+args ${@}${1}
+args ${@}foo
+
+IFS=
+
+args "$@""${1}"
+args "${1}""$@"
+
+args ${@}${1}
+args ${1}${@}
+args ${@}foo
+
+echo third set:
+IFS=$' \t\n'
+
+alias declare=typeset
+
+a(){ echo
+ echo '"${@:2}a3 a2" a$1 #works as long as $1 and 3 are swapped'
+ echo "${@:2}a3 a2" a$1
+ "${@:2}a3 a2" a$1
+ echo $?
+ a=("${@}");}
+b(){ echo
+ echo '"${@:2}b$1 b2" b3 #fails! why?'
+ echo "${@:2}b$1 b2" b3
+ "${@:2}b$1 b2" b3
+ echo $?
+ b=("${@}");}
+c(){ echo
+ echo '${@:2}c$1 c2 c3 #works as long as quoting omitted'
+ echo ${@:2}c$1 c2 c3
+ ${@:2}c$1 c2 c3
+ echo $?
+ c=("${@}");}
+a x set y z;declare -p a
+b x set y z;declare -p b
+c x set y z;declare -p c
diff --git a/tests/dollar-at6.sub b/tests/dollar-at6.sub
new file mode 100644
index 0000000..039e11f
--- /dev/null
+++ b/tests/dollar-at6.sub
@@ -0,0 +1,30 @@
+set -- '';
+
+recho "${@}" x
+recho "${@:1}" x
+
+set -- "${@:1}"
+echo "$#"
+
+set -- '' ''
+
+recho "${@:1}" x
+recho "${@:1:1}" x
+
+typeset -a A # ksh93 needs this
+A=('' '')
+recho "${A[@]:0}" x
+
+recho "${A[@]:0:1}" x
+
+recho "${A[@]:1}" x
+
+set -- ''
+
+recho "${@/foo/bar}"
+recho "${@^^[abcde]}"
+
+A=( '' )
+
+recho "${A[@]/foo/bar}"
+recho "${A[@],,[abcde]}"
diff --git a/tests/dollar-star6.sub b/tests/dollar-star6.sub
new file mode 100644
index 0000000..dbd59ec
--- /dev/null
+++ b/tests/dollar-star6.sub
@@ -0,0 +1,19 @@
+recho "A${*:-w}R"
+recho "A${*-w}R"
+recho "A${*}R"
+
+set -- ""
+
+recho "A${*:-w}R"
+recho "A${*-w}R"
+recho "A${*}R"
+
+set -- $'\177'
+
+recho "A${*:+w}R"
+recho "A${*+w}R"
+recho "A${*}R"
+
+recho A${*:+w}R
+recho A${*+w}R
+recho A${*}R
diff --git a/tests/dollar-star7.sub b/tests/dollar-star7.sub
new file mode 100644
index 0000000..72d6c24
--- /dev/null
+++ b/tests/dollar-star7.sub
@@ -0,0 +1,30 @@
+# if IFS side effects in ${IFS=} assignments take place, how do you cope with
+# later changes to IFS in the same set of expansions? You've already
+# committed to using the first character of the (old) IFS to expand $* in
+# the previous expansions, and changing it to not include ' ', for instance,
+# results in the first couple of ${*} below not being split at all
+
+set -f -- a b c
+
+unset -v IFS
+printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
+echo
+printf "after 1: IFS "
+echo "${IFS-unset}"
+recho "$*"
+
+set -f -- a 'b c' d
+unset -v IFS
+printf '<%s> ' ${*}${IFS=}${*}${IFS:=-}"${*}"
+echo
+printf "after 2: IFS "
+echo "${IFS-unset}"
+recho "$*"
+
+unset -v IFS
+recho $*
+recho "$*"
+
+IFS=' '
+recho $*
+recho "$*"
diff --git a/tests/dollar.right b/tests/dollar.right
index 13db8e2..6af02b1 100644
--- a/tests/dollar.right
+++ b/tests/dollar.right
@@ -95,6 +95,14 @@ ok 1
ok 2
ok 3
ok 4
+var=${a[*]} ... one:::two:three:::four
+var="${a[*]}" ... one:::two:three:::four
+var=$* ... one:::two:three:::four
+var="$*" ... one:::two:three:::four
+var=${a[@]} ... one:::two three:::four
+var="${a[@]}" ... one:::two three:::four
+var=$@ ... one:::two three:::four
+var="$@" ... one:::two three:::four
xa|xb|xc
xa|xb|xc
a|b|c
@@ -166,3 +174,111 @@ ab
cd
ok 1
ok 2
+argv[1] = <a b>
+argv[2] = <c d>
+argv[1] = <a>
+argv[2] = <b>
+argv[3] = <c>
+argv[4] = <d>
+argv[1] = <a b c d>
+argv[1] = <a b c d>
+<1> <2> <3> <4> <5 1>
+<1 1> <2> <3> <4> <5>
+<11> <2> <3> <4> <51>
+<1 1> <2> <3> <4> <5 1>
+<11> <2> <3> <4> <51>
+<1> <2> <3> <4> <51>
+<11> <2> <3> <4> <5>
+<1> <2> <3> <4> <51>
+<11> <2> <3> <4> <5>
+<1> <2> <3> <4> <5foo>
+<1> <2> <3> <4> <51>
+<1> <2> <3> <4> <5foo>
+<1> <2> <3> <4> <51>
+<11> <2> <3> <4> <5>
+<1> <2> <3> <4> <51>
+<11> <2> <3> <4> <5>
+<1> <2> <3> <4> <5foo>
+second set:
+<1 2> <3> <4> <5 1 2>
+<1 2 1 2> <3> <4> <5>
+<1 21 2> <3> <4> <51 2>
+<1 2 1 2> <3> <4> <5 1 2>
+<1> <21 2> <3> <4> <51> <2>
+<1 2> <3> <4> <51> <2>
+<1> <21 2> <3> <4> <5>
+<1 2> <3> <4> <51 2>
+<1 21 2> <3> <4> <5>
+<1 2> <3> <4> <5foo>
+<1> <2> <3> <4> <51> <2>
+<1> <2> <3> <4> <5foo>
+<1 2> <3> <4> <51 2>
+<1 21 2> <3> <4> <5>
+<1 2> <3> <4> <51 2>
+<1 21 2> <3> <4> <5>
+<1 2> <3> <4> <5foo>
+third set:
+
+"${@:2}a3 a2" a$1 #works as long as $1 and 3 are swapped
+set y za3 a2 ax
+0
+declare -a a='([0]="y" [1]="za3 a2" [2]="ax")'
+
+"${@:2}b$1 b2" b3 #fails! why?
+set y zbx b2 b3
+0
+declare -a b='([0]="y" [1]="zbx b2" [2]="b3")'
+
+${@:2}c$1 c2 c3 #works as long as quoting omitted
+set y zcx c2 c3
+0
+declare -a c='([0]="y" [1]="zcx" [2]="c2" [3]="c3")'
+argv[1] = <>
+argv[2] = <x>
+argv[1] = <>
+argv[2] = <x>
+1
+argv[1] = <>
+argv[2] = <>
+argv[3] = <x>
+argv[1] = <>
+argv[2] = <x>
+argv[1] = <>
+argv[2] = <>
+argv[3] = <x>
+argv[1] = <>
+argv[2] = <x>
+argv[1] = <>
+argv[2] = <x>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <AwR>
+argv[1] = <AwR>
+argv[1] = <AR>
+argv[1] = <AwR>
+argv[1] = <AR>
+argv[1] = <AR>
+argv[1] = <AwR>
+argv[1] = <AwR>
+argv[1] = <A^?R>
+argv[1] = <AwR>
+argv[1] = <AwR>
+argv[1] = <A^?R>
+<a> <b> <ca> <b> <c-a-b-c>
+after 1: IFS -
+argv[1] = <a-b-c>
+<a> <b> <c> <da> <b c> <d-a-b c-d>
+after 2: IFS -
+argv[1] = <a-b c-d>
+argv[1] = <a>
+argv[2] = <b>
+argv[3] = <c>
+argv[4] = <d>
+argv[1] = <a b c d>
+argv[1] = <a>
+argv[2] = <b>
+argv[3] = <c>
+argv[4] = <d>
+argv[1] = <a b c d>
diff --git a/tests/errors.right b/tests/errors.right
index 7dd80c4..63d6b7e 100644
--- a/tests/errors.right
+++ b/tests/errors.right
@@ -8,14 +8,14 @@ unalias: usage: unalias [-a] name [name ...]
declare -fr func
./errors.tests: line 36: func: readonly function
./errors.tests: line 39: unset: -x: invalid option
-unset: usage: unset [-f] [-v] [name ...]
+unset: usage: unset [-f] [-v] [-n] [name ...]
./errors.tests: line 42: unset: func: cannot unset: readonly function
./errors.tests: line 45: declare: func: readonly function
./errors.tests: line 49: unset: XPATH: cannot unset: readonly variable
./errors.tests: line 52: unset: `/bin/sh': not a valid identifier
./errors.tests: line 55: unset: cannot simultaneously unset a function and a variable
./errors.tests: line 58: declare: -z: invalid option
-declare: usage: declare [-aAfFgilrtux] [-p] [name[=value] ...]
+declare: usage: declare [-aAfFgilnrtux] [-p] [name[=value] ...]
./errors.tests: line 60: declare: `-z': not a valid identifier
./errors.tests: line 61: declare: `/bin/sh': not a valid identifier
./errors.tests: line 65: declare: cannot use `-f' to make functions
@@ -98,4 +98,16 @@ trap: usage: trap [-lp] [[arg] signal_spec ...]
./errors.tests: line 250: kill: `': not a pid or valid job spec
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
./errors.tests: line 255: set: trackall: invalid option name
-./errors.tests: line 262: `!!': not a valid identifier
+./errors.tests: line 259: xx: readonly variable
+1
+./errors1.sub: line 1: .: -i: invalid option
+.: usage: . filename [arguments]
+./errors1.sub: line 9: shift: -4: shift count out of range
+./errors1.sub: line 14: break: -1: loop count out of range
+after f
+./errors2.sub: line 3: ${$NO_SUCH_VAR}: bad substitution
+1
+./errors3.sub: line 5: no_such_file: No such file or directory
+TEST
+./errors3.sub: line 7: no_such_file: No such file or directory
+./errors.tests: line 271: `!!': not a valid identifier
diff --git a/tests/errors.tests b/tests/errors.tests
index 4ead467..14eeb08 100644
--- a/tests/errors.tests
+++ b/tests/errors.tests
@@ -254,6 +254,15 @@ kill -INT
# bad shell option names
set -o trackall # bash is not ksh
+# problem with versions through bash-4.2
+readonly xx=5
+echo $((xx=5))
+echo $?
+
+${THIS_SH} ./errors1.sub
+${THIS_SH} ./errors2.sub
+${THIS_SH} ./errors3.sub
+
# this must be last!
# in posix mode, a function name must be a valid identifier
# this can't go in posix2.tests, since it causes the shell to exit
diff --git a/tests/errors1.sub b/tests/errors1.sub
new file mode 100644
index 0000000..8e7440b
--- /dev/null
+++ b/tests/errors1.sub
@@ -0,0 +1,27 @@
+. -i /dev/tty
+
+f()
+{
+ return -1
+}
+
+set -- a b c
+shift -4
+
+f
+
+for f in 1 2 3; do
+ break -1
+done
+
+
+f()
+{
+ return -25
+}
+
+f
+echo after f
+exit -25
+
+exit -56
diff --git a/tests/errors2.sub b/tests/errors2.sub
new file mode 100644
index 0000000..79ef333
--- /dev/null
+++ b/tests/errors2.sub
@@ -0,0 +1,3 @@
+set -e
+trap 'echo $?' EXIT
+echo ${$NO_SUCH_VAR} # Bad substitution expected here
diff --git a/tests/errors3.sub b/tests/errors3.sub
new file mode 100644
index 0000000..b2ae3d7
--- /dev/null
+++ b/tests/errors3.sub
@@ -0,0 +1,7 @@
+# redirection errors with special builtins should exit the shell when in
+# Posix mode, not otherwise; being on the LHS of || or && should not make
+# a difference
+
+exec 9<no_such_file || echo TEST
+set -o posix
+exec 9<no_such_file || echo TEST
diff --git a/tests/exec.right b/tests/exec.right
index c51a253..54488bf 100644
--- a/tests/exec.right
+++ b/tests/exec.right
@@ -4,28 +4,29 @@ aa bb cc dd ee
after exec1.sub with args: 0
after exec1.sub without args: 0
-./execscript: line 20: notthere: command not found
+after exec1.sub: one two three
+./execscript: line 21: notthere: command not found
127
/tmp/bash: notthere: No such file or directory
127
/bin/sh: /bin/sh: cannot execute binary file
126
-./execscript: line 39: /: Is a directory
+./execscript: line 40: /: Is a directory
126
/: /: is a directory
126
-./execscript: line 46: .: /: is a directory
+./execscript: line 47: .: /: is a directory
1
126
0
this is bashenv
./exec3.sub: line 3: /tmp/bash-notthere: No such file or directory
127
-./execscript: line 70: notthere: No such file or directory
+./execscript: line 71: notthere: No such file or directory
127
-./execscript: line 73: notthere: No such file or directory
+./execscript: line 74: notthere: No such file or directory
127
-./execscript: line 76: notthere: command not found
+./execscript: line 77: notthere: command not found
127
this is sh
this is sh
diff --git a/tests/execscript b/tests/execscript
index f1db527..5a4e903 100644
--- a/tests/execscript
+++ b/tests/execscript
@@ -12,6 +12,7 @@ echo calling exec1.sub
echo after exec1.sub with args: $?
./exec1.sub
echo after exec1.sub without args: $?
+echo after exec1.sub: "$@"
# set up a fixed path so we know notthere will not be found
PATH=/usr/bin:/bin:/usr/local/bin:
diff --git a/tests/exp.right b/tests/exp.right
index 959ded2..c027036 100644
--- a/tests/exp.right
+++ b/tests/exp.right
@@ -1,9 +1,9 @@
argv[1] = <^A>
argv[1] = <^A>
-argv[1] = <^B>
-argv[1] = <^B>
+argv[1] = <^?>
+argv[1] = <^?>
argv[1] = <^A>
-argv[1] = <^B>
+argv[1] = <^?>
argv[1] = <abcdefgh>
argv[1] = <abcdefgh>
argv[1] = <abcdefgh>
@@ -25,11 +25,11 @@ argv[1] = <abc>
argv[1] = <abcdef>
argv[1] = <abcdef>
argv[1] = <^A>
-argv[1] = <^B>
+argv[1] = <^?>
argv[1] = <^A>
-argv[1] = <^B>
+argv[1] = <^?>
argv[1] = <^A>
-argv[1] = <^B>
+argv[1] = <^?>
argv[1] = <>
argv[1] = <>
argv[1] = <>
@@ -42,13 +42,13 @@ argv[1] = <\\>
argv[1] = <a>
argv[2] = <b>
argv[1] = <^A>
-argv[2] = <^B>
+argv[2] = <^?>
argv[1] = <**>
argv[1] = <\.\./*/>
-argv[1] = <^A^B^A^B>
+argv[1] = <^A^?^A^?>
argv[1] = <^A^A>
-argv[1] = <^A^B>
-argv[1] = <^A^A^B>
+argv[1] = <^A^?>
+argv[1] = <^A^A^?>
argv[1] = < abc>
argv[2] = <def>
argv[3] = <ghi>
@@ -170,3 +170,38 @@ a
val
val
no arg passed
+hello
+[0;31m\]
+]
+[hello
+\[\e[0;31m\]
+
+hello
+eo
+argv[1] = <a>
+argv[1] = <a>
+argv[1] = <^?>
+argv[1] = <^?b>
+argv[1] = <b^?>
+argv[1] = <c>
+argv[1] = <c>
+argv[1] = <c>
+argv[1] = <c>
+argv[1] = <c>
+argv[1] = <c>
+argv[1] = <correct>
+argv[2] = <>
+argv[1] = <correct>
+argv[2] = <>
+argv[1] = <correct>
+argv[2] = <>
+argv[1] = <XwrongX>
+argv[2] = <>
+argv[1] = <correct>
+argv[2] = <a>
+argv[1] = <XwrongX>
+argv[2] = <a>
+argv[1] = <correct>
+argv[2] = <a>
+argv[1] = <correct>
+argv[2] = <a>
diff --git a/tests/exp.tests b/tests/exp.tests
index c97b48c..9f77a7f 100644
--- a/tests/exp.tests
+++ b/tests/exp.tests
@@ -22,14 +22,14 @@ expect "<^A>"
recho `echo ''`
expect "<^A>"
recho `echo ""`
-expect "<^B>"
-recho `echo ''`
-expect "<^B>"
-recho `echo ""`
+expect "<^?>"
+recho `echo ''`
+expect "<^?>"
+recho `echo ""`
expect "<^A>"
recho `echo `
-expect "<^B>"
-recho `echo `
+expect "<^?>"
+recho `echo `
# Test null strings without variable expansion
expect "<abcdefgh>"
@@ -89,16 +89,16 @@ unset xxx yyy
# Test the unquoted special quoting characters
expect "<^A>"
recho 
-expect "<^B>"
-recho 
+expect "<^?>"
+recho 
expect "<^A>"
recho ""
-expect "<^B>"
-recho ""
+expect "<^?>"
+recho ""
expect "<^A>"
recho ''
-expect "<^B>"
-recho ''
+expect "<^?>"
+recho ''
# Test expansion of a variable that is unset
expect nothing
@@ -139,9 +139,9 @@ expect '<a> <b>'
FOO=`echo 'a b' | tr ' ' '\012'`
recho $FOO
-# This should give argv[1] = ^A argv[2] = ^B
-expect '<^A> <^B>'
-FOO=`echo ' ' | tr ' ' '\012'`
+# This should give argv[1] = ^A argv[2] = ^?
+expect '<^A> <^?>'
+FOO=`echo ' ' | tr ' ' '\012'`
recho $FOO
# Test quoted and unquoted globbing characters
@@ -153,14 +153,14 @@ recho "\.\./*/"
# Test patterns that come up when the shell quotes funny character
# combinations
-expect '<^A^B^A^B>'
-recho ''
+expect '<^A^?^A^?>'
+recho ''
expect '<^A^A>'
recho ''
-expect '<^A^B>'
-recho ''
-expect '<^A^A^B>'
-recho ''
+expect '<^A^?>'
+recho ''
+expect '<^A^A^?>'
+recho ''
# More tests of "$@"
set abc def ghi jkl
@@ -386,3 +386,7 @@ ${THIS_SH} ./exp2.sub
${THIS_SH} ./exp3.sub
${THIS_SH} ./exp4.sub
+
+${THIS_SH} ./exp5.sub
+
+${THIS_SH} ./exp6.sub
diff --git a/tests/exp5.sub b/tests/exp5.sub
new file mode 100644
index 0000000..9346b57
--- /dev/null
+++ b/tests/exp5.sub
@@ -0,0 +1,22 @@
+# expansions involving patterns
+
+var='[hello'
+echo "${var//[/}"
+
+red='\[\e[0;31m\]'
+echo "${red//\\[\\e/}"
+
+foo="${red//\\[\\e/}"
+
+# foo == [0;31m\]
+echo "${foo//[0;31m\\/}"
+
+echo "${var//[]/}"
+echo "${red//[]/}"
+
+v=hello
+foo='[:alpha:]'
+
+echo ${v//[[:alpha:]]/}
+echo ${v//[[:alpha]]/}
+echo ${v//[[:alpha]/}
diff --git a/tests/exp6.sub b/tests/exp6.sub
new file mode 100644
index 0000000..a1c9fe6
--- /dev/null
+++ b/tests/exp6.sub
@@ -0,0 +1,30 @@
+recho """"a
+recho a""""
+
+recho """"
+
+recho """"b
+recho b""""
+
+recho """"""c
+recho c""""""
+
+recho """"""c""""
+recho """"c""""""
+
+recho """"""""c
+recho c""""""""
+
+# BASH BUG: spurious DEL characters appear on empty variable interpolation.
+# BASH 4.2.8(1)-release
+
+a=''
+
+recho correct "$a" # correct empty output line
+recho correct "$a""$a" # correct empty output line
+recho correct "$a""$a""$a" # correct empty output line
+recho XwrongX "$a""$a""$a""$a" # spurious two DEL chars appear at line end
+recho correct a"$a" # correct single "a" on line
+recho XwrongX a"$a""$a" # spurious DEL char appears at line end
+recho correct a"$a$a" # correct single "a" on line
+recho correct a"$a$a$a$a" # correct single "a" on line
diff --git a/tests/extglob.right b/tests/extglob.right
index 7b9cc94..837ccc2 100644
--- a/tests/extglob.right
+++ b/tests/extglob.right
@@ -88,3 +88,7 @@ a.c
ok 1
ok 2
ok 3
+a ab
+a ab
+a ab
+a
diff --git a/tests/extglob.tests b/tests/extglob.tests
index f9c17c7..0fa310a 100644
--- a/tests/extglob.tests
+++ b/tests/extglob.tests
@@ -368,4 +368,6 @@ builtin cd "$MYDIR"
${THIS_SH} ./extglob1.sub
+${THIS_SH} ./extglob1a.sub
+
exit 0
diff --git a/tests/extglob1a.sub b/tests/extglob1a.sub
new file mode 100644
index 0000000..e029ea4
--- /dev/null
+++ b/tests/extglob1a.sub
@@ -0,0 +1,16 @@
+shopt -s extglob
+
+TESTDIR=${TMPDIR:-/tmp}/eglob-test-$$
+mkdir $TESTDIR
+builtin cd $TESTDIR || { echo $0: cannot cd to $TESTDIR >&2 ; exit 1; }
+rm -rf *
+
+touch a ab ba
+
+echo a*!(x)
+echo a!(x)
+echo a*?(x)
+echo a?(x)
+
+builtin cd /
+rm -rf $TESTDIR
diff --git a/tests/globstar.right b/tests/globstar.right
index b75d80b..c104fd3 100644
--- a/tests/globstar.right
+++ b/tests/globstar.right
@@ -153,3 +153,433 @@ alias.o builtins builtins/history.o builtins/jobs.o builtins/kill.o builtins/let
bar/foo foo
bar/foo/ foo/
bar/foo/e bar/foo/f foo/a foo/b
+<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/a/a>
+<a/a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/b/a>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/b/a>
+<b/b/a>
+<b/b/a/a>
+<b/b/b/a>
+== <a/**> ==
+<a/>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+== <**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+<b>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/b>
+<b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b>
+<b/b/b/a>
+<b/b/b/b>
+== <**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+<b>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/b>
+<b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b>
+<b/b/b/a>
+<b/b/b/b>
+== <**/**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+<b>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/b>
+<b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b>
+<b/b/b/a>
+<b/b/b/b>
+== <**/**/**/**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+<b>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/b>
+<b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b>
+<b/b/b/a>
+<b/b/b/b>
+== <**/**/a> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/b/a>
+<b/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/b/a>
+<b/b/a>
+<b/b/a/a>
+<b/b/b/a>
+== <a/**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+== <a/**/**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+== <a/**/**/**/**> ==
+<a>
+<a/a>
+<a/a/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/b>
+== <**/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>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/b>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/a>
+<a/b/b/b>
+<b/a>
+<b/a/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/a>
+<b/a/b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b/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/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/b>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/a>
+<a/b/b/b>
+<b/a>
+<b/a/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/a>
+<b/a/b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b/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/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/b>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/a>
+<a/b/b/b>
+<b/a>
+<b/a/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/a>
+<b/a/b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b/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/a>
+<a/a/a/a>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/a/b>
+<a/a/b>
+<a/a/b>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/a>
+<a/a/b/b>
+<a/a/b/b>
+<a/b>
+<a/b/a>
+<a/b/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/a>
+<a/b/a/b>
+<a/b/a/b>
+<a/b/b>
+<a/b/b/a>
+<a/b/b/a>
+<a/b/b/b>
+<b/a>
+<b/a/a>
+<b/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/a>
+<b/a/a/b>
+<b/a/a/b>
+<b/a/b>
+<b/a/b/a>
+<b/a/b/a>
+<b/a/b/b>
+<b/b/a>
+<b/b/a/a>
+<b/b/a/a>
+<b/b/a/b>
+<b/b/b/a>
+/tmp/empty
diff --git a/tests/globstar.tests b/tests/globstar.tests
index 9b1f9d2..f7efbd1 100644
--- a/tests/globstar.tests
+++ b/tests/globstar.tests
@@ -39,3 +39,4 @@ cd $dir
rm -rf $GDIR
${THIS_SH} ./globstar1.sub
+${THIS_SH} ./globstar2.sub
diff --git a/tests/globstar2.sub b/tests/globstar2.sub
new file mode 100644
index 0000000..844d312
--- /dev/null
+++ b/tests/globstar2.sub
@@ -0,0 +1,80 @@
+shopt -s globstar
+s()
+{
+ printf '== <%s> ==\n' "$@"
+}
+p()
+{
+ printf '<%q>\n' "$@"
+}
+
+mkdir -p /tmp/empty/a/a/a
+cd /tmp/empty
+
+# good
+p **
+p **/**
+p **/**/**
+
+rm -rf a
+mkdir -p /tmp/empty/{a,b}/{a,b}/{a,b}/{a,b}
+cd /tmp/empty
+
+# good
+s '**/a'
+p **/a
+
+# good
+s 'a/**'
+p a/**
+
+# good
+s '**'
+p **
+
+# good
+s '**/**'
+p **/**
+
+# good
+s '**/**/**'
+p **/**/**
+
+# good
+s '**/**/**/**/**'
+p **/**/**/**/**
+
+# good
+s '**/**/a'
+p **/**/a
+
+# good
+s 'a/**/**'
+p a/**/**
+
+# good
+s 'a/**/**/**'
+p a/**/**/**
+
+# good
+s 'a/**/**/**/**'
+p a/**/**/**/**
+
+# same as ksh93
+s '**/a/**'
+p **/a/**
+
+# same as ksh93
+s '**/a/**/**'
+p **/a/**/**
+
+# same as ksh93
+s '**/a/**/**/**'
+p **/a/**/**/**
+
+# good
+s '**/**/a/**'
+p **/**/a/**
+
+cd -
+rm -rf /tmp/empty
diff --git a/tests/heredoc.right b/tests/heredoc.right
index b8754de..6abaa1f 100644
--- a/tests/heredoc.right
+++ b/tests/heredoc.right
@@ -58,7 +58,34 @@ qux
bar
qux
+abc def geh
+./heredoc3.sub: line 6: warning: here-document at line 4 delimited by end-of-file (wanted `EOF')
+= here is the text =
+./heredoc3.sub: line 12: warning: here-document at line 10 delimited by end-of-file (wanted `EOF')
+this paren ) is not a problem
+./heredoc3.sub: line 18: warning: here-document at line 16 delimited by end-of-file (wanted `EOF')
+these balanced parens ( ) are not a problem
+./heredoc3.sub: line 24: warning: here-document at line 22 delimited by end-of-file (wanted `EOF')
+quoted balanced parens \( ) are not a problem either
+more text in a subshell
+some more text in a different subshell
+end
+hello
+hello
+ENDEND
+end ENDEND
+hello
+end hello
+x star x
+end x*x
+helloEND
+end helloEND
+hello
+\END
+end hello<NL>\END
+./heredoc3.sub: line 74: warning: here-document at line 72 delimited by end-of-file (wanted `EOF')
+./heredoc3.sub: line 75: syntax error: unexpected end of file
comsub here-string
-./heredoc.tests: line 100: warning: here-document at line 98 delimited by end-of-file (wanted `EOF')
+./heredoc.tests: line 105: warning: here-document at line 103 delimited by end-of-file (wanted `EOF')
hi
there
diff --git a/tests/heredoc.tests b/tests/heredoc.tests
index 79bf4ce..ebc770a 100644
--- a/tests/heredoc.tests
+++ b/tests/heredoc.tests
@@ -88,6 +88,11 @@ ${THIS_SH} -c 'type fff'
${THIS_SH} ./heredoc1.sub
+# test heredocs in command substitutions
+${THIS_SH} ./heredoc2.sub
+
+${THIS_SH} ./heredoc3.sub
+
echo $(
cat <<< "comsub here-string"
)
diff --git a/tests/heredoc2.sub b/tests/heredoc2.sub
new file mode 100644
index 0000000..7e97ed8
--- /dev/null
+++ b/tests/heredoc2.sub
@@ -0,0 +1,9 @@
+TEST=$(cat <<EOF | sort -u
+abc
+geh
+def
+abc
+EOF
+)
+
+echo $TEST
diff --git a/tests/heredoc3.sub b/tests/heredoc3.sub
new file mode 100644
index 0000000..73a111e
--- /dev/null
+++ b/tests/heredoc3.sub
@@ -0,0 +1,74 @@
+text=$(cat <<EOF
+here is the text
+EOF)
+
+echo = $text =
+
+unbalanced=$(cat <<EOF
+this paren ) is not a problem
+EOF)
+
+echo $unbalanced
+
+balanced=$(cat <<EOF
+these balanced parens ( ) are not a problem
+EOF)
+
+echo $balanced
+
+balanced=$(cat <<EOF
+quoted balanced parens \( ) are not a problem either
+EOF)
+
+echo $balanced
+
+(cat <<EOF
+more text in a subshell
+EOF
+)
+
+(cat <<EOF; )
+some more text in a different subshell
+EOF
+echo end
+
+# semi-weird examples posted by Wayne Pollack to austin-group mailing list
+cat <<-' END'
+ hello
+ END
+
+cat <<END
+hello
+END\
+END
+END
+echo end ENDEND
+
+cat <<' END '
+hello
+ END
+echo end hello
+
+cat <<x*x & touch 'x*x'
+x star x
+x*x
+echo end 'x*x'
+rm 'x*x'
+
+cat <<END
+hello\
+END
+END
+echo end helloEND
+
+cat <<END
+hello
+\END
+END
+echo end 'hello<NL>\END'
+
+# this has to be last -- results in a syntax error
+# doesn't currently parse because EOF is not on a line by itself -- should it?
+(cat <<EOF
+still more text in a subshell
+EOF)
diff --git a/tests/histexp.tests b/tests/histexp.tests
index dccbfe0..add2a67 100644
--- a/tests/histexp.tests
+++ b/tests/histexp.tests
@@ -5,7 +5,7 @@ trap 'rm /tmp/newhistory' 0
file=bax
histchars='!^#' # make sure history comment char is set correctly
-unset HISTFILESIZE
+unset HISTFILESIZE HISTTIMEFORMAT
history -c
diff --git a/tests/history.right b/tests/history.right
index 3bac71a..3dc93a1 100644
--- a/tests/history.right
+++ b/tests/history.right
@@ -140,7 +140,7 @@ three
one
two
three
-4.2
+4.3
echo ${BASH_VERSION%\.*}
-4.2
+4.3
echo ${BASH_VERSION%\.*}
diff --git a/tests/history.tests b/tests/history.tests
index 688095d..25d7834 100644
--- a/tests/history.tests
+++ b/tests/history.tests
@@ -109,5 +109,6 @@ shopt -q -o history
echo $?
${THIS_SH} ./history1.sub
+rm foohist-*
${THIS_SH} ./history2.sub
diff --git a/tests/history1.sub b/tests/history1.sub
index 543a3e8..fa51ffc 100644
--- a/tests/history1.sub
+++ b/tests/history1.sub
@@ -1,3 +1,5 @@
+trap 'rm -f $HISTFILE' 0 1 2 3 6 15
+
HISTFILE=foohist-$$
unset HISTIGNORE HISTCONTROL
set -o history
diff --git a/tests/intl.right b/tests/intl.right
index 52c65e4..acf108a 100644
--- a/tests/intl.right
+++ b/tests/intl.right
@@ -17,3 +17,35 @@ aéb
1.0000
1.0000
1,0000
+Passed all 1378 Unicode tests
+0000000 303 277 012
+0000003
+0000000 303 277 012
+0000003
+0000000 303 277 012
+0000003
+0000000 303 277 012
+0000003
+0000000 357 277 277 012
+0000004
+0000000 357 277 277 012
+0000004
+0000000 012
+0000001
+0000000 012
+0000001
+0000000 012
+0000001
+0000000 012
+0000001
+0000000 303 277 012
+0000003
+0000000 303 277 012
+0000003
+0000000 303 277 012
+0000003
+0000000 101 040 302 243 040 305 222 012
+0000010
+./unicode3.sub: line 2: 5§@3™+ÆS8Ÿ¢ê³: command not found
+5§@3™+ÆS8Ÿ¢ê³
++ : $'5\247@3\231+\306S8\237\242\352\263'
diff --git a/tests/intl.tests b/tests/intl.tests
index 37518db..3844fa8 100644
--- a/tests/intl.tests
+++ b/tests/intl.tests
@@ -43,3 +43,8 @@ ${THIS_SH} ./intl1.sub
# this tests both international handling in printf and temporary environments
${THIS_SH} ./intl2.sub
+
+${THIS_SH} ./unicode1.sub 2>/dev/null
+${THIS_SH} ./unicode2.sub
+
+${THIS_SH} ./unicode3.sub 2>&1
diff --git a/tests/iquote.right b/tests/iquote.right
index d164f10..9476128 100644
--- a/tests/iquote.right
+++ b/tests/iquote.right
@@ -59,3 +59,34 @@ argv[1] = <aaa^?bbb>
argv[1] = <ccc^?ddd>
argv[1] = <eee^?fff>
argv[1] = <ggg^?hhh>
+argv[1] = <xy>
+argv[1] = <xy>
+argv[1] = <xy>
+argv[1] = <x^?y>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <>
+argv[1] = <^?>
+argv[1] = <^? >
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?x>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?>
+argv[1] = < ^?x>
+argv[1] = <^?x>
+argv[1] = <^?>
+argv[1] = < ^? x>
+argv[1] = <^? x>
+argv[1] = <^? >
diff --git a/tests/iquote.tests b/tests/iquote.tests
index a2cdf4f..a1e6362 100644
--- a/tests/iquote.tests
+++ b/tests/iquote.tests
@@ -141,3 +141,5 @@ recho aaa$'\177'bbb
recho ccc""ddd
recho "eeefff"
recho ggg"$(echo $'\177')"hhh
+
+${THIS_SH} ./iquote1.sub
diff --git a/tests/iquote1.sub b/tests/iquote1.sub
new file mode 100644
index 0000000..1a8a35c
--- /dev/null
+++ b/tests/iquote1.sub
@@ -0,0 +1,43 @@
+# Problems with variables that expand to 0x7f and quoted nulls in the same
+# expansion -- affects bash versions 4.0-post 4.2
+a=x
+b=
+del=$'\x7f'
+
+set ""
+
+recho ${undef-"x$*y"}
+recho "x$*y"
+recho x"$*"y
+recho x"$del"y
+
+recho ${undef-"$@"}
+recho "$@"
+recho "${@}"
+recho ${undef-"$*"}
+recho "$*"
+recho "${*}"
+
+recho "$del${a#x}"
+recho "$del ${a#x}"
+recho " $del${a#x}"
+
+recho " $del$b"
+recho " $del${b}"
+recho " $del${b#x}"
+recho " $del${a#x}"
+
+recho " $del${a%x}"
+recho " $del${a:0:0}"
+recho " $del"${a:0:0}
+recho " $del""${a:0:0}"
+recho " $del${a}"
+recho " $del"
+recho " ${del}${a:0:0}"
+recho " ${del:0:1}${a:0:0}"
+recho " ${del:0:1}${a}"
+recho "${del:0:1}${a#d}"
+recho "${del:0:1}${a#x}"
+recho " ${del:0:1} ${a}"
+recho "${del:0:1} ${a#d}"
+recho "${del:0:1} ${a#x}"
diff --git a/tests/jobs.right b/tests/jobs.right
index a4c8a7c..7af54eb 100644
--- a/tests/jobs.right
+++ b/tests/jobs.right
@@ -24,20 +24,23 @@ job 7 returns 0
4
0
i killed it
+12
+[1]- Running sleep 20 &
+[3]+ Running sleep 20 &
0
-./jobs.tests: line 19: wait: %1: no such job
-./jobs.tests: line 24: fg: no job control
+./jobs.tests: line 22: wait: %1: no such job
+./jobs.tests: line 27: fg: no job control
wait-for-pid
wait-errors
-./jobs.tests: line 37: wait: `1-1': not a pid or valid job spec
-./jobs.tests: line 38: wait: `-4': not a pid or valid job spec
+./jobs.tests: line 40: wait: `1-1': not a pid or valid job spec
+./jobs.tests: line 41: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
forked
wait-when-no-children
wait-for-job
-./jobs.tests: line 60: wait: %2: no such job
+./jobs.tests: line 63: wait: %2: no such job
127
async list wait-for-job
forked
@@ -50,19 +53,19 @@ sleep 5
fg-bg 4
sleep 5
fg-bg 5
-./jobs.tests: line 87: fg: %2: no such job
-./jobs.tests: line 88: bg: job 1 already in background
+./jobs.tests: line 90: fg: %2: no such job
+./jobs.tests: line 91: bg: job 1 already in background
fg-bg 6
-./jobs.tests: line 95: fg: -s: invalid option
+./jobs.tests: line 98: fg: -s: invalid option
fg: usage: fg [job_spec]
-./jobs.tests: line 96: bg: -s: invalid option
+./jobs.tests: line 99: bg: -s: invalid option
bg: usage: bg [job_spec ...]
-./jobs.tests: line 101: disown: -s: invalid option
+./jobs.tests: line 104: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
-./jobs.tests: line 105: disown: %1: no such job
-./jobs.tests: line 108: disown: %2: no such job
+./jobs.tests: line 108: disown: %1: no such job
+./jobs.tests: line 111: disown: %2: no such job
wait-for-non-child
-./jobs.tests: line 111: wait: pid 1 is not a child of this shell
+./jobs.tests: line 114: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
@@ -72,8 +75,8 @@ running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
-./jobs.tests: line 128: kill: %4: no such job
-./jobs.tests: line 130: jobs: %4: no such job
+./jobs.tests: line 131: kill: %4: no such job
+./jobs.tests: line 133: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
diff --git a/tests/jobs.tests b/tests/jobs.tests
index e2acba5..c99f4f7 100644
--- a/tests/jobs.tests
+++ b/tests/jobs.tests
@@ -12,6 +12,9 @@ ${THIS_SH} ./jobs3.sub
# active
${THIS_SH} ./jobs4.sub
+# test out wait -n framework
+${THIS_SH} ./jobs5.sub
+
jobs
echo $?
diff --git a/tests/jobs5.sub b/tests/jobs5.sub
new file mode 100644
index 0000000..35d3981
--- /dev/null
+++ b/tests/jobs5.sub
@@ -0,0 +1,12 @@
+# framework to test new `wait -n' option that waits for any job to finish
+
+set -m
+
+sleep 20 &
+{ sleep 5; exit 12; } &
+sleep 20 &
+
+wait -n
+echo $?
+
+jobs
diff --git a/tests/nameref.right b/tests/nameref.right
new file mode 100644
index 0000000..5321534
--- /dev/null
+++ b/tests/nameref.right
@@ -0,0 +1,129 @@
+one
+two
+three
+declare -n fee="flip"
+declare -n foo="bar"
+turning off nameref attribute on foo
+bar
+after +n foo bar = other
+one
+two
+one
+expect <one>
+argv[1] = <one>
+expect <two>
+argv[1] = <two>
+expect <one>
+one
+expect <one>
+one
+expect <one>
+argv[1] = <one>
+changevar: expect <two>
+argv[1] = <two>
+expect <two>
+argv[1] = <two>
+changevar: expect <three four five>
+argv[1] = <three four five>
+expect <three four five>
+argv[1] = <three four five>
+./nameref.tests: line 93: bar: readonly variable
+./nameref.tests: line 94: foo: readonly variable
+one
+one
+./nameref.tests: line 106: foo: readonly variable
+./nameref.tests: line 103: foo: readonly variable
+one
+one
+bar
+
+./nameref2.sub: line 5: foo: readonly variable
+
+expect <unset>
+argv[1] = <unset>
+expect <unset>
+argv[1] = <unset>
+expect <bar>
+argv[1] = <bar>
+expect <unset>
+argv[1] = <unset>
+./nameref3.sub: line 21: unset: bar: cannot unset: readonly variable
+expect <two>
+two
+expect <two>
+two
+three
+unset
+four
+0
+expect <a b>
+a b
+expect <foo>
+foo
+1 3 5 7 9
+9
+1 3 42 7 9
+1 3 42 7 9
+9
+1 3 44 7 9
+unset
+expect <a b c d e>
+argv[1] = <a b c d e>
+expect <zero> <one> <seven> <three> <four>
+argv[1] = <zero>
+argv[2] = <one>
+argv[3] = <seven>
+argv[4] = <three>
+argv[5] = <four>
+16
+expect <4>
+4
+expect <4>
+4
+expect <4>
+4
+expect <one>
+one
+expect <one>
+one
+expect <one>
+one
+expect <four>
+four
+errors = 0
+1
+2
+v1: 1
+v2: 2
+ref -> first, value: I am first
+ref -> second, value: I am in the middle
+ref -> third, value: I am last
+final state: ref -> third, value: I am last
+ref -> one, value: 1
+ref -> two, value: 2
+ref -> three, value: 3
+final state: ref -> three, value: 3
+./nameref5.sub: line 43: unset: three: cannot unset: readonly variable
+ref -> one, value: 1
+ref -> two, value: 2
+ref -> three, value: 3
+final state: ref -> three, value: 3
+./nameref6.sub: line 2: typeset: x: nameref variable self references not allowed
+./nameref6.sub: line 12: typeset: x: reference variable cannot be an array
+the -- 1
+42 -- 0
+y -- 0
+2 -- 0
+2 -- 0
+y -- 0
+bar
+unset
+inside
+inside: two
+outside:
+foo
+local
+./nameref8.sub: line 47: typeset: v: nameref variable self references not allowed
+./nameref8.sub: line 54: warning: x: circular name reference
+./nameref8.sub: line 55: warning: x: circular name reference
+x =
diff --git a/tests/nameref.tests b/tests/nameref.tests
new file mode 100644
index 0000000..438133c
--- /dev/null
+++ b/tests/nameref.tests
@@ -0,0 +1,118 @@
+# basic nameref tests
+bar=one
+flow=two
+flip=three
+
+foo=bar
+typeset -n foo
+
+typeset -n fee=flow
+
+echo ${foo}
+echo ${fee}
+
+typeset -n fee=flip
+echo ${fee}
+
+typeset -n
+
+echo turning off nameref attribute on foo
+typeset +n foo=other
+echo ${foo}
+echo after +n foo bar = $bar
+
+unset foo bar fee
+
+bar=one
+
+foo=bar
+typeset -n foo
+
+foo=two printf "%s\n" $foo
+foo=two eval 'printf "%s\n" $foo'
+
+foo=two echo $foo
+
+unset foo bar
+# other basic assignment tests
+bar=one
+
+echo "expect <one>"
+recho ${bar}
+typeset -n foo=bar
+foo=two
+
+echo "expect <two>"
+recho ${bar}
+
+# this appears to be a ksh93 bug; it doesn't unset foo here and messes up
+# later
+unset foo bar
+
+# initial tests of working inside shell functions
+echoval()
+{
+ typeset -n ref=$1
+ printf "%s\n" $ref
+}
+
+foo=bar
+bar=one
+echo "expect <$foo>"
+echoval foo
+echo "expect <$bar>"
+echoval bar
+
+unset foo bar
+changevar()
+{
+ typeset -n v=$1
+
+ shift
+ v="$@"
+ echo "changevar: expect <$@>"
+ recho "$v"
+}
+
+bar=one
+
+echo "expect <one>"
+recho ${bar}
+changevar bar two
+echo "expect <two>"
+recho $bar
+
+changevar bar three four five
+echo "expect <three four five>"
+recho "$bar"
+
+unset foo bar
+unset -n foo bar
+readonly foo=one
+typeset -n bar=foo
+bar=4
+foo=4
+
+echo $foo
+echo $bar
+
+assignvar()
+{
+ typeset -n ref=$1
+ shift
+ ref="$@"
+}
+
+readonly foo=one
+
+assignvar foo two three four
+echo $foo
+
+${THIS_SH} ./nameref1.sub
+${THIS_SH} ./nameref2.sub
+${THIS_SH} ./nameref3.sub
+${THIS_SH} ./nameref4.sub
+${THIS_SH} ./nameref5.sub
+${THIS_SH} ./nameref6.sub
+${THIS_SH} ./nameref7.sub
+${THIS_SH} ./nameref8.sub
diff --git a/tests/nameref1.sub b/tests/nameref1.sub
new file mode 100644
index 0000000..50bb25d
--- /dev/null
+++ b/tests/nameref1.sub
@@ -0,0 +1,13 @@
+# indirect referencing of a nameref returns the variable name it references
+unset foo bar
+
+bar=one
+foo=bar
+
+typeset -n foo
+
+echo ${foo}
+echo ${!foo}
+
+# this is a current incompatibility
+echo ${!foo[0]}
diff --git a/tests/nameref2.sub b/tests/nameref2.sub
new file mode 100644
index 0000000..547cc19
--- /dev/null
+++ b/tests/nameref2.sub
@@ -0,0 +1,7 @@
+# test readonly nameref variables
+# ksh93 allows this but not typeset -rn ref=foo?
+typeset -n ref=foo
+readonly ref
+foo=4
+
+echo $ref
diff --git a/tests/nameref3.sub b/tests/nameref3.sub
new file mode 100644
index 0000000..5790291
--- /dev/null
+++ b/tests/nameref3.sub
@@ -0,0 +1,37 @@
+# nameref requires changes to unset
+bar=one
+typeset -n foo=bar
+
+# normal unset unsets only variable nameref references
+# need unset -n to unset nameref itself
+unset foo
+echo "expect <unset>"
+recho ${bar-unset}
+echo "expect <unset>"
+recho ${foo-unset}
+echo "expect <bar>"
+recho ${!foo}
+unset -n foo
+echo "expect <unset>"
+recho "${!foo-unset}"
+
+readonly bar=two
+typeset -n foo=bar
+
+unset foo # this should fail because bar is readonly
+
+echo "expect <two>"
+echo ${bar-unset}
+echo "expect <two>"
+echo ${foo-unset}
+
+# one question is what happens when you unset the underlying variable
+qux=three
+typeset -n ref
+ref=qux
+
+echo $ref
+unset qux
+echo ${ref-unset}
+qux=four
+echo ${ref-unset}
diff --git a/tests/nameref4.sub b/tests/nameref4.sub
new file mode 100644
index 0000000..f1e2aef
--- /dev/null
+++ b/tests/nameref4.sub
@@ -0,0 +1,212 @@
+# test suite cribbed from ksh93 nameref tests
+typeset -i errors=0
+ckval()
+{
+ typeset -n one=$1
+
+ if [[ $one != $2 ]]; then
+ echo "one=$one != 2=$2"
+ (( errors++ ))
+ fi
+}
+
+ckref()
+{
+ typeset -n one=$1 two=$2
+
+ if [[ $one != $two ]]; then
+ echo "one=$one != two=$two"
+ (( errors++ ))
+ fi
+}
+
+name=first
+
+ckref name name
+
+func1()
+{
+ typeset -n color=$1
+ func2 color
+}
+
+func2()
+{
+ typeset color=$1
+ set -- ${color[@]}
+ printf "<%s>" "$@"
+ echo
+}
+
+typeset -A color
+color[apple]=red
+color[grape]=purple
+color[banana]=yellow
+
+# XXX
+#func1 color
+
+unset foo bar
+export bar=foo
+typeset -n foo=bar
+ckval foo foo
+
+# XXX - need to see if we can do checks for self-referencing at assignment
+# time
+command typeset -n xx=yy
+command typeset -n yy=xx
+echo $?
+
+unset foo bar
+unset -n foo bar
+set foo
+typeset -n bar=$1
+foo=hello
+ckval bar hello
+
+# XXX -- another self-referencing error?
+# ksh93 makes this another invalid self-reference
+unset foo bar
+bar=123
+foobar()
+{
+ typeset -n foo=bar
+ typeset -n foo=bar
+
+ ckval foo 123
+}
+
+typeset -n short=long
+short=( a b )
+echo "expect <a b>"
+echo ${long[@]}
+unset short long
+
+# assignment to a previously-unset variable
+typeset -n short=long
+short=foo
+echo "expect <foo>"
+echo ${long}
+unset short long
+
+unset foo bar
+
+# simple array references and assignments
+typeset -n foo=bar
+bar=( 1 3 5 7 9)
+echo ${foo[@]}
+echo ${foo[4]}
+foo[2]=42
+echo ${bar[@]}
+
+barfunc()
+{
+ typeset -n v=$1
+ echo ${v[@]}
+ echo ${v[4]}
+ v[2]=44
+ echo ${bar[@]}
+}
+barfunc bar
+
+unset -f foobar
+unset foo bar
+
+# should ref at global scope survive call to foobar()?
+unset ref x
+typeset -n ref
+x=42
+foobar()
+{
+ local xxx=3
+ ref=xxx
+ return 0
+}
+echo ${ref-unset}
+ref=x
+foobar
+ckval ref xxx
+ckval x xxx
+
+# assignment in a function to something possibly out of scope
+assignvar()
+{
+ typeset -n v=$1
+ shift
+ v="$@"
+}
+
+assignvar lex a b c d e
+echo "expect <a b c d e>"
+recho "${lex}"
+
+unset foo bar short long
+
+typeset -n foo='x[2]'
+
+x=(zero one two three four)
+foo=seven
+
+echo "expect <zero> <one> <seven> <three> <four>"
+recho "${x[@]}"
+
+unset ref x
+typeset -n ref
+ref=x
+# make sure nameref to a previously-unset variable creates the variable
+ref=42
+ckval x 42
+
+# make sure they work inside arithmetic expressions
+unset foo bar ref x xxx
+typeset -i ivar
+typeset -n iref=ivar
+
+ivar=4+3
+ckval ivar 7
+iref+=5
+ckval ivar 12
+echo $(( iref+4 ))
+(( iref=17 ))
+ckval ivar 17
+
+typeset +n iref
+unset iref ivar
+
+typeset +n foo bar
+unset foo bar
+
+# should the reference do immediate evaluation or deferred?
+set -- one two three four
+bar=4
+# XXX - what does foo get set to here?
+typeset -n foo='bar[0]'
+echo "expect <4>"
+echo ${bar[0]}
+echo "expect <4>"
+echo ${foo}
+echo "expect <4>"
+echo $foo
+ckval foo $bar
+
+# Need to add code and tests for nameref to array subscripts
+bar=(one two three four)
+
+typeset -n foo='bar[0]'
+typeset -n qux='bar[3]'
+echo "expect <one>"
+echo ${bar[0]}
+echo "expect <one>"
+echo ${foo}
+echo "expect <one>"
+echo $foo
+ckval foo $bar
+
+echo "expect <four>"
+echo $qux
+ckval qux ${bar[3]}
+
+# Need to add code and tests for `for' loop nameref variables
+
+echo errors = $errors
+exit $errors
diff --git a/tests/nameref5.sub b/tests/nameref5.sub
new file mode 100644
index 0000000..2c67a94
--- /dev/null
+++ b/tests/nameref5.sub
@@ -0,0 +1,50 @@
+# nameref variables as for loop index variables are special
+v1=1
+v2=2
+
+# simple for loop
+for v in v1 v2
+do
+ typeset -n ref=$v
+ echo $ref
+done
+unset v
+
+set -- first second third fourth fifth
+
+# unless you put a ${!v} in the for loop, ksh93 misbehaves
+typeset -n v=v1
+for v in v1 v2; do
+ echo "${!v}: $v"
+done
+unset v
+
+# example cribbed from ksh93 o'reilly book
+first="I am first"
+second="I am in the middle"
+third="I am last"
+
+typeset -n ref=first
+for ref in first second third ; do
+ echo "ref -> ${!ref}, value: $ref"
+done
+echo final state: "ref -> ${!ref}, value: $ref"
+
+readonly one=1
+readonly two=2
+readonly three=3
+
+typeset -n ref=one
+for ref in one two three; do
+ echo "ref -> ${!ref}, value: $ref"
+done
+echo final state: "ref -> ${!ref}, value: $ref"
+
+unset ref
+typeset -n ref=one
+readonly ref
+
+for ref in one two three; do
+ echo "ref -> ${!ref}, value: $ref"
+done
+echo final state: "ref -> ${!ref}, value: $ref"
diff --git a/tests/nameref6.sub b/tests/nameref6.sub
new file mode 100644
index 0000000..cf70d41
--- /dev/null
+++ b/tests/nameref6.sub
@@ -0,0 +1,44 @@
+# these should be errors
+typeset -n x=x
+#echo $x -- $?
+
+typeset -n x[3]=x
+#echo $x -- $?
+
+x=(the browns suck)
+y=(one two three)
+# should be an error but not disturb the current contents of x
+# maybe rethink that later
+typeset -n x=y
+echo $x -- $?
+
+typeset -n
+
+unset x y
+
+y=42
+typeset -i x=1
+
+# the integer attribute causes arithmetic eval to be done
+# we should not allow namerefs to non-identifiers
+typeset -n x=y
+echo $x -- $?
+
+typeset +n x
+echo $x -- $?
+
+# same kind of thing
+
+unset -n x
+unset y
+
+set -- first second third
+y=2
+typeset -i x=1
+
+typeset -n x=y
+echo $x -- $?
+echo ${x} -- $?
+
+typeset +n x
+echo $x -- $?
diff --git a/tests/nameref7.sub b/tests/nameref7.sub
new file mode 100644
index 0000000..19bdc98
--- /dev/null
+++ b/tests/nameref7.sub
@@ -0,0 +1,18 @@
+fn ()
+{
+ declare -n var=foo; var=bar
+}
+
+unset foo
+fn
+echo ${foo:-unset}
+
+unset -f fn
+unset foo
+fn()
+{
+ declare -n var; var=foo
+}
+
+fn
+echo ${foo:-unset}
diff --git a/tests/nameref8.sub b/tests/nameref8.sub
new file mode 100644
index 0000000..6837f6f
--- /dev/null
+++ b/tests/nameref8.sub
@@ -0,0 +1,57 @@
+function f1
+{
+ typeset -n v=$1
+
+ v=inside
+}
+
+v=global
+f1 v
+echo $v
+
+unset v
+unset -f f1
+
+function foo
+{
+ typeset x=one
+
+ typeset -n y=$1
+ y=two
+ echo inside: $x
+}
+
+foo x
+echo outside: $x
+
+function foo2
+{
+ typeset -n x=$1
+
+ x=foo
+}
+
+foo2 x
+echo $x
+
+unset -f foo
+function foo { typeset -n v=$1; v=local; }
+
+v=global
+foo v
+echo $v
+
+unset v
+
+# invalid self reference at global scope
+typeset -n v=v
+
+# can we catch a circular self-reference?
+typeset -n v=w
+typeset -n w=x
+typeset -n x=v
+
+x=4
+echo x = $x
+
+unset -n v w x
diff --git a/tests/new-exp.right b/tests/new-exp.right
index ac0058f..3243d05 100644
--- a/tests/new-exp.right
+++ b/tests/new-exp.right
@@ -165,6 +165,9 @@ this is test 2
./new-exp2.sub: line 31: /tmp/bashtmp.x*: No such file or directory
./new-exp2.sub: line 35: /tmp/redir-notthere: No such file or directory
1
+
+./new-exp2.sub: line 42: 1111111111111111111111: command not found
+
argv[1] = <6>
./new-exp.tests: line 277: ${#:}: bad substitution
argv[1] = <'>
@@ -559,6 +562,14 @@ ing999
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
art;string0;string1;string2;string3;string4;string5;string6;string7;string8;string9;string10;string11;string12;string13;string14;string15;string16;string17;string18;string19;string20;string21;string22;string23;string24;string25;string26;string27;string28;string29;string30;string31;string32;string33;string34;string35;string36;string37;string38;string39;string40;string41;string42;string43;string44;string45;string46;string47;string48;string49;string50;string51;string52;string53;string54;string55;string56;string57;string58;string59;string60;string61;string62;string63;string64;string65;string66;string67;string68;string69;string70;string71;string72;string73;string74;string75;string76;string77;string78;string79;string80;string81;string82;string83;string84;string85;string86;string87;string88;string89;string90;string91;string92;string93;string94;string95;string96;string97;string98;string99;string100;string101;string102;string103;string104;string105;string106;string107;string108;string109;string110;string111;string112;string113;string114;string115;string116;string117;string118;string119;string120;string121;string122;string123;string124;string125;string126;string127;string128;string129;string130;string131;string132;string133;string134;string135;string136;string137;string138;string139;string140;string141;string142;string143;string144;string145;string146;string147;string148;string149;string150;string151;string152;string153;string154;string155;string156;string157;string158;string159;string160;string161;string162;string163;string164;string165;string166;string167;string168;string169;string170;string171;string172;string173;string174;string175;string176;string177;string178;string179;string180;string181;string182;string183;string184;string185;string186;string187;string188;string189;string190;string191;string192;string193;string194;string195;string196;string197;string198;string199;string200;string201;string202;string203;string204;string205;string206;string207;string208;string209;string210;string211;string212;string213;string214;string215;string216;string217;string218;string219;string220;string221;string222;string223;string224;string225;string226;string227;string228;string229;string230;string231;string232;string233;string234;string235;string236;string237;string238;string239;string240;string241;string242;string243;string244;string245;string246;string247;string248;string249;string250;string251;string252;string253;string254;string255;string256;string257;string258;string259;string260;string261;string262;string263;string264;string265;string266;string267;string268;string269;string270;string271;string272;string273;string274;string275;string276;string277;string278;string279;string280;string281;string282;string283;string284;string285;string286;string287;string288;string289;string290;string291;string292;string293;string294;string295;string296;string297;string298;string299;string300;string301;string302;string303;string304;string305;string306;string307;string308;string309;string310;string311;string312;string313;string314;string315;string316;string317;string318;string319;string320;string321;string322;string323;string324;string325;string326;string327;string328;string329;string330;string331;string332;string333;string334;string335;string336;string337;string338;string339;string340;string341;string342;string343;string344;string345;string346;string347;string348;string349;string350;string351;string352;string353;string354;string355;string356;string357;string358;string359;string360;string361;string362;string363;string364;string365;string366;string367;string368;string369;string370;string371;string372;string373;string374;string375;string376;string377;string378;string379;string380;string381;string382;string383;string384;string385;string386;string387;string388;string389;string390;string391;string392;string393;string394;string395;string396;string397;string398;string399;string400;string401;string402;string403;string404;string405;string406;string407;string408;string409;string410;string411;string412;string413;string414;string415;string416;string417;string418;string419;string420;string421;string422;string423;string424;string425;string426;string427;string428;string429;string430;string431;string432;string433;string434;string435;string436;string437;string438;string439;string440;string441;string442;string443;string444;string445;string446;string447;string448;string449;string450;string451;string452;string453;string454;string455;string456;string457;string458;string459;string460;string461;string462;string463;string464;string465;string466;string467;string468;string469;string470;string471;string472;string473;string474;string475;string476;string477;string478;string479;string480;string481;string482;string483;string484;string485;string486;string487;string488;string489;string490;string491;string492;string493;string494;string495;string496;string497;string498;string499;string500;string501;string502;string503;string504;string505;string506;string507;string508;string509;string510;string511;string512;string513;string514;string515;string516;string517;string518;string519;string520;string521;string522;string523;string524;string525;string526;string527;string528;string529;string530;string531;string532;string533;string534;string535;string536;string537;string538;string539;string540;string541;string542;string543;string544;string545;string546;string547;string548;string549;string550;string551;string552;string553;string554;string555;string556;string557;string558;string559;string560;string561;string562;string563;string564;string565;string566;string567;string568;string569;string570;string571;string572;string573;string574;string575;string576;string577;string578;string579;string580;string581;string582;string583;string584;string585;string586;string587;string588;string589;string590;string591;string592;string593;string594;string595;string596;string597;string598;string599;string600;string601;string602;string603;string604;string605;string606;string607;string608;string609;string610;string611;string612;string613;string614;string615;string616;string617;string618;string619;string620;string621;string622;string623;string624;string625;string626;string627;string628;string629;string630;string631;string632;string633;string634;string635;string636;string637;string638;string639;string640;string641;string642;string643;string644;string645;string646;string647;string648;string649;string650;string651;string652;string653;string654;string655;string656;string657;string658;string659;string660;string661;string662;string663;string664;string665;string666;string667;string668;string669;string670;string671;string672;string673;string674;string675;string676;string677;string678;string679;string680;string681;string682;string683;string684;string685;string686;string687;string688;string689;string690;string691;string692;string693;string694;string695;string696;string697;string698;string699;string700;string701;string702;string703;string704;string705;string706;string707;string708;string709;string710;string711;string712;string713;string714;string715;string716;string717;string718;string719;string720;string721;string722;string723;string724;string725;string726;string727;string728;string729;string730;string731;string732;string733;string734;string735;string736;string737;string738;string739;string740;string741;string742;string743;string744;string745;string746;string747;string748;string749;string750;string751;string752;string753;string754;string755;string756;string757;string758;string759;string760;string761;string762;string763;string764;string765;string766;string767;string768;string769;string770;string771;string772;string773;string774;string775;string776;string777;string778;string779;string780;string781;string782;string783;string784;string785;string786;string787;string788;string789;string790;string791;string792;string793;string794;string795;string796;string797;string798;string799;string800;string801;string802;string803;string804;string805;string806;string807;string808;string809;string810;string811;string812;string813;string814;string815;string816;string817;string818;string819;string820;string821;string822;string823;string824;string825;string826;string827;string828;string829;string830;string831;string832;string833;string834;string835;string836;string837;string838;string839;string840;string841;string842;string843;string844;string845;string846;string847;string848;string849;string850;string851;string852;string853;string854;string855;string856;string857;string858;string859;string860;string861;string862;string863;string864;string865;string866;string867;string868;string869;string870;string871;string872;string873;string874;string875;string876;string877;string878;string879;string880;string881;string882;string883;string884;string885;string886;string887;string888;string889;string890;string891;string892;string893;string894;string895;string896;string897;string898;string899;string900;string901;string902;string903;string904;string905;string906;string907;string908;string909;string910;string911;string912;string913;string914;string915;string916;string917;string918;string919;string920;string921;string922;string923;string924;string925;string926;string927;string928;string929;string930;string931;string932;string933;string934;string935;string936;string937;string938;string939;string940;string941;string942;string943;string944;string945;string946;string947;string948;string949;string950;string951;string952;string953;string954;string955;string956;string957;string958;string959;string960;string961;string962;string963;string964;string965;string966;string967;string968;string969;string970;string971;string972;string973;string974;string975;string976;string977;string978;string979;string980;string981;string982;string983;string984;string985;string986;string987;string988;string989;string990;string991;string992;string993;string994;string995;string996;string997;string998;string999
start;string0;string1;string2;string3;string4;string5;string6;string7;string8;string9;string10;string11;string12;string13;string14;string15;string16;string17;string18;string19;string20;string21;string22;string23;string24;string25;string26;string27;string28;string29;string30;string31;string32;string33;string34;string35;string36;string37;string38;string39;string40;string41;string42;string43;string44;string45;string46;string47;string48;string49;string50;string51;string52;string53;string54;string55;string56;string57;string58;string59;string60;string61;string62;string63;string64;string65;string66;string67;string68;string69;string70;string71;string72;string73;string74;string75;string76;string77;string78;string79;string80;string81;string82;string83;string84;string85;string86;string87;string88;string89;string90;string91;string92;string93;string94;string95;string96;string97;string98;string99;string100;string101;string102;string103;string104;string105;string106;string107;string108;string109;string110;string111;string112;string113;string114;string115;string116;string117;string118;string119;string120;string121;string122;string123;string124;string125;string126;string127;string128;string129;string130;string131;string132;string133;string134;string135;string136;string137;string138;string139;string140;string141;string142;string143;string144;string145;string146;string147;string148;string149;string150;string151;string152;string153;string154;string155;string156;string157;string158;string159;string160;string161;string162;string163;string164;string165;string166;string167;string168;string169;string170;string171;string172;string173;string174;string175;string176;string177;string178;string179;string180;string181;string182;string183;string184;string185;string186;string187;string188;string189;string190;string191;string192;string193;string194;string195;string196;string197;string198;string199;string200;string201;string202;string203;string204;string205;string206;string207;string208;string209;string210;string211;string212;string213;string214;string215;string216;string217;string218;string219;string220;string221;string222;string223;string224;string225;string226;string227;string228;string229;string230;string231;string232;string233;string234;string235;string236;string237;string238;string239;string240;string241;string242;string243;string244;string245;string246;string247;string248;string249;string250;string251;string252;string253;string254;string255;string256;string257;string258;string259;string260;string261;string262;string263;string264;string265;string266;string267;string268;string269;string270;string271;string272;string273;string274;string275;string276;string277;string278;string279;string280;string281;string282;string283;string284;string285;string286;string287;string288;string289;string290;string291;string292;string293;string294;string295;string296;string297;string298;string299;string300;string301;string302;string303;string304;string305;string306;string307;string308;string309;string310;string311;string312;string313;string314;string315;string316;string317;string318;string319;string320;string321;string322;string323;string324;string325;string326;string327;string328;string329;string330;string331;string332;string333;string334;string335;string336;string337;string338;string339;string340;string341;string342;string343;string344;string345;string346;string347;string348;string349;string350;string351;string352;string353;string354;string355;string356;string357;string358;string359;string360;string361;string362;string363;string364;string365;string366;string367;string368;string369;string370;string371;string372;string373;string374;string375;string376;string377;string378;string379;string380;string381;string382;string383;string384;string385;string386;string387;string388;string389;string390;string391;string392;string393;string394;string395;string396;string397;string398;string399;string400;string401;string402;string403;string404;string405;string406;string407;string408;string409;string410;string411;string412;string413;string414;string415;string416;string417;string418;string419;string420;string421;string422;string423;string424;string425;string426;string427;string428;string429;string430;string431;string432;string433;string434;string435;string436;string437;string438;string439;string440;string441;string442;string443;string444;string445;string446;string447;string448;string449;string450;string451;string452;string453;string454;string455;string456;string457;string458;string459;string460;string461;string462;string463;string464;string465;string466;string467;string468;string469;string470;string471;string472;string473;string474;string475;string476;string477;string478;string479;string480;string481;string482;string483;string484;string485;string486;string487;string488;string489;string490;string491;string492;string493;string494;string495;string496;string497;string498;string499;string500;string501;string502;string503;string504;string505;string506;string507;string508;string509;string510;string511;string512;string513;string514;string515;string516;string517;string518;string519;string520;string521;string522;string523;string524;string525;string526;string527;string528;string529;string530;string531;string532;string533;string534;string535;string536;string537;string538;string539;string540;string541;string542;string543;string544;string545;string546;string547;string548;string549;string550;string551;string552;string553;string554;string555;string556;string557;string558;string559;string560;string561;string562;string563;string564;string565;string566;string567;string568;string569;string570;string571;string572;string573;string574;string575;string576;string577;string578;string579;string580;string581;string582;string583;string584;string585;string586;string587;string588;string589;string590;string591;string592;string593;string594;string595;string596;string597;string598;string599;string600;string601;string602;string603;string604;string605;string606;string607;string608;string609;string610;string611;string612;string613;string614;string615;string616;string617;string618;string619;string620;string621;string622;string623;string624;string625;string626;string627;string628;string629;string630;string631;string632;string633;string634;string635;string636;string637;string638;string639;string640;string641;string642;string643;string644;string645;string646;string647;string648;string649;string650;string651;string652;string653;string654;string655;string656;string657;string658;string659;string660;string661;string662;string663;string664;string665;string666;string667;string668;string669;string670;string671;string672;string673;string674;string675;string676;string677;string678;string679;string680;string681;string682;string683;string684;string685;string686;string687;string688;string689;string690;string691;string692;string693;string694;string695;string696;string697;string698;string699;string700;string701;string702;string703;string704;string705;string706;string707;string708;string709;string710;string711;string712;string713;string714;string715;string716;string717;string718;string719;string720;string721;string722;string723;string724;string725;string726;string727;string728;string729;string730;string731;string732;string733;string734;string735;string736;string737;string738;string739;string740;string741;string742;string743;string744;string745;string746;string747;string748;string749;string750;string751;string752;string753;string754;string755;string756;string757;string758;string759;string760;string761;string762;string763;string764;string765;string766;string767;string768;string769;string770;string771;string772;string773;string774;string775;string776;string777;string778;string779;string780;string781;string782;string783;string784;string785;string786;string787;string788;string789;string790;string791;string792;string793;string794;string795;string796;string797;string798;string799;string800;string801;string802;string803;string804;string805;string806;string807;string808;string809;string810;string811;string812;string813;string814;string815;string816;string817;string818;string819;string820;string821;string822;string823;string824;string825;string826;string827;string828;string829;string830;string831;string832;string833;string834;string835;string836;string837;string838;string839;string840;string841;string842;string843;string844;string845;string846;string847;string848;string849;string850;string851;string852;string853;string854;string855;string856;string857;string858;string859;string860;string861;string862;string863;string864;string865;string866;string867;string868;string869;string870;string871;string872;string873;string874;string875;string876;string877;string878;string879;string880;string881;string882;string883;string884;string885;string886;string887;string888;string889;string890;string891;string892;string893;string894;string895;string896;string897;string898;string899;string900;string901;string902;string903;string904;string905;string906;string907;string908;string909;string910;string911;string912;string913;string914;string915;string916;string917;string918;string919;string920;string921;string922;string923;string924;string925;string926;string927;string928;string929;string930;string931;string932;string933;string934;string935;string936;string937;string938;string939;string940;string941;string942;string943;string944;string945;string946;string947;string948;string949;string950;string951;string952;string953;string954;string955;string956;string957;string958;string959;string960;string961;string962;string963;string964;string965;string966;string967;string968;string969;string970;string971;string972;string973;string974;string975;string976;string977;string978;string979;string980;string981;string982;string983;string984;string985;string986;string987;string988;string989;string990;string991;string992;string993;string994;string995;string996;string997;string998;string9
+a Value = 1 2 3 4 5
+a Sub = 0 1 2 3 4
+b Value = a b c d e
+b Sub = 0 1 2 3 4
+c Value = 10 20 40 80
+c Sub = 0 2 4 8
+<1> <2> <3> <4> <5>
+<10> <20> <40> <80>
argv[1] = </>
argv[1] = </>
-./new-exp.tests: line 580: ABXD: parameter unset
+./new-exp.tests: line 584: ABXD: parameter unset
diff --git a/tests/new-exp.tests b/tests/new-exp.tests
index 2817041..e48ac3d 100644
--- a/tests/new-exp.tests
+++ b/tests/new-exp.tests
@@ -569,6 +569,10 @@ ${THIS_SH} ./new-exp7.sub
${THIS_SH} ./new-exp8.sub
+# tests to check whether things like indirect expansion of a variable whose
+# value is 'anothervar[@]' stop working
+${THIS_SH} ./new-exp9.sub
+
# problems with stray CTLNUL in bash-4.0-alpha
unset a
a=/a
diff --git a/tests/new-exp2.sub b/tests/new-exp2.sub
index 5e922aa..e837779 100644
--- a/tests/new-exp2.sub
+++ b/tests/new-exp2.sub
@@ -34,3 +34,9 @@ set +o posix
# now see what happens when we try it with a non-existant file
LINES3=$(< /tmp/redir-notthere)
echo $?
+
+# These were bugs through bash-4.2
+{ : "$({xxxxxxxxxxxxxxxxxxxx}</dev/stdin)"; } <<<'hi'
+echo ${xxxxxxxxxxxxxxxxxxxx}
+
+{ echo "$(1111111111111111111111</dev/stdin)"; } <<<'hi'
diff --git a/tests/new-exp9.sub b/tests/new-exp9.sub
new file mode 100644
index 0000000..c9d133c
--- /dev/null
+++ b/tests/new-exp9.sub
@@ -0,0 +1,31 @@
+indirarray()
+{
+ local intermediary
+ local sub
+
+ intermediary="${1}[@]"
+ local -a leftValue=("${!intermediary}")
+
+ local -a leftSub
+ eval leftSub=(\"\${!${1}[@]}\")
+
+ echo "$1" Value = ${leftValue[@]}
+ echo "$1" Sub = ${leftSub[@]}
+}
+
+a=(1 2 3 4 5)
+b=(a b c d e)
+
+c=([0]=10 [2]=20 [4]=40 [8]=80)
+
+indirarray a
+indirarray b
+indirarray c
+
+ref=a
+tmp="$ref[@]"
+printf "<%s> " "${!tmp}"; echo # Iterate whole array.
+
+ref=c
+tmp="$ref[@]"
+printf "<%s> " "${!tmp}"; echo # Iterate whole array.
diff --git a/tests/nquote.right b/tests/nquote.right
index 267f0e7..9d1290e 100644
--- a/tests/nquote.right
+++ b/tests/nquote.right
@@ -38,3 +38,21 @@ argv[1] = <'A^IB'>
hello' world
hello world!
hello' world!
+' | '
+' | '
+x | x
+x | x
+' | '
+' | '
+' | '
+' | '
+' | '
+' | '
+x | x
+'
+$'\''
+'
+'abcd'
+$'\'abcd\''
+'
+1
diff --git a/tests/nquote.tests b/tests/nquote.tests
index 720c3e1..aa0a9d8 100644
--- a/tests/nquote.tests
+++ b/tests/nquote.tests
@@ -116,3 +116,4 @@ recho "${mytab:-$'\t'}"
recho "$( args $'A\tB' )"
${THIS_SH} ./nquote1.sub
+${THIS_SH} ./nquote2.sub
diff --git a/tests/nquote2.sub b/tests/nquote2.sub
new file mode 100644
index 0000000..d3325f1
--- /dev/null
+++ b/tests/nquote2.sub
@@ -0,0 +1,29 @@
+t() {
+ printf '%s | %s\n' "$1" "$2"
+ }
+ v="'" # v <- '
+
+ #--
+ t "${v/$'\''/$'\''}" "'"
+ t ${v/$'\''/$'\''} "'"
+ t "${v/$'\''/x}" "x"
+ t ${v/$'\''/x} "x"
+ t "${v/x/$'\''}" "'"
+ t ${v/x/$'\''} "'"
+ t "${v/x/$'\x5c\''}" "'"
+ t ${v/x/$'\x5c\''} "'"
+ t "${v/\'/\'}" "'"
+ t ${v/\'/\'} "'"
+ t ${v/\'/x} "x"
+
+echo "'"
+echo "$'\''"
+
+echo $'\''
+
+echo $'\'abcd\''
+echo "$'\'abcd\''"
+
+v=1
+echo ${v/1/\'}
+echo ${v/\'/2}
diff --git a/tests/posix2.tests b/tests/posix2.tests
index a186e78..d0fb46c 100644
--- a/tests/posix2.tests
+++ b/tests/posix2.tests
@@ -146,7 +146,7 @@ fi
newtest
SQUOTE="'"
val1=$(set | sed -n 's:^SQUOTE=::p')
-if [ "$val1" != "''\\'''" ]; then
+if [ "$val1" != "\'" ]; then
testfail "variable quoting 1"
fi
diff --git a/tests/printf.right b/tests/printf.right
index 065d2f7..ae34a89 100644
--- a/tests/printf.right
+++ b/tests/printf.right
Binary files differ
diff --git a/tests/printf.tests b/tests/printf.tests
index 9644cc2..e72f5c8 100644
--- a/tests/printf.tests
+++ b/tests/printf.tests
@@ -314,3 +314,6 @@ ${THIS_SH} ./printf1.sub
${THIS_SH} ./printf2.sub
${THIS_SH} ./printf3.sub
+
+${THIS_SH} ./printf4.sub
+
diff --git a/tests/printf2.sub b/tests/printf2.sub
index 4cff30d..45c48d4 100644
--- a/tests/printf2.sub
+++ b/tests/printf2.sub
@@ -1,3 +1,4 @@
+unset LC_ALL LC_CTYPE
export LANG=en_US.UTF-8
case $(printf %d\\n \'À) in
diff --git a/tests/printf3.sub b/tests/printf3.sub
index 85a2705..ec14fa3 100644
--- a/tests/printf3.sub
+++ b/tests/printf3.sub
@@ -5,12 +5,17 @@ SHELLSTART=$(date +%s)
SECS=1275250155
export TZ=EST5EDT
+case $SHELLSTART in
+*s*) SHELLSTART=$(perl -e 'print time') ; DATESECS=false ;; # take a shot
+*) DATESECS=true ;;
+esac
+
printf "%()T\n" $SECS
printf "%(abde)Z\n" -1
printf "%(%e-%b-%Y %T)T\n" $SECS
-printf -v v1 "%(%e-%b-%Y %T)T\n" $(date +%s)
+printf -v v1 "%(%e-%b-%Y %T)T\n" $( $DATESECS && date +%s || perl -e 'print time')
printf -v v2 "%(%e-%b-%Y %T)T\n" -1
case $v1 in
@@ -51,3 +56,7 @@ printf "%-40.50(%a %b %e %H:%M:%S %Z %Y)T date-style time\n" $SECS
# test fieldwidth, justification, precision, embedded parens
printf "%-40.50(%x (foo) %X)T date-style time\n" $SECS
+
+# problem introduced in bash-4.2 patch 5
+unset TZ
+printf '%(%Y-%m-%d %H:%M:%S %Z)T\n' >/dev/null
diff --git a/tests/printf4.sub b/tests/printf4.sub
new file mode 100644
index 0000000..2ffd997
--- /dev/null
+++ b/tests/printf4.sub
@@ -0,0 +1,69 @@
+# Problems with padding, field widths, and `+' through bash-4.2
+
+printf "x%10.0fx\n" 123
+printf -v foo "x%10.0fx" 123
+echo "$foo"
+
+printf "x%10.0fx\n" 123
+printf -v foo "x%10.0fx" 123
+echo "$foo"
+
+printf "x%10.fx\n" 123
+printf -v foo "x%10.fx" 123
+echo "$foo"
+
+printf "x%10.2fx\n" 123
+printf -v foo "x%10.2fx" 123
+echo "$foo"
+
+printf "x%10.02fx\n" 123
+printf -v foo "x%10.02fx" 123
+echo "$foo"
+
+printf "x%-010.0fx\n" 123
+printf -v foo "x%-010.0fx" 123
+echo "$foo"
+
+printf "x%+010.0ex\n" 123
+printf -v foo "x%+010.0ex" 123
+echo "$foo"
+
+printf "x%+010.0fx\n" 123
+printf -v foo "x%+010.0fx" 123
+echo "$foo"
+
+printf "x%+010.0gx\n" 123
+printf -v foo "x%+010.0gx" 123
+echo "$foo"
+
+printf "x%+010.0dx\n" 123
+printf -v foo "x%+010.0dx" 123
+echo "$foo"
+
+printf "x%+010.0ldx\n" 123
+printf -v foo "x%+010.0ldx" 123
+echo "$foo"
+
+printf "x%+010.0xx\n" 123
+printf -v foo "x%+010.0xx" 123
+echo "$foo"
+
+printf "x%-+10.0fx\n" 123
+printf -v foo "x%-+10.0fx" 123
+echo "$foo"
+
+printf "x%-+10.0dx\n" 123
+printf -v foo "x%-+10.0dx" 123
+echo "$foo"
+
+printf "%f\n" -123
+printf -v foo "%f" -123
+echo "$foo"
+
+printf "x%+10.0fx\n" 123
+printf -v foo "x%+10.0fx" 123
+echo "$foo"
+
+printf "x%+10.0dx\n" 123
+printf -v foo "x%+10.0dx" 123
+echo "$foo"
diff --git a/tests/quote.right b/tests/quote.right
index 424d1a0..00b55c6 100644
--- a/tests/quote.right
+++ b/tests/quote.right
@@ -66,3 +66,17 @@ argv[2] = <ab>
${
argv[1] = <(")>
argv[1] = <(")>
+'weferfds'\''dsfsdf'
+'weferfdsdsfsdf'
+'weferfds'\''dsfsdf'
+'weferfds'\\dsfsdf'
+testdd ddtest
+testdd '\''ddtest
+testdddding
+testdddding
+test'ing
+test'ing
+test'string
+a'b'c
+foo b c baz
+foo 'bar baz
diff --git a/tests/quote.tests b/tests/quote.tests
index 46edea7..0c55293 100644
--- a/tests/quote.tests
+++ b/tests/quote.tests
@@ -109,3 +109,4 @@ recho `echo "(\\")"`
# ultimate workaround
recho `echo "(\")"`
+${THIS_SH} ./quote1.sub
diff --git a/tests/quote1.sub b/tests/quote1.sub
new file mode 100644
index 0000000..c83e64a
--- /dev/null
+++ b/tests/quote1.sub
@@ -0,0 +1,49 @@
+# inconsistency with quoted pattern substitution patterns through bash-4.2
+# fixed in a ksh93-compatible (and Posix-compatible, in general) way
+# NOT backwards compatible
+
+test="weferfds'dsfsdf"
+
+# why does this work, this list was born of frustration, I tried
+# everything I could think of.
+echo \'${test//"'"/\'\\\'\'}\'" "
+
+#but none of the following
+
+echo "'${test//"'"/}'"
+
+echo "'${test//"'"/"'\\''"}'"
+
+echo "'${test//"'"/\'\\'\'}'"
+
+#echo "'${test//'/}'" # hangs waiting for '
+#echo "'${test//"'"/'\\''}'" # hangs waiting for '
+
+unset test
+test=teststrtest
+echo "${test//str/"dd dd"}"
+echo ${test//str/"dd '\''dd"}
+
+unset test
+test=teststring
+
+echo "${test//str/"dddd"}"
+
+echo ${test//str/"dddd"}
+
+echo ${test//str/"'"}
+
+echo "${test//str/"'"}"
+
+#echo "${test//str/'}" # hangs
+
+test=test\'string
+echo "${test//"'"/"'"}"
+
+x="a'b'c"; echo "${x//\'/\'}"
+
+printf '%s\n' "foo ${IFS+"b c"} baz"
+
+# this is where the default behavior differs from posix
+set -o posix
+echo "foo ${IFS+'bar} baz"
diff --git a/tests/read.right b/tests/read.right
index d9632a8..73cb704 100644
--- a/tests/read.right
+++ b/tests/read.right
@@ -44,6 +44,7 @@ abcde
./read3.sub: line 4: read: -1: invalid number
abc
ab
+abc
#
while read -u 3 var
do
diff --git a/tests/read3.sub b/tests/read3.sub
index 22088cb..af41e3f 100644
--- a/tests/read3.sub
+++ b/tests/read3.sub
@@ -15,5 +15,10 @@ echo ab | {
echo $xyz
}
+echo abc | {
+ read -N 4 -d$'\n' foo
+ echo $foo
+}
+
read -n 1 < $0
echo "$REPLY"
diff --git a/tests/redir.right b/tests/redir.right
index f816c63..f461e65 100644
--- a/tests/redir.right
+++ b/tests/redir.right
@@ -130,7 +130,7 @@ to stdout
logfunc is a function
logfunc ()
{
- echo "$@" &>>$TMPDIR/log
+ echo "$@" &>> $TMPDIR/log
}
foo
bix is a function
@@ -139,3 +139,4 @@ bix ()
echo foo 2>&1 | cat
}
foo
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
diff --git a/tests/redir.tests b/tests/redir.tests
index 37759b5..c2e4866 100644
--- a/tests/redir.tests
+++ b/tests/redir.tests
@@ -187,3 +187,5 @@ exec 2>&9
exec 9>&-
${THIS_SH} ./redir9.sub
+
+${THIS_SH} ./redir10.sub
diff --git a/tests/redir10.sub b/tests/redir10.sub
new file mode 100644
index 0000000..27c48e8
--- /dev/null
+++ b/tests/redir10.sub
@@ -0,0 +1,25 @@
+#!/bin/bash
+#
+# Out of file descriptors, because it forgets to close redirection. Only
+# happens in a shell function. Problem through bash-4.2.
+
+ulimit -n 128
+
+bug()
+{
+c=`ulimit -n`
+let c+=100
+while let c--
+do
+ while read -ru3 x
+ do
+ echo -n :
+ done 3< <(echo x)
+
+done
+}
+
+bug
+echo
+
+exit 0
diff --git a/tests/rhs-exp.right b/tests/rhs-exp.right
index c5dca42..4ce6743 100644
--- a/tests/rhs-exp.right
+++ b/tests/rhs-exp.right
@@ -72,3 +72,34 @@ a?b
ab
a/b
ab
+argv[1] = <bc>
+argv[1] = <bc>
+argv[1] = <ab>
+argv[1] = <ab>
+argv[1] = <bc>
+argv[1] = <bc>
+argv[1] = <c>
+argv[1] = <ab>
+argv[1] = <ab>
+argv[1] = <aacc>
+argv[1] = <aacc>
+argv[1] = <aabbcc>
+argv[1] = <aabbcc>
+argv[1] = <Oenophile>
+argv[1] = <OEnOphIlE>
+argv[1] = <>
+argv[1] = <abc>
+argv[1] = <''>
+argv[1] = <>
+good 1
+good 2
+good 3
+good 4
+good 5
+ok 1
+ok 2
+ok 3
+ok 4
+ok 5
+ok 6
+ok 7
diff --git a/tests/rhs-exp.tests b/tests/rhs-exp.tests
index d457198..a28d7f0 100644
--- a/tests/rhs-exp.tests
+++ b/tests/rhs-exp.tests
@@ -47,3 +47,5 @@ var="a?b" ; echo "${var//\?/}"
var="a/b" ; echo "${var//\\//}"
var="a/b" ; echo "${var//\//}"
+
+${THIS_SH} ./rhs-exp1.sub
diff --git a/tests/rhs-exp1.sub b/tests/rhs-exp1.sub
new file mode 100644
index 0000000..5631ea5
--- /dev/null
+++ b/tests/rhs-exp1.sub
@@ -0,0 +1,103 @@
+# fixes for bugs in bash-4.2 regarding empty strings in expand_string_for_rhs
+
+f=abc
+recho ${f##""a}
+recho ${f##"$v"a}
+
+recho ${f%%""c}
+recho ${f%%"$v"c}
+
+recho ${f//""a}
+recho ${f//"$v"a}
+
+recho ${f/""a""b/}
+recho ${f/""c/}
+recho ${f/"$v"c/}
+
+unset foo empty
+foo=aabbcc
+
+recho ${foo/bb/}
+recho ${foo/bb/$empty}
+
+recho ${foo/}
+recho ${empty/}
+
+recho ${foo/ }
+recho ${empty/ }
+unset foo empty
+
+S2=oenophile
+
+recho ${S2^"$v"[aeiou]}
+recho ${S2^^"$v"[aeiou]}
+
+recho ${foo:-""}
+recho ${foo:-""abc}
+
+recho "${foo:-''}"
+recho "${foo:-}"
+
+if [[ $var == "" ]]; then
+ echo good 1
+fi
+
+if [[ "$var"X == ""X ]]; then
+ echo good 2
+fi
+
+if [ "$var"X == ""X"" ]; then
+ echo good 3
+fi
+
+if [ X"" == X ]; then
+ echo good 4
+fi
+
+if [[ X"" == X ]]; then
+ echo good 5
+fi
+
+case x"" in
+ x) echo 'ok 1'
+ ;;
+ x??) echo 'this would be really odd'
+ ;;
+ x?) echo 'does this prove anything?'
+ echo x""x
+ ;;
+ *) echo 'no match'
+ ;;
+esac
+
+if [[ x"" == x ]]; then
+ echo ok 2
+fi
+
+if [[ x"" == x"" ]]; then
+ echo ok 3
+else
+ echo bad 3
+fi
+
+case x"" in
+x"") echo ok 4 ;;
+*) echo bad 4;;
+esac
+
+if [[ x"" == x"" ]]; then
+ echo ok 5
+else
+ echo bad 5
+fi
+
+case x"" in
+"x") echo ok 6 ;;
+*) echo bad 6;;
+esac
+
+case x"" in
+"x") echo CTLNUL 7 ;;
+x) echo ok 7 ;;
+*) echo bad 7 ;;
+esac
diff --git a/tests/run-heredoc b/tests/run-heredoc
index c4e3168..456453a 100644
--- a/tests/run-heredoc
+++ b/tests/run-heredoc
@@ -1,2 +1,6 @@
+echo "warning: UNIX versions number signals and schedule processes differently." >&2
+echo "warning: If output differing only in line numbers is produced, please" >&2
+echo "warning: do not consider this a test failure." >&2
+
${THIS_SH} ./heredoc.tests > /tmp/xx 2>&1
diff /tmp/xx heredoc.right && rm -f /tmp/xx
diff --git a/tests/run-nameref b/tests/run-nameref
new file mode 100644
index 0000000..40f00d5
--- /dev/null
+++ b/tests/run-nameref
@@ -0,0 +1,4 @@
+echo "warning: some of these tests will fail if arrays have not" >&2
+echo "warning: been compiled into the shell" >&2
+${THIS_SH} ./nameref.tests > /tmp/xx 2>&1
+diff /tmp/xx nameref.right && rm -f /tmp/xx
diff --git a/tests/run-printf b/tests/run-printf
index 4555c62..7b152a1 100644
--- a/tests/run-printf
+++ b/tests/run-printf
@@ -1,5 +1,7 @@
# See whether or not we can use `diff -a'
-( diff -a ./printf.tests ./printf.tests >/dev/null 2>&1 ) && AFLAG=-a
+#( diff -a ./printf.tests ./printf.tests >/dev/null 2>&1 ) && AFLAG=-a
-${THIS_SH} ./printf.tests > /tmp/xx 2>&1
-diff $AFLAG /tmp/xx printf.right && rm -f /tmp/xx
+# use cat -v (and assume it's there) to make control chars visible
+${THIS_SH} ./printf.tests 2>&1 | cat -v > /tmp/xx
+#diff $AFLAG /tmp/xx printf.right && rm -f /tmp/xx
+diff /tmp/xx printf.right && rm -f /tmp/xx
diff --git a/tests/set-e.right b/tests/set-e.right
index 85a5986..e2a9f2c 100644
--- a/tests/set-e.right
+++ b/tests/set-e.right
@@ -65,3 +65,8 @@ after failure 3
true || false no exit
false || true no exit
false && false no exit
+A:
+B:
+ehB
+C:
+D:
diff --git a/tests/set-e.tests b/tests/set-e.tests
index 8c0cfcf..d38edf6 100644
--- a/tests/set-e.tests
+++ b/tests/set-e.tests
@@ -108,3 +108,4 @@ set +e
${THIS_SH} ./set-e1.sub
${THIS_SH} ./set-e2.sub
+${THIS_SH} ./set-e3.sub
diff --git a/tests/set-e3.sub b/tests/set-e3.sub
new file mode 100644
index 0000000..db176b1
--- /dev/null
+++ b/tests/set-e3.sub
@@ -0,0 +1,10 @@
+foo()
+{
+ echo A:
+ . ./set-e3a.sub
+ echo D:
+}
+
+# should run all the way through; foo being called in a context where set -e
+# is ignored means that that condition persists through sourcing the file
+foo && true
diff --git a/tests/set-e3a.sub b/tests/set-e3a.sub
new file mode 100644
index 0000000..5d008e7
--- /dev/null
+++ b/tests/set-e3a.sub
@@ -0,0 +1,7 @@
+echo B:
+
+set -e
+echo $-
+false
+
+echo C:
diff --git a/tests/shopt.right b/tests/shopt.right
index 0d3c08c..0a7edfb 100644
--- a/tests/shopt.right
+++ b/tests/shopt.right
@@ -12,6 +12,8 @@ shopt -u compat31
shopt -u compat32
shopt -u compat40
shopt -u compat41
+shopt -u compat42
+shopt -s complete_fullquote
shopt -u direxpand
shopt -u dirspell
shopt -u dotglob
@@ -23,6 +25,7 @@ shopt -s extquote
shopt -u failglob
shopt -s force_fignore
shopt -u globstar
+shopt -u globasciiranges
shopt -u gnu_errfmt
shopt -u histappend
shopt -u histreedit
@@ -51,6 +54,7 @@ shopt -s sourcepath
--
shopt -s cdspell
shopt -s cmdhist
+shopt -s complete_fullquote
shopt -s expand_aliases
shopt -s extquote
shopt -s force_fignore
@@ -69,6 +73,7 @@ shopt -u compat31
shopt -u compat32
shopt -u compat40
shopt -u compat41
+shopt -u compat42
shopt -u direxpand
shopt -u dirspell
shopt -u dotglob
@@ -77,6 +82,7 @@ shopt -u extdebug
shopt -u extglob
shopt -u failglob
shopt -u globstar
+shopt -u globasciiranges
shopt -u gnu_errfmt
shopt -u histappend
shopt -u histreedit
@@ -103,6 +109,7 @@ compat31 off
compat32 off
compat40 off
compat41 off
+compat42 off
direxpand off
dirspell off
dotglob off
@@ -111,6 +118,7 @@ extdebug off
extglob off
failglob off
globstar off
+globasciiranges off
gnu_errfmt off
histappend off
histreedit off
diff --git a/tests/source7.sub b/tests/source7.sub
new file mode 100644
index 0000000..8ca0aef
--- /dev/null
+++ b/tests/source7.sub
@@ -0,0 +1,40 @@
+shopt -s expand_aliases
+
+: ${TMPDIR:=/var/tmp}
+
+echo '((echo abc; echo def;); echo ghi)' > $TMPDIR/x28-$$
+. $TMPDIR/x28-$$
+rm -f $TMPDIR/x28-$$
+
+echo after
+
+TMPFILE=$TMPDIR/x29-$$
+
+echo "#! ${THIS_SH}" >$TMPFILE
+cat >> $TMPFILE << \EOF
+
+(echo -n "$1 "; echo subshell)
+EOF
+chmod 755 $TMPFILE
+
+alias foo1='$TMPFILE one.1; source $TMPFILE two.1; source $TMPFILE three.1; $TMPFILE four.1'
+alias foo2='$TMPFILE one.2;
+source $TMPFILE two.2;
+source $TMPFILE three.2;
+$TMPFILE four.2;
+'
+
+foo1
+foo2
+
+echo x29 - done
+rm -f $TMPFILE
+
+# this is also treated similarly to an alias expansion internally
+((echo abc; echo def;); echo ghi)
+
+if (((4+4) + (4 + 7))); then
+ echo ok
+fi
+
+(()) # make sure the null expression works OK
diff --git a/tests/tilde.right b/tests/tilde.right
index fe58ae3..49549b4 100644
--- a/tests/tilde.right
+++ b/tests/tilde.right
@@ -19,6 +19,7 @@ abcd:~chet
/bin:/usr/bin:.:/usr/xyz/bin
/bin:/usr/bin:.:~/bin
/bin:/usr/bin:.:~/bin
+\~
ok 1
ok 2
ok 3
diff --git a/tests/tilde.tests b/tests/tilde.tests
index 8b2bdb8..50f19e9 100644
--- a/tests/tilde.tests
+++ b/tests/tilde.tests
@@ -48,6 +48,8 @@ echo "$PPATH"
declare -x PPATH="$XPATH:~/bin"
echo "$PPATH"
+printf "%q\n" '~'
+
# more tests of tilde expansion when executing case commands
case ~ in
$HOME) echo ok 1;;
diff --git a/tests/trap.right b/tests/trap.right
index d1879a4..b361564 100644
--- a/tests/trap.right
+++ b/tests/trap.right
@@ -75,6 +75,24 @@ command substitution
trap: 8
+[9] echo 4
4
+exit subshell 1
+current shell
+exit subshell 2
+current shell
+current shell
+current shell
+outside 1
+outside 2
+outside 3
+outside 4
+sleep 2
+wait $!
+exit
+in trap EXIT
+sleep 2
+wait $!
+exit
+in trap EXIT
caught a child death
caught a child death
caught a child death
diff --git a/tests/trap.tests b/tests/trap.tests
index e9e10cc..5d8b06c 100644
--- a/tests/trap.tests
+++ b/tests/trap.tests
@@ -68,6 +68,11 @@ trap '' USR2
${THIS_SH} ./trap3.sub
+${THIS_SH} ./trap4.sub
+
+# This doesn't work right on all Unix versions
+#${THIS_SH} ./trap5.sub
+
#
# show that setting a trap on SIGCHLD is not disastrous.
#
diff --git a/tests/trap4.sub b/tests/trap4.sub
new file mode 100644
index 0000000..ab5ca3e
--- /dev/null
+++ b/tests/trap4.sub
@@ -0,0 +1,42 @@
+# make sure subshells at the end of pipelines run any exit traps they set
+
+: | { trap 'echo exit subshell 1' EXIT; exit; }; echo current shell
+
+: | { trap 'echo exit subshell 2' EXIT; exit; }; echo current shell
+
+: | { trap 'echo exit subshell 3' EXIT; exit; } | : ; echo current shell
+
+: | { trap 'echo exit subshell 4' EXIT; exit; } | : ; echo current shell
+
+trap 'echo inherited exit trap' EXIT
+: | { exit; } ; echo outside 1
+: | ( exit; ) ; echo outside 2
+: | { exit; } | : ; echo outside 3
+: | ( exit; ) | : ; echo outside 4
+
+trap - EXIT
+
+# make sure group commands that are not at the beginning or end of pipelines
+# run an EXIT trap, with and without the exit builtin
+echo ignored |
+{
+ trap 'echo "in trap EXIT">&2' EXIT
+ sleep 4 &
+ echo 'sleep 2'>&2
+ sleep 2
+ echo 'wait $!'>&2
+ wait $!
+ echo 'exit'>&2
+ exit
+} | cat
+
+echo ignored |
+{
+ trap 'echo "in trap EXIT">&2' EXIT
+ sleep 4 &
+ echo 'sleep 2'>&2
+ sleep 2
+ echo 'wait $!'>&2
+ wait $!
+ echo 'exit'>&2
+} | cat
diff --git a/tests/trap5.sub b/tests/trap5.sub
new file mode 100644
index 0000000..7f3380b
--- /dev/null
+++ b/tests/trap5.sub
@@ -0,0 +1,18 @@
+# make sure process substitution runs the exit trap
+[[ -n $(< <(trap "cat /dev/fd/0" EXIT)) ]] <<<works && echo works || echo "fail :("
+
+read foo < <(trap "echo bar" EXIT)
+echo $foo
+
+cat <(trap "echo bar" EXIT)
+
+trap "echo bar" EXIT #should proc subst inherit this?
+cat <(echo foo ; exit 0;)
+
+trap - 0
+trap
+
+cat <(echo foo; trap "echo bar" EXIT)
+
+trap "echo bar" EXIT #should proc subst inherit this?
+cat <(echo foo)
diff --git a/tests/type.right b/tests/type.right
index 6dbce64..3f7d26e 100644
--- a/tests/type.right
+++ b/tests/type.right
@@ -96,3 +96,40 @@ EOF
a:file
b:file
c:file
+bb is a function
+bb ()
+{
+ ( cat <<EOF
+foo
+bar
+EOF
+ )
+ echo after subshell
+}
+mkcoprocs is a function
+mkcoprocs ()
+{
+ coproc a {
+ cat <<EOF1
+producer 1
+EOF1
+
+ }
+ coproc b {
+ cat <<EOF2
+producer 2
+EOF2
+
+ }
+ echo "coprocs created"
+}
+mkcoprocs is a function
+mkcoprocs ()
+{
+ coproc COPROC ( b cat <<EOF
+heredoc
+body
+EOF
+ )
+ echo "coprocs created"
+}
diff --git a/tests/type.tests b/tests/type.tests
index 2df4efd..1c03e01 100644
--- a/tests/type.tests
+++ b/tests/type.tests
@@ -93,3 +93,5 @@ ${THIS_SH} type1.sub
${THIS_SH} type2.sub
${THIS_SH} type3.sub
+
+${THIS_SH} type4.sub
diff --git a/tests/type4.sub b/tests/type4.sub
new file mode 100644
index 0000000..ed5bcf6
--- /dev/null
+++ b/tests/type4.sub
@@ -0,0 +1,43 @@
+bb()
+{
+ (
+ cat << EOF
+foo
+bar
+EOF
+ )
+ echo after subshell
+}
+
+type bb
+
+
+mkcoprocs()
+{
+ coproc a { cat <<EOF1
+producer 1
+EOF1
+}
+coproc b { cat << EOF2
+producer 2
+EOF2
+}
+
+echo "coprocs created"
+}
+
+type mkcoprocs
+
+unset -f mkcoprocs
+
+mkcoprocs()
+{
+ coproc ( b cat << EOF
+heredoc
+body
+EOF
+ )
+echo "coprocs created"
+}
+
+type mkcoprocs
diff --git a/tests/unicode1.sub b/tests/unicode1.sub
new file mode 100644
index 0000000..baa92ea
--- /dev/null
+++ b/tests/unicode1.sub
@@ -0,0 +1,583 @@
+unset LC_ALL
+
+ErrorCnt=0
+TestCnt=0
+
+ function check_valid_var_name {
+ case "${1:?Missing Variable Name}" in
+ [!a-zA-Z_]* | *[!a-zA-Z_0-9]* ) return 3;;
+ esac
+ }
+ # get_array_element VariableName ArrayName ArrayElement
+ function get_array_element {
+ check_valid_var_name "${1:?Missing Variable Name}" || return $?
+ check_valid_var_name "${2:?Missing Array Name}" || return $?
+ eval "${1}"'="${'"${2}"'["${3:?Missing Array Index}"]}"'
+ }
+ # unset_array_element VarName ArrayName
+ function get_array_element_cnt {
+ check_valid_var_name "${1:?Missing Variable Name}" || return $?
+ check_valid_var_name "${2:?Missing Array Name}" || return $?
+ eval "${1}"'="${#'"${2}"'[@]}"'
+ }
+
+
+function TestCodePage {
+ local TargetCharset="${1:?Missing Test charset}"
+ local EChar RChar TCnt
+ get_array_element_cnt TCnt "${2:?Missing Array Name}"
+ for (( x=1 ; x<${TCnt} ; x++ )); do
+ get_array_element EChar "${2}" ${x}
+ if [ -n "${EChar}" ]; then
+ let TestCnt+=1
+ printf -v UVal '\\U%08x' "${x}"
+ LC_CTYPE=${TargetCharset} printf -v RChar "${UVal}" 2>/dev/null
+ if [ "${EChar}" != "${RChar}" ]; then
+ let ErrorCnt+=1
+ printf "${TargetCharset}: Error Encoding U+%08X to ${TL} [ \"%q\" != \"%q\" ]\n" "${x}" "${EChar}" "${RChar}"
+ fi
+ fi
+ done
+}
+
+
+#for ((x=1;x<255;x++)); do printf ' [0x%04x]=$'\''\%03o'\' $x $x ; [ $(($x%5)) = 0 ] && echo; done
+fr_FR_ISO_8859_1=(
+ [0x0001]=$'\001' [0x0002]=$'\002' [0x0003]=$'\003' [0x0004]=$'\004' [0x0005]=$'\005'
+ [0x0006]=$'\006' [0x0007]=$'\007' [0x0008]=$'\010' [0x0009]=$'\011' [0x000a]=$'\012'
+ [0x000b]=$'\013' [0x000c]=$'\014' [0x000d]=$'\015' [0x000e]=$'\016' [0x000f]=$'\017'
+ [0x0010]=$'\020' [0x0011]=$'\021' [0x0012]=$'\022' [0x0013]=$'\023' [0x0014]=$'\024'
+ [0x0015]=$'\025' [0x0016]=$'\026' [0x0017]=$'\027' [0x0018]=$'\030' [0x0019]=$'\031'
+ [0x001a]=$'\032' [0x001b]=$'\033' [0x001c]=$'\034' [0x001d]=$'\035' [0x001e]=$'\036'
+ [0x001f]=$'\037' [0x0020]=$'\040' [0x0021]=$'\041' [0x0022]=$'\042' [0x0023]=$'\043'
+ [0x0024]=$'\044' [0x0025]=$'\045' [0x0026]=$'\046' [0x0027]=$'\047' [0x0028]=$'\050'
+ [0x0029]=$'\051' [0x002a]=$'\052' [0x002b]=$'\053' [0x002c]=$'\054' [0x002d]=$'\055'
+ [0x002e]=$'\056' [0x002f]=$'\057' [0x0030]=$'\060' [0x0031]=$'\061' [0x0032]=$'\062'
+ [0x0033]=$'\063' [0x0034]=$'\064' [0x0035]=$'\065' [0x0036]=$'\066' [0x0037]=$'\067'
+ [0x0038]=$'\070' [0x0039]=$'\071' [0x003a]=$'\072' [0x003b]=$'\073' [0x003c]=$'\074'
+ [0x003d]=$'\075' [0x003e]=$'\076' [0x003f]=$'\077' [0x0040]=$'\100' [0x0041]=$'\101'
+ [0x0042]=$'\102' [0x0043]=$'\103' [0x0044]=$'\104' [0x0045]=$'\105' [0x0046]=$'\106'
+ [0x0047]=$'\107' [0x0048]=$'\110' [0x0049]=$'\111' [0x004a]=$'\112' [0x004b]=$'\113'
+ [0x004c]=$'\114' [0x004d]=$'\115' [0x004e]=$'\116' [0x004f]=$'\117' [0x0050]=$'\120'
+ [0x0051]=$'\121' [0x0052]=$'\122' [0x0053]=$'\123' [0x0054]=$'\124' [0x0055]=$'\125'
+ [0x0056]=$'\126' [0x0057]=$'\127' [0x0058]=$'\130' [0x0059]=$'\131' [0x005a]=$'\132'
+ [0x005b]=$'\133' [0x005c]=$'\134' [0x005d]=$'\135' [0x005e]=$'\136' [0x005f]=$'\137'
+ [0x0060]=$'\140' [0x0061]=$'\141' [0x0062]=$'\142' [0x0063]=$'\143' [0x0064]=$'\144'
+ [0x0065]=$'\145' [0x0066]=$'\146' [0x0067]=$'\147' [0x0068]=$'\150' [0x0069]=$'\151'
+ [0x006a]=$'\152' [0x006b]=$'\153' [0x006c]=$'\154' [0x006d]=$'\155' [0x006e]=$'\156'
+ [0x006f]=$'\157' [0x0070]=$'\160' [0x0071]=$'\161' [0x0072]=$'\162' [0x0073]=$'\163'
+ [0x0074]=$'\164' [0x0075]=$'\165' [0x0076]=$'\166' [0x0077]=$'\167' [0x0078]=$'\170'
+ [0x0079]=$'\171' [0x007a]=$'\172' [0x007b]=$'\173' [0x007c]=$'\174' [0x007d]=$'\175'
+ [0x007e]=$'\176' [0x007f]=$'\177' [0x0080]=$'\200' [0x0081]=$'\201' [0x0082]=$'\202'
+ [0x0083]=$'\203' [0x0084]=$'\204' [0x0085]=$'\205' [0x0086]=$'\206' [0x0087]=$'\207'
+ [0x0088]=$'\210' [0x0089]=$'\211' [0x008a]=$'\212' [0x008b]=$'\213' [0x008c]=$'\214'
+ [0x008d]=$'\215' [0x008e]=$'\216' [0x008f]=$'\217' [0x0090]=$'\220' [0x0091]=$'\221'
+ [0x0092]=$'\222' [0x0093]=$'\223' [0x0094]=$'\224' [0x0095]=$'\225' [0x0096]=$'\226'
+ [0x0097]=$'\227' [0x0098]=$'\230' [0x0099]=$'\231' [0x009a]=$'\232' [0x009b]=$'\233'
+ [0x009c]=$'\234' [0x009d]=$'\235' [0x009e]=$'\236' [0x009f]=$'\237' [0x00a0]=$'\240'
+ [0x00a1]=$'\241' [0x00a2]=$'\242' [0x00a3]=$'\243' [0x00a4]=$'\244' [0x00a5]=$'\245'
+ [0x00a6]=$'\246' [0x00a7]=$'\247' [0x00a8]=$'\250' [0x00a9]=$'\251' [0x00aa]=$'\252'
+ [0x00ab]=$'\253' [0x00ac]=$'\254' [0x00ad]=$'\255' [0x00ae]=$'\256' [0x00af]=$'\257'
+ [0x00b0]=$'\260' [0x00b1]=$'\261' [0x00b2]=$'\262' [0x00b3]=$'\263' [0x00b4]=$'\264'
+ [0x00b5]=$'\265' [0x00b6]=$'\266' [0x00b7]=$'\267' [0x00b8]=$'\270' [0x00b9]=$'\271'
+ [0x00ba]=$'\272' [0x00bb]=$'\273' [0x00bc]=$'\274' [0x00bd]=$'\275' [0x00be]=$'\276'
+ [0x00bf]=$'\277' [0x00c0]=$'\300' [0x00c1]=$'\301' [0x00c2]=$'\302' [0x00c3]=$'\303'
+ [0x00c4]=$'\304' [0x00c5]=$'\305' [0x00c6]=$'\306' [0x00c7]=$'\307' [0x00c8]=$'\310'
+ [0x00c9]=$'\311' [0x00ca]=$'\312' [0x00cb]=$'\313' [0x00cc]=$'\314' [0x00cd]=$'\315'
+ [0x00ce]=$'\316' [0x00cf]=$'\317' [0x00d0]=$'\320' [0x00d1]=$'\321' [0x00d2]=$'\322'
+ [0x00d3]=$'\323' [0x00d4]=$'\324' [0x00d5]=$'\325' [0x00d6]=$'\326' [0x00d7]=$'\327'
+ [0x00d8]=$'\330' [0x00d9]=$'\331' [0x00da]=$'\332' [0x00db]=$'\333' [0x00dc]=$'\334'
+ [0x00dd]=$'\335' [0x00de]=$'\336' [0x00df]=$'\337' [0x00e0]=$'\340' [0x00e1]=$'\341'
+ [0x00e2]=$'\342' [0x00e3]=$'\343' [0x00e4]=$'\344' [0x00e5]=$'\345' [0x00e6]=$'\346'
+ [0x00e7]=$'\347' [0x00e8]=$'\350' [0x00e9]=$'\351' [0x00ea]=$'\352' [0x00eb]=$'\353'
+ [0x00ec]=$'\354' [0x00ed]=$'\355' [0x00ee]=$'\356' [0x00ef]=$'\357' [0x00f0]=$'\360'
+ [0x00f1]=$'\361' [0x00f2]=$'\362' [0x00f3]=$'\363' [0x00f4]=$'\364' [0x00f5]=$'\365'
+ [0x00f6]=$'\366' [0x00f7]=$'\367' [0x00f8]=$'\370' [0x00f9]=$'\371' [0x00fa]=$'\372'
+ [0x00fb]=$'\373' [0x00fc]=$'\374' [0x00fd]=$'\375' [0x00fe]=$'\376'
+)
+
+TestCodePage fr_FR.ISO8859-1 fr_FR_ISO_8859_1
+
+zh_TW_BIG5=(
+ [0x00f6]=$'\366' [0x00f7]=$'\367' [0x00f8]=$'\370' [0x00f9]=$'\371' [0x00fa]=$'\372'
+ [0x00fb]=$'\373' [0x00fc]=$'\374' [0x00fd]=$'\375' [0x00fe]=$'\376'
+)
+TestCodePage zh_TW.BIG5 zh_TW_BIG5
+
+jp_JP_SHIFT_JIS=(
+ [0x0001]=$'\x01' # START OF HEADING
+ [0x0002]=$'\x02' # START OF TEXT
+ [0x0003]=$'\x03' # END OF TEXT
+ [0x0004]=$'\x04' # END OF TRANSMISSION
+ [0x0005]=$'\x05' # ENQUIRY
+ [0x0006]=$'\x06' # ACKNOWLEDGE
+ [0x0007]=$'\x07' # BELL
+ [0x0008]=$'\x08' # BACKSPACE
+ [0x0009]=$'\x09' # HORIZONTAL TABULATION
+ [0x000A]=$'\x0A' # LINE FEED
+ [0x000B]=$'\x0B' # VERTICAL TABULATION
+ [0x000C]=$'\x0C' # FORM FEED
+ [0x000D]=$'\x0D' # CARRIAGE RETURN
+ [0x000E]=$'\x0E' # SHIFT OUT
+ [0x000F]=$'\x0F' # SHIFT IN
+ [0x0010]=$'\x10' # DATA LINK ESCAPE
+ [0x0011]=$'\x11' # DEVICE CONTROL ONE
+ [0x0012]=$'\x12' # DEVICE CONTROL TWO
+ [0x0013]=$'\x13' # DEVICE CONTROL THREE
+ [0x0014]=$'\x14' # DEVICE CONTROL FOUR
+ [0x0015]=$'\x15' # NEGATIVE ACKNOWLEDGE
+ [0x0016]=$'\x16' # SYNCHRONOUS IDLE
+ [0x0017]=$'\x17' # END OF TRANSMISSION BLOCK
+ [0x0018]=$'\x18' # CANCEL
+ [0x0019]=$'\x19' # END OF MEDIUM
+ [0x001A]=$'\x1A' # SUBSTITUTE
+ [0x001B]=$'\x1B' # ESCAPE
+ [0x001C]=$'\x1C' # FILE SEPARATOR
+ [0x001D]=$'\x1D' # GROUP SEPARATOR
+ [0x001E]=$'\x1E' # RECORD SEPARATOR
+ [0x001F]=$'\x1F' # UNIT SEPARATOR
+ [0x0020]=$'\x20' # SPACE
+ [0x0021]=$'\x21' # EXCLAMATION MARK
+ [0x0022]=$'\x22' # QUOTATION MARK
+ [0x0023]=$'\x23' # NUMBER SIGN
+ [0x0024]=$'\x24' # DOLLAR SIGN
+ [0x0025]=$'\x25' # PERCENT SIGN
+ [0x0026]=$'\x26' # AMPERSAND
+ [0x0027]=$'\x27' # APOSTROPHE
+ [0x0028]=$'\x28' # LEFT PARENTHESIS
+ [0x0029]=$'\x29' # RIGHT PARENTHESIS
+ [0x002A]=$'\x2A' # ASTERISK
+ [0x002B]=$'\x2B' # PLUS SIGN
+ [0x002C]=$'\x2C' # COMMA
+ [0x002D]=$'\x2D' # HYPHEN-MINUS
+ [0x002E]=$'\x2E' # FULL STOP
+ [0x002F]=$'\x2F' # SOLIDUS
+ [0x0030]=$'\x30' # DIGIT ZERO
+ [0x0031]=$'\x31' # DIGIT ONE
+ [0x0032]=$'\x32' # DIGIT TWO
+ [0x0033]=$'\x33' # DIGIT THREE
+ [0x0034]=$'\x34' # DIGIT FOUR
+ [0x0035]=$'\x35' # DIGIT FIVE
+ [0x0036]=$'\x36' # DIGIT SIX
+ [0x0037]=$'\x37' # DIGIT SEVEN
+ [0x0038]=$'\x38' # DIGIT EIGHT
+ [0x0039]=$'\x39' # DIGIT NINE
+ [0x003A]=$'\x3A' # COLON
+ [0x003B]=$'\x3B' # SEMICOLON
+ [0x003C]=$'\x3C' # LESS-THAN SIGN
+ [0x003D]=$'\x3D' # EQUALS SIGN
+ [0x003E]=$'\x3E' # GREATER-THAN SIGN
+ [0x003F]=$'\x3F' # QUESTION MARK
+ [0x0040]=$'\x40' # COMMERCIAL AT
+ [0x0041]=$'\x41' # LATIN CAPITAL LETTER A
+ [0x0042]=$'\x42' # LATIN CAPITAL LETTER B
+ [0x0043]=$'\x43' # LATIN CAPITAL LETTER C
+ [0x0044]=$'\x44' # LATIN CAPITAL LETTER D
+ [0x0045]=$'\x45' # LATIN CAPITAL LETTER E
+ [0x0046]=$'\x46' # LATIN CAPITAL LETTER F
+ [0x0047]=$'\x47' # LATIN CAPITAL LETTER G
+ [0x0048]=$'\x48' # LATIN CAPITAL LETTER H
+ [0x0049]=$'\x49' # LATIN CAPITAL LETTER I
+ [0x004A]=$'\x4A' # LATIN CAPITAL LETTER J
+ [0x004B]=$'\x4B' # LATIN CAPITAL LETTER K
+ [0x004C]=$'\x4C' # LATIN CAPITAL LETTER L
+ [0x004D]=$'\x4D' # LATIN CAPITAL LETTER M
+ [0x004E]=$'\x4E' # LATIN CAPITAL LETTER N
+ [0x004F]=$'\x4F' # LATIN CAPITAL LETTER O
+ [0x0050]=$'\x50' # LATIN CAPITAL LETTER P
+ [0x0051]=$'\x51' # LATIN CAPITAL LETTER Q
+ [0x0052]=$'\x52' # LATIN CAPITAL LETTER R
+ [0x0053]=$'\x53' # LATIN CAPITAL LETTER S
+ [0x0054]=$'\x54' # LATIN CAPITAL LETTER T
+ [0x0055]=$'\x55' # LATIN CAPITAL LETTER U
+ [0x0056]=$'\x56' # LATIN CAPITAL LETTER V
+ [0x0057]=$'\x57' # LATIN CAPITAL LETTER W
+ [0x0058]=$'\x58' # LATIN CAPITAL LETTER X
+ [0x0059]=$'\x59' # LATIN CAPITAL LETTER Y
+ [0x005A]=$'\x5A' # LATIN CAPITAL LETTER Z
+ [0x005B]=$'\x5B' # LEFT SQUARE BRACKET
+ [0x005C]=$'\x5C' # REVERSE SOLIDUS (YEN SIGN)
+ [0x005D]=$'\x5D' # RIGHT SQUARE BRACKET
+ [0x005E]=$'\x5E' # CIRCUMFLEX ACCENT
+ [0x005F]=$'\x5F' # LOW LINE
+ [0x0060]=$'\x60' # GRAVE ACCENT
+ [0x0061]=$'\x61' # LATIN SMALL LETTER A
+ [0x0062]=$'\x62' # LATIN SMALL LETTER B
+ [0x0063]=$'\x63' # LATIN SMALL LETTER C
+ [0x0064]=$'\x64' # LATIN SMALL LETTER D
+ [0x0065]=$'\x65' # LATIN SMALL LETTER E
+ [0x0066]=$'\x66' # LATIN SMALL LETTER F
+ [0x0067]=$'\x67' # LATIN SMALL LETTER G
+ [0x0068]=$'\x68' # LATIN SMALL LETTER H
+ [0x0069]=$'\x69' # LATIN SMALL LETTER I
+ [0x006A]=$'\x6A' # LATIN SMALL LETTER J
+ [0x006B]=$'\x6B' # LATIN SMALL LETTER K
+ [0x006C]=$'\x6C' # LATIN SMALL LETTER L
+ [0x006D]=$'\x6D' # LATIN SMALL LETTER M
+ [0x006E]=$'\x6E' # LATIN SMALL LETTER N
+ [0x006F]=$'\x6F' # LATIN SMALL LETTER O
+ [0x0070]=$'\x70' # LATIN SMALL LETTER P
+ [0x0071]=$'\x71' # LATIN SMALL LETTER Q
+ [0x0072]=$'\x72' # LATIN SMALL LETTER R
+ [0x0073]=$'\x73' # LATIN SMALL LETTER S
+ [0x0074]=$'\x74' # LATIN SMALL LETTER T
+ [0x0075]=$'\x75' # LATIN SMALL LETTER U
+ [0x0076]=$'\x76' # LATIN SMALL LETTER V
+ [0x0077]=$'\x77' # LATIN SMALL LETTER W
+ [0x0078]=$'\x78' # LATIN SMALL LETTER X
+ [0x0079]=$'\x79' # LATIN SMALL LETTER Y
+ [0x007A]=$'\x7A' # LATIN SMALL LETTER Z
+ [0x007B]=$'\x7B' # LEFT CURLY BRACKET
+ [0x007C]=$'\x7C' # VERTICAL LINE
+ [0x007D]=$'\x7D' # RIGHT CURLY BRACKET
+ [0x007E]=$'\x7E' # TILDE
+ [0x007F]=$'\x7F' # DELETE
+ [0xFF61]=$'\xA1' # HALFWIDTH IDEOGRAPHIC FULL STOP
+ [0xFF62]=$'\xA2' # HALFWIDTH LEFT CORNER BRACKET
+ [0xFF63]=$'\xA3' # HALFWIDTH RIGHT CORNER BRACKET
+ [0xFF64]=$'\xA4' # HALFWIDTH IDEOGRAPHIC COMMA
+ [0xFF65]=$'\xA5' # HALFWIDTH KATAKANA MIDDLE DOT
+ [0xFF66]=$'\xA6' # HALFWIDTH KATAKANA LETTER WO
+ [0xFF67]=$'\xA7' # HALFWIDTH KATAKANA LETTER SMALL A
+ [0xFF68]=$'\xA8' # HALFWIDTH KATAKANA LETTER SMALL I
+ [0xFF69]=$'\xA9' # HALFWIDTH KATAKANA LETTER SMALL U
+ [0xFF6A]=$'\xAA' # HALFWIDTH KATAKANA LETTER SMALL E
+ [0xFF6B]=$'\xAB' # HALFWIDTH KATAKANA LETTER SMALL O
+ [0xFF6C]=$'\xAC' # HALFWIDTH KATAKANA LETTER SMALL YA
+ [0xFF6D]=$'\xAD' # HALFWIDTH KATAKANA LETTER SMALL YU
+ [0xFF6E]=$'\xAE' # HALFWIDTH KATAKANA LETTER SMALL YO
+ [0xFF6F]=$'\xAF' # HALFWIDTH KATAKANA LETTER SMALL TU
+ [0xFF70]=$'\xB0' # HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
+ [0xFF71]=$'\xB1' # HALFWIDTH KATAKANA LETTER A
+ [0xFF72]=$'\xB2' # HALFWIDTH KATAKANA LETTER I
+ [0xFF73]=$'\xB3' # HALFWIDTH KATAKANA LETTER U
+ [0xFF74]=$'\xB4' # HALFWIDTH KATAKANA LETTER E
+ [0xFF75]=$'\xB5' # HALFWIDTH KATAKANA LETTER O
+ [0xFF76]=$'\xB6' # HALFWIDTH KATAKANA LETTER KA
+ [0xFF77]=$'\xB7' # HALFWIDTH KATAKANA LETTER KI
+ [0xFF78]=$'\xB8' # HALFWIDTH KATAKANA LETTER KU
+ [0xFF79]=$'\xB9' # HALFWIDTH KATAKANA LETTER KE
+ [0xFF7A]=$'\xBA' # HALFWIDTH KATAKANA LETTER KO
+ [0xFF7B]=$'\xBB' # HALFWIDTH KATAKANA LETTER SA
+ [0xFF7C]=$'\xBC' # HALFWIDTH KATAKANA LETTER SI
+ [0xFF7D]=$'\xBD' # HALFWIDTH KATAKANA LETTER SU
+ [0xFF7E]=$'\xBE' # HALFWIDTH KATAKANA LETTER SE
+ [0xFF7F]=$'\xBF' # HALFWIDTH KATAKANA LETTER SO
+ [0xFF80]=$'\xC0' # HALFWIDTH KATAKANA LETTER TA
+ [0xFF81]=$'\xC1' # HALFWIDTH KATAKANA LETTER TI
+ [0xFF82]=$'\xC2' # HALFWIDTH KATAKANA LETTER TU
+ [0xFF83]=$'\xC3' # HALFWIDTH KATAKANA LETTER TE
+ [0xFF84]=$'\xC4' # HALFWIDTH KATAKANA LETTER TO
+ [0xFF85]=$'\xC5' # HALFWIDTH KATAKANA LETTER NA
+ [0xFF86]=$'\xC6' # HALFWIDTH KATAKANA LETTER NI
+ [0xFF87]=$'\xC7' # HALFWIDTH KATAKANA LETTER NU
+ [0xFF88]=$'\xC8' # HALFWIDTH KATAKANA LETTER NE
+ [0xFF89]=$'\xC9' # HALFWIDTH KATAKANA LETTER NO
+ [0xFF8A]=$'\xCA' # HALFWIDTH KATAKANA LETTER HA
+ [0xFF8B]=$'\xCB' # HALFWIDTH KATAKANA LETTER HI
+ [0xFF8C]=$'\xCC' # HALFWIDTH KATAKANA LETTER HU
+ [0xFF8D]=$'\xCD' # HALFWIDTH KATAKANA LETTER HE
+ [0xFF8E]=$'\xCE' # HALFWIDTH KATAKANA LETTER HO
+ [0xFF8F]=$'\xCF' # HALFWIDTH KATAKANA LETTER MA
+ [0xFF90]=$'\xD0' # HALFWIDTH KATAKANA LETTER MI
+ [0xFF91]=$'\xD1' # HALFWIDTH KATAKANA LETTER MU
+ [0xFF92]=$'\xD2' # HALFWIDTH KATAKANA LETTER ME
+ [0xFF93]=$'\xD3' # HALFWIDTH KATAKANA LETTER MO
+ [0xFF94]=$'\xD4' # HALFWIDTH KATAKANA LETTER YA
+ [0xFF95]=$'\xD5' # HALFWIDTH KATAKANA LETTER YU
+ [0xFF96]=$'\xD6' # HALFWIDTH KATAKANA LETTER YO
+ [0xFF97]=$'\xD7' # HALFWIDTH KATAKANA LETTER RA
+ [0xFF98]=$'\xD8' # HALFWIDTH KATAKANA LETTER RI
+ [0xFF99]=$'\xD9' # HALFWIDTH KATAKANA LETTER RU
+ [0xFF9A]=$'\xDA' # HALFWIDTH KATAKANA LETTER RE
+ [0xFF9B]=$'\xDB' # HALFWIDTH KATAKANA LETTER RO
+ [0xFF9C]=$'\xDC' # HALFWIDTH KATAKANA LETTER WA
+ [0xFF9D]=$'\xDD' # HALFWIDTH KATAKANA LETTER N
+ [0xFF9E]=$'\xDE' # HALFWIDTH KATAKANA VOICED SOUND MARK
+ [0xFF9F]=$'\xDF' # HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
+)
+#TestCodePage ja_JP.SHIFT_JIS jp_JP_SHIFT_JIS
+TestCodePage ja_JP.SJIS jp_JP_SHIFT_JIS
+
+#for ((x=1;x<1000;x++)); do printf ' [0x%04x]=%-11q' "$x" "$(printf "$(printf '\\U%08x' $x)")" ; [ $(($x%5)) = 0 ] && echo; done
+C_UTF_8=(
+ [0x0001]=$'\001' [0x0002]=$'\002' [0x0003]=$'\003' [0x0004]=$'\004' [0x0005]=$'\005'
+ [0x0006]=$'\006' [0x0007]=$'\a' [0x0008]=$'\b' [0x0009]=$'\t' [0x000a]=''
+ [0x000b]=$'\v' [0x000c]=$'\f' [0x000d]=$'\r' [0x000e]=$'\016' [0x000f]=$'\017'
+ [0x0010]=$'\020' [0x0011]=$'\021' [0x0012]=$'\022' [0x0013]=$'\023' [0x0014]=$'\024'
+ [0x0015]=$'\025' [0x0016]=$'\026' [0x0017]=$'\027' [0x0018]=$'\030' [0x0019]=$'\031'
+ [0x001a]=$'\032' [0x001b]=$'\E' [0x001c]=$'\034' [0x001d]=$'\035' [0x001e]=$'\036'
+ [0x001f]=$'\037' [0x0020]=\ [0x0021]=\! [0x0022]=\" [0x0023]=\#
+ [0x0024]=\$ [0x0025]=% [0x0026]=\& [0x0027]=\' [0x0028]=\(
+ [0x0029]=\) [0x002a]=\* [0x002b]=+ [0x002c]=\, [0x002d]=-
+ [0x002e]=. [0x002f]=/ [0x0030]=0 [0x0031]=1 [0x0032]=2
+ [0x0033]=3 [0x0034]=4 [0x0035]=5 [0x0036]=6 [0x0037]=7
+ [0x0038]=8 [0x0039]=9 [0x003a]=: [0x003b]=\; [0x003c]=\<
+ [0x003d]== [0x003e]=\> [0x003f]=\? [0x0040]=@ [0x0041]=A
+ [0x0042]=B [0x0043]=C [0x0044]=D [0x0045]=E [0x0046]=F
+ [0x0047]=G [0x0048]=H [0x0049]=I [0x004a]=J [0x004b]=K
+ [0x004c]=L [0x004d]=M [0x004e]=N [0x004f]=O [0x0050]=P
+ [0x0051]=Q [0x0052]=R [0x0053]=S [0x0054]=T [0x0055]=U
+ [0x0056]=V [0x0057]=W [0x0058]=X [0x0059]=Y [0x005a]=Z
+ [0x005b]=\[ [0x005c]=\\ [0x005d]=\] [0x005e]=\^ [0x005f]=_
+ [0x0060]=\` [0x0061]=a [0x0062]=b [0x0063]=c [0x0064]=d
+ [0x0065]=e [0x0066]=f [0x0067]=g [0x0068]=h [0x0069]=i
+ [0x006a]=j [0x006b]=k [0x006c]=l [0x006d]=m [0x006e]=n
+ [0x006f]=o [0x0070]=p [0x0071]=q [0x0072]=r [0x0073]=s
+ [0x0074]=t [0x0075]=u [0x0076]=v [0x0077]=w [0x0078]=x
+ [0x0079]=y [0x007a]=z [0x007b]=\{ [0x007c]=\| [0x007d]=\}
+ [0x007e]="~" [0x007f]=$'\177' [0x0080]=$'\302\200' [0x0081]=$'\302\201' [0x0082]=$'\302\202'
+ [0x0083]=$'\302\203' [0x0084]=$'\302\204' [0x0085]=$'\302\205' [0x0086]=$'\302\206' [0x0087]=$'\302\207'
+ [0x0088]=$'\302\210' [0x0089]=$'\302\211' [0x008a]=$'\302\212' [0x008b]=$'\302\213' [0x008c]=$'\302\214'
+ [0x008d]=$'\302\215' [0x008e]=$'\302\216' [0x008f]=$'\302\217' [0x0090]=$'\302\220' [0x0091]=$'\302\221'
+ [0x0092]=$'\302\222' [0x0093]=$'\302\223' [0x0094]=$'\302\224' [0x0095]=$'\302\225' [0x0096]=$'\302\226'
+ [0x0097]=$'\302\227' [0x0098]=$'\302\230' [0x0099]=$'\302\231' [0x009a]=$'\302\232' [0x009b]=$'\302\233'
+ [0x009c]=$'\302\234' [0x009d]=$'\302\235' [0x009e]=$'\302\236' [0x009f]=$'\302\237' [0x00a0]=$'\302\240'
+ [0x00a1]=$'\302\241' [0x00a2]=$'\302\242' [0x00a3]=$'\302\243' [0x00a4]=$'\302\244' [0x00a5]=$'\302\245'
+ [0x00a6]=$'\302\246' [0x00a7]=$'\302\247' [0x00a8]=$'\302\250' [0x00a9]=$'\302\251' [0x00aa]=$'\302\252'
+ [0x00ab]=$'\302\253' [0x00ac]=$'\302\254' [0x00ad]=$'\302\255' [0x00ae]=$'\302\256' [0x00af]=$'\302\257'
+ [0x00b0]=$'\302\260' [0x00b1]=$'\302\261' [0x00b2]=$'\302\262' [0x00b3]=$'\302\263' [0x00b4]=$'\302\264'
+ [0x00b5]=$'\302\265' [0x00b6]=$'\302\266' [0x00b7]=$'\302\267' [0x00b8]=$'\302\270' [0x00b9]=$'\302\271'
+ [0x00ba]=$'\302\272' [0x00bb]=$'\302\273' [0x00bc]=$'\302\274' [0x00bd]=$'\302\275' [0x00be]=$'\302\276'
+ [0x00bf]=$'\302\277' [0x00c0]=$'\303\200' [0x00c1]=$'\303\201' [0x00c2]=$'\303\202' [0x00c3]=$'\303\203'
+ [0x00c4]=$'\303\204' [0x00c5]=$'\303\205' [0x00c6]=$'\303\206' [0x00c7]=$'\303\207' [0x00c8]=$'\303\210'
+ [0x00c9]=$'\303\211' [0x00ca]=$'\303\212' [0x00cb]=$'\303\213' [0x00cc]=$'\303\214' [0x00cd]=$'\303\215'
+ [0x00ce]=$'\303\216' [0x00cf]=$'\303\217' [0x00d0]=$'\303\220' [0x00d1]=$'\303\221' [0x00d2]=$'\303\222'
+ [0x00d3]=$'\303\223' [0x00d4]=$'\303\224' [0x00d5]=$'\303\225' [0x00d6]=$'\303\226' [0x00d7]=$'\303\227'
+ [0x00d8]=$'\303\230' [0x00d9]=$'\303\231' [0x00da]=$'\303\232' [0x00db]=$'\303\233' [0x00dc]=$'\303\234'
+ [0x00dd]=$'\303\235' [0x00de]=$'\303\236' [0x00df]=$'\303\237' [0x00e0]=$'\303\240' [0x00e1]=$'\303\241'
+ [0x00e2]=$'\303\242' [0x00e3]=$'\303\243' [0x00e4]=$'\303\244' [0x00e5]=$'\303\245' [0x00e6]=$'\303\246'
+ [0x00e7]=$'\303\247' [0x00e8]=$'\303\250' [0x00e9]=$'\303\251' [0x00ea]=$'\303\252' [0x00eb]=$'\303\253'
+ [0x00ec]=$'\303\254' [0x00ed]=$'\303\255' [0x00ee]=$'\303\256' [0x00ef]=$'\303\257' [0x00f0]=$'\303\260'
+ [0x00f1]=$'\303\261' [0x00f2]=$'\303\262' [0x00f3]=$'\303\263' [0x00f4]=$'\303\264' [0x00f5]=$'\303\265'
+ [0x00f6]=$'\303\266' [0x00f7]=$'\303\267' [0x00f8]=$'\303\270' [0x00f9]=$'\303\271' [0x00fa]=$'\303\272'
+ [0x00fb]=$'\303\273' [0x00fc]=$'\303\274' [0x00fd]=$'\303\275' [0x00fe]=$'\303\276' [0x00ff]=$'\303\277'
+ [0x0100]=$'\304\200' [0x0101]=$'\304\201' [0x0102]=$'\304\202' [0x0103]=$'\304\203' [0x0104]=$'\304\204'
+ [0x0105]=$'\304\205' [0x0106]=$'\304\206' [0x0107]=$'\304\207' [0x0108]=$'\304\210' [0x0109]=$'\304\211'
+ [0x010a]=$'\304\212' [0x010b]=$'\304\213' [0x010c]=$'\304\214' [0x010d]=$'\304\215' [0x010e]=$'\304\216'
+ [0x010f]=$'\304\217' [0x0110]=$'\304\220' [0x0111]=$'\304\221' [0x0112]=$'\304\222' [0x0113]=$'\304\223'
+ [0x0114]=$'\304\224' [0x0115]=$'\304\225' [0x0116]=$'\304\226' [0x0117]=$'\304\227' [0x0118]=$'\304\230'
+ [0x0119]=$'\304\231' [0x011a]=$'\304\232' [0x011b]=$'\304\233' [0x011c]=$'\304\234' [0x011d]=$'\304\235'
+ [0x011e]=$'\304\236' [0x011f]=$'\304\237' [0x0120]=$'\304\240' [0x0121]=$'\304\241' [0x0122]=$'\304\242'
+ [0x0123]=$'\304\243' [0x0124]=$'\304\244' [0x0125]=$'\304\245' [0x0126]=$'\304\246' [0x0127]=$'\304\247'
+ [0x0128]=$'\304\250' [0x0129]=$'\304\251' [0x012a]=$'\304\252' [0x012b]=$'\304\253' [0x012c]=$'\304\254'
+ [0x012d]=$'\304\255' [0x012e]=$'\304\256' [0x012f]=$'\304\257' [0x0130]=$'\304\260' [0x0131]=$'\304\261'
+ [0x0132]=$'\304\262' [0x0133]=$'\304\263' [0x0134]=$'\304\264' [0x0135]=$'\304\265' [0x0136]=$'\304\266'
+ [0x0137]=$'\304\267' [0x0138]=$'\304\270' [0x0139]=$'\304\271' [0x013a]=$'\304\272' [0x013b]=$'\304\273'
+ [0x013c]=$'\304\274' [0x013d]=$'\304\275' [0x013e]=$'\304\276' [0x013f]=$'\304\277' [0x0140]=$'\305\200'
+ [0x0141]=$'\305\201' [0x0142]=$'\305\202' [0x0143]=$'\305\203' [0x0144]=$'\305\204' [0x0145]=$'\305\205'
+ [0x0146]=$'\305\206' [0x0147]=$'\305\207' [0x0148]=$'\305\210' [0x0149]=$'\305\211' [0x014a]=$'\305\212'
+ [0x014b]=$'\305\213' [0x014c]=$'\305\214' [0x014d]=$'\305\215' [0x014e]=$'\305\216' [0x014f]=$'\305\217'
+ [0x0150]=$'\305\220' [0x0151]=$'\305\221' [0x0152]=$'\305\222' [0x0153]=$'\305\223' [0x0154]=$'\305\224'
+ [0x0155]=$'\305\225' [0x0156]=$'\305\226' [0x0157]=$'\305\227' [0x0158]=$'\305\230' [0x0159]=$'\305\231'
+ [0x015a]=$'\305\232' [0x015b]=$'\305\233' [0x015c]=$'\305\234' [0x015d]=$'\305\235' [0x015e]=$'\305\236'
+ [0x015f]=$'\305\237' [0x0160]=$'\305\240' [0x0161]=$'\305\241' [0x0162]=$'\305\242' [0x0163]=$'\305\243'
+ [0x0164]=$'\305\244' [0x0165]=$'\305\245' [0x0166]=$'\305\246' [0x0167]=$'\305\247' [0x0168]=$'\305\250'
+ [0x0169]=$'\305\251' [0x016a]=$'\305\252' [0x016b]=$'\305\253' [0x016c]=$'\305\254' [0x016d]=$'\305\255'
+ [0x016e]=$'\305\256' [0x016f]=$'\305\257' [0x0170]=$'\305\260' [0x0171]=$'\305\261' [0x0172]=$'\305\262'
+ [0x0173]=$'\305\263' [0x0174]=$'\305\264' [0x0175]=$'\305\265' [0x0176]=$'\305\266' [0x0177]=$'\305\267'
+ [0x0178]=$'\305\270' [0x0179]=$'\305\271' [0x017a]=$'\305\272' [0x017b]=$'\305\273' [0x017c]=$'\305\274'
+ [0x017d]=$'\305\275' [0x017e]=$'\305\276' [0x017f]=$'\305\277' [0x0180]=$'\306\200' [0x0181]=$'\306\201'
+ [0x0182]=$'\306\202' [0x0183]=$'\306\203' [0x0184]=$'\306\204' [0x0185]=$'\306\205' [0x0186]=$'\306\206'
+ [0x0187]=$'\306\207' [0x0188]=$'\306\210' [0x0189]=$'\306\211' [0x018a]=$'\306\212' [0x018b]=$'\306\213'
+ [0x018c]=$'\306\214' [0x018d]=$'\306\215' [0x018e]=$'\306\216' [0x018f]=$'\306\217' [0x0190]=$'\306\220'
+ [0x0191]=$'\306\221' [0x0192]=$'\306\222' [0x0193]=$'\306\223' [0x0194]=$'\306\224' [0x0195]=$'\306\225'
+ [0x0196]=$'\306\226' [0x0197]=$'\306\227' [0x0198]=$'\306\230' [0x0199]=$'\306\231' [0x019a]=$'\306\232'
+ [0x019b]=$'\306\233' [0x019c]=$'\306\234' [0x019d]=$'\306\235' [0x019e]=$'\306\236' [0x019f]=$'\306\237'
+ [0x01a0]=$'\306\240' [0x01a1]=$'\306\241' [0x01a2]=$'\306\242' [0x01a3]=$'\306\243' [0x01a4]=$'\306\244'
+ [0x01a5]=$'\306\245' [0x01a6]=$'\306\246' [0x01a7]=$'\306\247' [0x01a8]=$'\306\250' [0x01a9]=$'\306\251'
+ [0x01aa]=$'\306\252' [0x01ab]=$'\306\253' [0x01ac]=$'\306\254' [0x01ad]=$'\306\255' [0x01ae]=$'\306\256'
+ [0x01af]=$'\306\257' [0x01b0]=$'\306\260' [0x01b1]=$'\306\261' [0x01b2]=$'\306\262' [0x01b3]=$'\306\263'
+ [0x01b4]=$'\306\264' [0x01b5]=$'\306\265' [0x01b6]=$'\306\266' [0x01b7]=$'\306\267' [0x01b8]=$'\306\270'
+ [0x01b9]=$'\306\271' [0x01ba]=$'\306\272' [0x01bb]=$'\306\273' [0x01bc]=$'\306\274' [0x01bd]=$'\306\275'
+ [0x01be]=$'\306\276' [0x01bf]=$'\306\277' [0x01c0]=$'\307\200' [0x01c1]=$'\307\201' [0x01c2]=$'\307\202'
+ [0x01c3]=$'\307\203' [0x01c4]=$'\307\204' [0x01c5]=$'\307\205' [0x01c6]=$'\307\206' [0x01c7]=$'\307\207'
+ [0x01c8]=$'\307\210' [0x01c9]=$'\307\211' [0x01ca]=$'\307\212' [0x01cb]=$'\307\213' [0x01cc]=$'\307\214'
+ [0x01cd]=$'\307\215' [0x01ce]=$'\307\216' [0x01cf]=$'\307\217' [0x01d0]=$'\307\220' [0x01d1]=$'\307\221'
+ [0x01d2]=$'\307\222' [0x01d3]=$'\307\223' [0x01d4]=$'\307\224' [0x01d5]=$'\307\225' [0x01d6]=$'\307\226'
+ [0x01d7]=$'\307\227' [0x01d8]=$'\307\230' [0x01d9]=$'\307\231' [0x01da]=$'\307\232' [0x01db]=$'\307\233'
+ [0x01dc]=$'\307\234' [0x01dd]=$'\307\235' [0x01de]=$'\307\236' [0x01df]=$'\307\237' [0x01e0]=$'\307\240'
+ [0x01e1]=$'\307\241' [0x01e2]=$'\307\242' [0x01e3]=$'\307\243' [0x01e4]=$'\307\244' [0x01e5]=$'\307\245'
+ [0x01e6]=$'\307\246' [0x01e7]=$'\307\247' [0x01e8]=$'\307\250' [0x01e9]=$'\307\251' [0x01ea]=$'\307\252'
+ [0x01eb]=$'\307\253' [0x01ec]=$'\307\254' [0x01ed]=$'\307\255' [0x01ee]=$'\307\256' [0x01ef]=$'\307\257'
+ [0x01f0]=$'\307\260' [0x01f1]=$'\307\261' [0x01f2]=$'\307\262' [0x01f3]=$'\307\263' [0x01f4]=$'\307\264'
+ [0x01f5]=$'\307\265' [0x01f6]=$'\307\266' [0x01f7]=$'\307\267' [0x01f8]=$'\307\270' [0x01f9]=$'\307\271'
+ [0x01fa]=$'\307\272' [0x01fb]=$'\307\273' [0x01fc]=$'\307\274' [0x01fd]=$'\307\275' [0x01fe]=$'\307\276'
+ [0x01ff]=$'\307\277' [0x0200]=$'\310\200' [0x0201]=$'\310\201' [0x0202]=$'\310\202' [0x0203]=$'\310\203'
+ [0x0204]=$'\310\204' [0x0205]=$'\310\205' [0x0206]=$'\310\206' [0x0207]=$'\310\207' [0x0208]=$'\310\210'
+ [0x0209]=$'\310\211' [0x020a]=$'\310\212' [0x020b]=$'\310\213' [0x020c]=$'\310\214' [0x020d]=$'\310\215'
+ [0x020e]=$'\310\216' [0x020f]=$'\310\217' [0x0210]=$'\310\220' [0x0211]=$'\310\221' [0x0212]=$'\310\222'
+ [0x0213]=$'\310\223' [0x0214]=$'\310\224' [0x0215]=$'\310\225' [0x0216]=$'\310\226' [0x0217]=$'\310\227'
+ [0x0218]=$'\310\230' [0x0219]=$'\310\231' [0x021a]=$'\310\232' [0x021b]=$'\310\233' [0x021c]=$'\310\234'
+ [0x021d]=$'\310\235' [0x021e]=$'\310\236' [0x021f]=$'\310\237' [0x0220]=$'\310\240' [0x0221]=$'\310\241'
+ [0x0222]=$'\310\242' [0x0223]=$'\310\243' [0x0224]=$'\310\244' [0x0225]=$'\310\245' [0x0226]=$'\310\246'
+ [0x0227]=$'\310\247' [0x0228]=$'\310\250' [0x0229]=$'\310\251' [0x022a]=$'\310\252' [0x022b]=$'\310\253'
+ [0x022c]=$'\310\254' [0x022d]=$'\310\255' [0x022e]=$'\310\256' [0x022f]=$'\310\257' [0x0230]=$'\310\260'
+ [0x0231]=$'\310\261' [0x0232]=$'\310\262' [0x0233]=$'\310\263' [0x0234]=$'\310\264' [0x0235]=$'\310\265'
+ [0x0236]=$'\310\266' [0x0237]=$'\310\267' [0x0238]=$'\310\270' [0x0239]=$'\310\271' [0x023a]=$'\310\272'
+ [0x023b]=$'\310\273' [0x023c]=$'\310\274' [0x023d]=$'\310\275' [0x023e]=$'\310\276' [0x023f]=$'\310\277'
+ [0x0240]=$'\311\200' [0x0241]=$'\311\201' [0x0242]=$'\311\202' [0x0243]=$'\311\203' [0x0244]=$'\311\204'
+ [0x0245]=$'\311\205' [0x0246]=$'\311\206' [0x0247]=$'\311\207' [0x0248]=$'\311\210' [0x0249]=$'\311\211'
+ [0x024a]=$'\311\212' [0x024b]=$'\311\213' [0x024c]=$'\311\214' [0x024d]=$'\311\215' [0x024e]=$'\311\216'
+ [0x024f]=$'\311\217' [0x0250]=$'\311\220' [0x0251]=$'\311\221' [0x0252]=$'\311\222' [0x0253]=$'\311\223'
+ [0x0254]=$'\311\224' [0x0255]=$'\311\225' [0x0256]=$'\311\226' [0x0257]=$'\311\227' [0x0258]=$'\311\230'
+ [0x0259]=$'\311\231' [0x025a]=$'\311\232' [0x025b]=$'\311\233' [0x025c]=$'\311\234' [0x025d]=$'\311\235'
+ [0x025e]=$'\311\236' [0x025f]=$'\311\237' [0x0260]=$'\311\240' [0x0261]=$'\311\241' [0x0262]=$'\311\242'
+ [0x0263]=$'\311\243' [0x0264]=$'\311\244' [0x0265]=$'\311\245' [0x0266]=$'\311\246' [0x0267]=$'\311\247'
+ [0x0268]=$'\311\250' [0x0269]=$'\311\251' [0x026a]=$'\311\252' [0x026b]=$'\311\253' [0x026c]=$'\311\254'
+ [0x026d]=$'\311\255' [0x026e]=$'\311\256' [0x026f]=$'\311\257' [0x0270]=$'\311\260' [0x0271]=$'\311\261'
+ [0x0272]=$'\311\262' [0x0273]=$'\311\263' [0x0274]=$'\311\264' [0x0275]=$'\311\265' [0x0276]=$'\311\266'
+ [0x0277]=$'\311\267' [0x0278]=$'\311\270' [0x0279]=$'\311\271' [0x027a]=$'\311\272' [0x027b]=$'\311\273'
+ [0x027c]=$'\311\274' [0x027d]=$'\311\275' [0x027e]=$'\311\276' [0x027f]=$'\311\277' [0x0280]=$'\312\200'
+ [0x0281]=$'\312\201' [0x0282]=$'\312\202' [0x0283]=$'\312\203' [0x0284]=$'\312\204' [0x0285]=$'\312\205'
+ [0x0286]=$'\312\206' [0x0287]=$'\312\207' [0x0288]=$'\312\210' [0x0289]=$'\312\211' [0x028a]=$'\312\212'
+ [0x028b]=$'\312\213' [0x028c]=$'\312\214' [0x028d]=$'\312\215' [0x028e]=$'\312\216' [0x028f]=$'\312\217'
+ [0x0290]=$'\312\220' [0x0291]=$'\312\221' [0x0292]=$'\312\222' [0x0293]=$'\312\223' [0x0294]=$'\312\224'
+ [0x0295]=$'\312\225' [0x0296]=$'\312\226' [0x0297]=$'\312\227' [0x0298]=$'\312\230' [0x0299]=$'\312\231'
+ [0x029a]=$'\312\232' [0x029b]=$'\312\233' [0x029c]=$'\312\234' [0x029d]=$'\312\235' [0x029e]=$'\312\236'
+ [0x029f]=$'\312\237' [0x02a0]=$'\312\240' [0x02a1]=$'\312\241' [0x02a2]=$'\312\242' [0x02a3]=$'\312\243'
+ [0x02a4]=$'\312\244' [0x02a5]=$'\312\245' [0x02a6]=$'\312\246' [0x02a7]=$'\312\247' [0x02a8]=$'\312\250'
+ [0x02a9]=$'\312\251' [0x02aa]=$'\312\252' [0x02ab]=$'\312\253' [0x02ac]=$'\312\254' [0x02ad]=$'\312\255'
+ [0x02ae]=$'\312\256' [0x02af]=$'\312\257' [0x02b0]=$'\312\260' [0x02b1]=$'\312\261' [0x02b2]=$'\312\262'
+ [0x02b3]=$'\312\263' [0x02b4]=$'\312\264' [0x02b5]=$'\312\265' [0x02b6]=$'\312\266' [0x02b7]=$'\312\267'
+ [0x02b8]=$'\312\270' [0x02b9]=$'\312\271' [0x02ba]=$'\312\272' [0x02bb]=$'\312\273' [0x02bc]=$'\312\274'
+ [0x02bd]=$'\312\275' [0x02be]=$'\312\276' [0x02bf]=$'\312\277' [0x02c0]=$'\313\200' [0x02c1]=$'\313\201'
+ [0x02c2]=$'\313\202' [0x02c3]=$'\313\203' [0x02c4]=$'\313\204' [0x02c5]=$'\313\205' [0x02c6]=$'\313\206'
+ [0x02c7]=$'\313\207' [0x02c8]=$'\313\210' [0x02c9]=$'\313\211' [0x02ca]=$'\313\212' [0x02cb]=$'\313\213'
+ [0x02cc]=$'\313\214' [0x02cd]=$'\313\215' [0x02ce]=$'\313\216' [0x02cf]=$'\313\217' [0x02d0]=$'\313\220'
+ [0x02d1]=$'\313\221' [0x02d2]=$'\313\222' [0x02d3]=$'\313\223' [0x02d4]=$'\313\224' [0x02d5]=$'\313\225'
+ [0x02d6]=$'\313\226' [0x02d7]=$'\313\227' [0x02d8]=$'\313\230' [0x02d9]=$'\313\231' [0x02da]=$'\313\232'
+ [0x02db]=$'\313\233' [0x02dc]=$'\313\234' [0x02dd]=$'\313\235' [0x02de]=$'\313\236' [0x02df]=$'\313\237'
+ [0x02e0]=$'\313\240' [0x02e1]=$'\313\241' [0x02e2]=$'\313\242' [0x02e3]=$'\313\243' [0x02e4]=$'\313\244'
+ [0x02e5]=$'\313\245' [0x02e6]=$'\313\246' [0x02e7]=$'\313\247' [0x02e8]=$'\313\250' [0x02e9]=$'\313\251'
+ [0x02ea]=$'\313\252' [0x02eb]=$'\313\253' [0x02ec]=$'\313\254' [0x02ed]=$'\313\255' [0x02ee]=$'\313\256'
+ [0x02ef]=$'\313\257' [0x02f0]=$'\313\260' [0x02f1]=$'\313\261' [0x02f2]=$'\313\262' [0x02f3]=$'\313\263'
+ [0x02f4]=$'\313\264' [0x02f5]=$'\313\265' [0x02f6]=$'\313\266' [0x02f7]=$'\313\267' [0x02f8]=$'\313\270'
+ [0x02f9]=$'\313\271' [0x02fa]=$'\313\272' [0x02fb]=$'\313\273' [0x02fc]=$'\313\274' [0x02fd]=$'\313\275'
+ [0x02fe]=$'\313\276' [0x02ff]=$'\313\277' [0x0300]=$'\314\200' [0x0301]=$'\314\201' [0x0302]=$'\314\202'
+ [0x0303]=$'\314\203' [0x0304]=$'\314\204' [0x0305]=$'\314\205' [0x0306]=$'\314\206' [0x0307]=$'\314\207'
+ [0x0308]=$'\314\210' [0x0309]=$'\314\211' [0x030a]=$'\314\212' [0x030b]=$'\314\213' [0x030c]=$'\314\214'
+ [0x030d]=$'\314\215' [0x030e]=$'\314\216' [0x030f]=$'\314\217' [0x0310]=$'\314\220' [0x0311]=$'\314\221'
+ [0x0312]=$'\314\222' [0x0313]=$'\314\223' [0x0314]=$'\314\224' [0x0315]=$'\314\225' [0x0316]=$'\314\226'
+ [0x0317]=$'\314\227' [0x0318]=$'\314\230' [0x0319]=$'\314\231' [0x031a]=$'\314\232' [0x031b]=$'\314\233'
+ [0x031c]=$'\314\234' [0x031d]=$'\314\235' [0x031e]=$'\314\236' [0x031f]=$'\314\237' [0x0320]=$'\314\240'
+ [0x0321]=$'\314\241' [0x0322]=$'\314\242' [0x0323]=$'\314\243' [0x0324]=$'\314\244' [0x0325]=$'\314\245'
+ [0x0326]=$'\314\246' [0x0327]=$'\314\247' [0x0328]=$'\314\250' [0x0329]=$'\314\251' [0x032a]=$'\314\252'
+ [0x032b]=$'\314\253' [0x032c]=$'\314\254' [0x032d]=$'\314\255' [0x032e]=$'\314\256' [0x032f]=$'\314\257'
+ [0x0330]=$'\314\260' [0x0331]=$'\314\261' [0x0332]=$'\314\262' [0x0333]=$'\314\263' [0x0334]=$'\314\264'
+ [0x0335]=$'\314\265' [0x0336]=$'\314\266' [0x0337]=$'\314\267' [0x0338]=$'\314\270' [0x0339]=$'\314\271'
+ [0x033a]=$'\314\272' [0x033b]=$'\314\273' [0x033c]=$'\314\274' [0x033d]=$'\314\275' [0x033e]=$'\314\276'
+ [0x033f]=$'\314\277' [0x0340]=$'\315\200' [0x0341]=$'\315\201' [0x0342]=$'\315\202' [0x0343]=$'\315\203'
+ [0x0344]=$'\315\204' [0x0345]=$'\315\205' [0x0346]=$'\315\206' [0x0347]=$'\315\207' [0x0348]=$'\315\210'
+ [0x0349]=$'\315\211' [0x034a]=$'\315\212' [0x034b]=$'\315\213' [0x034c]=$'\315\214' [0x034d]=$'\315\215'
+ [0x034e]=$'\315\216' [0x034f]=$'\315\217' [0x0350]=$'\315\220' [0x0351]=$'\315\221' [0x0352]=$'\315\222'
+ [0x0353]=$'\315\223' [0x0354]=$'\315\224' [0x0355]=$'\315\225' [0x0356]=$'\315\226' [0x0357]=$'\315\227'
+ [0x0358]=$'\315\230' [0x0359]=$'\315\231' [0x035a]=$'\315\232' [0x035b]=$'\315\233' [0x035c]=$'\315\234'
+ [0x035d]=$'\315\235' [0x035e]=$'\315\236' [0x035f]=$'\315\237' [0x0360]=$'\315\240' [0x0361]=$'\315\241'
+ [0x0362]=$'\315\242' [0x0363]=$'\315\243' [0x0364]=$'\315\244' [0x0365]=$'\315\245' [0x0366]=$'\315\246'
+ [0x0367]=$'\315\247' [0x0368]=$'\315\250' [0x0369]=$'\315\251' [0x036a]=$'\315\252' [0x036b]=$'\315\253'
+ [0x036c]=$'\315\254' [0x036d]=$'\315\255' [0x036e]=$'\315\256' [0x036f]=$'\315\257' [0x0370]=$'\315\260'
+ [0x0371]=$'\315\261' [0x0372]=$'\315\262' [0x0373]=$'\315\263' [0x0374]=$'\315\264' [0x0375]=$'\315\265'
+ [0x0376]=$'\315\266' [0x0377]=$'\315\267' [0x0378]=$'\315\270' [0x0379]=$'\315\271' [0x037a]=$'\315\272'
+ [0x037b]=$'\315\273' [0x037c]=$'\315\274' [0x037d]=$'\315\275' [0x037e]=$'\315\276' [0x037f]=$'\315\277'
+ [0x0380]=$'\316\200' [0x0381]=$'\316\201' [0x0382]=$'\316\202' [0x0383]=$'\316\203' [0x0384]=$'\316\204'
+ [0x0385]=$'\316\205' [0x0386]=$'\316\206' [0x0387]=$'\316\207' [0x0388]=$'\316\210' [0x0389]=$'\316\211'
+ [0x038a]=$'\316\212' [0x038b]=$'\316\213' [0x038c]=$'\316\214' [0x038d]=$'\316\215' [0x038e]=$'\316\216'
+ [0x038f]=$'\316\217' [0x0390]=$'\316\220' [0x0391]=$'\316\221' [0x0392]=$'\316\222' [0x0393]=$'\316\223'
+ [0x0394]=$'\316\224' [0x0395]=$'\316\225' [0x0396]=$'\316\226' [0x0397]=$'\316\227' [0x0398]=$'\316\230'
+ [0x0399]=$'\316\231' [0x039a]=$'\316\232' [0x039b]=$'\316\233' [0x039c]=$'\316\234' [0x039d]=$'\316\235'
+ [0x039e]=$'\316\236' [0x039f]=$'\316\237' [0x03a0]=$'\316\240' [0x03a1]=$'\316\241' [0x03a2]=$'\316\242'
+ [0x03a3]=$'\316\243' [0x03a4]=$'\316\244' [0x03a5]=$'\316\245' [0x03a6]=$'\316\246' [0x03a7]=$'\316\247'
+ [0x03a8]=$'\316\250' [0x03a9]=$'\316\251' [0x03aa]=$'\316\252' [0x03ab]=$'\316\253' [0x03ac]=$'\316\254'
+ [0x03ad]=$'\316\255' [0x03ae]=$'\316\256' [0x03af]=$'\316\257' [0x03b0]=$'\316\260' [0x03b1]=$'\316\261'
+ [0x03b2]=$'\316\262' [0x03b3]=$'\316\263' [0x03b4]=$'\316\264' [0x03b5]=$'\316\265' [0x03b6]=$'\316\266'
+ [0x03b7]=$'\316\267' [0x03b8]=$'\316\270' [0x03b9]=$'\316\271' [0x03ba]=$'\316\272' [0x03bb]=$'\316\273'
+ [0x03bc]=$'\316\274' [0x03bd]=$'\316\275' [0x03be]=$'\316\276' [0x03bf]=$'\316\277' [0x03c0]=$'\317\200'
+ [0x03c1]=$'\317\201' [0x03c2]=$'\317\202' [0x03c3]=$'\317\203' [0x03c4]=$'\317\204' [0x03c5]=$'\317\205'
+ [0x03c6]=$'\317\206' [0x03c7]=$'\317\207' [0x03c8]=$'\317\210' [0x03c9]=$'\317\211' [0x03ca]=$'\317\212'
+ [0x03cb]=$'\317\213' [0x03cc]=$'\317\214' [0x03cd]=$'\317\215' [0x03ce]=$'\317\216' [0x03cf]=$'\317\217'
+ [0x03d0]=$'\317\220' [0x03d1]=$'\317\221' [0x03d2]=$'\317\222' [0x03d3]=$'\317\223' [0x03d4]=$'\317\224'
+ [0x03d5]=$'\317\225' [0x03d6]=$'\317\226' [0x03d7]=$'\317\227' [0x03d8]=$'\317\230' [0x03d9]=$'\317\231'
+ [0x03da]=$'\317\232' [0x03db]=$'\317\233' [0x03dc]=$'\317\234' [0x03dd]=$'\317\235' [0x03de]=$'\317\236'
+ [0x03df]=$'\317\237' [0x03e0]=$'\317\240' [0x03e1]=$'\317\241' [0x03e2]=$'\317\242' [0x03e3]=$'\317\243'
+ [0x03e4]=$'\317\244' [0x03e5]=$'\317\245' [0x03e6]=$'\317\246' [0x03e7]=$'\317\247'
+
+
+ [0x1000]=$'\341\200\200' [0x1001]=$'\341\200\201' [0x1002]=$'\341\200\202' [0x1003]=$'\341\200\203' [0x1004]=$'\341\200\204'
+ [0x1005]=$'\341\200\205' [0x1006]=$'\341\200\206' [0x1007]=$'\341\200\207' [0x1008]=$'\341\200\210' [0x1009]=$'\341\200\211'
+ [0x100a]=$'\341\200\212' [0x100b]=$'\341\200\213' [0x100c]=$'\341\200\214' [0x100d]=$'\341\200\215' [0x100e]=$'\341\200\216'
+ [0x100f]=$'\341\200\217' [0x1010]=$'\341\200\220' [0x1011]=$'\341\200\221' [0x1012]=$'\341\200\222' [0x1013]=$'\341\200\223'
+ [0x1014]=$'\341\200\224' [0x1015]=$'\341\200\225' [0x1016]=$'\341\200\226' [0x1017]=$'\341\200\227' [0x1018]=$'\341\200\230'
+ [0x1019]=$'\341\200\231' [0x101a]=$'\341\200\232' [0x101b]=$'\341\200\233' [0x101c]=$'\341\200\234' [0x101d]=$'\341\200\235'
+ [0x101e]=$'\341\200\236' [0x101f]=$'\341\200\237' [0x1020]=$'\341\200\240' [0x1021]=$'\341\200\241' [0x1022]=$'\341\200\242'
+ [0x1023]=$'\341\200\243' [0x1024]=$'\341\200\244' [0x1025]=$'\341\200\245' [0x1026]=$'\341\200\246' [0x1027]=$'\341\200\247'
+ [0x1028]=$'\341\200\250' [0x1029]=$'\341\200\251' [0x102a]=$'\341\200\252' [0x102b]=$'\341\200\253' [0x102c]=$'\341\200\254'
+ [0x102d]=$'\341\200\255' [0x102e]=$'\341\200\256' [0x102f]=$'\341\200\257' [0x1030]=$'\341\200\260' [0x1031]=$'\341\200\261'
+ [0x1032]=$'\341\200\262' [0x1033]=$'\341\200\263' [0x1034]=$'\341\200\264' [0x1035]=$'\341\200\265' [0x1036]=$'\341\200\266'
+ [0x1037]=$'\341\200\267' [0x1038]=$'\341\200\270' [0x1039]=$'\341\200\271' [0x103a]=$'\341\200\272' [0x103b]=$'\341\200\273'
+ [0x103c]=$'\341\200\274' [0x103d]=$'\341\200\275' [0x103e]=$'\341\200\276' [0x103f]=$'\341\200\277' [0x1040]=$'\341\201\200'
+ [0x1041]=$'\341\201\201' [0x1042]=$'\341\201\202' [0x1043]=$'\341\201\203' [0x1044]=$'\341\201\204' [0x1045]=$'\341\201\205'
+ [0x1046]=$'\341\201\206' [0x1047]=$'\341\201\207' [0x1048]=$'\341\201\210' [0x1049]=$'\341\201\211' [0x104a]=$'\341\201\212'
+ [0x104b]=$'\341\201\213' [0x104c]=$'\341\201\214' [0x104d]=$'\341\201\215' [0x104e]=$'\341\201\216' [0x104f]=$'\341\201\217'
+
+ [0x10000]=$'\360\220\200\200' [0x10001]=$'\360\220\200\201' [0x10002]=$'\360\220\200\202' [0x10003]=$'\360\220\200\203' [0x10004]=$'\360\220\200\204'
+ [0x10005]=$'\360\220\200\205' [0x10006]=$'\360\220\200\206' [0x10007]=$'\360\220\200\207' [0x10008]=$'\360\220\200\210' [0x10009]=$'\360\220\200\211'
+ [0x1000a]=$'\360\220\200\212' [0x1000b]=$'\360\220\200\213' [0x1000c]=$'\360\220\200\214' [0x1000d]=$'\360\220\200\215' [0x1000e]=$'\360\220\200\216'
+ [0x1000f]=$'\360\220\200\217' [0x10010]=$'\360\220\200\220' [0x10011]=$'\360\220\200\221' [0x10012]=$'\360\220\200\222' [0x10013]=$'\360\220\200\223'
+ [0x10014]=$'\360\220\200\224' [0x10015]=$'\360\220\200\225' [0x10016]=$'\360\220\200\226' [0x10017]=$'\360\220\200\227' [0x10018]=$'\360\220\200\230'
+ [0x10019]=$'\360\220\200\231' [0x1001a]=$'\360\220\200\232' [0x1001b]=$'\360\220\200\233' [0x1001c]=$'\360\220\200\234' [0x1001d]=$'\360\220\200\235'
+ [0x1001e]=$'\360\220\200\236' [0x1001f]=$'\360\220\200\237' [0x10020]=$'\360\220\200\240' [0x10021]=$'\360\220\200\241' [0x10022]=$'\360\220\200\242'
+ [0x10023]=$'\360\220\200\243' [0x10024]=$'\360\220\200\244' [0x10025]=$'\360\220\200\245' [0x10026]=$'\360\220\200\246' [0x10027]=$'\360\220\200\247'
+ [0x10028]=$'\360\220\200\250' [0x10029]=$'\360\220\200\251' [0x1002a]=$'\360\220\200\252' [0x1002b]=$'\360\220\200\253' [0x1002c]=$'\360\220\200\254'
+ [0x1002d]=$'\360\220\200\255' [0x1002e]=$'\360\220\200\256' [0x1002f]=$'\360\220\200\257' [0x10030]=$'\360\220\200\260' [0x10031]=$'\360\220\200\261'
+ [0x10032]=$'\360\220\200\262' [0x10033]=$'\360\220\200\263' [0x10034]=$'\360\220\200\264' [0x10035]=$'\360\220\200\265' [0x10036]=$'\360\220\200\266'
+ [0x10037]=$'\360\220\200\267' [0x10038]=$'\360\220\200\270' [0x10039]=$'\360\220\200\271' [0x1003a]=$'\360\220\200\272' [0x1003b]=$'\360\220\200\273'
+ [0x1003c]=$'\360\220\200\274' [0x1003d]=$'\360\220\200\275' [0x1003e]=$'\360\220\200\276' [0x1003f]=$'\360\220\200\277' [0x10040]=$'\360\220\201\200'
+ [0x10041]=$'\360\220\201\201' [0x10042]=$'\360\220\201\202' [0x10043]=$'\360\220\201\203' [0x10044]=$'\360\220\201\204' [0x10045]=$'\360\220\201\205'
+ [0x10046]=$'\360\220\201\206' [0x10047]=$'\360\220\201\207' [0x10048]=$'\360\220\201\210' [0x10049]=$'\360\220\201\211' [0x1004a]=$'\360\220\201\212'
+ [0x1004b]=$'\360\220\201\213' [0x1004c]=$'\360\220\201\214' [0x1004d]=$'\360\220\201\215' [0x1004e]=$'\360\220\201\216' [0x1004f]=$'\360\220\201\217'
+
+ [0x1000000]=$'\371\200\200\200\200' [0x1000001]=$'\371\200\200\200\201' [0x1000002]=$'\371\200\200\200\202' [0x1000003]=$'\371\200\200\200\203' [0x1000004]=$'\371\200\200\200\204'
+ [0x1000005]=$'\371\200\200\200\205' [0x1000006]=$'\371\200\200\200\206' [0x1000007]=$'\371\200\200\200\207' [0x1000008]=$'\371\200\200\200\210' [0x1000009]=$'\371\200\200\200\211'
+ [0x100000a]=$'\371\200\200\200\212' [0x100000b]=$'\371\200\200\200\213' [0x100000c]=$'\371\200\200\200\214' [0x100000d]=$'\371\200\200\200\215' [0x100000e]=$'\371\200\200\200\216'
+ [0x100000f]=$'\371\200\200\200\217' [0x1000010]=$'\371\200\200\200\220' [0x1000011]=$'\371\200\200\200\221' [0x1000012]=$'\371\200\200\200\222' [0x1000013]=$'\371\200\200\200\223'
+ [0x1000014]=$'\371\200\200\200\224' [0x1000015]=$'\371\200\200\200\225' [0x1000016]=$'\371\200\200\200\226' [0x1000017]=$'\371\200\200\200\227' [0x1000018]=$'\371\200\200\200\230'
+ [0x1000019]=$'\371\200\200\200\231' [0x100001a]=$'\371\200\200\200\232' [0x100001b]=$'\371\200\200\200\233' [0x100001c]=$'\371\200\200\200\234' [0x100001d]=$'\371\200\200\200\235'
+ [0x100001e]=$'\371\200\200\200\236' [0x100001f]=$'\371\200\200\200\237' [0x1000020]=$'\371\200\200\200\240' [0x1000021]=$'\371\200\200\200\241' [0x1000022]=$'\371\200\200\200\242'
+ [0x1000023]=$'\371\200\200\200\243' [0x1000024]=$'\371\200\200\200\244' [0x1000025]=$'\371\200\200\200\245' [0x1000026]=$'\371\200\200\200\246' [0x1000027]=$'\371\200\200\200\247'
+ [0x1000028]=$'\371\200\200\200\250' [0x1000029]=$'\371\200\200\200\251' [0x100002a]=$'\371\200\200\200\252' [0x100002b]=$'\371\200\200\200\253' [0x100002c]=$'\371\200\200\200\254'
+ [0x100002d]=$'\371\200\200\200\255' [0x100002e]=$'\371\200\200\200\256' [0x100002f]=$'\371\200\200\200\257' [0x1000030]=$'\371\200\200\200\260' [0x1000031]=$'\371\200\200\200\261'
+ [0x1000032]=$'\371\200\200\200\262' [0x1000033]=$'\371\200\200\200\263' [0x1000034]=$'\371\200\200\200\264' [0x1000035]=$'\371\200\200\200\265' [0x1000036]=$'\371\200\200\200\266'
+ [0x1000037]=$'\371\200\200\200\267' [0x1000038]=$'\371\200\200\200\270' [0x1000039]=$'\371\200\200\200\271' [0x100003a]=$'\371\200\200\200\272' [0x100003b]=$'\371\200\200\200\273'
+ [0x100003c]=$'\371\200\200\200\274' [0x100003d]=$'\371\200\200\200\275' [0x100003e]=$'\371\200\200\200\276' [0x100003f]=$'\371\200\200\200\277' [0x1000040]=$'\371\200\200\201\200'
+ [0x1000041]=$'\371\200\200\201\201' [0x1000042]=$'\371\200\200\201\202' [0x1000043]=$'\371\200\200\201\203' [0x1000044]=$'\371\200\200\201\204' [0x1000045]=$'\371\200\200\201\205'
+ [0x1000046]=$'\371\200\200\201\206' [0x1000047]=$'\371\200\200\201\207' [0x1000048]=$'\371\200\200\201\210' [0x1000049]=$'\371\200\200\201\211' [0x100004a]=$'\371\200\200\201\212'
+ [0x100004b]=$'\371\200\200\201\213' [0x100004c]=$'\371\200\200\201\214' [0x100004d]=$'\371\200\200\201\215' [0x100004e]=$'\371\200\200\201\216' [0x100004f]=$'\371\200\200\201\217'
+
+ [0x70000000]=$'\375\260\200\200\200\200' [0x70000001]=$'\375\260\200\200\200\201' [0x70000002]=$'\375\260\200\200\200\202' [0x70000003]=$'\375\260\200\200\200\203'
+ [0x70000004]=$'\375\260\200\200\200\204' [0x70000005]=$'\375\260\200\200\200\205' [0x70000006]=$'\375\260\200\200\200\206' [0x70000007]=$'\375\260\200\200\200\207' [0x70000008]=$'\375\260\200\200\200\210'
+ [0x70000009]=$'\375\260\200\200\200\211' [0x7000000a]=$'\375\260\200\200\200\212' [0x7000000b]=$'\375\260\200\200\200\213' [0x7000000c]=$'\375\260\200\200\200\214' [0x7000000d]=$'\375\260\200\200\200\215'
+ [0x7000000e]=$'\375\260\200\200\200\216' [0x7000000f]=$'\375\260\200\200\200\217' [0x70000010]=$'\375\260\200\200\200\220' [0x70000011]=$'\375\260\200\200\200\221' [0x70000012]=$'\375\260\200\200\200\222'
+ [0x70000013]=$'\375\260\200\200\200\223' [0x70000014]=$'\375\260\200\200\200\224' [0x70000015]=$'\375\260\200\200\200\225' [0x70000016]=$'\375\260\200\200\200\226' [0x70000017]=$'\375\260\200\200\200\227'
+ [0x70000018]=$'\375\260\200\200\200\230' [0x70000019]=$'\375\260\200\200\200\231' [0x7000001a]=$'\375\260\200\200\200\232' [0x7000001b]=$'\375\260\200\200\200\233' [0x7000001c]=$'\375\260\200\200\200\234'
+ [0x7000001d]=$'\375\260\200\200\200\235' [0x7000001e]=$'\375\260\200\200\200\236' [0x7000001f]=$'\375\260\200\200\200\237' [0x70000020]=$'\375\260\200\200\200\240' [0x70000021]=$'\375\260\200\200\200\241'
+ [0x70000022]=$'\375\260\200\200\200\242' [0x70000023]=$'\375\260\200\200\200\243' [0x70000024]=$'\375\260\200\200\200\244' [0x70000025]=$'\375\260\200\200\200\245' [0x70000026]=$'\375\260\200\200\200\246'
+ [0x70000027]=$'\375\260\200\200\200\247' [0x70000028]=$'\375\260\200\200\200\250' [0x70000029]=$'\375\260\200\200\200\251' [0x7000002a]=$'\375\260\200\200\200\252' [0x7000002b]=$'\375\260\200\200\200\253'
+ [0x7000002c]=$'\375\260\200\200\200\254' [0x7000002d]=$'\375\260\200\200\200\255' [0x7000002e]=$'\375\260\200\200\200\256' [0x7000002f]=$'\375\260\200\200\200\257' [0x70000030]=$'\375\260\200\200\200\260'
+ [0x70000031]=$'\375\260\200\200\200\261' [0x70000032]=$'\375\260\200\200\200\262' [0x70000033]=$'\375\260\200\200\200\263' [0x70000034]=$'\375\260\200\200\200\264' [0x70000035]=$'\375\260\200\200\200\265'
+ [0x70000036]=$'\375\260\200\200\200\266' [0x70000037]=$'\375\260\200\200\200\267' [0x70000038]=$'\375\260\200\200\200\270' [0x70000039]=$'\375\260\200\200\200\271' [0x7000003a]=$'\375\260\200\200\200\272'
+ [0x7000003b]=$'\375\260\200\200\200\273' [0x7000003c]=$'\375\260\200\200\200\274' [0x7000003d]=$'\375\260\200\200\200\275' [0x7000003e]=$'\375\260\200\200\200\276' [0x7000003f]=$'\375\260\200\200\200\277'
+ [0x70000040]=$'\375\260\200\200\201\200' [0x70000041]=$'\375\260\200\200\201\201' [0x70000042]=$'\375\260\200\200\201\202' [0x70000043]=$'\375\260\200\200\201\203' [0x70000044]=$'\375\260\200\200\201\204'
+ [0x70000045]=$'\375\260\200\200\201\205' [0x70000046]=$'\375\260\200\200\201\206' [0x70000047]=$'\375\260\200\200\201\207' [0x70000048]=$'\375\260\200\200\201\210' [0x70000049]=$'\375\260\200\200\201\211'
+ [0x7000004a]=$'\375\260\200\200\201\212' [0x7000004b]=$'\375\260\200\200\201\213' [0x7000004c]=$'\375\260\200\200\201\214' [0x7000004d]=$'\375\260\200\200\201\215' [0x7000004e]=$'\375\260\200\200\201\216'
+
+
+
+ )
+TestCodePage en_US.UTF-8 C_UTF_8
+
+if [ ${ErrorCnt} -gt 0 ]; then
+ echo "Failed ${ErrorCnt} of ${TestCnt} Unicode tests"
+else
+ echo "Passed all ${TestCnt} Unicode tests"
+fi
diff --git a/tests/unicode2.sub b/tests/unicode2.sub
new file mode 100644
index 0000000..f10cdec
--- /dev/null
+++ b/tests/unicode2.sub
@@ -0,0 +1,22 @@
+export LANG=en_US.UTF-8
+
+printf '%s\n' "$(printf '\uff')" | od -b
+printf '%s\n' $'\uff' | od -b
+
+printf '\uff'\\n | od -b
+echo $'\uff' | od -b
+
+printf '\uffff'\\n | od -b
+echo $'\uffff' | od -b
+
+printf '\Ufffffffe'\\n | od -b
+echo $'\Ufffffffe' | od -b
+
+printf '\Uffffffff'\\n | od -b
+echo $'\Uffffffff' | od -b
+
+LC_CTYPE=C printf '\uff'\\n | od -b
+LC_CTYPE=ru_RU.CP1251 printf '\uff'\\n | od -b
+LC_CTYPE=en_US.UTF-8 printf '\uff'\\n | od -b
+
+echo -e '\u0041 \u00a3 \u0152' | od -b
diff --git a/tests/unicode3.sub b/tests/unicode3.sub
new file mode 100644
index 0000000..f79871f
--- /dev/null
+++ b/tests/unicode3.sub
@@ -0,0 +1,7 @@
+payload=$'\065\247\100\063\231\053\306\123\070\237\242\352\263'
+"$payload"
+
+printf %q "$payload"
+echo
+
+set -x ; : "$payload"
diff --git a/tests/varenv.right b/tests/varenv.right
index df8086d..2d98b22 100644
--- a/tests/varenv.right
+++ b/tests/varenv.right
@@ -51,6 +51,21 @@ after fff3: x=4
|0|12|
|y|
|y|
+a:b:c:d
+a-b-c-d
+a:b:c:d
+g: ,
+f: ,
+FIN: asdf fdsa, asdf fdsa
+g: v = , w =
+f: v = , w =
+FIN: v = two, w = one
+declare -Ar FOOBAR='([foo]="bar" )'
+declare -Ar FOOBAR='([foo]="bar" )'
+declare -ar FOOBAR2='([0]="bar")'
+declare -ar FOOBAR2='([0]="bar")'
+F OUTSIDE
+F OUTSIDE
a=z
a=b
a=z
diff --git a/tests/varenv.sh b/tests/varenv.sh
index 77776f9..6576282 100644
--- a/tests/varenv.sh
+++ b/tests/varenv.sh
@@ -202,5 +202,18 @@ $THIS_SH ./varenv1.sub
# more tests; bugs in bash up to version 2.05a
$THIS_SH ./varenv2.sub
+# more tests; bugs in bash IFS scoping up through version 4.2
+$THIS_SH ./varenv3.sub
+
+# scoping problems with declare -g through bash-4.2
+${THIS_SH} ./varenv4.sub
+
+# more scoping and declaration problems with -g and arrays through bash-4.2
+${THIS_SH} ./varenv5.sub
+
+# variable scoping in the presence of nameref
+${THIS_SH} ./varenv6.sub
+
# make sure variable scoping is done right
tt() { typeset a=b;echo a=$a; };a=z;echo a=$a;tt;echo a=$a
+
diff --git a/tests/varenv3.sub b/tests/varenv3.sub
new file mode 100644
index 0000000..1384fcb
--- /dev/null
+++ b/tests/varenv3.sub
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+oifs=$IFS
+
+inner () {
+#recho inner: "$IFS" >&2
+ echo a/b/c/d
+ exit 0
+}
+
+outer() {
+#recho outer: "$IFS" >&2
+for i in 1; do
+ IFS=/ read m v k a < <(IFS=$oifs inner)
+
+echo $m:$v:$k:$a
+done
+}
+
+outer
+unset m k v a b c d
+
+for j in 1; do
+ IFS=: read a b c d
+done < <(outer)
+
+echo $a-$b-$c-$d
+unset m k v a b c d
+
+IFS=: read a b c d < <(outer)
+
+echo $a:$b:$c:$d
diff --git a/tests/varenv4.sub b/tests/varenv4.sub
new file mode 100644
index 0000000..4852ad6
--- /dev/null
+++ b/tests/varenv4.sub
@@ -0,0 +1,44 @@
+f()
+{
+ local -a v
+ local -a w
+
+ g
+ echo "f: ${v[@]}, ${w[@]}"
+}
+
+g()
+{
+ aux=v
+ declare -ga "$aux=( asdf fdsa )"
+ declare -ga w=( asdf fdsa )
+
+ echo "g: ${v[@]}, ${w[@]}"
+}
+
+f
+echo "FIN: ${v[@]}, ${w[@]}"
+
+unset v w
+unset -f f g
+
+f()
+{
+ local v
+ local w
+
+ g
+ echo f: v = $v, w = $w
+}
+
+g()
+{
+ aux=v
+ declare -g w=one
+ declare -g "$aux=two"
+
+ echo g: v = $v, w = $w
+}
+
+f
+echo FIN: v = $v, w = $w
diff --git a/tests/varenv5.sub b/tests/varenv5.sub
new file mode 100644
index 0000000..8ebfa36
--- /dev/null
+++ b/tests/varenv5.sub
@@ -0,0 +1,16 @@
+function foobar {
+ declare -rgA FOOBAR=([foo]=bar)
+ declare -p FOOBAR
+}
+foobar
+declare -p FOOBAR
+
+unset -f foobar
+
+foobar() {
+ declare -rga FOOBAR2=([foo]=bar)
+ declare -p FOOBAR2
+}
+
+foobar
+declare -p FOOBAR2
diff --git a/tests/varenv6.sub b/tests/varenv6.sub
new file mode 100644
index 0000000..d0269fb
--- /dev/null
+++ b/tests/varenv6.sub
@@ -0,0 +1,28 @@
+f()
+{
+ local str=F
+ g str
+}
+
+g()
+{
+ local -n ref=$1
+ printf "%s " "$ref"
+ ref=G
+}
+
+str=OUTSIDE;
+f
+
+printf "%s\n" "$str"
+
+unset -f f g
+unset str
+
+f() { local -a arr=(F); g arr; };
+
+g() { local -n ref=$1; printf "%s " "${ref[0]}"; ref=(G); };
+
+arr=(OUTSIDE);
+f;
+printf "%s\n" "${arr[0]}"
diff --git a/tests/vredir.right b/tests/vredir.right
index 585a10e..07e02a7 100644
--- a/tests/vredir.right
+++ b/tests/vredir.right
@@ -20,7 +20,7 @@ bar ()
exec {v}> $TMPFILE;
echo $v
}
-11
+10
line 1
line 2
line 3
@@ -35,11 +35,11 @@ EOF
echo $v
}
-11
+10
foo 1
foo 2
foo 3
-11
+10
/bin/bash
/bin/csh
/bin/ksh
@@ -64,7 +64,7 @@ iclosev ()
/bin/zsh
./vredir3.sub: line 4: v: ambiguous redirect
after
-11 12
+10 11
a
a
swizzle is a function
@@ -75,7 +75,7 @@ swizzle ()
exec {stdin}<&$fd0;
exec {stdout}>&$fd1
}
-13 11
+12 10
a
a
swizzle is a function
@@ -88,7 +88,5 @@ swizzle ()
}
ok 1
./vredir6.sub: redirection error: cannot duplicate fd: Invalid argument
-./vredir6.sub: line 10: /dev/null: Invalid argument
-./vredir6.sub: redirection error: cannot duplicate fd: Invalid argument
./vredir6.sub: line 13: v: Invalid argument
unset