mirror of
https://github.com/irmen/prog8.git
synced 2024-11-22 15:33:02 +00:00
* #40: refactor tests
This commit is contained in:
parent
3496a30528
commit
3b91e59a79
@ -37,13 +37,9 @@ class TestAntlrParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModuleFileNeedNotEndWithNewline() {
|
fun testModuleSourceNeedNotEndWithNewline() {
|
||||||
val srcText = """
|
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||||
main {
|
val srcText = "foo {" + nl + "}" // source ends with '}' (= NO newline, issue #40)
|
||||||
sub start() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}""" // file ends with '}' (= NO newline, issue #40)
|
|
||||||
|
|
||||||
// before the fix, prog8Parser would have reported (thrown) "missing <EOL> at '<EOF>'"
|
// before the fix, prog8Parser would have reported (thrown) "missing <EOL> at '<EOF>'"
|
||||||
val parseTree = parseModule(srcText)
|
val parseTree = parseModule(srcText)
|
||||||
@ -51,14 +47,9 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testModuleFileMayEndWithNewline() {
|
fun testModuleSourceMayEndWithNewline() {
|
||||||
val srcText = """
|
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||||
main {
|
val srcText = "foo {" + nl + "}" + nl // source does end with a newline (issue #40)
|
||||||
sub start() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
""" // file does end with a newline (issue #40)
|
|
||||||
val parseTree = parseModule(srcText)
|
val parseTree = parseModule(srcText)
|
||||||
assertEquals(parseTree.block().size, 1)
|
assertEquals(parseTree.block().size, 1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user