Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/tests/test/commands/insert.rs')
-rw-r--r--helix-term/tests/test/commands/insert.rs56
1 files changed, 56 insertions, 0 deletions
diff --git a/helix-term/tests/test/commands/insert.rs b/helix-term/tests/test/commands/insert.rs
index 9499868e..7f00826b 100644
--- a/helix-term/tests/test/commands/insert.rs
+++ b/helix-term/tests/test/commands/insert.rs
@@ -583,3 +583,59 @@ async fn test_jump_undo_redo() -> anyhow::Result<()> {
.await?;
Ok(())
}
+
+#[tokio::test(flavor = "multi_thread")]
+async fn test_indent_with_spaces() -> anyhow::Result<()> {
+ let tests = vec![
+ // at start of line
+ (
+ indoc! {"\
+ SELECT *
+ #[|FROM table]#
+ #(|WHERE condition)#
+ "},
+ "i<tab>",
+ indoc! {"\
+ SELECT *
+ #[|FROM table]#
+ #(|WHERE condition)#
+ "},
+ ),
+ // in the middle of line
+ (
+ indoc! {"\
+ SELECT #[*|]#
+ FROM #(table|)#
+ WHERE #(condition|)#
+ "},
+ "i<S-tab>",
+ indoc! {"\
+ SELECT #[|*]#
+ FROM #(|table)#
+ WHERE #(|condition)#
+ "},
+ ),
+ // indentation in normal mode
+ (
+ indoc! {"\
+ -- comment
+ #[|SELECT *
+ FROM table
+ WHERE condition]#
+ "},
+ "<gt>",
+ indoc! {"\
+ -- comment
+ #[|SELECT *
+ FROM table
+ WHERE condition]#
+ "},
+ ),
+ ];
+
+ for test in tests {
+ test_with_config(AppBuilder::new().with_file("foo.rs", None), test).await?;
+ }
+
+ Ok(())
+}