internal fixes for declare; additional tests for broken wcwidth()

This commit is contained in:
Chet Ramey
2024-02-27 14:40:31 -05:00
parent 43ecbeb31e
commit 9b2a8c6d65
13 changed files with 539 additions and 504 deletions
+22 -22
View File
@@ -1,6 +1,6 @@
./array.tests: line 28: syntax error near unexpected token `&'
./array.tests: line 28: `test=(first & second)'
./array.tests: line 34: syntax error near unexpected token `&'
./array.tests: line 34: `test=(first & second)'
1
abcde
abcde
@@ -26,7 +26,7 @@ hello world
11
3
bdef hello world test expression test 2
./array.tests: line 92: readonly: `a[5]': not a valid identifier
./array.tests: line 98: readonly: `a[5]': not a valid identifier
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
declare -ar c
declare -ar a=([1]="" [2]="bdef" [5]="hello world" [6]="test expression" [15]="test 2")
@@ -46,17 +46,17 @@ declare -ar c
declare -a d=([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")
declare -a e=([0]="test")
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 116: a: readonly variable
./array.tests: line 118: b[]: bad array subscript
./array.tests: line 119: b[*]: bad array subscript
./array.tests: line 122: a: readonly variable
./array.tests: line 124: b[]: bad array subscript
./array.tests: line 125: b[*]: bad array subscript
this
./array.tests: line 122: c[-2]: bad array subscript
./array.tests: line 123: c: bad array subscript
./array.tests: line 128: c[-2]: bad array subscript
./array.tests: line 129: c: bad array subscript
./array.tests: line 125: d[7]: cannot assign list to array member
./array.tests: line 127: []=abcde: bad array subscript
./array.tests: line 128: [*]=last: cannot assign to non-numeric index
./array.tests: line 129: [-65]=negative: bad array subscript
./array.tests: line 131: d[7]: cannot assign list to array member
./array.tests: line 133: []=abcde: bad array subscript
./array.tests: line 134: [*]=last: cannot assign to non-numeric index
./array.tests: line 135: [-65]=negative: bad array subscript
declare -a BASH_ARGC=()
declare -a BASH_ARGV=()
declare -a BASH_LINENO=([0]="0")
@@ -69,8 +69,8 @@ declare -ar c
declare -a d=([1]="test test")
declare -a e=()
declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")
./array.tests: line 137: unset: ps1: not an array variable
./array.tests: line 141: declare: c: readonly variable
./array.tests: line 143: unset: ps1: not an array variable
./array.tests: line 147: declare: c: readonly variable
this of
this is a test of read using arrays
this test
@@ -123,7 +123,7 @@ argv[1] = </>
55
49
6 -- 6
./array.tests: line 232: [-10]: bad array subscript
./array.tests: line 238: [-10]: bad array subscript
0
42 14 44
grep [ 123 ] *
@@ -131,9 +131,9 @@ grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
./array.tests: line 261: syntax error near unexpected token `&'
./array.tests: line 261: `badarray=( metacharacters like & need to be quoted in compound assignments)'
./array.tests: line 265: narray: unbound variable
./array.tests: line 267: syntax error near unexpected token `&'
./array.tests: line 267: `badarray=( metacharacters like & need to be quoted in compound assignments)'
./array.tests: line 271: 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: declare: `[]=asdf': not a valid identifier
@@ -160,10 +160,10 @@ for case if then else
12 14 16 18 20
4414758999202
aaa bbb
./array.tests: line 315: syntax error near unexpected token `<>'
./array.tests: line 315: `metas=( <> < > ! )'
./array.tests: line 316: syntax error near unexpected token `<>'
./array.tests: line 316: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
./array.tests: line 321: syntax error near unexpected token `<>'
./array.tests: line 321: `metas=( <> < > ! )'
./array.tests: line 322: syntax error near unexpected token `<>'
./array.tests: line 322: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5