mirror of
https://github.com/irmen/prog8.git
synced 2024-11-29 17:50:35 +00:00
+ #40: test that (module-level) blocks *before the last* still must have a newline after their closing }
This commit is contained in:
parent
3b91e59a79
commit
1468049fe9
@ -54,6 +54,21 @@ class TestAntlrParser {
|
|||||||
assertEquals(parseTree.block().size, 1)
|
assertEquals(parseTree.block().size, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testAllBlocksButLastMustEndWithNewline() {
|
||||||
|
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||||
|
|
||||||
|
// BAD: 2nd block `bar` does NOT start on new line; however, there's is a nl at the very end
|
||||||
|
val srcBad = "foo {" + nl + "}" + " bar {" + nl + "}" + nl
|
||||||
|
|
||||||
|
// GOOD: 2nd block `bar` does start on a new line; however, a nl at the very end ain't needed
|
||||||
|
val srcGood = "foo {" + nl + "}" + nl + "bar {" + nl + "}"
|
||||||
|
|
||||||
|
assertFailsWith<ParsingFailedError> { parseModule(srcBad) }
|
||||||
|
val parseTree = parseModule(srcGood)
|
||||||
|
assertEquals(parseTree.block().size, 2)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testProg8Ast() {
|
fun testProg8Ast() {
|
||||||
// can create charstreams from many other sources as well;
|
// can create charstreams from many other sources as well;
|
||||||
|
Loading…
Reference in New Issue
Block a user