| 1 | import os.cmdline |
| 2 | |
| 3 | fn test_options() { |
| 4 | args := ['v', '-d', 'aa', '-d', 'bb', '-d', 'cc'] |
| 5 | ret := cmdline.options(args, '-d') |
| 6 | assert ret == ['aa', 'bb', 'cc'] |
| 7 | } |
| 8 | |
| 9 | fn test_option() { |
| 10 | args := ['v', '-d', 'aa'] |
| 11 | ret := cmdline.option(args, '-d', '') |
| 12 | assert ret == 'aa' |
| 13 | } |
| 14 | |
| 15 | fn test_options_before() { |
| 16 | args := ['-stat', 'test', 'aaa.v'] |
| 17 | ret := cmdline.options_before(args, ['test']) |
| 18 | assert ret == ['-stat'] |
| 19 | } |
| 20 | |
| 21 | fn test_options_after() { |
| 22 | args := ['-stat', 'test', 'aaa.v'] |
| 23 | ret := cmdline.options_after(args, ['test']) |
| 24 | assert ret == ['aaa.v'] |
| 25 | } |
| 26 | |
| 27 | fn test_only_non_options() { |
| 28 | args := ['-d', 'aa', '--help', 'bb'] |
| 29 | ret := cmdline.only_non_options(args) |
| 30 | assert ret == ['aa', 'bb'] |
| 31 | } |
| 32 | |
| 33 | fn test_only_options() { |
| 34 | args := ['-d', 'aa', '--help', 'bb'] |
| 35 | ret := cmdline.only_options(args) |
| 36 | assert ret == ['-d', '--help'] |
| 37 | } |
| 38 | |