From f4af6797abff57766ac5a97162698a4588cf1a10 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 18:21:46 +0900 Subject: [PATCH 1/9] Add terminal browse journeys --- ...es_and_ranges_to_inspect_a_code_point.snap | 43 +++++++++ tests/terminal_e2e.rs | 87 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 tests/snapshots/terminal_e2e__browses_through_planes_and_ranges_to_inspect_a_code_point.snap diff --git a/tests/snapshots/terminal_e2e__browses_through_planes_and_ranges_to_inspect_a_code_point.snap b/tests/snapshots/terminal_e2e__browses_through_planes_and_ranges_to_inspect_a_code_point.snap new file mode 100644 index 0000000..6fa4c52 --- /dev/null +++ b/tests/snapshots/terminal_e2e__browses_through_planes_and_ranges_to_inspect_a_code_point.snap @@ -0,0 +1,43 @@ +--- +source: tests/terminal_e2e.rs +expression: screen.with_styles() +--- +size: 100x30 cursor: hidden +┌ Browse · Code Points · U+0000–U+00FF ────────────────────┐┌ Selection Preview ───────────────────┐ +│ 0 1 2 3 4 5 6 7 8 9 A B C D E F ││ Character B │ +│ 000000 · · · · · · · · · · · · · · · · ││ Code Point U+0042 │ +│ 000010 · · · · · · · · · · · · · · · · ││ Primary Name LATIN CAPITAL │ +│ 000020 · ! " # $ % & ' ( ) * + , - . / ││ LETTER B │ +│ 000030 0 1 2 3 4 5 6 7 8 9 : ; < = > ? ││ Block Basic Latin │ +│ 000040 @ A B C D E F G H I J K L M N O ││ General Category Lu — Uppercase │ +│ 000050 P Q R S T U V W X Y Z [ \ ] ^ _ ││ Letter │ +│ 000060 ` a b c d e f g h i j k l m n o ││ │ +│ 000070 p q r s t u v w x y z { | } ~ · ││ │ +│ 000080 · · · · · · · · · · · · · · · · ││ │ +│ 000090 · · · · · · · · · · · · · · · · ││ │ +│ 0000A0 · ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ · ® ¯ ││ │ +│ 0000B0 ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ ││ │ +│ 0000C0 À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï ││ │ +│ 0000D0 Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß ││ │ +│ 0000E0 à á â ã ä å æ ç è é ê ë ì í î ï ││ │ +│ 0000F0 ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└──────────────────────────────────────────────────────────┘└──────────────────────────────────────┘ + h/l/k/j: Move C-u/C-d: Jump g/G: Ends Enter: Inspect BS: Back Esc: Close q: Quit F1: Help + +styles: +1: 62-78 fg=8 +2: 62-78 fg=8 +3: 62-78 fg=8 +5: 62-78 fg=8 +6: 15-17 fg=0 bg=6; 62-78 fg=8 +29: 0-99 fg=8 diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 0da673f..00eb072 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -99,6 +99,93 @@ fn searches_for_a_name_and_opens_the_result_in_the_inspector() -> termlens::Resu Ok(()) } +#[test] +fn browses_through_planes_and_ranges_to_inspect_a_code_point() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('p'))?; + terminal.wait_until(|screen| { + screen.contains("Browse · Planes") && screen.contains("Basic Multilingual Plane") + })?; + terminal.send(Key::Enter)?; + terminal.wait_until(|screen| { + screen.contains("Browse · Ranges · Plane 0") && screen.contains("U+0000–U+00FF") + })?; + terminal.send(Key::Enter)?; + terminal.wait_until(|screen| { + screen.contains("Browse · Code Points") && screen.contains("Selection Preview") + })?; + terminal.send(Key::Right)?; + let screen = terminal.snapshot_after(|screen| { + screen.contains("Browse · Code Points") && screen.contains("U+0042") + })?; + insta::assert_snapshot!(screen.with_styles()); + + terminal.send(Key::Enter)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+0042") + && screen.contains("LATIN CAPITAL LETTER B") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + +#[test] +fn backs_out_of_a_block_table_without_changing_the_inspected_code_point() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('b'))?; + terminal.wait_until(|screen| { + screen.contains("Browse · Blocks") && screen.contains("Basic Latin") + })?; + terminal.send(Key::Enter)?; + terminal.wait_until(|screen| screen.contains("Browse · Block Code Points"))?; + terminal.send(Key::Right)?; + terminal.wait_until(|screen| screen.contains("U+0042"))?; + + terminal.send(Key::Backspace)?; + terminal.wait_until(|screen| screen.contains("Browse · Blocks"))?; + terminal.send(Key::Esc)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+0041") + && screen.contains("LATIN CAPITAL LETTER A") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + +#[test] +fn cancels_direct_code_point_browsing_without_changing_the_inspector() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('c'))?; + terminal.wait_until(|screen| screen.contains("Browse · Code Points"))?; + terminal.send(Key::Right)?; + terminal.wait_until(|screen| screen.contains("U+0042"))?; + terminal.send(Key::Esc)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+0041") + && screen.contains("LATIN CAPITAL LETTER A") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + #[test] fn redraws_across_the_minimum_terminal_size_boundary() -> termlens::Result<()> { let mut terminal = spawn("off")?; From 5b3584b9c96a629cad6d9a58eb090b4103491e07 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 18:22:35 +0900 Subject: [PATCH 2/9] Test search correction after reopening --- tests/terminal_e2e.rs | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 00eb072..77e3de2 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -99,6 +99,49 @@ fn searches_for_a_name_and_opens_the_result_in_the_inspector() -> termlens::Resu Ok(()) } +#[test] +fn reopens_search_and_corrects_a_query_with_no_results() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('/'))?; + terminal.wait_until(|screen| screen.contains("Search by Unicode name"))?; + terminal.send_str("rightwards arrox")?; + terminal.snapshot_after(|screen| { + screen.contains("rightwards arrox") && screen.contains("No matching characters") + })?; + + terminal.send(Key::Esc)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") && screen.contains("LATIN CAPITAL LETTER A") + })?; + terminal.send(Key::Char('/'))?; + terminal.wait_until(|screen| { + screen.contains("Search") + && screen.contains("rightwards arrox") + && screen.contains("No matching characters") + })?; + + terminal.send(Key::Backspace)?; + terminal.send(Key::Char('w'))?; + terminal.snapshot_after(|screen| { + screen.contains("rightwards arrow") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + terminal.send(Key::Enter)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + #[test] fn browses_through_planes_and_ranges_to_inspect_a_code_point() -> termlens::Result<()> { let mut terminal = spawn("off")?; From 32ad8750ca025cad631b12f53535ac5d4c4a7253 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 18:23:20 +0900 Subject: [PATCH 3/9] Verify configured keys through contextual help --- tests/terminal_e2e.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 77e3de2..220caf5 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -8,12 +8,15 @@ fn spawn(graphics: &str) -> termlens::Result { } #[test] -fn applies_an_explicit_config_file_before_entering_the_terminal() -> termlens::Result<()> { +fn custom_keybindings_appear_in_help_and_drive_the_app() -> termlens::Result<()> { let directory = tempdir()?; let path = directory.path().join("config.toml"); fs::write( &path, r#" + [keybindings.global] + help = ["f2"] + [keybindings.inspector] quit = ["x"] "#, @@ -26,7 +29,20 @@ fn applies_an_explicit_config_file_before_entering_the_terminal() -> termlens::R )?; terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + terminal.send(Key::F(2))?; + terminal.snapshot_after(|screen| { + screen.contains("Help · Inspector") && screen.contains("") && screen.contains("") + })?; + terminal.send(Key::F(2))?; + terminal.wait_until(|screen| { + screen.contains("Identity") && screen.contains("LATIN CAPITAL LETTER A") + })?; + terminal.send(Key::Char('q'))?; + terminal.send(Key::F(2))?; + terminal.wait_until(|screen| screen.contains("Help · Inspector"))?; + terminal.send(Key::F(2))?; + terminal.wait_until(|screen| screen.contains("Identity"))?; terminal.send(Key::Char('x'))?; let status = terminal.wait_exit()?; From a4e6c8ae3c828252aa7f49de74ca01927eeafe2e Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 18:24:07 +0900 Subject: [PATCH 4/9] Test search continuity across terminal resize --- ...sult_selected_across_terminal_resizes.snap | 25 +++++++++++ tests/terminal_e2e.rs | 43 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 tests/snapshots/terminal_e2e__keeps_the_search_result_selected_across_terminal_resizes.snap diff --git a/tests/snapshots/terminal_e2e__keeps_the_search_result_selected_across_terminal_resizes.snap b/tests/snapshots/terminal_e2e__keeps_the_search_result_selected_across_terminal_resizes.snap new file mode 100644 index 0000000..c860477 --- /dev/null +++ b/tests/snapshots/terminal_e2e__keeps_the_search_result_selected_across_terminal_resizes.snap @@ -0,0 +1,25 @@ +--- +source: tests/terminal_e2e.rs +expression: minimum.with_styles() +--- +size: 60x16 cursor: 1,8 +┌ Search ──────────────────────────────────────────────────┐ +│ U+2192 │ +└──────────────────────────────────────────────────────────┘ +┌ Results · 1 ─────────────────────────────────────────────┐ +│ → U+2192 RIGHTWARDS ARROW │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +│ │ +└──────────────────────────────────────────────────────────┘ + ↑/↓: Move Enter: Inspect Esc: Close C-c: Quit F1: Help + +styles: +4: 2-7 fg=0 bg=6; 8-13 fg=15 bg=6 bold; 14-57 fg=0 bg=6 +15: 0-59 fg=8 diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 220caf5..02e2f63 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -158,6 +158,49 @@ fn reopens_search_and_corrects_a_query_with_no_results() -> termlens::Result<()> Ok(()) } +#[test] +fn keeps_the_search_result_selected_across_terminal_resizes() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('/'))?; + terminal.wait_until(|screen| screen.contains("Search by Unicode name"))?; + terminal.send_str("U+2192")?; + terminal.snapshot_after(|screen| { + screen.contains("Search") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + + terminal.resize(60, 16)?; + let minimum = terminal.snapshot_after(|screen| { + screen.size() == (60, 16) + && screen.contains("Search") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + insta::assert_snapshot!(minimum.with_styles()); + + terminal.resize(100, 30)?; + terminal.snapshot_after(|screen| { + screen.size() == (100, 30) + && screen.contains("Selection Preview") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + terminal.send(Key::Enter)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + #[test] fn browses_through_planes_and_ranges_to_inspect_a_code_point() -> termlens::Result<()> { let mut terminal = spawn("off")?; From 94286a0cd0ff9906e76dfb5f066cc420c2d88601 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 18:25:04 +0900 Subject: [PATCH 5/9] Test search state across contextual help --- tests/terminal_e2e.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 02e2f63..4c1f047 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -201,6 +201,45 @@ fn keeps_the_search_result_selected_across_terminal_resizes() -> termlens::Resul Ok(()) } +#[test] +fn search_help_does_not_edit_the_query_or_lose_the_result() -> termlens::Result<()> { + let mut terminal = spawn("off")?; + terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; + + terminal.send(Key::Char('/'))?; + terminal.wait_until(|screen| screen.contains("Search by Unicode name"))?; + terminal.send_str("U+2192")?; + terminal.wait_until(|screen| { + screen.contains("Results · 1") && screen.contains("RIGHTWARDS ARROW") + })?; + + terminal.send(Key::F(1))?; + terminal.snapshot_after(|screen| { + screen.contains("Help · Search") && screen.contains("Inspect the selected result") + })?; + terminal.send(Key::Char('x'))?; + terminal.send(Key::F(1))?; + let screen = terminal.snapshot_after(|screen| { + screen.contains("Search") + && screen.contains("Results · 1") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + assert!(!screen.contains("U+2192x"), "{screen}"); + + terminal.send(Key::Enter)?; + terminal.snapshot_after(|screen| { + screen.contains("Identity") + && screen.contains("U+2192") + && screen.contains("RIGHTWARDS ARROW") + })?; + + terminal.send(Key::Char('q'))?; + let status = terminal.wait_exit()?; + assert!(status.success(), "exit status: {status}"); + Ok(()) +} + #[test] fn browses_through_planes_and_ranges_to_inspect_a_code_point() -> termlens::Result<()> { let mut terminal = spawn("off")?; From 2de470cd246d77037158f40dcea6c17993eddc59 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 19:56:06 +0900 Subject: [PATCH 6/9] Snapshot configured inspector help screen --- ...ings_appear_in_help_and_drive_the_app.snap | 56 +++++++++++++++++++ tests/terminal_e2e.rs | 6 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap diff --git a/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap b/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap new file mode 100644 index 0000000..db781f9 --- /dev/null +++ b/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap @@ -0,0 +1,56 @@ +--- +source: tests/terminal_e2e.rs +expression: "help.mask_matching(env!(\"CARGO_PKG_VERSION\"), '▒').with_styles()" +--- +size: 100x30 cursor: hidden +┌ Help · Inspector ────────────────────────────────────────────────────────────────────────────────┐ +│ │ +│ sauva - Terminal Unicode Explorer │ +│ │ +│ Version: ▒▒▒▒▒ │ +│ │ +│ https://github.com/lusingander/sauva │ +│ │ +│ ──────────────────────────────────────────────────────────────────────────────────────────────── │ +│ │ +│ Previous code point │ +│ Next code point │ +│ Select the previous property │ +│ Select the next property │ +│ Move properties up one page │ +│ Move properties down one page │ +│ Select the first property │ +│ Select the last property │ +│ Copy the selected property value │ +│ Open search │ +│

