diff options
Diffstat (limited to 'src/test/java/org')
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNodeMatchers.java | 28 | ||||
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserConstructedTypeTests.java | 26 |
2 files changed, 31 insertions, 23 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNodeMatchers.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNodeMatchers.java new file mode 100644 index 0000000..9e2c217 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNodeMatchers.java @@ -0,0 +1,28 @@ +package org.zwobble.hobgoblin.compiler.ast.untyped; + +import org.zwobble.precisely.Matcher; + +import static org.zwobble.precisely.Matchers.*; + +public class UntypedNodeMatchers { + private UntypedNodeMatchers() { + } + + public static Matcher<UntypedTypeLevelExpressionNode> isUntypedConstructedTypeNode( + Matcher<UntypedTypeLevelExpressionNode> receiver, + Matcher<Iterable<? extends UntypedTypeLevelExpressionNode>> args + ) { + return instanceOf( + UntypedConstructedTypeNode.class, + has("receiver", UntypedConstructedTypeNode::receiver, receiver), + has("args", UntypedConstructedTypeNode::args, args) + ); + } + + public static Matcher<UntypedTypeLevelExpressionNode> isUntypedTypeLevelReferenceNode(String name) { + return instanceOf( + UntypedTypeLevelReferenceNode.class, + has("name", UntypedTypeLevelReferenceNode::name, equalTo(name)) + ); + } +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserConstructedTypeTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserConstructedTypeTests.java index 1444cf0..3b6a614 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserConstructedTypeTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserConstructedTypeTests.java @@ -1,14 +1,12 @@ package org.zwobble.hobgoblin.compiler.parser; import org.junit.jupiter.api.Test; -import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode; -import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode; -import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode; -import org.zwobble.precisely.Matcher; +import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNodeMatchers.isUntypedConstructedTypeNode; +import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNodeMatchers.isUntypedTypeLevelReferenceNode; import static org.zwobble.hobgoblin.compiler.parser.ParserTesting.parseString; import static org.zwobble.precisely.AssertThat.assertThat; -import static org.zwobble.precisely.Matchers.*; +import static org.zwobble.precisely.Matchers.isSequence; public class ParserConstructedTypeTests { @Test @@ -54,23 +52,5 @@ public class ParserConstructedTypeTests { ) )); } - - private static Matcher<UntypedTypeLevelExpressionNode> isUntypedConstructedTypeNode( - Matcher<UntypedTypeLevelExpressionNode> receiver, - Matcher<Iterable<? extends UntypedTypeLevelExpressionNode>> args - ) { - return instanceOf( - UntypedConstructedTypeNode.class, - has("receiver", UntypedConstructedTypeNode::receiver, receiver), - has("args", UntypedConstructedTypeNode::args, args) - ); - } - - private static Matcher<UntypedTypeLevelExpressionNode> isUntypedTypeLevelReferenceNode(String name) { - return instanceOf( - UntypedTypeLevelReferenceNode.class, - has("name", UntypedTypeLevelReferenceNode::name, equalTo(name)) - ); - } } |
