Skip to content

Commit 2fe6802

Browse files
committed
add test for cycle tags
1 parent 7abb6c0 commit 2fe6802

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/pure/stack_set.rs

+20
Original file line numberDiff line numberDiff line change
@@ -1309,6 +1309,26 @@ pub mod tests {
13091309

13101310
assert!(matches!(res, Err(Error::NoScreens)));
13111311
}
1312+
1313+
1314+
#[test_case(true,1,1; "forward")]
1315+
#[test_case(false,1,3; "backward")]
1316+
#[test_case(true,4,0; "forward loop to start")]
1317+
#[test]
1318+
fn tag_cycle_focuses_correct_tag(forward: bool,count:usize, expected_index: usize) {
1319+
let mut s = test_stack_set(4,2);
1320+
1321+
for _ in 0..count{
1322+
if forward {
1323+
s.next_tag()
1324+
} else {
1325+
s.previous_tag()
1326+
}
1327+
}
1328+
let tags=s.ordered_tags();
1329+
1330+
assert_eq!(s.current_tag(), tags[expected_index]);
1331+
}
13121332
}
13131333

13141334
#[cfg(test)]

0 commit comments

Comments
 (0)