diff options
Diffstat (limited to 'src/test/java/org/shedlang/compiler/parser')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/parser/ParserTryTests.java | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/test/java/org/shedlang/compiler/parser/ParserTryTests.java b/src/test/java/org/shedlang/compiler/parser/ParserTryTests.java index 0782cdd4..3a1a2ac2 100644 --- a/src/test/java/org/shedlang/compiler/parser/ParserTryTests.java +++ b/src/test/java/org/shedlang/compiler/parser/ParserTryTests.java @@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test; import static org.shedlang.compiler.ast.untyped.UntypedNodeMatchers.*; import static org.shedlang.compiler.parser.ParserTesting.parseString; import static org.zwobble.precisely.AssertThat.assertThat; -import static org.zwobble.precisely.Matchers.isSequence; +import static org.zwobble.precisely.Matchers.*; public class ParserTryTests { @Test @@ -15,9 +15,10 @@ public class ParserTryTests { 1; } handle State { fun read() { + resume 42; } - fun write() { + fun write(value) { } } """; @@ -32,10 +33,21 @@ public class ParserTryTests { ))) .withHandledEffect(isUntypedTypeLevelReferenceNode("State")) .withHandlerMethods(isSequence( - isUntypedFunctionDefinitionNode() - .withName("read"), - isUntypedFunctionDefinitionNode() + isUntypedTryHandlerMethodNode() + .withName("read") + .withParams(isUntypedParamsNode(isSequence(), isSequence())) + .withBody(isUntypedBlockNode(isSequence( + isUntypedResumeNode(isOptionalOf(isUntypedIntLiteralNode(42))) + ))), + isUntypedTryHandlerMethodNode() .withName("write") + .withParams(isUntypedParamsNode( + isSequence( + isUntypedParamNode("value", isOptionalEmpty()) + ), + isSequence() + )) + .withBody(isUntypedBlockNode(isSequence())) )) ); } |
