Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands.rs')
| -rw-r--r-- | helix-term/tests/test/commands.rs | 218 |
1 files changed, 19 insertions, 199 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 90ff4cf0..6b904aa3 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -2,33 +2,10 @@ use helix_term::application::Application; use super::*; -mod insert; mod movement; -mod reverse_selection_contents; -mod rotate_selection_contents; mod write; #[tokio::test(flavor = "multi_thread")] -async fn search_selection_detect_word_boundaries_at_eof() -> anyhow::Result<()> { - // <https://github.com/helix-editor/helix/issues/12609> - test(( - indoc! {"\ - #[o|]#ne - two - three"}, - "gej*h", - indoc! {"\ - one - two - three#[ - |]#"}, - )) - .await?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread")] async fn test_selection_duplication() -> anyhow::Result<()> { // Forward test(( @@ -232,10 +209,13 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> { "}, "|echo foo<ret>", indoc! {"\ - #[|foo]# - #(|foo)# - #(|foo)#" - }, + #[|foo\n]# + + #(|foo\n)# + + #(|foo\n)# + + "}, )) .await?; @@ -248,9 +228,12 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> { "}, "!echo foo<ret>", indoc! {"\ - #[|foo]#lorem - #(|foo)#ipsum - #(|foo)#dolor + #[|foo\n]# + lorem + #(|foo\n)# + ipsum + #(|foo\n)# + dolor "}, )) .await?; @@ -264,9 +247,12 @@ async fn test_multi_selection_shell_commands() -> anyhow::Result<()> { "}, "<A-!>echo foo<ret>", indoc! {"\ - lorem#[|foo]# - ipsum#(|foo)# - dolor#(|foo)# + lorem#[|foo\n]# + + ipsum#(|foo\n)# + + dolor#(|foo\n)# + "}, )) .await?; @@ -656,49 +642,6 @@ async fn test_join_selections_space() -> anyhow::Result<()> { } #[tokio::test(flavor = "multi_thread")] -async fn test_join_selections_comment() -> anyhow::Result<()> { - test(( - indoc! {"\ - /// #[a|]#bc - /// def - "}, - ":lang rust<ret>J", - indoc! {"\ - /// #[a|]#bc def - "}, - )) - .await?; - - // Only join if the comment token matches the previous line. - test(( - indoc! {"\ - #[| // a - // b - /// c - /// d - e - /// f - // g]# - "}, - ":lang rust<ret>J", - indoc! {"\ - #[| // a b /// c d e f // g]# - "}, - )) - .await?; - - test(( - "#[|\t// Join comments -\t// with indent]#", - ":lang go<ret>J", - "#[|\t// Join comments with indent]#", - )) - .await?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread")] async fn test_read_file() -> anyhow::Result<()> { let mut file = tempfile::NamedTempFile::new()?; let contents_to_read = "some contents"; @@ -721,126 +664,3 @@ async fn test_read_file() -> anyhow::Result<()> { Ok(()) } - -#[tokio::test(flavor = "multi_thread")] -async fn surround_delete() -> anyhow::Result<()> { - // Test `surround_delete` when head < anchor - test(("(#[| ]#)", "mdm", "#[| ]#")).await?; - test(("(#[| ]#)", "md(", "#[| ]#")).await?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread")] -async fn surround_replace_ts() -> anyhow::Result<()> { - const INPUT: &str = r#"\ -fn foo() { - if let Some(_) = None { - testing!("f#[|o]#o)"); - } -} -"#; - test(( - INPUT, - ":lang rust<ret>mrm'", - r#"\ -fn foo() { - if let Some(_) = None { - testing!('f#[|o]#o)'); - } -} -"#, - )) - .await?; - - test(( - INPUT, - ":lang rust<ret>3mrm[", - r#"\ -fn foo() { - if let Some(_) = None [ - testing!("f#[|o]#o)"); - ] -} -"#, - )) - .await?; - - test(( - INPUT, - ":lang rust<ret>2mrm{", - r#"\ -fn foo() { - if let Some(_) = None { - testing!{"f#[|o]#o)"}; - } -} -"#, - )) - .await?; - - test(( - indoc! {"\ - #[a - b - c - d - e|]# - f - "}, - "s\\n<ret>r,", - "a#[,|]#b#(,|)#c#(,|)#d#(,|)#e\nf\n", - )) - .await?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread")] -async fn macro_play_within_macro_record() -> anyhow::Result<()> { - // <https://github.com/helix-editor/helix/issues/12697> - // - // * `"aQihello<esc>Q` record a macro to register 'a' which inserts "hello" - // * `Q"aq<space>world<esc>Q` record a macro to the default macro register which plays the - // macro in register 'a' and then inserts " world" - // * `%d` clear the buffer - // * `q` replay the macro in the default macro register - // * `i<ret>` add a newline at the end - // - // The inner macro in register 'a' should replay within the outer macro exactly once to insert - // "hello world". - test(( - indoc! {"\ - #[|]# - "}, - r#""aQihello<esc>QQ"aqi<space>world<esc>Q%dqi<ret>"#, - indoc! {"\ - hello world - #[|]#"}, - )) - .await?; - - Ok(()) -} - -#[tokio::test(flavor = "multi_thread")] -async fn global_search_with_multibyte_chars() -> anyhow::Result<()> { - // Assert that `helix_term::commands::global_search` handles multibyte characters correctly. - test(( - indoc! {"\ - // Hello world! - // #[| - ]# - "}, - // start global search - " /«十分に長い マルチバイトキャラクター列» で検索<ret><esc>", - indoc! {"\ - // Hello world! - // #[| - ]# - "}, - )) - .await?; - - Ok(()) -} |