Add tests for non-compatible ABI changes

This commit is contained in:
Alexey Tsvetkov
2018-12-02 23:41:56 +03:00
parent 5891617674
commit 8992ee6280
12 changed files with 63 additions and 2 deletions
@@ -13,13 +13,17 @@ abstract class AbstractCompareJvmAbiTest : BaseJvmAbiTest() {
fun doTest(path: String) {
val testDir = File(path)
val base = Compilation(testDir, "base").also { make(it) }
val sameAbiDir = testDir.resolve("sameAbi")
val differentAbiDir = testDir.resolve("differentAbi")
if (testDir.resolve("sameAbi").exists()) {
assert(sameAbiDir.exists() || differentAbiDir.exists()) { "Nothing to compare" }
if (sameAbiDir.exists()) {
val sameAbi = Compilation(testDir, "sameAbi").also { make(it) }
assertEqualDirectories(sameAbi.abiDir, base.abiDir, forgiveExtraFiles = false)
}
if (testDir.resolve("differentAbi").exists()) {
if (differentAbiDir.exists()) {
val differentAbi = Compilation(testDir, "differentAbi").also { make(it) }
assertFails("$base and $differentAbi abi are equal") {
assertEqualDirectories(differentAbi.abiDir, base.abiDir, forgiveExtraFiles = false)
@@ -34,6 +34,11 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
runTest("plugins/jvm-abi-gen/testData/compare/anonymousClass/");
}
@TestMetadata("classFlags")
public void testClassFlags() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/classFlags/");
}
@TestMetadata("classPrivateMemebers")
public void testClassPrivateMemebers() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/classPrivateMemebers/");
@@ -44,6 +49,11 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
runTest("plugins/jvm-abi-gen/testData/compare/clinit/");
}
@TestMetadata("constant")
public void testConstant() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/constant/");
}
@TestMetadata("functionBody")
public void testFunctionBody() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/functionBody/");
@@ -64,6 +74,11 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
runTest("plugins/jvm-abi-gen/testData/compare/localClass/");
}
@TestMetadata("parameterName")
public void testParameterName() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/parameterName/");
}
@TestMetadata("privateClass")
public void testPrivateClass() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/privateClass/");
@@ -79,6 +94,16 @@ public class CompareJvmAbiTestGenerated extends AbstractCompareJvmAbiTest {
runTest("plugins/jvm-abi-gen/testData/compare/propertyReference/");
}
@TestMetadata("returnType")
public void testReturnType() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/returnType/");
}
@TestMetadata("superClass")
public void testSuperClass() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/superClass/");
}
@TestMetadata("topLevelPrivateMembers")
public void testTopLevelPrivateMembers() throws Exception {
runTest("plugins/jvm-abi-gen/testData/compare/topLevelPrivateMembers/");
@@ -0,0 +1,3 @@
package test
class Class
@@ -0,0 +1,3 @@
package test
open class Class
@@ -0,0 +1,3 @@
package test
const val x = 0
@@ -0,0 +1,3 @@
package test
const val x = 1
@@ -0,0 +1,3 @@
package test
fun id(x: Int): Int = x
@@ -0,0 +1,3 @@
package test
fun id(y: Int): Int = y
@@ -0,0 +1,3 @@
package test
fun foo() = 0
@@ -0,0 +1,3 @@
package test
fun foo() = "0"
@@ -0,0 +1,4 @@
package test
open class A
class B : A()
@@ -0,0 +1,4 @@
package test
open class A
class B