v / cmd / tools / vpm / args_test.v
26 lines · 22 sloc · 908 bytes · 5b0de094e3a1e12a9e4acccc66876a4ea8291732
Raw
1module main
2
3fn test_parse_vpm_command_skips_option_values() {
4 args := ['-m', 'https://mirror.example', 'install', '--once', 'nedpals.args']
5 assert parse_vpm_command(args) == 'install'
6}
7
8fn test_parse_query_args_skips_option_values() {
9 args := ['install', '-m', 'https://mirror.example', 'nedpals.args']
10 assert parse_query_args(args, 'install') == ['nedpals.args']
11}
12
13fn test_parse_query_args_empty_with_only_mirror() {
14 args := ['install', '-m', 'https://mirror.example']
15 assert parse_query_args(args, 'install') == []string{}
16}
17
18fn test_merge_server_urls_appends_custom_urls_after_defaults() {
19 default_urls := ['https://official-a.example', 'https://official-b.example']
20 custom_urls := ['https://official-b.example', 'https://mirror.example']
21 assert merge_server_urls(default_urls, custom_urls) == [
22 'https://official-a.example',
23 'https://official-b.example',
24 'https://mirror.example',
25 ]
26}
27