mirror of
https://github.com/vlang/v.git
synced 2025-08-04 02:07:28 -04:00
This commit is contained in:
parent
97c9f5f9e4
commit
15bf8222b9
@ -304,7 +304,7 @@ fn (mut fs FlagParser) parse_bool_value(longhand string, shorthand u8) !string {
|
|||||||
}
|
}
|
||||||
if arg.len > 1 && arg[0] == `-` && arg[1] != `-` {
|
if arg.len > 1 && arg[0] == `-` && arg[1] != `-` {
|
||||||
mut found := false
|
mut found := false
|
||||||
for j in 1 .. arg.len - 1 {
|
for j in 1 .. arg.len {
|
||||||
if arg[j].is_space() {
|
if arg[j].is_space() {
|
||||||
break
|
break
|
||||||
} else if arg[j] == shorthand {
|
} else if arg[j] == shorthand {
|
||||||
|
@ -501,3 +501,16 @@ fn test_finalize_with_multi_shortargs() {
|
|||||||
println(additional_args.join_lines())
|
println(additional_args.join_lines())
|
||||||
assert additional_args == []
|
assert additional_args == []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_finalize_with_multi_shortargs_different_order() {
|
||||||
|
mut fp := flag.new_flag_parser(['-ba', '-c'])
|
||||||
|
a_bool := fp.bool('a_bool', `a`, false, '')
|
||||||
|
assert a_bool
|
||||||
|
b_bool := fp.bool('b_bool', `b`, false, '')
|
||||||
|
assert b_bool
|
||||||
|
c_bool := fp.bool('c_bool', `c`, false, '')
|
||||||
|
assert c_bool
|
||||||
|
additional_args := fp.finalize()!
|
||||||
|
println(additional_args.join_lines())
|
||||||
|
assert additional_args == []
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user