aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/tests')
-rw-r--r--helix-term/tests/test/commands.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands.rs b/helix-term/tests/test/commands.rs
index 52b123c7..b13c37bc 100644
--- a/helix-term/tests/test/commands.rs
+++ b/helix-term/tests/test/commands.rs
@@ -426,3 +426,56 @@ async fn test_delete_char_forward() -> anyhow::Result<()> {
Ok(())
}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn test_insert_with_indent() -> anyhow::Result<()> {
+ const INPUT: &str = "\
+#[f|]#n foo() {
+ if let Some(_) = None {
+
+ }
+\x20
+}
+
+fn bar() {
+
+}";
+
+ // insert_at_line_start
+ test((
+ INPUT,
+ ":lang rust<ret>%<A-s>I",
+ "\
+#[f|]#n foo() {
+ #(i|)#f let Some(_) = None {
+ #(\n|)#\
+\x20 #(}|)#
+#(\x20|)#
+#(}|)#
+#(\n|)#\
+#(f|)#n bar() {
+ #(\n|)#\
+#(}|)#",
+ ))
+ .await?;
+
+ // insert_at_line_end
+ test((
+ INPUT,
+ ":lang rust<ret>%<A-s>A",
+ "\
+fn foo() {#[\n|]#\
+\x20 if let Some(_) = None {#(\n|)#\
+\x20 #(\n|)#\
+\x20 }#(\n|)#\
+\x20#(\n|)#\
+}#(\n|)#\
+#(\n|)#\
+fn bar() {#(\n|)#\
+\x20 #(\n|)#\
+}#(|)#",
+ ))
+ .await?;
+
+ Ok(())
+}