diff --git a/compilerAst/test/TestModuleImporter.kt b/compilerAst/test/TestModuleImporter.kt index 16edb94c4..61a0db0b1 100644 --- a/compilerAst/test/TestModuleImporter.kt +++ b/compilerAst/test/TestModuleImporter.kt @@ -257,8 +257,8 @@ class TestModuleImporter { } } - @Test - fun testImportingFileWithSyntaxError() { + + private fun doTestImportingFileWithSyntaxError(repetitions: Int) { val program = Program("foo", mutableListOf(), DummyFunctions, DummyMemsizer) val searchIn = "./" + workingDir.relativize(fixturesDir).toString().replace("\\", "/") val importer = ModuleImporter(program, "blah", listOf(searchIn)) @@ -267,7 +267,7 @@ class TestModuleImporter { val act = { importer.importLibraryModule(importing.nameWithoutExtension) } - repeat(2) { n -> + repeat(repetitions) { n -> assertThrows(count[n] + " call") { act() }.let { assertThat(it.position.file, `is`(imported.normalize().absolutePathString())) assertThat("line; should be 1-based", it.position.line, `is`(2)) @@ -276,6 +276,17 @@ class TestModuleImporter { } } } + + @Test + fun testImportingFileWithSyntaxError_once() { + doTestImportingFileWithSyntaxError(1) + } + + @Test + @Disabled("TODO: module that imports faulty module should not be kept in Program.modules") + fun testImportingFileWithSyntaxError_twice() { + doTestImportingFileWithSyntaxError(2) + } } } }