diff --git a/src/test/java/intellij_awk/AwkBracesAndQuoteAutoCloseTests.java b/src/test/java/intellij_awk/AwkBracesAndQuoteAutoCloseTests.java index fb3e954..1caaf4d 100644 --- a/src/test/java/intellij_awk/AwkBracesAndQuoteAutoCloseTests.java +++ b/src/test/java/intellij_awk/AwkBracesAndQuoteAutoCloseTests.java @@ -73,6 +73,43 @@ public void testQuote1() { "BEGIN {\n print \"\"\n print \"\"}"); } + public void testEnterCurlyBrace1() { + doTest( + '\n', + "function f() {\n {print 123\n}", + "function f() {\n {\n print 123\n }\n}"); + } + + public void testEnterCurlyBrace2() { + doTest( + '\n', + "function f() {\n if(1){print 123\n}", + "function f() {\n if(1){\n print 123\n }\n}"); + } + + public void testEnterCurlyBrace3() { + doTest( + '\n', + "function f() {\n while(1){print 123\n}", + "function f() {\n while(1){\n print 123\n }\n}"); + } + + public void testEnterCurlyBrace4() { + doTest( + '\n', + "function f() {\n for (;;) {f(1)\n}", + "function f() {\n for (;;) {\n f(1)\n }\n}"); + } + public void testEnterCurlyBrace5() { + doTest('\n', "{print 123", "{\n print 123\n}"); + } + public void testEnterCurlyBrace6() { + doTest('\n', "BEGIN{print 123", "BEGIN{\n print 123\n}"); + } + public void testEnterCurlyBrace7() { + doTest('\n', "NF {print 123", "NF {\n print 123\n}"); + } + private void doTest(char brace, String code, String expectedCode) { myFixture.configureByText("a.awk", code); myFixture.type(brace);