Migrate boxWithJava tests to multi-file framework
This commit is contained in:
+16
@@ -1,3 +1,19 @@
|
||||
// FILE: Child.java
|
||||
|
||||
class Child extends Parent {
|
||||
public static int b = 3;
|
||||
public static int c = 4;
|
||||
}
|
||||
|
||||
// FILE: Parent.java
|
||||
|
||||
class Parent {
|
||||
public static int a = 1;
|
||||
public static int b = 2;
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box(): String {
|
||||
if (Parent.a != 1) return "expected Parent.a == 1"
|
||||
if (Parent.b != 2) return "expected Parent.b == 2"
|
||||
@@ -1,4 +0,0 @@
|
||||
class Child extends Parent {
|
||||
public static int b = 3;
|
||||
public static int c = 4;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
class Parent {
|
||||
public static int a = 1;
|
||||
public static int b = 2;
|
||||
}
|
||||
+24
@@ -1,3 +1,27 @@
|
||||
// FILE: Child.java
|
||||
|
||||
class Child extends Parent {
|
||||
public static String bar() {
|
||||
return "Child.bar";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Child.baz";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Parent.java
|
||||
|
||||
class Parent {
|
||||
public static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Parent.baz";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box(): String {
|
||||
if (Parent.foo() != "Parent.foo") return "expected: Parent.foo"
|
||||
if (Parent.baz() != "Parent.baz") return "expected: Parent.baz"
|
||||
@@ -1,8 +0,0 @@
|
||||
class Child extends Parent {
|
||||
public static String bar() {
|
||||
return "Child.bar";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Child.baz";
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
class Parent {
|
||||
public static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
public static String baz() {
|
||||
return "Parent.baz";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// FILE: Child.java
|
||||
|
||||
class Child extends Parent {
|
||||
public static String a = "2";
|
||||
public static String foo() {
|
||||
return "Child.foo()";
|
||||
}
|
||||
public static String foo(int i) {
|
||||
return "Child.foo(int)";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Parent.java
|
||||
|
||||
class Parent {
|
||||
private static int a = 1;
|
||||
private static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun box(): String {
|
||||
if (Child.a != "2") return "Fail #1"
|
||||
if (Child.foo() != "Child.foo()") return "Fail #2"
|
||||
if (Child.foo(1) != "Child.foo(int)") return "Fail #3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
class Child extends Parent {
|
||||
public static String a = "2";
|
||||
public static String foo() {
|
||||
return "Child.foo()";
|
||||
}
|
||||
public static String foo(int i) {
|
||||
return "Child.foo(int)";
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
class Parent {
|
||||
private static int a = 1;
|
||||
private static String foo() {
|
||||
return "Parent.foo";
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fun box(): String {
|
||||
if (Child.a != "2") return "Fail #1"
|
||||
if (Child.foo() != "Child.foo()") return "Fail #2"
|
||||
if (Child.foo(1) != "Child.foo(int)") return "Fail #3"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// FILE: JavaClass.java
|
||||
|
||||
public class JavaClass {
|
||||
|
||||
public String runZ(Z z) {
|
||||
return z.run("O", "K");
|
||||
}
|
||||
|
||||
protected interface Z {
|
||||
String run(String s1, String s2);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
|
||||
package zzz
|
||||
|
||||
import JavaClass
|
||||
import JavaClass.Z
|
||||
|
||||
class A : JavaClass() {
|
||||
fun test() = runZ(JavaClass.Z {a, b -> a + b})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A().test()
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
public class JavaClass {
|
||||
|
||||
public String runZ(Z z) {
|
||||
return z.run("O", "K");
|
||||
}
|
||||
|
||||
protected interface Z {
|
||||
String run(String s1, String s2);
|
||||
}
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package zzz
|
||||
|
||||
import JavaClass
|
||||
import JavaClass.Z
|
||||
|
||||
class A : JavaClass() {
|
||||
fun test() = runZ(JavaClass.Z {a, b -> a + b})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return A().test()
|
||||
}
|
||||
+13
-1
@@ -1,3 +1,15 @@
|
||||
// FILE: First.java
|
||||
|
||||
public abstract class First {
|
||||
protected static String TEST = "OK";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: First.kt
|
||||
|
||||
package anotherPackage
|
||||
|
||||
import First
|
||||
@@ -20,4 +32,4 @@ fun box(): String {
|
||||
if (Second().foo2().invoke() != "OK") return "fail 4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
public abstract class First {
|
||||
protected static String TEST = "OK";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
}
|
||||
+28
-1
@@ -1,3 +1,30 @@
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
|
||||
protected static String BASE_ONLY = "BASE";
|
||||
|
||||
protected static String baseOnly() {
|
||||
return BASE_ONLY;
|
||||
}
|
||||
|
||||
protected static String TEST = "BASE";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
|
||||
public static class Derived extends Base {
|
||||
protected static String TEST = "DERIVED";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
|
||||
package anotherPackage
|
||||
|
||||
import Base.Derived
|
||||
@@ -28,4 +55,4 @@ class Kotlin : Base.Derived() {
|
||||
|
||||
fun box(): String {
|
||||
return Kotlin().doTest()
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
public class Base {
|
||||
|
||||
protected static String BASE_ONLY = "BASE";
|
||||
|
||||
protected static String baseOnly() {
|
||||
return BASE_ONLY;
|
||||
}
|
||||
|
||||
protected static String TEST = "BASE";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
|
||||
public static class Derived extends Base {
|
||||
protected static String TEST = "DERIVED";
|
||||
|
||||
protected static String test() {
|
||||
return TEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -1,3 +1,15 @@
|
||||
// FILE: First.java
|
||||
|
||||
public abstract class First {
|
||||
protected static String TEST = "O";
|
||||
|
||||
protected static String test() {
|
||||
return "K";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: Kotlin.kt
|
||||
|
||||
package anotherPackage
|
||||
|
||||
import First
|
||||
@@ -11,4 +23,4 @@ class Test : First() {
|
||||
|
||||
fun box(): String {
|
||||
return Test().doTest()
|
||||
}
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
public abstract class First {
|
||||
protected static String TEST = "O";
|
||||
|
||||
protected static String test() {
|
||||
return "K";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user