Results for builtin-getopts.test.sh

statusdashbashmkshashosh
pass 1614131613
ok 01100
BUG 12313
FAIL 00001
total1717171717
casedashbashmkshashoshdescription
0pass pass pass pass pass getopts empty
1pass pass pass pass pass getopts sees unknown arg
2pass pass pass pass pass getopts three invocations
3pass pass pass pass pass getopts resets OPTARG
4pass pass pass pass pass Basic getopts invocation
5pass ok ok pass pass getopts with invalid variable name
detailsdetails
6pass pass pass pass pass getopts with invalid flag
7pass pass pass pass pass getopts missing required argument
8pass pass pass pass pass getopts doesn't look for flags after args
9pass pass pass pass pass getopts with explicit args
10pass pass pass pass pass OPTIND
11pass pass BUG pass BUG OPTIND after multiple getopts with same spec
detailsdetails
12BUG pass BUG BUG BUG OPTIND after multiple getopts with different spec
detailsdetailsdetailsdetails
13pass BUG BUG pass BUG OPTIND narrowed down
detailsdetailsdetails
14pass pass pass pass pass Getopts parses the function's arguments
15pass pass pass pass pass Local OPTIND
16pass BUG pass pass FAIL Flags can be smooshed together, e.g. -ab
detailsdetails
72 passed, 2 OK, 0 not implemented, 10 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:
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:
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:
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: