failing test for throw

This commit is contained in:
Dmitry Jemerov
2011-04-21 18:01:58 +02:00
parent 11f8ed8c28
commit 843c102922
2 changed files with 20 additions and 0 deletions
@@ -85,4 +85,18 @@ public class ControlStructuresTest extends CodegenTestCase {
String[] args = new String[] { "IntelliJ", " ", "IDEA" };
assertEquals("IntelliJ IDEA", main.invoke(null, new Object[] { args }));
}
public void testThrowCheckedException() throws Exception {
loadText("fun foo() { throw new Exception(); }");
final Method main = generateFunction();
boolean caught = false;
try {
main.invoke(null);
} catch (InvocationTargetException e) {
if (e.getTargetException().getClass() == Exception.class) {
caught = true;
}
}
assertTrue(caught);
}
}