run-file () { local spec_name=$1; shift; local spec_file=spec/$spec_name.test.sh; local suite; suite=$(test/sh_spec.py --print-spec-suite $spec_file); local spec_subdir; case $suite in osh) spec_subdir='osh-cpp' ;; ysh) spec_subdir='ysh-cpp' ;; *) die "Invalid suite $suite" ;; esac; local base_dir=_tmp/spec/$spec_subdir; mkdir -v -p $base_dir; sh-spec $spec_file --timeout 10 --oils-bin-dir $PWD/bin --oils-cpp-bin-dir $REPO_ROOT/_bin/cxx-asan --tsv-output $base_dir/${spec_name}.tsv "$@" } array: spec test case results

Results for array.test.sh

statusoshosh-cpp
pass 6565
FAIL 33
total6868
caseoshosh-cppdescription
0pass pass nounset / set -u with empty array (bug in bash 4.3, fixed in 4.4)
1pass pass local array
2pass pass Command with with word splitting in array
3pass pass space before ( in array initialization
4pass pass array over multiple lines
5pass pass array with invalid token
6pass pass array with empty string
7pass pass Retrieve index
8pass pass Retrieve out of bounds index
9pass pass Negative index
10pass pass Negative index and sparse array
11pass pass Negative index and sparse array
12pass pass Length after unset
13pass pass Retrieve index that is a variable
14pass pass Retrieve index that is a variable without $
15pass pass Retrieve index that is a command sub
16pass pass Retrieve array indices with ${!a}
17pass pass Retrieve sparse array indices with ${!a}
18pass pass ${!a[1]} is named ref in bash
19pass pass ${!a} on array
20pass pass All elements unquoted
21pass pass All elements quoted
22pass pass $*
23pass pass "$*"
24pass pass Interpolate array into array
25pass pass Exporting array doesn't do anything, not even first element
26pass pass strict_array prevents exporting array
27pass pass Arrays can't be used as env bindings
28pass pass Set element
29pass pass Set element with var ref
30pass pass Set element with array ref
31pass pass Set array item to array
32pass pass Slice of array with [@]
33pass pass Negative slice begin
34pass pass Negative slice length
35pass pass Slice with arithmetic
36pass pass Number of elements
37pass pass Length of an element
38pass pass Iteration
39pass pass glob within array yields separate elements
40pass pass declare array and then append
41pass pass Array syntax in wrong place
42FAIL FAIL Single array with :-
detailsdetails
43pass pass Stripping a whole array unquoted
44pass pass Stripping a whole array quoted
45pass pass Multiple subscripts not allowed
46pass pass Length op, index op, then transform op is not allowed
47pass pass ${mystr[@]} and ${mystr[*]} are no-ops
48pass pass ${mystr[@]} and ${mystr[*]} disallowed with strict_array
49pass pass Create a "user" array out of the argv array
50pass pass Tilde expansion within array
51pass pass Brace Expansion within Array
52pass pass array default
53pass pass Singleton Array Copy and Assign. OSH can't index strings with ints
54pass pass declare -a / local -a is empty array
55pass pass Create sparse array
56pass pass Create sparse array implicitly
57pass pass Append sparse arrays
58pass pass Slice of sparse array with [@]
59pass pass Using an array itself as the index on LHS
60pass pass Using an array itself as the index on RHS
61pass pass a[$x$y] on LHS and RHS
62pass pass Dynamic parsing of LHS a[$code]=value
63pass pass Dynamic parsing of RHS ${a[$code]}
64pass pass Is element set? test -v a[i]
65pass pass [[ -v a[i] ]]
66FAIL FAIL test -v a[i] with arith expressions
detailsdetails
67FAIL FAIL More arith expressions in [[ -v array[expr]] ]]
detailsdetails
130 passed, 0 OK, 0 not implemented, 0 BUG, 3 failed, 0 timeouts, 0 cases skipped
3 failed under osh

Details on runs that didn't PASS

osh42 Single array with :-

[osh stdout] Expected "['none', 'x', 'none']\n", got "['x', '']\n"

stdout:
['x', '']
stderr:
osh-cpp42 Single array with :-

[osh-cpp stdout] Expected "['none', 'x', 'none']\n", got "['x', '']\n"

stdout:
['x', '']
stderr:
osh66 test -v a[i] with arith expressions

[osh stdout] Expected 'status=0\nstatus=1\n\ndbracket\nstatus=0\nstatus=1\n' Got 'status=1\nstatus=1\n\ndbracket\nstatus=1\nstatus=1\n'

stdout:
status=1
status=1

dbracket
status=1
status=1
stderr:
osh-cpp66 test -v a[i] with arith expressions

[osh-cpp stdout] Expected 'status=0\nstatus=1\n\ndbracket\nstatus=0\nstatus=1\n' Got 'status=1\nstatus=1\n\ndbracket\nstatus=1\nstatus=1\n'

stdout:
status=1
status=1

dbracket
status=1
status=1
stderr:
osh67 More arith expressions in [[ -v array[expr]] ]]

[osh stdout] Expected 'zero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n' Got 'zero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n'

stdout:
zero=1
one=1
two=1
---
zero=1
one=1
two=1
---
zero=1
one=1
two=1
stderr:
osh-cpp67 More arith expressions in [[ -v array[expr]] ]]

[osh-cpp stdout] Expected 'zero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n---\nzero=0\none=0\ntwo=1\n' Got 'zero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n---\nzero=1\none=1\ntwo=1\n'

stdout:
zero=1
one=1
two=1
---
zero=1
one=1
two=1
---
zero=1
one=1
two=1
stderr: