[Test] Migrate AbstractBytecodeTextTest to new test infrastructure

This commit is contained in:
Dmitriy Novozhilov
2021-01-25 14:40:14 +03:00
parent e928448e00
commit f61a318c9d
26 changed files with 3556 additions and 1737 deletions
@@ -32,14 +32,19 @@ fun compileJavaFiles(
val diagnosticCollector = DiagnosticCollector<JavaFileObject>()
javaCompiler.getStandardFileManager(diagnosticCollector, Locale.ENGLISH, Charset.forName("utf-8")).use { fileManager ->
val javaFileObjectsFromFiles = fileManager.getJavaFileObjectsFromFiles(files)
val task = javaCompiler.getTask(
StringWriter(), // do not write to System.err
fileManager,
diagnosticCollector,
options,
null,
javaFileObjectsFromFiles
)
val task = try {
javaCompiler.getTask(
StringWriter(), // do not write to System.err
fileManager,
diagnosticCollector,
options,
null,
javaFileObjectsFromFiles
)
} catch (e: Throwable) {
if (ignoreJavaErrors) return false
else throw e
}
val success = task.call() // do NOT inline this variable, call() should complete before errorsToString()
if (javaErrorFile == null || !javaErrorFile.exists()) {
assertions.assertTrue(success || ignoreJavaErrors) { errorsToString(diagnosticCollector, true) }