From 2ac1de305e10238a2e7ed8c0d66f3fa78566dbaa Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Tue, 5 Jul 2022 01:51:15 +0300 Subject: Fix backwards selection duplication widening bug (#2945) * Fix backwards selection duplication widening bug * Add integration tests * Make tests line-ending agnostic Make tests line-ending agnostic Use indoc to fix tests Fix line-ending on test input--- helix-term/tests/test/commands.rs | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'helix-term/tests/test') diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs index 0cd79bc7..f7ce9af0 100644 --- a/helix-term/tests/test/commands.rs +++ b/helix-term/tests/test/commands.rs @@ -91,3 +91,43 @@ async fn test_buffer_close_concurrent() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test] +async fn test_selection_duplication() -> anyhow::Result<()> { + // Forward + test(( + platform_line(indoc! {"\ + #[lo|]#rem + ipsum + dolor + "}) + .as_str(), + "CC", + platform_line(indoc! {"\ + #(lo|)#rem + #(ip|)#sum + #[do|]#lor + "}) + .as_str(), + )) + .await?; + + // Backward + test(( + platform_line(indoc! {"\ + #[|lo]#rem + ipsum + dolor + "}) + .as_str(), + "CC", + platform_line(indoc! {"\ + #(|lo)#rem + #(|ip)#sum + #[|do]#lor + "}) + .as_str(), + )) + .await?; + Ok(()) +} -- cgit v1.2.3-70-g09d2