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-compat: spec test case results

Results for array-compat.test.sh

statusoshosh-cpp
pass 77
ok 33
FAIL 22
total1212
caseoshosh-cppdescription
0pass pass Assignment Causes Array Decay
1pass pass Array Decay with IFS
2pass pass User arrays decay
3ok ok strict_array: $array is not valid in OSH, is ${array[0]} in ksh/bash
detailsdetails
4ok ok strict_array: ${array} is not valid in OSH, is ${array[0]} in ksh/bash
detailsdetails
5pass pass Assign to array index without initialization
6pass pass a[40] grows array
7pass pass array decays to string when comparing with [[ a = b ]]
8ok ok ++ on a whole array increments the first element (disallowed with strict_array)
detailsdetails
9pass pass Apply vectorized operations on ${a[*]}
10FAIL FAIL value.BashArray internal representation - Indexed
detailsdetails
11FAIL FAIL value.BashArray internal representation - Assoc (ordering is a problem)
detailsdetails
14 passed, 6 OK, 0 not implemented, 0 BUG, 2 failed, 0 timeouts, 0 cases skipped
2 failed under osh

Details on runs that didn't PASS

osh3 strict_array: $array is not valid in OSH, is ${array[0]} in ksh/bash

stdout:
stderr: 
  echo $a
       ^~
[ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *)
osh-cpp3 strict_array: $array is not valid in OSH, is ${array[0]} in ksh/bash

stdout:
stderr: 
  echo $a
       ^~
[ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *)
osh4 strict_array: ${array} is not valid in OSH, is ${array[0]} in ksh/bash

stdout:
stderr: 
  echo ${a}
       ^~
[ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *)
osh-cpp4 strict_array: ${array} is not valid in OSH, is ${array[0]} in ksh/bash

stdout:
stderr: 
  echo ${a}
       ^~
[ stdin ]:4: fatal: Array 'a' can't be referred to as a scalar (without @ or *)
osh8 ++ on a whole array increments the first element (disallowed with strict_array)

stdout:
stderr: 
  (( a++ ))  # doesn't make sense
     ^
[ stdin ]:4: fatal: Expected a value convertible to integer, got BashArray
osh-cpp8 ++ on a whole array increments the first element (disallowed with strict_array)

stdout:
stderr: 
  (( a++ ))  # doesn't make sense
     ^
[ stdin ]:4: fatal: Expected a value convertible to integer, got BashArray
osh10 value.BashArray internal representation - Indexed

[osh stdout] Expected 'declare -a z=()\ndeclare -a z=([0]="b" [1]="c")\ndeclare -a z=([0]="b" [1]="c" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ-append" [5]="d" [6]="f" [7]="g")\n[\'keys\', \'0\', \'1\', \'5\', \'6\', \'7\']\n[\'values\', \'b-mystr\', \'ZZZ-append\', \'d\', \'f\', \'g\']\nstatus=1\n' Got 'z=()\nz=(b c)\nz=(); z[0]=b z[1]=c z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=g\n'
[osh status] Expected 0, got 1

stdout:
z=()
z=(b c)
z=(); z[0]=b z[1]=c z[5]=d
z=(); z[0]=b z[1]=ZZZ z[5]=d
z=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=g
stderr:
  z+=-mystr
  ^~~
[ stdin ]:18: fatal: Can't append string to array
osh-cpp10 value.BashArray internal representation - Indexed

[osh-cpp stdout] Expected 'declare -a z=()\ndeclare -a z=([0]="b" [1]="c")\ndeclare -a z=([0]="b" [1]="c" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d")\ndeclare -a z=([0]="b" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ" [5]="d" [6]="f" [7]="g")\ndeclare -a z=([0]="b-mystr" [1]="ZZZ-append" [5]="d" [6]="f" [7]="g")\n[\'keys\', \'0\', \'1\', \'5\', \'6\', \'7\']\n[\'values\', \'b-mystr\', \'ZZZ-append\', \'d\', \'f\', \'g\']\nstatus=1\n' Got 'z=()\nz=(b c)\nz=(); z[0]=b z[1]=c z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d\nz=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=g\n'
[osh-cpp status] Expected 0, got 1

stdout:
z=()
z=(b c)
z=(); z[0]=b z[1]=c z[5]=d
z=(); z[0]=b z[1]=ZZZ z[5]=d
z=(); z[0]=b z[1]=ZZZ z[5]=d z[6]=f z[7]=g
stderr:
  z+=-mystr
  ^~~
[ stdin ]:18: fatal: Can't append string to array
osh11 value.BashArray internal representation - Assoc (ordering is a problem)

[osh stdout] Expected 'declare -A A=([k]="v" )\n[\'keys\', \'k\']\n[\'values\', \'v\']\n' Got "A=(['k']=v)\n['keys', 'k']\n['values', 'v']\n"

stdout:
A=(['k']=v)
['keys', 'k']
['values', 'v']
stderr:
osh-cpp11 value.BashArray internal representation - Assoc (ordering is a problem)

[osh-cpp stdout] Expected 'declare -A A=([k]="v" )\n[\'keys\', \'k\']\n[\'values\', \'v\']\n' Got "A=(['k']=v)\n['keys', 'k']\n['values', 'v']\n"

stdout:
A=(['k']=v)
['keys', 'k']
['values', 'v']
stderr: