diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/ast/untyped/UntypedCallNodeMatcher.java | 21 | ||||
| -rw-r--r-- | src/test/java/org/shedlang/compiler/parser/ParserCallTests.java | 14 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedCallNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedCallNodeMatcher.java index 3514b522..64cbe0dd 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedCallNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedCallNodeMatcher.java @@ -5,10 +5,7 @@ import org.pcollections.PVector; import org.shedlang.compiler.testing.MatcherBuilder; import org.zwobble.precisely.Matcher; -import java.util.Optional; - -import static org.zwobble.precisely.Matchers.equalTo; -import static org.zwobble.precisely.Matchers.has; +import static org.zwobble.precisely.Matchers.*; public class UntypedCallNodeMatcher extends MatcherBuilder<UntypedExpressionNode, UntypedCallNode, UntypedCallNodeMatcher> { public static UntypedCallNodeMatcher empty() { @@ -29,10 +26,22 @@ public class UntypedCallNodeMatcher extends MatcherBuilder<UntypedExpressionNode return new UntypedCallNodeMatcher(submatchers); } + public UntypedCallNodeMatcher withoutTypeLevelArgs() { + return with(has("typeLevelArgs", x -> x.typeLevelArgs(), isOptionalEmpty())); + } + public UntypedCallNodeMatcher withTypeLevelArgs( - Matcher<? super Optional<? extends Iterable<? extends UntypedTypeLevelExpressionNode>>> typeLevelArgs + Matcher<? super Iterable<? extends UntypedTypeLevelExpressionNode>> typeLevelArgs ) { - return with(has("typeLevelArgs", x -> x.typeLevelArgs(), typeLevelArgs)); + return with(has( + "typeLevelArgs", + x -> x.typeLevelArgs(), + isOptionalOf(has( + "args", + x -> x.args(), + typeLevelArgs + )) + )); } public UntypedCallNodeMatcher withArgs(Matcher<UntypedArgsNode> args) { diff --git a/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java index db0cb5de..745c3e7c 100644 --- a/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java +++ b/src/test/java/org/shedlang/compiler/parser/ParserCallTests.java @@ -213,7 +213,7 @@ public class ParserCallTests { assertThat( node, isUntypedCallNode() - .withTypeLevelArgs(isOptionalEmpty()) + .withoutTypeLevelArgs() ); } @@ -226,9 +226,9 @@ public class ParserCallTests { assertThat( node, isUntypedCallNode() - .withTypeLevelArgs(isOptionalOf(isSequence( + .withTypeLevelArgs(isSequence( isUntypedTypeLevelReferenceNode("A") - ))) + )) ); } @@ -241,11 +241,11 @@ public class ParserCallTests { assertThat( node, isUntypedCallNode() - .withTypeLevelArgs(isOptionalOf(isSequence( + .withTypeLevelArgs(isSequence( isUntypedTypeLevelReferenceNode("A"), isUntypedTypeLevelReferenceNode("B"), isUntypedTypeLevelReferenceNode("C") - ))) + )) ); } @@ -258,9 +258,9 @@ public class ParserCallTests { assertThat( node, isUntypedCallNode() - .withTypeLevelArgs(isOptionalOf(isSequence( + .withTypeLevelArgs(isSequence( isUntypedTypeLevelReferenceNode("A") - ))) + )) ); } } |
