use of org.jetbrains.kotlin.cli.common.modules.ModuleScriptData in project kotlin by JetBrains.
the class AbstractModuleXmlParserTest method doTest.
protected static void doTest(String xmlPath) throws IOException {
File txtFile = new File(FileUtil.getNameWithoutExtension(xmlPath) + ".txt");
ModuleScriptData result = ModuleXmlParser.parseModuleScript(xmlPath, new MessageCollector() {
@Override
public void report(@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location) {
throw new AssertionError(MessageRenderer.PLAIN_FULL_PATHS.render(severity, message, location));
}
@Override
public void clear() {
// Do nothing
}
@Override
public boolean hasErrors() {
throw new UnsupportedOperationException();
}
});
StringBuilder sb = new StringBuilder();
for (Module module : result.getModules()) {
sb.append(moduleToString(module)).append("\n");
}
String actual = sb.toString();
if (!txtFile.exists()) {
FileUtil.writeToFile(txtFile, actual);
fail("Expected data file does not exist. A new file created: " + txtFile);
}
KotlinTestUtils.assertEqualsToFile(txtFile, actual);
}
Aggregations