summaryrefslogtreecommitdiff
path: root/chapter18/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'chapter18/src/test/java')
-rw-r--r--chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java
index 8ac98d72..369a0c39 100644
--- a/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java
+++ b/chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java
@@ -4,8 +4,8 @@ import com.seaofnodes.simple.evaluator.Evaluator;
import com.seaofnodes.simple.node.StopNode;
import org.junit.Test;
import org.junit.Ignore;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+
+import static org.junit.Assert.*;
public class Chapter18Test {
@@ -30,8 +30,20 @@ return x2;
""");
StopNode stop = parser.parse().iterate();
assertEquals("return null;", stop.toString());
- assertEquals(null, Evaluator.evaluate(stop, 0));
+ assertNull( Evaluator.evaluate( stop, 0 ) );
}
+ @Ignore @Test
+ public void testFcn0() {
+ Parser parser = new Parser("""
+{int -> int}? sq = { int x ->
+ x*x
+};
+return sq;
+""");
+ StopNode stop = parser.parse().iterate();
+ assertEquals("return fcn;", stop.toString());
+ assertEquals(1L, Evaluator.evaluate(stop, 0));
+ }
}