summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-11-01 21:09:24 +0000
committerMichael Williamson <mike@zwobble.org>2026-11-01 21:09:24 +0000
commit83cd529c660872f4e3a502cace62cd72a739ff05 (patch)
treebb233ffff4c4ecb8e8e0f4fab07d391cb956c8ab /src/test
parentda5f2e83708371b1497665c7d0ee8f382898247c (diff)
Extract Relation type
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTableMatcher.java41
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java4
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java3
3 files changed, 45 insertions, 3 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTableMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTableMatcher.java
new file mode 100644
index 0000000..3aff4dc
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/RelationTableMatcher.java
@@ -0,0 +1,41 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.ast.typed;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher imports
+
+public final class RelationTableMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher isRelationTable() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.RelationTable>> submatchers;
+
+ private RelationTableMatcher(
+ java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.RelationTable>> 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.typed.RelationTable.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher withTable(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.types.Table> table) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.RelationTable>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("table", org.zwobble.hobgoblin.compiler.ast.typed.RelationTable::table, (org.zwobble.precisely.Matcher) table));
+ return new org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher body
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java
index 651ede0..d9a6bc5 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java
@@ -36,9 +36,9 @@ public final class TypedQueryDefinitionNodeMatcher implements org.zwobble.precis
return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers);
}
- public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withTable(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.types.Table> table) {
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withRelation(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.Relation> relation) {
var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>>(this.submatchers);
- submatchers.add(org.zwobble.precisely.Matchers.has("table", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::table, (org.zwobble.precisely.Matcher) table));
+ submatchers.add(org.zwobble.precisely.Matchers.has("relation", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::relation, (org.zwobble.precisely.Matcher) relation));
return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers);
}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
index 4ecc1c6..66be9a7 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
@@ -8,6 +8,7 @@ import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode;
import org.zwobble.hobgoblin.compiler.sources.NullSource;
import org.zwobble.hobgoblin.compiler.types.*;
+import static org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher.isRelationTable;
import static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher.isTypedQueryDefinitionNode;
import static org.zwobble.hobgoblin.compiler.typechecker.TypeCheckerTesting.typeCheckNamespaceStatement;
import static org.zwobble.precisely.AssertThat.assertThat;
@@ -34,7 +35,7 @@ public class TypeCheckerQueryDefinitionTests {
assertThat(typed, isTypedQueryDefinitionNode()
.withName(equalTo("allAuthors"))
- .withTable(equalTo(table))
+ .withRelation(isRelationTable().withTable(equalTo(table)))
);
}
}