Results for builtin-getopts.test.sh

statusdashbashmkshashoshosh_ALT
pass 161413161313
ok 011000
BUG 123133
FAIL 000011
total171717171717
casedashbashmkshashoshosh_ALTdescription
0pass pass pass pass pass pass getopts empty
1pass pass pass pass pass pass getopts sees unknown arg
2pass pass pass pass pass pass getopts three invocations
3pass pass pass pass pass pass getopts resets OPTARG
4pass pass pass pass pass pass Basic getopts invocation
5pass ok ok pass pass pass getopts with invalid variable name
detailsdetails
6pass pass pass pass pass pass getopts with invalid flag
7pass pass pass pass pass pass getopts missing required argument
8pass pass pass pass pass pass getopts doesn't look for flags after args
9pass pass pass pass pass pass getopts with explicit args
10pass pass pass pass pass pass OPTIND
11pass pass BUG pass BUG BUG OPTIND after multiple getopts with same spec
detailsdetailsdetails
12BUG pass BUG BUG BUG BUG OPTIND after multiple getopts with different spec
detailsdetailsdetailsdetailsdetails
13pass BUG BUG pass BUG BUG OPTIND narrowed down
detailsdetailsdetailsdetails
14pass pass pass pass pass pass Getopts parses the function's arguments
15pass pass pass pass pass pass Local OPTIND
16pass BUG pass pass FAIL FAIL Flags can be smooshed together, e.g. -ab
detailsdetailsdetails
85 passed, 2 OK, 0 not implemented, 13 BUG, 1 failed, 0 timeouts, 0 cases skipped
1 failed under osh

Details on runs that didn't PASS

bash5 getopts with invalid variable name

stdout:
status=1 opt= OPTARG=foo OPTIND=3
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/bash: line 2: getopts: `opt-': not a valid identifier
mksh5 getopts with invalid variable name

stdout:
status=1 opt= OPTARG= OPTIND=1
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[2]: getopts: opt-: is not an identifier
mksh11 OPTIND after multiple getopts with same spec

stdout:
1
-
-
4
4
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[13]: getopts: arguments changed since last call
osh11 OPTIND after multiple getopts with same spec

stdout:
1
-
-
4
4
stderr:
osh_ALT11 OPTIND after multiple getopts with same spec

stdout:
1
-
-
4
4
stderr:
dash12 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
-
5
_
2
stderr:
No arg for -f option
mksh12 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
5
5
stderr:
/home/andy/git/oilshell/oil/_tmp/spec-bin/mksh: <stdin>[14]: getopts: arguments changed since last call
ash12 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
-
5
_
2
stderr:
No arg for -f option
osh12 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
5
5
stderr:
osh_ALT12 OPTIND after multiple getopts with different spec

stdout:
.
2
-
-
5
5
stderr:
bash13 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
mksh13 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
osh13 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
osh_ALT13 OPTIND narrowed down

stdout:
a=1 b= c= d=1 e=E
stderr:
bash16 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=hello
stderr:
osh16 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:
osh_ALT16 Flags can be smooshed together, e.g. -ab

[osh_ALT 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: