diff options
| author | Cliff Click <cliffc@acm.org> | 2024-12-22 10:28:32 -0800 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2025-01-15 15:07:30 -0800 |
| commit | fcd6dcf5265b4b23fd69af761316c064b8f9f7ce (patch) | |
| tree | 038146e9f3b5f58ff770a5d4e51f6ed0d6d4e2bd /chapter18/src/test | |
| parent | e58920741c38043f3f257ef088ca330893b7c84c (diff) | |
| download | Simple-fcd6dcf5265b4b23fd69af761316c064b8f9f7ce.tar.gz Simple-fcd6dcf5265b4b23fd69af761316c064b8f9f7ce.zip | |
Intercept first function definition
Diffstat (limited to 'chapter18/src/test')
| -rw-r--r-- | chapter18/src/test/java/com/seaofnodes/simple/Chapter18Test.java | 18 |
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)); + } } |
