ysh-stdlib-args () { run-file ysh-stdlib-args "$@" } run-file () { local spec_name=$1; shift; sh-spec spec/$spec_name.test.sh --compare-shells --oils-bin-dir $PWD/bin "$@" }
spec test index / oilshell.org
status | ysh | ysh_ALT | |
pass | 7 | 7 | |
FAIL | 2 | 2 | |
total | 9 | 9 | |
case | ysh | ysh_ALT | description |
0 | pass | pass | args.ysh example usage |
1 | pass | pass | Bool flag, positional args, more positional |
2 | pass | pass | Test multiple ARGVs against a parser |
3 | FAIL | FAIL | Basic help message |
details | details | ||
4 | FAIL | FAIL | Compare parseArgs() vs Python argparse |
details | details | ||
5 | pass | pass | Define spec and print it |
6 | pass | pass | Default values |
7 | pass | pass | Duplicate argument/flag names |
8 | pass | pass | Error cases |
14 passed, 0 OK, 0 not implemented, 0 BUG, 4 failed, 0 timeouts, 0 cases skipped 2 failed under osh
ysh | 3 Basic help message [ysh stdout] Expected 'usage: program-name [-h] [-v] src dst\n\nReference Implementation\n\npositional arguments:\n src\n dst\n\noptions:\n -h, --help show this help message and exit\n -v, --verbose Verbose\n' Got '' [ysh status] Expected 0, got 127 stdout: stderr: description ''' ^~~~~~~~~~~ [ stdin ]:4: 'description' not found (OILS-ERR-100) [ stdin ]:4: errexit PID 36162: command.Simple failed with status 127 |
ysh_ALT | 3 Basic help message [ysh_ALT stdout] Expected 'usage: program-name [-h] [-v] src dst\n\nReference Implementation\n\npositional arguments:\n src\n dst\n\noptions:\n -h, --help show this help message and exit\n -v, --verbose Verbose\n' Got '' [ysh_ALT status] Expected 0, got 127 stdout: stderr: description ''' ^~~~~~~~~~~ [ stdin ]:4: 'description' not found (OILS-ERR-100) [ stdin ]:4: errexit PID 36165: command.Simple failed with status 127 |
ysh | 4 Compare parseArgs() vs Python argparse [ysh stdout] Expected '---------- -v --count 120 example.sh ----------\n$ bin/ysh example.sh -v --count 120 example.sh\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh\nNamespace(filename=\'example.sh\', count=\'120\', verbose=True)\n\n---------- -v --count 120 example.sh -v ----------\n$ bin/ysh example.sh -v --count 120 example.sh -v\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh -v\nNamespace(filename=\'example.sh\', count=\'120\', verbose=True)\n\n---------- -v --count 120 example.sh -v --count 150 ----------\n$ bin/ysh example.sh -v --count 120 example.sh -v --count 150\n(Dict) {"verbose":true,"count":150,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh -v --count 150\nNamespace(filename=\'example.sh\', count=\'150\', verbose=True)\n\n' Got '---------- -v --count 120 example.sh ----------\n$ bin/ysh example.sh -v --count 120 example.sh\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh\n' [ysh status] Expected 0, got 127 stdout: ---------- -v --count 120 example.sh ---------- $ bin/ysh example.sh -v --count 120 example.sh (Dict) {"verbose":true,"count":120,"file":"example.sh"} $ python3 example.py -v --count 120 example.shstderr: python3 -c $argparse_py @args ^~~~~~~ [ stdin ]:42: 'python3' not found (OILS-ERR-100) [ stdin ]:42: errexit PID 36166: command.Simple failed with status 127 |
ysh_ALT | 4 Compare parseArgs() vs Python argparse [ysh_ALT stdout] Expected '---------- -v --count 120 example.sh ----------\n$ bin/ysh example.sh -v --count 120 example.sh\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh\nNamespace(filename=\'example.sh\', count=\'120\', verbose=True)\n\n---------- -v --count 120 example.sh -v ----------\n$ bin/ysh example.sh -v --count 120 example.sh -v\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh -v\nNamespace(filename=\'example.sh\', count=\'120\', verbose=True)\n\n---------- -v --count 120 example.sh -v --count 150 ----------\n$ bin/ysh example.sh -v --count 120 example.sh -v --count 150\n(Dict) {"verbose":true,"count":150,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh -v --count 150\nNamespace(filename=\'example.sh\', count=\'150\', verbose=True)\n\n' Got '---------- -v --count 120 example.sh ----------\n$ bin/ysh example.sh -v --count 120 example.sh\n(Dict) {"verbose":true,"count":120,"file":"example.sh"}\n\n$ python3 example.py -v --count 120 example.sh\n' [ysh_ALT status] Expected 0, got 127 stdout: ---------- -v --count 120 example.sh ---------- $ bin/ysh example.sh -v --count 120 example.sh (Dict) {"verbose":true,"count":120,"file":"example.sh"} $ python3 example.py -v --count 120 example.shstderr: python3 -c $argparse_py @args ^~~~~~~ [ stdin ]:42: 'python3' not found (OILS-ERR-100) [ stdin ]:42: errexit PID 36169: command.Simple failed with status 127 |