diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-06-12 18:14:20 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-06-12 18:14:20 +0100 |
| commit | ab00034281dc82f4f6533a4bbc6c5e5703a2286c (patch) | |
| tree | c396dd3ed606290b30b6ff3aa89b4b06d19223b3 /src/test/java | |
| parent | 981ea99ece6e3595db9116e8a2e7e1e0bc9ad435 (diff) | |
Generate precisely matchers from hobgoblin definitions
Diffstat (limited to 'src/test/java')
9 files changed, 344 insertions, 10 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedConstructedTypeNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedConstructedTypeNodeMatcher.java new file mode 100644 index 0000000..10dba87 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedConstructedTypeNodeMatcher.java @@ -0,0 +1,42 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedConstructedTypeNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher isUntypedConstructedTypeNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode>> submatchers; + + private UntypedConstructedTypeNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher withReceiver(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode> receiver) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("receiver", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode::receiver, receiver))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher withArgs(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode>> args) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode::args, args))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedConstructedTypeNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNamespaceNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNamespaceNodeMatcher.java new file mode 100644 index 0000000..96a3b96 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNamespaceNodeMatcher.java @@ -0,0 +1,42 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedNamespaceNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher isUntypedNamespaceNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode>> submatchers; + + private UntypedNamespaceNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher withNamespaceName(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.types.NamespaceName> namespaceName) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher(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.UntypedNamespaceNode::namespaceName, namespaceName))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher withBody(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceStatementNode>> body) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("body", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode::body, body))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNativeTypeDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNativeTypeDefinitionNodeMatcher.java new file mode 100644 index 0000000..d2c185b --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedNativeTypeDefinitionNodeMatcher.java @@ -0,0 +1,42 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedNativeTypeDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher isUntypedNativeTypeDefinitionNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode>> submatchers; + + private UntypedNativeTypeDefinitionNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode::name, name))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher withDocComment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.DocComment> docComment) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("docComment", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode::docComment, docComment))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNativeTypeDefinitionNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java new file mode 100644 index 0000000..7ed5390 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructDefinitionNodeMatcher.java @@ -0,0 +1,46 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedStructDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher isUntypedStructDefinitionNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode>> submatchers; + + private UntypedStructDefinitionNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode::name, name))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher withFields(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode>> fields) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("fields", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode::fields, fields))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher withDocComment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.DocComment> docComment) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("docComment", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode::docComment, docComment))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructFieldDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructFieldDefinitionNodeMatcher.java new file mode 100644 index 0000000..ec2c417 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedStructFieldDefinitionNodeMatcher.java @@ -0,0 +1,42 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedStructFieldDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher isUntypedStructFieldDefinitionNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode>> submatchers; + + private UntypedStructFieldDefinitionNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode::name, name))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher withType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode> type) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode::type, type))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumDefinitionNodeMatcher.java new file mode 100644 index 0000000..fe704ac --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumDefinitionNodeMatcher.java @@ -0,0 +1,46 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedSumDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher isUntypedSumDefinitionNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode>> submatchers; + + private UntypedSumDefinitionNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode::name, name))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher withVariants(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode>> variants) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("variants", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode::variants, variants))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher withDocComment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.DocComment> docComment) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("docComment", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode::docComment, docComment))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumVariantDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumVariantDefinitionNodeMatcher.java new file mode 100644 index 0000000..cf8d16d --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedSumVariantDefinitionNodeMatcher.java @@ -0,0 +1,38 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedSumVariantDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher isUntypedSumVariantDefinitionNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode>> submatchers; + + private UntypedSumVariantDefinitionNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher withType(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode> type) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("type", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode::type, type))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNodeMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedTypeLevelReferenceNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedTypeLevelReferenceNodeMatcher.java new file mode 100644 index 0000000..f24b92a --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedTypeLevelReferenceNodeMatcher.java @@ -0,0 +1,38 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.ast.untyped; + +public class UntypedTypeLevelReferenceNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher isUntypedTypeLevelReferenceNode() { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode>> submatchers; + + private UntypedTypeLevelReferenceNodeMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode>> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher<java.lang.Object> toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode::name, name))).toList()); + } + + public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) { + return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher(java.util.stream.Stream.concat(this.submatchers.stream(), java.util.stream.Stream.of(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode::source, source))).toList()); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher body +} 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 22cddca..22878dc 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserNamespaceTests.java @@ -1,10 +1,10 @@ package org.zwobble.hobgoblin.compiler.parser; import org.junit.jupiter.api.Test; -import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode; import org.zwobble.hobgoblin.compiler.types.NamespaceName; +import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNodeMatcher.isUntypedNamespaceNode; import static org.zwobble.hobgoblin.compiler.parser.ParserTesting.parseString; import static org.zwobble.precisely.AssertThat.assertThat; import static org.zwobble.precisely.Matchers.*; @@ -19,11 +19,10 @@ public class ParserNamespaceTests { tokens -> Parser.parseNamespace(tokens, NamespaceName.of("Example", "Project")) ); - assertThat(node, instanceOf( - UntypedNamespaceNode.class, - has("namespaceName", x -> x.namespaceName(), equalTo(NamespaceName.of("Example", "Project"))), - has("body", x -> x.body(), isSequence()) - )); + assertThat(node, isUntypedNamespaceNode() + .withNamespaceName(equalTo(NamespaceName.of("Example", "Project"))) + .withBody(isSequence()) + ); } @Test @@ -37,9 +36,8 @@ public class ParserNamespaceTests { tokens -> Parser.parseNamespace(tokens, NamespaceName.of("Example", "Project")) ); - assertThat(node, instanceOf( - UntypedNamespaceNode.class, - has("body", UntypedNamespaceNode::body, isSequence( + assertThat(node, isUntypedNamespaceNode() + .withBody(isSequence( instanceOf( UntypedStructDefinitionNode.class, has("name", UntypedStructDefinitionNode::name, equalTo("One")) @@ -49,6 +47,6 @@ public class ParserNamespaceTests { has("name", UntypedStructDefinitionNode::name, equalTo("Two")) ) )) - )); + ); } } |