Browse planes │ +│ Browse ranges │ +│ Browse blocks │ +│ Browse code points │ +│ Quit │ +│ Open or close help │ +│ │ +│ │ +└──────────────────────────────────────────────────────────────────────────────────────────────────┘ + k/j: Move C-u/C-d: Page g/G: Ends Esc/F2: Close C-c: Quit + +styles: +6: 3-38 fg=4 +8: 2-97 fg=8 +10: 4 fg=3; 9-12 fg=3 +11: 4 fg=3; 9-13 fg=3 +12: 4 fg=3; 9-10 fg=3 +13: 4 fg=3; 9-12 fg=3 +14: 4-9 fg=3 +15: 4-9 fg=3 +16: 4 fg=3 +17: 4 fg=3 +18: 4 fg=3 +19: 4 fg=3 +20: 4 fg=3 +21: 4 fg=3 +22: 4 fg=3 +23: 4 fg=3 +24: 4 fg=3; 9-14 fg=3 +25: 4-5 fg=3 +29: 0-99 fg=8 diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 4c1f047..71b2030 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -30,9 +30,13 @@ fn custom_keybindings_appear_in_help_and_drive_the_app() -> termlens::Result<()> terminal.snapshot_after(|screen| screen.contains("LATIN CAPITAL LETTER A"))?; terminal.send(Key::F(2))?; - terminal.snapshot_after(|screen| { + let help = terminal.snapshot_after(|screen| { screen.contains("Help · Inspector") && screen.contains("") && screen.contains("") })?; + insta::assert_snapshot!( + help.mask_matching(env!("CARGO_PKG_VERSION"), '▒') + .with_styles() + ); terminal.send(Key::F(2))?; terminal.wait_until(|screen| { screen.contains("Identity") && screen.contains("LATIN CAPITAL LETTER A") From 31a098e0a8a98b2ffe665be855123e97c5bc94d2 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 19:56:31 +0900 Subject: [PATCH 7/9] Snapshot reopened search with no results --- ..._and_corrects_a_query_with_no_results.snap | 41 +++++++++++++++++++ tests/terminal_e2e.rs | 3 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/snapshots/terminal_e2e__reopens_search_and_corrects_a_query_with_no_results.snap diff --git a/tests/snapshots/terminal_e2e__reopens_search_and_corrects_a_query_with_no_results.snap b/tests/snapshots/terminal_e2e__reopens_search_and_corrects_a_query_with_no_results.snap new file mode 100644 index 0000000..6772d09 --- /dev/null +++ b/tests/snapshots/terminal_e2e__reopens_search_and_corrects_a_query_with_no_results.snap @@ -0,0 +1,41 @@ +--- +source: tests/terminal_e2e.rs +expression: reopened.with_styles() +--- +size: 100x30 cursor: 1,18 +┌ Search ──────────────────────────────────────────────────┐┌ Selection Preview ───────────────────┐ +│ rightwards arrox ││ │ +└──────────────────────────────────────────────────────────┘│ │ +┌ Results · 0 ─────────────────────────────────────────────┐│ │ +│ No matching characters ││ │ +│ Try another name, code point, or character ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ No preview │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +│ ││ │ +└──────────────────────────────────────────────────────────┘└──────────────────────────────────────┘ + ↑/↓: Move Enter: Inspect Esc: Close C-c: Quit F1: Help + +styles: +4: 2-23 bold +5: 2-43 fg=8 +14: 62-97 fg=8 +29: 0-99 fg=8 diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 71b2030..7bf3950 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -136,11 +136,12 @@ fn reopens_search_and_corrects_a_query_with_no_results() -> termlens::Result<()> screen.contains("Identity") && screen.contains("LATIN CAPITAL LETTER A") })?; terminal.send(Key::Char('/'))?; - terminal.wait_until(|screen| { + let reopened = terminal.snapshot_after(|screen| { screen.contains("Search") && screen.contains("rightwards arrox") && screen.contains("No matching characters") })?; + insta::assert_snapshot!(reopened.with_styles()); terminal.send(Key::Backspace)?; terminal.send(Key::Char('w'))?; From dcc89306833f61e6c96f7c16ddb84e805be0dbbd Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 19:57:13 +0900 Subject: [PATCH 8/9] Snapshot inspector after browse selection --- ...e2e__inspector_after_browse_selection.snap | 62 +++++++++++++++++++ tests/terminal_e2e.rs | 3 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 tests/snapshots/terminal_e2e__inspector_after_browse_selection.snap diff --git a/tests/snapshots/terminal_e2e__inspector_after_browse_selection.snap b/tests/snapshots/terminal_e2e__inspector_after_browse_selection.snap new file mode 100644 index 0000000..53d0bee --- /dev/null +++ b/tests/snapshots/terminal_e2e__inspector_after_browse_selection.snap @@ -0,0 +1,62 @@ +--- +source: tests/terminal_e2e.rs +expression: inspector.with_styles() +--- +size: 100x30 cursor: hidden +┌ Inspector ───────────────────────────────────────────────┐┌ Glyph Preview ───────────────────────┐ +│ Identity │││ Font — │ +│ Character B │││ Version — │ +│ Code Point U+0042 │││ │ +│ Primary Name LATIN CAPITAL LETTER B │││ │ +│ Aliases None │││ │ +│ Plane 0 — Basic Multilingual │││ │ +│ Plane │││ │ +│ Block Basic Latin │││ │ +│ │││ │ +│ Classification │││ │ +│ General Category Lu — Uppercase Letter │││ │ +│ Script Latin │││ │ +│ Age 1.1 │││ │ +│ East Asian Width Na — Narrow │││ Graphics disabled │ +│ Canonical Combining Class 0 — Not Reordered │││ Enable with --graphics auto/force. │ +│ Bidi Class L — Left To Right │││ │ +│ Default Ignorable No │││ │ +│ │││ │ +│ Encoding │││ │ +│ UTF-8 42 │││ │ +│ UTF-16 0042 │││ │ +│ HTML Decimal B │││ │ +│ HTML Hex B ││ │ +│ Rust char '\u{42}' ││ │ +│ Unicode Escape \u0042 ││ │ +│ ││ │ +│ Normalization ││ │ +└──────────────────────────────────────────────────────────┘└──────────────────────────────────────┘ + h/l: Point k/j: Field C-u/C-d: Page y: Copy /: Search p/r/b/c: Browse q: Quit F1: Help + +styles: +1: 2-9 fg=6 bold; 62-70 fg=8 +2: 2-57 fg=0 bg=6; 62-70 fg=8 +3: 2-30 fg=8 +4: 2-30 fg=8 +5: 2-30 fg=8 +6: 2-30 fg=8 +7: 2-30 fg=8 +8: 2-30 fg=8 +10: 2-15 fg=6 bold +11: 2-30 fg=8 +12: 2-30 fg=8 +13: 2-30 fg=8 +14: 2-30 fg=8; 72-88 fg=3 bold +15: 2-30 fg=8; 63-96 fg=8 +16: 2-30 fg=8 +17: 2-30 fg=8 +19: 2-9 fg=6 bold +20: 2-30 fg=8 +21: 2-30 fg=8 +22: 2-30 fg=8 +23: 2-30 fg=8 +24: 2-30 fg=8 +25: 2-30 fg=8 +27: 2-14 fg=6 bold +29: 0-99 fg=8 diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 7bf3950..6374ab6 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -269,11 +269,12 @@ fn browses_through_planes_and_ranges_to_inspect_a_code_point() -> termlens::Resu insta::assert_snapshot!(screen.with_styles()); terminal.send(Key::Enter)?; - terminal.snapshot_after(|screen| { + let inspector = terminal.snapshot_after(|screen| { screen.contains("Identity") && screen.contains("U+0042") && screen.contains("LATIN CAPITAL LETTER B") })?; + insta::assert_snapshot!("inspector_after_browse_selection", inspector.with_styles()); terminal.send(Key::Char('q'))?; let status = terminal.wait_exit()?; From 1ff1ef4306f652d5f5943de15b4322352a7c2e00 Mon Sep 17 00:00:00 2001 From: Kyosuke Fujimoto Date: Tue, 22 Sep 2026 20:04:06 +0900 Subject: [PATCH 9/9] Mask package metadata in help snapshot --- ...m_keybindings_appear_in_help_and_drive_the_app.snap | 6 +++--- tests/terminal_e2e.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap b/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap index db781f9..8da44e2 100644 --- a/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap +++ b/tests/snapshots/terminal_e2e__custom_keybindings_appear_in_help_and_drive_the_app.snap @@ -1,15 +1,15 @@ --- source: tests/terminal_e2e.rs -expression: "help.mask_matching(env!(\"CARGO_PKG_VERSION\"), '▒').with_styles()" +expression: help.with_styles() --- size: 100x30 cursor: hidden ┌ Help · Inspector ────────────────────────────────────────────────────────────────────────────────┐ │ │ -│ sauva - Terminal Unicode Explorer │ +│ ▒▒▒▒▒ - ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │ │ │ │ Version: ▒▒▒▒▒ │ │ │ -│ https://github.com/lusingander/sauva │ +│ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ │ │ │ │ ──────────────────────────────────────────────────────────────────────────────────────────────── │ │ │ diff --git a/tests/terminal_e2e.rs b/tests/terminal_e2e.rs index 6374ab6..51b14d8 100644 --- a/tests/terminal_e2e.rs +++ b/tests/terminal_e2e.rs @@ -33,10 +33,12 @@ fn custom_keybindings_appear_in_help_and_drive_the_app() -> termlens::Result<()> let help = terminal.snapshot_after(|screen| { screen.contains("Help · Inspector") && screen.contains("") && screen.contains("") })?; - insta::assert_snapshot!( - help.mask_matching(env!("CARGO_PKG_VERSION"), '▒') - .with_styles() - ); + let help = help + .mask_matching(env!("CARGO_PKG_REPOSITORY"), '▒') + .mask_matching(env!("CARGO_PKG_DESCRIPTION"), '▒') + .mask_matching(env!("CARGO_PKG_NAME"), '▒') + .mask_matching(env!("CARGO_PKG_VERSION"), '▒'); + insta::assert_snapshot!(help.with_styles()); terminal.send(Key::F(2))?; terminal.wait_until(|screen| { screen.contains("Identity") && screen.contains("LATIN CAPITAL LETTER A")