Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands/movement.rs')
| -rw-r--r-- | helix-term/tests/test/commands/movement.rs | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands/movement.rs b/helix-term/tests/test/commands/movement.rs index f263fbac..84806d5f 100644 --- a/helix-term/tests/test/commands/movement.rs +++ b/helix-term/tests/test/commands/movement.rs @@ -601,3 +601,128 @@ async fn select_all_siblings() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test(flavor = "multi_thread")] +async fn select_all_children() -> anyhow::Result<()> { + let tests = vec![ + // basic tests + ( + helpers::platform_line(indoc! {r##" + let foo = bar#[(a, b, c)|]#; + "##}), + "<A-I>", + helpers::platform_line(indoc! {r##" + let foo = bar(#[a|]#, #(b|)#, #(c|)#); + "##}), + ), + ( + helpers::platform_line(indoc! {r##" + let a = #[[ + 1, + 2, + 3, + 4, + 5, + ]|]#; + "##}), + "<A-I>", + helpers::platform_line(indoc! {r##" + let a = [ + #[1|]#, + #(2|)#, + #(3|)#, + #(4|)#, + #(5|)#, + ]; + "##}), + ), + // direction is preserved + ( + helpers::platform_line(indoc! {r##" + let a = #[|[ + 1, + 2, + 3, + 4, + 5, + ]]#; + "##}), + "<A-I>", + helpers::platform_line(indoc! {r##" + let a = [ + #[|1]#, + #(|2)#, + #(|3)#, + #(|4)#, + #(|5)#, + ]; + "##}), + ), + // can't pick any more children - selection stays the same + ( + helpers::platform_line(indoc! {r##" + let a = [ + #[1|]#, + #(2|)#, + #(3|)#, + #(4|)#, + #(5|)#, + ]; + "##}), + "<A-I>", + helpers::platform_line(indoc! {r##" + let a = [ + #[1|]#, + #(2|)#, + #(3|)#, + #(4|)#, + #(5|)#, + ]; + "##}), + ), + // each cursor does the sibling select independently + ( + helpers::platform_line(indoc! {r##" + let a = #[|[ + 1, + 2, + 3, + 4, + 5, + ]]#; + + let b = #([ + "one", + "two", + "three", + "four", + "five", + ]|)#; + "##}), + "<A-I>", + helpers::platform_line(indoc! {r##" + let a = [ + #[|1]#, + #(|2)#, + #(|3)#, + #(|4)#, + #(|5)#, + ]; + + let b = [ + #("one"|)#, + #("two"|)#, + #("three"|)#, + #("four"|)#, + #("five"|)#, + ]; + "##}), + ), + ]; + + for test in tests { + test_with_config(AppBuilder::new().with_file("foo.rs", None), test).await?; + } + + Ok(()) +} |