| 1 | import flag |
| 2 | |
| 3 | const edge_case = ['appimage', '-v', '3', '-o', '/tmp/lol.appimage', '/home/user/Projects/game/'] |
| 4 | |
| 5 | pub struct AppImageOptions { |
| 6 | pub: |
| 7 | verbosity int @[short: v; xdoc: 'Verbosity level 1-3'] |
| 8 | dump_usage bool @[long: help; short: h; xdoc: 'Show this help message and exit'] |
| 9 | show_version bool @[long: version; xdoc: 'Output version information and exit'] |
| 10 | pub mut: |
| 11 | input string @[tail] |
| 12 | output string @[short: o; xdoc: 'Path to output (dir/file)'] |
| 13 | assets []string @[short: a; xdoc: 'Asset dir(s) to include in build'] |
| 14 | } |
| 15 | |
| 16 | fn test_edge_case() { |
| 17 | aio, no_matches := flag.to_struct[AppImageOptions](edge_case, skip: 1)! |
| 18 | assert aio.verbosity == 3 |
| 19 | assert aio.output == '/tmp/lol.appimage' |
| 20 | assert aio.input == '/home/user/Projects/game/' |
| 21 | assert aio.dump_usage == false |
| 22 | assert aio.show_version == false |
| 23 | assert aio.assets == [] |
| 24 | assert no_matches == [] |
| 25 | } |
| 26 | |