spec test index / oilshell.org
| status | dash | bash | mksh | ash | osh | |
| pass | 16 | 14 | 13 | 16 | 13 | |
| ok | 0 | 1 | 1 | 0 | 0 | |
| BUG | 1 | 2 | 3 | 1 | 3 | |
| FAIL | 0 | 0 | 0 | 0 | 1 | |
| total | 17 | 17 | 17 | 17 | 17 | |
| case | dash | bash | mksh | ash | osh | description |
| 0 | pass | pass | pass | pass | pass | getopts empty |
| 1 | pass | pass | pass | pass | pass | getopts sees unknown arg |
| 2 | pass | pass | pass | pass | pass | getopts three invocations |
| 3 | pass | pass | pass | pass | pass | getopts resets OPTARG |
| 4 | pass | pass | pass | pass | pass | Basic getopts invocation |
| 5 | pass | ok | ok | pass | pass | getopts with invalid variable name |
| details | details | |||||
| 6 | pass | pass | pass | pass | pass | getopts with invalid flag |
| 7 | pass | pass | pass | pass | pass | getopts missing required argument |
| 8 | pass | pass | pass | pass | pass | getopts doesn't look for flags after args |
| 9 | pass | pass | pass | pass | pass | getopts with explicit args |
| 10 | pass | pass | pass | pass | pass | OPTIND |
| 11 | pass | pass | BUG | pass | BUG | OPTIND after multiple getopts with same spec |
| details | details | |||||
| 12 | BUG | pass | BUG | BUG | BUG | OPTIND after multiple getopts with different spec |
| details | details | details | details | |||
| 13 | pass | BUG | BUG | pass | BUG | OPTIND narrowed down |
| details | details | details | ||||
| 14 | pass | pass | pass | pass | pass | Getopts parses the function's arguments |
| 15 | pass | pass | pass | pass | pass | Local OPTIND |
| 16 | pass | BUG | pass | pass | FAIL | Flags can be smooshed together, e.g. -ab |
| details | details |
72 passed, 2 OK, 0 not implemented, 10 BUG, 1 failed, 0 timeouts, 0 cases skipped 1 failed under osh
| bash | 5 getopts with invalid variable name stdout: status=1 opt= OPTARG=foo OPTIND=3stderr: /home/andy/git/oilshell/oil/_tmp/spec-bin/bash: line 2: getopts: `opt-': not a valid identifier |
| mksh | 5 getopts with invalid variable name stdout: status=1 opt= OPTARG= OPTIND=1stderr: /home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[2]: getopts: opt-: is not an identifier |
| mksh | 11 OPTIND after multiple getopts with same spec stdout: 1 - - 4 4stderr: /home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[13]: getopts: arguments changed since last call |
| osh | 11 OPTIND after multiple getopts with same spec stdout: 1 - - 4 4stderr: |
| dash | 12 OPTIND after multiple getopts with different spec stdout: . 2 - - - 5 _ 2stderr: No arg for -f option |
| mksh | 12 OPTIND after multiple getopts with different spec stdout: . 2 - - 5 5stderr: /home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[14]: getopts: arguments changed since last call |
| ash | 12 OPTIND after multiple getopts with different spec stdout: . 2 - - - 5 _ 2stderr: No arg for -f option |
| osh | 12 OPTIND after multiple getopts with different spec stdout: . 2 - - 5 5stderr: |
| bash | 13 OPTIND narrowed down stdout: a=1 b= c= d=1 e=Estderr: |
| mksh | 13 OPTIND narrowed down stdout: a=1 b= c= d=1 e=Estderr: |
| osh | 13 OPTIND narrowed down stdout: a=1 b= c= d=1 e=Estderr: |
| bash | 16 Flags can be smooshed together, e.g. -ab stdout: OPTIND=1 opt=a OPTARG= OPTIND=3 opt=b OPTARG=hi OPTIND=5 opt=c OPTARG=hellostderr: |
| osh | 16 Flags can be smooshed together, e.g. -ab [osh stdout] Expected 'OPTIND=2 opt=a OPTARG=\nOPTIND=3 opt=b OPTARG=hi\nOPTIND=5 opt=c OPTARG=hello\n', got 'OPTIND=2 opt=? OPTARG=\nOPTIND=2 opt=? OPTARG=\nOPTIND=2 opt=? OPTARG=\n' stdout: OPTIND=2 opt=? OPTARG= OPTIND=2 opt=? OPTARG= OPTIND=2 opt=? OPTARG=stderr: |