From 282df181775ca1d96c9a30851db6323504eafae3 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Sun, 29 Dec 2024 19:09:42 -0500 Subject: [PATCH] wip: test coverage for all movement keys --- src/ui/test.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ui/test.rs b/src/ui/test.rs index bc1686f..b58de75 100644 --- a/src/ui/test.rs +++ b/src/ui/test.rs @@ -509,6 +509,26 @@ fn test_gg_movement() { assert_eq!(ws.book.location, Address { row: 1, col: 2 }); } +#[test] +fn test_h_j_k_l_movement() { + let mut ws = + Workspace::new_empty("en", "America/New_York").expect("Failed to get empty workbook"); + assert_eq!(Some(&Modality::Navigate), ws.state.modality_stack.last()); + InputScript::default() + .char('2') + .char('j') + .char('l').run(&mut ws) + .expect("failed to handle event sequence"); + assert_eq!(ws.book.location, Address { row: 3, col: 2 }); + InputScript::default() + .char('2') + .char('h') + .char('k') + .run(&mut ws) + .expect("failed to handle event sequence"); + assert_eq!(ws.book.location, Address { row: 1, col: 1 }); +} + macro_rules! assert_copy_paste { ($c: expr, $p: expr, $source: expr,) => { assert_copy_paste!($c, $p, $source, $source)