From c22eba38d5071500fa42c75176803e309122db3a Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Sun, 2 Feb 2025 19:47:27 +0000 Subject: [PATCH] chore: move all comment integration tests into a separate module --- helix-term/tests/integration.rs | 1 + helix-term/tests/test/commands.rs | 405 ----------------------------- helix-term/tests/test/comments.rs | 412 ++++++++++++++++++++++++++++++ 3 files changed, 413 insertions(+), 405 deletions(-) create mode 100644 helix-term/tests/test/comments.rs diff --git a/helix-term/tests/integration.rs b/helix-term/tests/integration.rs index 5e418cebd..7d908cb7d 100644 --- a/helix-term/tests/integration.rs +++ b/helix-term/tests/integration.rs @@ -19,6 +19,7 @@ mod test { mod auto_pairs; mod command_line; mod commands; + mod comments; mod languages; mod movement; mod splits; diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 537bc4827..398ab025e 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -653,411 +653,6 @@ async fn test_join_selections_space() -> anyhow::Result<()> { Ok(()) } -/// Comment and uncomment -#[tokio::test(flavor = "multi_thread")] -async fn test_injected_comment_tokens_simple() -> anyhow::Result<()> { - // Uncomment inner injection - test(( - indoc! {r#"\ -
Comment toggle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle on this line should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Comment inner injection - test(( - indoc! {r#"\ -Comment toggle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle on this line should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Block comment inner injection - test(( - indoc! {r#"\ -Comment toggle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle on this line should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Block uncomment inner injection - test(( - indoc! {r#"\ -Comment toggle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle on this line should use the HTML comment token(s).
- - "#}, - )) - .await?; - - Ok(()) -} - -/// Selections in different regions -#[tokio::test(flavor = "multi_thread")] -async fn test_injected_comment_tokens_multiple_selections() -> anyhow::Result<()> { - // Comments two different injection layers with different comments - test(( - indoc! {r#"\ -Comment toggle #[|on this line ]#should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle #[|on this line ]#should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Works with multiple selections - test(( - indoc! {r#"\ -Comment toggle #(|on this line )#should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle #(|on this line)# should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Works with block comment toggle across different layers - test(( - indoc! {r#"\ -Comment toggle #(|on this line)# should use the HTML comment token(s).
- - "#}, - ":lang htmlComment toggle #(|)# should use the HTML comment token(s).
- - "#}, - )) - .await?; - - // Many selections on the same line - test(( - indoc! {r#"\ -C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
- - "#}, - ":lang htmlC#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
- - "#}, - )) - .await?; - test(( - indoc! {r#"\ -C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
- - "#}, - ":lang htmlC#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
- - "#}, - )) - .await?; - - // Many single-selections - test(( - indoc! {r#"\ -C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
- - "#}, - ":lang htmlC#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
- - "#}, - )) - .await?; - test(( - indoc! {r#"\ -C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s).
- - "#}, - ":lang htmlC#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s).
- - "#}, - )) - .await?; - - Ok(()) -} - -/// A selection that spans across several injections takes comment tokens -/// from the injection with the bigger scope -#[tokio::test(flavor = "multi_thread")] -async fn test_injected_comment_tokens_selection_across_different_layers() -> anyhow::Result<()> { - test(( - indoc! {r#"\ -Comment tog#[|gle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment tog#[|gle on this line should use the HTML comment token(s).
- - "#}, - ":lang htmlComment tog#[|]#le on this line should use the javascript comment token(s).
- foo();
-
- "#},
- ))
- .await?;
-
- Ok(())
-}
-
-#[tokio::test(flavor = "multi_thread")]
-async fn test_join_selections_comment() -> anyhow::Result<()> {
- test((
- indoc! {"\
- /// #[a|]#bc
- /// def
- "},
- ":lang rust Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle on this line should use the HTML comment token(s). Comment toggle #[|on this line ]#should use the HTML comment token(s). Comment toggle #[|on this line ]#should use the HTML comment token(s). Comment toggle #(|on this line )#should use the HTML comment token(s). Comment toggle #(|on this line)# should use the HTML comment token(s). Comment toggle #(|on this line)# should use the HTML comment token(s). Comment toggle #(|)# should use the HTML comment token(s). C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s). C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s). C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s). C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s). C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s). C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s). C#[|]#mment t#(|)#ggle #(|)#n this line sh#(|)#uld use the HTML c#(|)#mment t#(|)#ken(s). C#[|o]#mment t#(|o)#ggle #(|o)#n this line sh#(|o)#uld use the HTML c#(|o)#mment t#(|o)#ken(s). Comment tog#[|gle on this line should use the HTML comment token(s). Comment tog#[|gle on this line should use the HTML comment token(s). Comment tog#[|]#le on this line should use the javascript comment token(s).
+ foo();
+
+ "#},
+ ))
+ .await?;
+
+ Ok(())
+}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn test_join_selections_comment() -> anyhow::Result<()> {
+ test((
+ indoc! {"\
+ /// #[a|]#bc
+ /// def
+ "},
+ ":lang rust