aboutsummaryrefslogtreecommitdiff
path: root/helix-term/tests/test/languages/go.rs
blob: 7bb3651e6ad733cc11865dd5cb8b524ce1725e9d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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(())
}