From 6cb3c96d60f93fe52ced758b2e268b75a6ce3c48 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sun, 29 Oct 2023 10:04:09 -0700 Subject: Fix missing trailing expression --- .../src/test/java/com/seaofnodes/simple/Chapter05Test.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'chapter05/src/test/java') diff --git a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java index 2ad7e59a..bb95dc18 100644 --- a/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java +++ b/chapter05/src/test/java/com/seaofnodes/simple/Chapter05Test.java @@ -96,6 +96,16 @@ return c; assertEquals("return 1;",stop.toString()); } + @Test + public void testChapter5BadNum() { + try { + new Parser("return 1-;").parse(); + fail(); + } catch( RuntimeException e ) { + assertEquals("Syntax error, expected an identifier or expression: ;",e.getMessage()); + } + } + @Test public void testChapter5Keyword1() { try { -- cgit v1.2.3