Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad committed Jun 4, 2019
1 parent 33dd81e commit b4fbf77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,29 @@ class MppProjectTest : BaseKotlinGradleTest() {
":transformJvmMainAtomicfu",
":transformJvmTestAtomicfu",
":compileKotlinJs",
":compileTestKotlinJs",
":transformJsMainAtomicfu",
":transformJsTestAtomicfu"
":transformJsMainAtomicfu"
)

build("build") {
checkOutcomes(TaskOutcome.SUCCESS, *tasksToCheck)

fun checkPlatform(platform: String, fileInMainName: String) {
val isJs = platform == "js"
val testCompileClasspathFiles = projectDir.resolve("build/classpath/$platform/test_compile.txt")
.readLines().asSequence().flatMapTo(HashSet()) { File(it).walk().filter(File::isFile) }

val testRuntimeClasspathFiles = projectDir.resolve("build/classpath/$platform/test_runtime.txt")
val testRuntimeClasspathFiles = if (isJs) emptySet<File>() else projectDir.resolve("build/classpath/$platform/test_runtime.txt")
.readLines().asSequence().flatMapTo(HashSet()) { File(it).walk().filter(File::isFile) }

projectDir.resolve("build/classes/kotlin/$platform/main/$fileInMainName").let {
it.checkExists()
check(it in testCompileClasspathFiles) { "Original '$it' is missing from $platform test compile classpath" }
check(it in testRuntimeClasspathFiles) { "Original '$it' is missing from $platform test runtime classpath" }
if (!isJs) check(it in testRuntimeClasspathFiles) { "Original '$it' is missing from $platform test runtime classpath" }
}

projectDir.resolve("build/classes/atomicfu/jvm/main/IntArithmetic.class").let {
it.checkExists()
check(it !in testCompileClasspathFiles) { "Transformed '$it' is present in $platform test compile classpath" }
check(it !in testRuntimeClasspathFiles) { "Transformed '$it' is present in $platform test runtime classpath" }
if (!isJs) check(it !in testRuntimeClasspathFiles) { "Transformed '$it' is present in $platform test runtime classpath" }
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def File classpathFile(String platform, String fileName) {
return file("$dir/$fileName")
}


compileTestKotlinJvm.doLast {
classpathFile("jvm", "test_compile.txt").text = classpath.files.join("\n")
}
Expand All @@ -62,6 +63,6 @@ compileTestKotlinJs.doLast {
classpathFile("js", "test_compile.txt").text = classpath.files.join("\n")
}

jsTest.doLast {
classpathFile("js", "test_runtime.txt").text = classpath.files.join("\n")
}
jsTest.dependsOn(":compileTestKotlinJs")
jsTest.dependsOn(":transformJsTestAtomicfu")
check.dependsOn(":jsTest")

0 comments on commit b4fbf77

Please sign in to comment.