aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/shedlang/compiler/ast
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
-rw-r--r--src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java4
-rw-r--r--src/test/java/org/shedlang/compiler/ast/untyped/UntypedTryNodeMatcher.java50
2 files changed, 54 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java
index 517ca77a..a9befa70 100644
--- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java
+++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java
@@ -311,6 +311,10 @@ public class UntypedNodeMatchers {
);
}
+ public static UntypedTryNodeMatcher isUntypedTryNode() {
+ return UntypedTryNodeMatcher.empty();
+ }
+
public static Matcher<UntypedExpressionNode> isUntypedTupleNode(
Matcher<Iterable<? extends UntypedExpressionNode>> elements
) {
diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedTryNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedTryNodeMatcher.java
new file mode 100644
index 00000000..e8f3cfb6
--- /dev/null
+++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedTryNodeMatcher.java
@@ -0,0 +1,50 @@
+package org.shedlang.compiler.ast.untyped;
+
+import org.pcollections.PVector;
+import org.shedlang.compiler.testing.MatcherBuilder;
+import org.shedlang.compiler.util.P;
+import org.zwobble.precisely.Matcher;
+
+import static org.zwobble.precisely.Matchers.has;
+
+public class UntypedTryNodeMatcher extends MatcherBuilder<
+ UntypedExpressionNode,
+ UntypedTryNode,
+ UntypedTryNodeMatcher
+> {
+ public static UntypedTryNodeMatcher empty() {
+ return new UntypedTryNodeMatcher(P.vector());
+ }
+
+ public UntypedTryNodeMatcher(PVector<Matcher<? super UntypedTryNode>> submatchers) {
+ super(submatchers);
+ }
+
+ @Override
+ protected Class<UntypedTryNode> expectedType() {
+ return UntypedTryNode.class;
+ }
+
+ @Override
+ protected UntypedTryNodeMatcher create(
+ PVector<Matcher<? super UntypedTryNode>> submatchers
+ ) {
+ return new UntypedTryNodeMatcher(submatchers);
+ }
+
+ public UntypedTryNodeMatcher withBody(Matcher<UntypedBlockNode> body) {
+ return with(has("body", x -> x.body(), body));
+ }
+
+ public UntypedTryNodeMatcher withHandledEffect(
+ Matcher<UntypedTypeLevelExpressionNode> handledEffect
+ ) {
+ return with(has("handledEffect", x -> x.handledEffect(), handledEffect));
+ }
+
+ public UntypedTryNodeMatcher withHandlers(
+ Matcher<Iterable<? extends UntypedFunctionDefinitionNode>> handlers
+ ) {
+ return with(has("handlers", x -> x.handlers(), handlers));
+ }
+}