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 "$@" } assign-extended: spec test case results

Results for assign-extended.test.sh

statusoshosh-cpp
pass 3333
ok 11
N-I 11
total3535
caseoshosh-cppdescription
0pass pass local -a
1pass pass declare -a
2N-I N-I indexed LHS with spaces (not allowed in OSH)
detailsdetails
3pass pass declare -f exit code indicates function existence
4pass pass declare -F prints function names
5pass pass declare -p var (exit status)
6pass pass declare
7pass pass declare -p
8pass pass declare -p doesn't print binary data, but can be loaded into bash
9pass pass declare -p var
10pass pass declare -p arr
11pass pass declare -p foo=bar doesn't make sense
12pass pass declare -pnrx
13pass pass declare -paA
14pass pass declare -pnrx var
15pass pass declare -pg
16pass pass declare -pg var
17pass pass ble.sh: eval -- "$(declare -p var arr)"
18pass pass eval -- "$(declare -p arr)" (restore arrays w/ unset elements)
19pass pass typeset -f
20pass pass typeset -p
21pass pass typeset -r makes a string readonly
22pass pass typeset -ar makes it readonly
23pass pass typeset -x makes it exported
24pass pass Multiple assignments / array assignments on a line
25pass pass Env bindings shouldn't contain array assignments
26pass pass syntax error in array assignment
27pass pass declare -g (bash-specific; bash-completion uses it)
28ok ok myvar=typeset (another form of dynamic assignment)
detailsdetails
29pass pass dynamic array parsing is not allowed
30pass pass dynamic flag in array in assign builtin
31pass pass typeset +x
32pass pass typeset +r removes read-only attribute (TODO: documented in bash to do nothing)
33pass pass function name with /
34pass pass invalid var name
66 passed, 2 OK, 2 not implemented, 0 BUG, 0 failed, 0 timeouts, 0 cases skipped

Details on runs that didn't PASS

osh2 indexed LHS with spaces (not allowed in OSH)

stdout:
status=127
[]
stderr:
  a[1 * 1]=x a[ 1 + 2 ]=z
  ^~
[ stdin ]:1: 'a[1' not found (OILS-ERR-100)
osh-cpp2 indexed LHS with spaces (not allowed in OSH)

stdout:
status=127
[]
stderr:
  a[1 * 1]=x a[ 1 + 2 ]=z
  ^~
[ stdin ]:1: 'a[1' not found (OILS-ERR-100)
osh28 myvar=typeset (another form of dynamic assignment)

stdout:
a b
stderr:
osh-cpp28 myvar=typeset (another form of dynamic assignment)

stdout:
a b
stderr: