From 3f1ee74475dac91fbc48a3eebb6b2861a52f8a39 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 19 Sep 2017 17:26:21 +0300 Subject: [PATCH] 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 --- .../AbstractMultiPlatformIntegrationTest.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/multiplatform/AbstractMultiPlatformIntegrationTest.kt b/compiler/tests/org/jetbrains/kotlin/multiplatform/AbstractMultiPlatformIntegrationTest.kt index 8094f858cfd..1d28d758442 100644 --- a/compiler/tests/org/jetbrains/kotlin/multiplatform/AbstractMultiPlatformIntegrationTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/multiplatform/AbstractMultiPlatformIntegrationTest.kt @@ -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]",