diff options
author | Alex | 2023-06-08 17:11:40 +0000 |
---|---|---|
committer | GitHub | 2023-06-08 17:11:40 +0000 |
commit | 993c68ad6f9d15c3870871ae5be16ebbd4de0382 (patch) | |
tree | 3e46edfa900cd0703ae7564f32feb70f0a58a63f /helix-term/tests/test/commands.rs | |
parent | e2a1678436ded3542be4d91d5eeee63eb777bde7 (diff) |
Auto indent on `insert_at_line_start` (#5837)
Diffstat (limited to 'helix-term/tests/test/commands.rs')
-rw-r--r-- | helix-term/tests/test/commands.rs | 53 |
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(()) +} |