summaryrefslogtreecommitdiff
path: root/chapter18/src
diff options
context:
space:
mode:
Diffstat (limited to 'chapter18/src')
-rw-r--r--chapter18/src/test/java/com/seaofnodes/simple/Chapter03Test.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Chapter03Test.java b/chapter18/src/test/java/com/seaofnodes/simple/Chapter03Test.java
index a7fc3ae5..825235cc 100644
--- a/chapter18/src/test/java/com/seaofnodes/simple/Chapter03Test.java
+++ b/chapter18/src/test/java/com/seaofnodes/simple/Chapter03Test.java
@@ -51,6 +51,16 @@ public class Chapter03Test {
}
@Test
+ public void testRedeclareVar() {
+ try {
+ new Parser("int a=1; int b=2; int c=0; int b=3; c=a+b;").parse();
+ fail();
+ } catch( RuntimeException e ) {
+ assertEquals("Redefining name 'b'",e.getMessage());
+ }
+ }
+
+ @Test
public void testBad1() {
try {
new CodeGen("int a=1; int b=2; int !c=0; { int b=3; c=a+b;").parse();