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 | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands/movement.rs b/helix-term/tests/test/commands/movement.rs index dd5a3bee..684f1dca 100644 --- a/helix-term/tests/test/commands/movement.rs +++ b/helix-term/tests/test/commands/movement.rs @@ -1067,6 +1067,72 @@ async fn expand_shrink_selection() -> anyhow::Result<()> { #[|Some(thing)]#, Some(other_thing), ) + + "##}, + ), + ]; + + for test in tests { + test_with_config(AppBuilder::new().with_file("foo.rs", None), test).await?; + } + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn expand_selection_around() -> anyhow::Result<()> { + let tests = vec![ + // single cursor stays single cursor, first goes to end of current + // node, then parent + ( + indoc! {r##" + Some(#[thing|]#) + "##}, + "<A-O><A-O>", + indoc! {r##" + #[Some(|]#thing#()|)# + "##}, + ), + // shrinking restores previous selection + ( + indoc! {r##" + Some(#[thing|]#) + "##}, + "<A-O><A-O><A-i><A-i>", + indoc! {r##" + Some(#[thing|]#) + "##}, + ), + // multi range collision merges expand as normal, except with the + // original selection removed from the result + ( + indoc! {r##" + ( + Some(#[thing|]#), + Some(#(other_thing|)#), + ) + "##}, + "<A-O><A-O><A-O>", + indoc! {r##" + #[( + Some(|]#thing#(), + Some(|)#other_thing#(), + )|)# + "##}, + ), + ( + indoc! {r##" + ( + Some(#[thing|]#), + Some(#(other_thing|)#), + ) + "##}, + "<A-O><A-O><A-O><A-i><A-i><A-i>", + indoc! {r##" + ( + Some(#[thing|]#), + Some(#(other_thing|)#), + ) "##}, ), ]; |