diff options
| author | Yichen Yan <oraluben@outlook.com> | 2023-11-01 22:08:30 +0800 |
|---|---|---|
| committer | Dibyendu Majumdar <dibyendumajumdar@users.noreply.github.com> | 2023-11-01 18:56:50 +0000 |
| commit | d3ffe6f9a935888233283962ce077ec25a01bec9 (patch) | |
| tree | d93ccfbdb034562d2fd17e4c2151cf5cddbe64e9 /chapter03/src/test/java/com | |
| parent | 3cad2b3c0af2418d51bb1ee46b1e24c5b362ba63 (diff) | |
| download | Simple-d3ffe6f9a935888233283962ce077ec25a01bec9.tar.gz Simple-d3ffe6f9a935888233283962ce077ec25a01bec9.zip | |
Bail out unclosed block (#25)
* Report unclosed block in parsing
* Fix tests
* Resolve comments and rebase onto chapter5
* Test `isEOF` after consume whitespaces
Diffstat (limited to 'chapter03/src/test/java/com')
| -rw-r--r-- | chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java index 5af07ec3..21faacac 100644 --- a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java +++ b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java @@ -168,4 +168,11 @@ public class Chapter03Test { // this test used to fail in chapter 1 assertEquals("return -100;", new Parser("return -100;").parse().print()); } + + @Test + public void testBad6() { + exceptionRule.expect(RuntimeException.class); + exceptionRule.expectMessage("Syntax error, expected }:"); + new Parser("int a=1; int b=2; int c=0; { int b=3; c=a+b;").parse(); + } } |
