aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests
diff options
context:
space:
mode:
authorAlex2023-06-08 17:11:40 +0000
committerGitHub2023-06-08 17:11:40 +0000
commit993c68ad6f9d15c3870871ae5be16ebbd4de0382 (patch)
tree3e46edfa900cd0703ae7564f32feb70f0a58a63f /helix-term/tests
parente2a1678436ded3542be4d91d5eeee63eb777bde7 (diff)
Auto indent on `insert_at_line_start` (#5837)
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(())
+}