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

Results for var-op-test.test.sh

statusoshosh-cpp
pass 2525
ok 33
total2828
caseoshosh-cppdescription
0pass pass Lazy Evaluation of Alternative
1pass pass Default value when empty
2pass pass Default value when unset
3ok ok Unquoted with array as default value
detailsdetails
4ok ok Quoted with array as default value
detailsdetails
5ok ok Assign default with array
detailsdetails
6pass pass Assign default value when empty
7pass pass Assign default value when unset
8pass pass ${v:+foo} Alternative value when empty
9pass pass ${v+foo} Alternative value when unset
10pass pass "${x+foo}" quoted (regression)
11pass pass ${s+foo} and ${s:+foo} when set -u
12pass pass "${array[@]} with set -u (bash is outlier)
13pass pass "${undefined[@]+foo}" and "${undefined[@]:+foo}", with set -u
14pass pass "${a[@]+foo}" and "${a[@]:+foo}" - operators are equivalent on arrays?
15pass pass Nix idiom ${!hooksSlice+"${!hooksSlice}"} - was workaround for obsolete bash 4.3 bug
16pass pass ${v-foo} and ${v:-foo} when set -u
17pass pass array and - and +
18pass pass $@ and - and +
19pass pass assoc array and - and +
20pass pass Error when empty
21pass pass Error when unset
22pass pass Error when unset
23pass pass ${var=x} dynamic scope
24pass pass array ${arr[0]=x}
25pass pass assoc array ${arr["k"]=x}
26pass pass "\z" as arg
27pass pass "\e" as arg
50 passed, 6 OK, 0 not implemented, 0 BUG, 0 failed, 0 timeouts, 0 cases skipped

Details on runs that didn't PASS

osh3 Unquoted with array as default value

stdout:
['Xx1 2', '3 4xX']
['Xx1', '2', '3', '4xX']
stderr:
osh-cpp3 Unquoted with array as default value

stdout:
['Xx1 2', '3 4xX']
['Xx1', '2', '3', '4xX']
stderr:
osh4 Quoted with array as default value

stdout:
['Xx1 2', '3 4xX']
['Xx1 2 3 4xX']
stderr:
osh-cpp4 Quoted with array as default value

stdout:
['Xx1 2', '3 4xX']
['Xx1 2 3 4xX']
stderr:
osh5 Assign default with array

stdout:
['Xx1 2', '3 4xX']
['x1 2 3 4x']
stderr:
osh-cpp5 Assign default with array

stdout:
['Xx1 2', '3 4xX']
['x1 2 3 4x']
stderr: