From 4a3e11d1af52cf098812612b7c43852523f14514 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Wed, 22 Oct 2014 22:49:47 +0400 Subject: [PATCH] Add test case for https://github.com/konsoletyper/teavm/issues/27 --- .../java/org/teavm/classlib/java/lang/VMTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java b/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java index a8963c000..bc77f5f6b 100644 --- a/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java +++ b/teavm-classlib/src/test/java/org/teavm/classlib/java/lang/VMTest.java @@ -83,4 +83,17 @@ public class VMTest { public void surrogateInStringLiteralsWork() { assertEquals(0xDDC2, "a\uDDC2b".charAt(1)); } + + @Test + public void separatesExceptionAndVariable() { + int n = foo(); + try { + bar(); + } catch (RuntimeException e) { + assertEquals(RuntimeException.class, e.getClass()); + assertEquals(2, n); + } + } + private int foo() { return 2; } + private void bar() { throw new RuntimeException(); } }