Skip to content

Commit

Permalink
Incorrect auto-insertion of } on Enter #216 : tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jun 24, 2024
1 parent a04a318 commit 44d980a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/test/java/intellij_awk/AwkBracesAndQuoteAutoCloseTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,43 @@ public void testQuote1() {
"BEGIN {\n print \"<caret>\"\n print \"\"}");
}

public void testEnterCurlyBrace1() {
doTest(
'\n',
"function f() {\n {<caret>print 123\n}",
"function f() {\n {\n <caret>print 123\n }\n}");
}

public void testEnterCurlyBrace2() {
doTest(
'\n',
"function f() {\n if(1){<caret>print 123\n}",
"function f() {\n if(1){\n <caret>print 123\n }\n}");
}

public void testEnterCurlyBrace3() {
doTest(
'\n',
"function f() {\n while(1){<caret>print 123\n}",
"function f() {\n while(1){\n <caret>print 123\n }\n}");
}

public void testEnterCurlyBrace4() {
doTest(
'\n',
"function f() {\n for (;;) {<caret>f(1)\n}",
"function f() {\n for (;;) {\n <caret>f(1)\n }\n}");
}
public void testEnterCurlyBrace5() {
doTest('\n', "{<caret>print 123", "{\n <caret>print 123\n}");
}
public void testEnterCurlyBrace6() {
doTest('\n', "BEGIN{<caret>print 123", "BEGIN{\n <caret>print 123\n}");
}
public void testEnterCurlyBrace7() {
doTest('\n', "NF {<caret>print 123", "NF {\n <caret>print 123\n}");
}

private void doTest(char brace, String code, String expectedCode) {
myFixture.configureByText("a.awk", code);
myFixture.type(brace);
Expand Down

0 comments on commit 44d980a

Please sign in to comment.