diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/client_ui.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/client_ui.rs b/tests/client_ui.rs index ea432e0..f5e3c0e 100644 --- a/tests/client_ui.rs +++ b/tests/client_ui.rs | |||
| @@ -99,6 +99,23 @@ fn redraw_moves_up_by_line_count_minus_one() { | |||
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | #[test] | 101 | #[test] |
| 102 | fn display_width_ignores_ansi_sequences() { | ||
| 103 | assert_eq!(display_width("\x1b[31m18\x1b[0m"), 2); | ||
| 104 | assert_eq!(display_width("\x1b[1;31m[ 18 ]\x1b[0m"), 6); | ||
| 105 | assert_eq!(display_width("plain"), 5); | ||
| 106 | } | ||
| 107 | |||
| 108 | #[test] | ||
| 109 | fn visual_line_count_ignores_ansi_sequences() { | ||
| 110 | let styled = format!("\x1b[31m{}\x1b[0m", "x".repeat(75)); | ||
| 111 | assert_eq!(visual_line_count(&[styled], 72), 2); | ||
| 112 | assert_eq!( | ||
| 113 | visual_line_count(&["\x1b[31m18\x1b[0m".to_string()], 80), | ||
| 114 | 1 | ||
| 115 | ); | ||
| 116 | } | ||
| 117 | |||
| 118 | #[test] | ||
| 102 | fn visual_line_count_accounts_for_terminal_wrapping() { | 119 | fn visual_line_count_accounts_for_terminal_wrapping() { |
| 103 | let lines = vec