Test uncommented and fixed
This commit is contained in:
@@ -108,34 +108,13 @@ public class PatternMatchingTest extends CodegenTestCase {
|
||||
assertEquals("x", foo.invoke(null, ""));
|
||||
}
|
||||
|
||||
public void testTuplePattern() throws Exception {
|
||||
loadText("fun foo(x: #(Any, Any)) = when(x) { is #(1,2) -> \"one,two\"; else -> \"something\" }");
|
||||
public void testCall() throws Exception {
|
||||
loadText("fun foo(s: String) = when { s[0] == 'J' -> \"JetBrains\"; else -> \"something\" }");
|
||||
Method foo = generateFunction();
|
||||
final Object result;
|
||||
try {
|
||||
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")));
|
||||
assertEquals("JetBrains", foo.invoke(null, "Java"));
|
||||
assertEquals("something", foo.invoke(null, "C#"));
|
||||
}
|
||||
|
||||
// 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 {
|
||||
blackBoxFile("patternMatching/callProperty.jet");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user