Rename tests: boxWithJava -> boxAgainstJava
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public enum simpleJavaEnum {
|
||||
A;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import test.*
|
||||
|
||||
fun box() =
|
||||
if (simpleJavaEnum.A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -0,0 +1,18 @@
|
||||
package test;
|
||||
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
|
||||
public enum simpleJavaEnumWithFunction {
|
||||
A {
|
||||
@Override
|
||||
public String repr() {
|
||||
return "A";
|
||||
}
|
||||
},
|
||||
B;
|
||||
|
||||
public String repr() {
|
||||
return "ololol" + toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import test.simpleJavaEnumWithFunction.*
|
||||
|
||||
fun box() =
|
||||
if (A.repr() == "A" && B.repr() == "olololB") "OK"
|
||||
else "fail"
|
||||
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public enum simpleJavaEnumWithStaticImport {
|
||||
A;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import test.simpleJavaEnumWithStaticImport.A
|
||||
|
||||
fun box() =
|
||||
if (A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class simpleJavaInnerEnum {
|
||||
public enum MyEnum {
|
||||
A;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import test.*
|
||||
import test.simpleJavaInnerEnum.MyEnum.A
|
||||
|
||||
fun box() =
|
||||
if (simpleJavaInnerEnum.MyEnum.A.toString() == "A" && A.toString() == "A") "OK"
|
||||
else "fail"
|
||||
@@ -0,0 +1,12 @@
|
||||
package test;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.EnumSet;
|
||||
|
||||
public enum staticField {
|
||||
INSTANCE;
|
||||
|
||||
public static int foo = 42;
|
||||
|
||||
public static final Set<staticField> INSTANCES = EnumSet.of(INSTANCE);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import test.staticField as E
|
||||
|
||||
fun box(): String {
|
||||
val instances = E.INSTANCES
|
||||
if (E.foo != 42)
|
||||
return "Wrong foo ${E.foo}"
|
||||
if (instances.size() != 1)
|
||||
return "Wrong size ${instances.size()}"
|
||||
if (E.INSTANCES.iterator().next() != E.INSTANCE)
|
||||
return "Wrong instance ${E.INSTANCES.iterator().next()}"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test;
|
||||
|
||||
public enum staticMethod {
|
||||
ENTRY;
|
||||
|
||||
public static String foo() {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
fun box() = test.staticMethod.foo()
|
||||
Reference in New Issue
Block a user