Added tests with SAM adapters in comparison operators.

This commit is contained in:
Evgeny Gerashchenko
2013-06-26 01:21:29 +04:00
parent 9905e2a719
commit 79185b6775
4 changed files with 34 additions and 1 deletions
@@ -57,7 +57,8 @@ import static org.jetbrains.jet.lang.resolve.BindingContext.*;
class CodegenAnnotatingVisitor extends JetVisitorVoid {
private static final TokenSet BINARY_OPERATIONS =
TokenSet.orSet(JetTokens.AUGMENTED_ASSIGNMENTS,
TokenSet.create(JetTokens.PLUS, JetTokens.MINUS, JetTokens.MUL, JetTokens.DIV, JetTokens.PERC, JetTokens.RANGE));
TokenSet.create(JetTokens.PLUS, JetTokens.MINUS, JetTokens.MUL, JetTokens.DIV, JetTokens.PERC, JetTokens.RANGE,
JetTokens.LT, JetTokens.GT, JetTokens.LTEQ, JetTokens.GTEQ));
private final Map<String, Integer> anonymousSubclassesCount = new HashMap<String, Integer>();
@@ -0,0 +1,6 @@
class JavaClass {
int compareTo(Runnable i) {
i.run();
return 239;
}
}
@@ -0,0 +1,21 @@
fun box(): String {
val obj = JavaClass()
var v1 = "FAIL"
obj < { v1 = "OK" }
if (v1 != "OK") return "<: $v1"
var v2 = "FAIL"
obj > { v2 = "OK" }
if (v2 != "OK") return ">: $v2"
var v3 = "FAIL"
obj <= { v3 = "OK" }
if (v3 != "OK") return "<=: $v3"
var v4 = "FAIL"
obj >= { v4 = "OK" }
if (v4 != "OK") return ">=: $v4"
return "OK"
}
@@ -247,6 +247,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/binary.kt");
}
@TestMetadata("compareTo.kt")
public void testCompareTo() throws Exception {
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/compareTo.kt");
}
@TestMetadata("contains.kt")
public void testContains() throws Exception {
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/operators/contains.kt");