summaryrefslogtreecommitdiff
path: root/helix-term/tests
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/tests')
-rw-r--r--helix-term/tests/test/commands.rs83
1 files changed, 83 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs
index e52b142c..1172a798 100644
--- a/helix-term/tests/test/commands.rs
+++ b/helix-term/tests/test/commands.rs
@@ -526,3 +526,86 @@ async fn test_join_selections() -> anyhow::Result<()> {
Ok(())
}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn test_join_selections_space() -> anyhow::Result<()> {
+ // join with empty lines panic
+ test((
+ platform_line(indoc! {"\
+ #[a
+
+ b
+
+ c
+
+ d
+
+ e|]#
+ "}),
+ "<A-J>",
+ platform_line(indoc! {"\
+ a#[ |]#b#( |)#c#( |)#d#( |)#e
+ "}),
+ ))
+ .await?;
+
+ // normal join
+ test((
+ platform_line(indoc! {"\
+ #[a|]#bc
+ def
+ "}),
+ "<A-J>",
+ platform_line(indoc! {"\
+ abc#[ |]#def
+ "}),
+ ))
+ .await?;
+
+ // join with empty line
+ test((
+ platform_line(indoc! {"\
+ #[a|]#bc
+
+ def
+ "}),
+ "<A-J>",
+ platform_line(indoc! {"\
+ #[a|]#bc
+ def
+ "}),
+ ))
+ .await?;
+
+ // join with additional space in non-empty line
+ test((
+ platform_line(indoc! {"\
+ #[a|]#bc
+
+ def
+ "}),
+ "<A-J><A-J>",
+ platform_line(indoc! {"\
+ abc#[ |]#def
+ "}),
+ ))
+ .await?;
+
+ // join with retained trailing spaces
+ test((
+ platform_line(indoc! {"\
+ #[aaa
+
+ bb
+
+ c |]#
+ "}),
+ "<A-J>",
+ platform_line(indoc! {"\
+ aaa #[ |]#bb #( |)#c
+ "}),
+ ))
+ .await?;
+
+ Ok(())
+}