Test uncommented and fixed
This commit is contained in:
@@ -108,34 +108,13 @@ public class PatternMatchingTest extends CodegenTestCase {
|
|||||||
assertEquals("x", foo.invoke(null, ""));
|
assertEquals("x", foo.invoke(null, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testTuplePattern() throws Exception {
|
public void testCall() throws Exception {
|
||||||
loadText("fun foo(x: #(Any, Any)) = when(x) { is #(1,2) -> \"one,two\"; else -> \"something\" }");
|
loadText("fun foo(s: String) = when { s[0] == 'J' -> \"JetBrains\"; else -> \"something\" }");
|
||||||
Method foo = generateFunction();
|
Method foo = generateFunction();
|
||||||
final Object result;
|
assertEquals("JetBrains", foo.invoke(null, "Java"));
|
||||||
try {
|
assertEquals("something", foo.invoke(null, "C#"));
|
||||||
result = foo.invoke(null, new Tuple2<Integer, Integer>(1, 2));
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(generateToText());
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
assertEquals("one,two", result);
|
|
||||||
assertEquals("something", foo.invoke(null, new Tuple2<String, String>("not", "tuple")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commented for KT-621
|
|
||||||
// public void testCall() throws Exception {
|
|
||||||
// loadText("fun foo(s: String) = when(s) { .startsWith(\"J\") => \"JetBrains\"; else => \"something\" }");
|
|
||||||
// Method foo = generateFunction();
|
|
||||||
// try {
|
|
||||||
// assertEquals("JetBrains", foo.invoke(null, "Java"));
|
|
||||||
// assertEquals("something", foo.invoke(null, "C#"));
|
|
||||||
// }
|
|
||||||
// catch (Throwable t) {
|
|
||||||
// System.out.println(generateToText());
|
|
||||||
// t.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void testCallProperty() throws Exception {
|
public void testCallProperty() throws Exception {
|
||||||
blackBoxFile("patternMatching/callProperty.jet");
|
blackBoxFile("patternMatching/callProperty.jet");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user