Migrate boxWithJava tests to multi-file framework

This commit is contained in:
Alexander Udalov
2016-03-01 19:18:37 +03:00
parent 0801ae5364
commit 2de7f38427
266 changed files with 2271 additions and 1729 deletions

View File

@@ -0,0 +1,28 @@
// FILE: Simple.java
public interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}
// FILE: main.kt
interface KInterface : Simple {
fun bar(): String {
return test("O") + Simple.testStatic("O")
}
}
class Test : KInterface {}
fun box(): String {
val test = Test().bar()
if (test != "OKOK") return "fail $test"
return "OK"
}

View File

@@ -0,0 +1,22 @@
// FILE: Simple.java
interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}
// FILE: main.kt
class Test : Simple {}
fun box(): String {
val test = Test().test("O")
if (test != "OK") return "fail $test"
return Simple.testStatic("O")
}

View File

@@ -0,0 +1,23 @@
// FILE: Simple.java
public interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}
// FILE: main.kt
interface TestInterface : Simple {}
class Test : TestInterface {}
fun box(): String {
val test = Test().test("O")
if (test != "OK") return "fail $test"
return Simple.testStatic("O")
}

View File

@@ -0,0 +1,23 @@
// FILE: Simple.java
public interface Simple {
default String test(String s) {
return s + "Fail";
}
}
// FILE: main.kt
interface KInterface: Simple {
override fun test(s: String): String {
return s + "K"
}
}
class Test : KInterface {
}
fun box(): String {
return Test().test("O")
}

View File

@@ -1,3 +1,16 @@
// FILE: Test.java
interface Test<T> {
T call();
default T testDefault(T p) {
return p;
}
}
// FILE: main.kt
class Child : Test<String> {
override fun call() : String {
return "OK"

View File

@@ -1,15 +1,23 @@
interface KTrait {
// FILE: Simple.java
interface Simple extends KInterface {
default String test() {
return "simple";
}
}
// FILE: main.kt
interface KInterface {
fun test(): String {
return "base";
}
}
class Test : Simple {
fun bar(): String {
return super.test()
}
}
fun box(): String {
@@ -20,4 +28,4 @@ fun box(): String {
if (bar != "simple") return "fail 2 $bar"
return "OK"
}
}

View File

@@ -1,4 +1,14 @@
interface KTrait : Test {
// FILE: Test.java
public interface Test {
default String test() {
return "OK";
}
}
// FILE: test.kt
interface KInterface : Test {
}
@@ -8,7 +18,7 @@ class KClass : Test {
}
}
class KTClass : KTrait {
class KTClass : KInterface {
fun ktest(): String {
return super.test() + test()
}
@@ -16,7 +26,7 @@ class KTClass : KTrait {
fun box(): String {
val p = object : KTrait {
val p = object : KInterface {
fun ktest(): String {
return super.test() + test()
}

View File

@@ -1,3 +1,13 @@
// FILE: Base.java
public interface Base {
default String foo() {
return "OK";
}
}
// FILE: derived.kt
interface K1 : Base
interface K2 : K1

View File

@@ -1,3 +1,12 @@
// FILE: J.java
public class J {
public J(String constructorParam) {}
public static void foo(int methodParam) {}
}
// FILE: K.kt
// JAVAC_OPTIONS: -parameters
import kotlin.test.assertEquals

View File

@@ -1,3 +1,13 @@
// FILE: J.java
public class J {
public J(String constructorParam) {}
public static void foo(int methodParam) {}
}
// FILE: K.kt
import kotlin.test.assertEquals
fun box(): String {

View File

@@ -0,0 +1,28 @@
// FILE: JavaCall.java
class JavaCall {
String call(Test test) {
return test.call();
}
}
// FILE: Test.java
interface Test {
String call();
default String test() {
return "K";
}
static String testStatic() {
return "K";
}
}
// FILE: sam.kt
fun box(): String {
return JavaCall().call {"OK"}
}

View File

@@ -1,9 +0,0 @@
public interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}

View File

@@ -1,14 +0,0 @@
interface KTrait : Simple {
fun bar(): String {
return test("O") + Simple.testStatic("O")
}
}
class Test : KTrait {}
fun box(): String {
val test = Test().bar()
if (test != "OKOK") return "fail $test"
return "OK"
}

View File

@@ -1,9 +0,0 @@
interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}

View File

@@ -1,8 +0,0 @@
class Test : Simple {}
fun box(): String {
val test = Test().test("O")
if (test != "OK") return "fail $test"
return Simple.testStatic("O")
}

View File

@@ -1,9 +0,0 @@
public interface Simple {
default String test(String s) {
return s + "K";
}
static String testStatic(String s) {
return s + "K";
}
}

View File

@@ -1,9 +0,0 @@
interface TestTrait : Simple {}
class Test : TestTrait {}
fun box(): String {
val test = Test().test("O")
if (test != "OK") return "fail $test"
return Simple.testStatic("O")
}

View File

@@ -1,5 +0,0 @@
public interface Simple {
default String test(String s) {
return s + "Fail";
}
}

View File

@@ -1,13 +0,0 @@
interface KTrait: Simple {
override fun test(s: String): String {
return s + "K"
}
}
class Test : KTrait {
}
fun box(): String {
return Test().test("O")
}

View File

@@ -1,8 +0,0 @@
interface Test<T> {
T call();
default T testDefault(T p) {
return p;
}
}

View File

@@ -1,5 +0,0 @@
interface Simple extends KTrait {
default String test() {
return "simple";
}
}

View File

@@ -1,5 +0,0 @@
public interface Test {
default String test() {
return "OK";
}
}

View File

@@ -1,5 +0,0 @@
public interface Base {
default String foo() {
return "OK";
}
}

View File

@@ -1,5 +0,0 @@
public class J {
public J(String constructorParam) {}
public static void foo(int methodParam) {}
}

View File

@@ -1,5 +0,0 @@
public class J {
public J(String constructorParam) {}
public static void foo(int methodParam) {}
}

View File

@@ -1,5 +0,0 @@
class JavaCall {
String call(Test test) {
return test.call();
}
}

View File

@@ -1,12 +0,0 @@
interface Test {
String call();
default String test() {
return "K";
}
static String testStatic() {
return "K";
}
}

View File

@@ -1,3 +0,0 @@
fun box(): String {
return JavaCall().call {"OK"}
}