mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
+ add two tests for parseModule with empty source text (from File and from String)
This commit is contained in:
parent
ddaef3e5d5
commit
6fa50a699f
@ -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
|
||||
fun testModuleNameForSourceFromString() {
|
||||
val srcText = """
|
||||
|
0
compilerAst/test/fixtures/empty.p8
vendored
Normal file
0
compilerAst/test/fixtures/empty.p8
vendored
Normal file
Loading…
Reference in New Issue
Block a user