summaryrefslogtreecommitdiff
path: root/chapter05/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'chapter05/src/test/java')
-rw-r--r--chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
index 5ac309f3..0516fb73 100644
--- a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
+++ b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java
@@ -430,4 +430,14 @@ return c;
// this test used to fail in chapter 1
assertEquals("return -100;", new Parser("return -100;").parse().print());
}
+
+ @Test
+ public void testBad6() {
+ try {
+ new Parser("int a=1; int b=2; int c=0; { int b=3; c=a+b;").parse();
+ fail();
+ } catch( RuntimeException e ) {
+ assertEquals("Syntax error, expected }: ",e.getMessage());
+ }
+ }
}