aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests/test/languages/go.rs
diff options
context:
space:
mode:
authorSkyler Hawthorne2023-04-14 15:00:15 +0000
committerBlaž Hrastnik2023-08-10 21:22:22 +0000
commit7078e8400736dce923be44a4d26f136a22640f93 (patch)
treee1f9d821b605c5809d3210a79b91922c6edeb06b /helix-term/tests/test/languages/go.rs
parent57f093d83641642ad5d4ba42ae59f03272efcfcc (diff)
Fix YAML auto indent
YAML indents queries are tweaked to fix auto indent behavior. A new capture type `indent.always` is introduced to address use cases where combining indent captures on a single line is desired. Fixes #6661
Diffstat (limited to 'helix-term/tests/test/languages/go.rs')
-rw-r--r--helix-term/tests/test/languages/go.rs41
1 files changed, 41 insertions, 0 deletions
diff --git a/helix-term/tests/test/languages/go.rs b/helix-term/tests/test/languages/go.rs
new file mode 100644
index 00000000..7bb3651e
--- /dev/null
+++ b/helix-term/tests/test/languages/go.rs
@@ -0,0 +1,41 @@
+use super::*;
+
+#[tokio::test(flavor = "multi_thread")]
+async fn auto_indent() -> anyhow::Result<()> {
+ let app = || AppBuilder::new().with_file("foo.go", None);
+
+ let enter_tests = [
+ (
+ helpers::platform_line(indoc! {r##"
+ type Test struct {#[}|]#
+ "##}),
+ "i<ret>",
+ helpers::platform_line(indoc! {"\
+ type Test struct {
+ \t#[|\n]#
+ }
+ "}),
+ ),
+ (
+ helpers::platform_line(indoc! {"\
+ func main() {
+ \tswitch nil {#[}|]#
+ }
+ "}),
+ "i<ret>",
+ helpers::platform_line(indoc! {"\
+ func main() {
+ \tswitch nil {
+ \t\t#[|\n]#
+ \t}
+ }
+ "}),
+ ),
+ ];
+
+ for test in enter_tests {
+ test_with_config(app(), test).await?;
+ }
+
+ Ok(())
+}