summaryrefslogtreecommitdiff
path: root/chapter18/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'chapter18/src/test/java/com')
-rw-r--r--chapter18/src/test/java/com/seaofnodes/simple/Chapter13Test.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Chapter13Test.java b/chapter18/src/test/java/com/seaofnodes/simple/Chapter13Test.java
index 6aa64bf9..de722026 100644
--- a/chapter18/src/test/java/com/seaofnodes/simple/Chapter13Test.java
+++ b/chapter18/src/test/java/com/seaofnodes/simple/Chapter13Test.java
@@ -128,6 +128,19 @@ return n.i;
}
@Test
+ public void testNullRef4() {
+ CodeGen code = new CodeGen("-null-5/null-5;");
+ try { code.parse().opto().typeCheck(); fail(); }
+ catch( Exception e ) { assertEquals("Cannot 'Add' null",e.getMessage()); }
+ }
+
+ @Test public void testNullRef5() {
+ CodeGen code = new CodeGen("return null+42;");
+ try { code.parse().opto().typeCheck(); fail(); }
+ catch( Exception e ) { assertEquals("Cannot 'Add' null",e.getMessage()); }
+ }
+
+ @Test
public void testEmpty() {
CodeGen code = new CodeGen(
"""