+ add two tests for parseModule with empty source text (from File and from String)

This commit is contained in:
meisl 2021-07-10 21:03:14 +02:00
parent ddaef3e5d5
commit 6fa50a699f
2 changed files with 15 additions and 0 deletions

View File

@ -176,6 +176,21 @@ class TestProg8Parser {
} }
@Test
fun testParseModuleWithEmptyString() {
val module = parseModule(SourceCode.of(""))
assertEquals(0, module.statements.size)
}
@Test
fun testParseModuleWithEmptyFile() {
val path = fixturesDir.resolve("empty.p8")
assertTrue(path.isRegularFile(), "sanity check: should be regular file: $path")
val module = parseModule(SourceCode.fromPath(path))
assertEquals(0, module.statements.size)
}
@Test @Test
fun testModuleNameForSourceFromString() { fun testModuleNameForSourceFromString() {
val srcText = """ val srcText = """

0
compilerAst/test/fixtures/empty.p8 vendored Normal file
View File