fix for KT-237

This commit is contained in:
Alex Tkachman
2011-09-04 14:20:40 +02:00
parent e862e8471a
commit 22e2caf7f8
8 changed files with 69 additions and 9 deletions
@@ -144,4 +144,8 @@ public class ControlStructuresTest extends CodegenTestCase {
public void testForUserType() throws Exception {
blackBoxFile("controlStructures/forUserType.jet");
}
public void testKt237() throws Exception {
blackBoxFile("regressions/kt237.jet");
}
}
@@ -448,8 +448,14 @@ public class NamespaceGenTest extends CodegenTestCase {
public void testPredicateOperator() throws Exception {
loadText("fun foo(s: String) = s?startsWith(\"J\")");
final Method main = generateFunction();
try {
assertEquals("JetBrains", main.invoke(null, "JetBrains"));
assertNull(main.invoke(null, "IntelliJ"));
}
catch (Throwable t) {
System.out.println(generateToText());
t.printStackTrace();
}
}
public void testEscapeSequence() throws Exception {
@@ -80,8 +80,14 @@ public class PatternMatchingTest extends CodegenTestCase {
public void testCall() throws Exception {
loadText("fun foo(s: String) = when(s) { .startsWith(\"J\") => \"JetBrains\"; else => \"something\" }");
Method foo = generateFunction();
assertEquals("JetBrains", foo.invoke(null, "Java"));
assertEquals("something", foo.invoke(null, "C#"));
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 {