Skip to content

Commit c8b5541

Browse files
committed
Add a test for empty opt_positions
1 parent f84e912 commit c8b5541

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/tests/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,7 @@ fn test_opt_get_default() {
11931193
fn test_opt_positions() {
11941194
let mut opts = Options::new();
11951195
opts.optflagmulti("a", "act", "Description");
1196+
opts.optflagmulti("e", "enact", "Description");
11961197
opts.optflagmulti("r", "react", "Description");
11971198

11981199
let args: Vec<String> = ["-a", "-a", "-r", "-a", "-r", "-r"]
@@ -1207,6 +1208,8 @@ fn test_opt_positions() {
12071208

12081209
let a_pos = matches.opt_positions("a");
12091210
assert_eq!(a_pos, vec![0, 1, 3]);
1210-
let b_pos = matches.opt_positions("r");
1211-
assert_eq!(b_pos, vec![2, 4, 5]);
1211+
let e_pos = matches.opt_positions("e");
1212+
assert_eq!(e_pos, vec![]);
1213+
let r_pos = matches.opt_positions("r");
1214+
assert_eq!(r_pos, vec![2, 4, 5]);
12121215
}

0 commit comments

Comments
 (0)