diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedImportNodeMatcher.java | 4 | ||||
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedImportNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedImportNodeMatcher.java index 9c8c183..e902170 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedImportNodeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedImportNodeMatcher.java @@ -29,6 +29,10 @@ public class UntypedImportNodeMatcher implements org.zwobble.precisely.Matcher<j return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("importedNames", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNode::importedNames, importedNames))).toList()); } + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNodeMatcher withAncestorDepth(org.zwobble.precisely.Matcher<? super java.util.Optional<java.lang.Integer>> ancestorDepth) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("ancestorDepth", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNode::ancestorDepth, ancestorDepth))).toList()); + } + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNodeMatcher withNamespaceName(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.types.NamespaceName> namespaceName) { return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("namespaceName", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedImportNode::namespaceName, namespaceName))).toList()); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java index 4df8b95..ada6414 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java @@ -42,13 +42,16 @@ public class ParserNamespaceTests { .withImports(isSequence( isUntypedImportNode() .withImportedNames(isSequence(equalTo("Point"))) + .withAncestorDepth(isOptionalEmpty()) .withNamespaceName(equalTo(NamespaceName.of("point"))), isUntypedImportNode() .withImportedNames(isSequence(equalTo("Square"), equalTo("Rectangle"))) - .withNamespaceName(equalTo(NamespaceName.of(".", "shapes"))), + .withAncestorDepth(isOptionalOf(equalTo(0))) + .withNamespaceName(equalTo(NamespaceName.of("shapes"))), isUntypedImportNode() .withImportedNames(isSequence(equalTo("Line"))) - .withNamespaceName(equalTo(NamespaceName.of("..", "..", "line"))) + .withAncestorDepth(isOptionalOf(equalTo(2))) + .withNamespaceName(equalTo(NamespaceName.of("line"))) )) ); } |
