From 3b91e59a792033b6f81780ce8e9d05cc9e9afda0 Mon Sep 17 00:00:00 2001 From: meisl Date: Sun, 13 Jun 2021 20:28:01 +0200 Subject: [PATCH] * #40: refactor tests --- compilerAst/test/TestAntlrParser.kt | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/compilerAst/test/TestAntlrParser.kt b/compilerAst/test/TestAntlrParser.kt index 4dfcf8e52..b58f91e2b 100644 --- a/compilerAst/test/TestAntlrParser.kt +++ b/compilerAst/test/TestAntlrParser.kt @@ -37,13 +37,9 @@ class TestAntlrParser { } @Test - fun testModuleFileNeedNotEndWithNewline() { - val srcText = """ -main { - sub start() { - return - } -}""" // file ends with '}' (= NO newline, issue #40) + fun testModuleSourceNeedNotEndWithNewline() { + val nl = "\n" // say, Unix-style (different flavours tested elsewhere) + val srcText = "foo {" + nl + "}" // source ends with '}' (= NO newline, issue #40) // before the fix, prog8Parser would have reported (thrown) "missing at ''" val parseTree = parseModule(srcText) @@ -51,14 +47,9 @@ main { } @Test - fun testModuleFileMayEndWithNewline() { - val srcText = """ -main { - sub start() { - return - } -} -""" // file does end with a newline (issue #40) + fun testModuleSourceMayEndWithNewline() { + val nl = "\n" // say, Unix-style (different flavours tested elsewhere) + val srcText = "foo {" + nl + "}" + nl // source does end with a newline (issue #40) val parseTree = parseModule(srcText) assertEquals(parseTree.block().size, 1) }