diff options
Diffstat (limited to 'helix-term/tests')
-rw-r--r-- | helix-term/tests/test/commands.rs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 6e7275f5..da2e020e 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -354,3 +354,61 @@ async fn test_extend_line() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn test_character_info() -> anyhow::Result<()> { + // UTF-8, single byte + test_key_sequence( + &mut helpers::AppBuilder::new().build()?, + Some("ih<esc>h:char<ret>"), + Some(&|app| { + assert_eq!( + r#""h" (U+0068) Dec 104 Hex 68"#, + app.editor.get_status().unwrap().0 + ); + }), + false, + ) + .await?; + + // UTF-8, multi-byte + test_key_sequence( + &mut helpers::AppBuilder::new().build()?, + Some("ië<esc>h:char<ret>"), + Some(&|app| { + assert_eq!( + r#""ë" (U+0065 U+0308) Hex 65 + cc 88"#, + app.editor.get_status().unwrap().0 + ); + }), + false, + ) + .await?; + + // Multiple characters displayed as one, escaped characters + test_key_sequence( + &mut helpers::AppBuilder::new().build()?, + Some(":line<minus>ending crlf<ret>:char<ret>"), + Some(&|app| { + assert_eq!( + r#""\r\n" (U+000d U+000a) Hex 0d + 0a"#, + app.editor.get_status().unwrap().0 + ); + }), + false, + ) + .await?; + + // Non-UTF-8 + test_key_sequence( + &mut helpers::AppBuilder::new().build()?, + Some(":encoding ascii<ret>ih<esc>h:char<ret>"), + Some(&|app| { + assert_eq!(r#""h" Dec 104 Hex 68"#, app.editor.get_status().unwrap().0); + }), + false, + ) + .await?; + + Ok(()) +} |