Minor, refactor compiler-running code in multiplatform integration test

The compiler is run twice and outputs are compared for equality. Thus,
if both runs ended with exceptions, the outputs were never equal because
the compiler was run from different places (stack traces were different
in only one line), which was a bit weird. Now outputs are equal and in
case of an exception, a standard "actual data differs from file content"
message is displayed
This commit is contained in:
Alexander Udalov
2017-09-19 17:26:21 +03:00
parent 2d9f07deec
commit 3f1ee74475
@@ -70,8 +70,13 @@ abstract class AbstractMultiPlatformIntegrationTest : KtUsefulTestCase() {
}
private fun CLICompiler<*>.compileBothWays(commonSource: File, platformSource: File, vararg mainArguments: String): String {
val platformFirst = compile(listOf(platformSource, commonSource), *mainArguments)
val commonFirst = compile(listOf(commonSource, platformSource), *mainArguments)
val configurations = listOf(
listOf(platformSource, commonSource),
listOf(commonSource, platformSource)
)
val (platformFirst, commonFirst) = configurations.map { compile(it, *mainArguments) }
if (platformFirst != commonFirst) {
assertEquals(
"Compilation results are different when compiling [platform-specific, common] compared to when compiling [common, platform-specific]",