summaryrefslogtreecommitdiff
path: root/src/test/java/org
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-11-01 21:23:32 +0000
committerMichael Williamson <mike@zwobble.org>2026-11-01 21:23:32 +0000
commit4674a3e03fbb27723d016c90e9ea9be73b78a2c3 (patch)
tree192956de13ead8925efc132b73becaf9428a2f0a /src/test/java/org
parenta6d2cf68ec980cb7f53e50e56fe1c0376b15bf5a (diff)
Remove explicit database schema on query definition
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedQueryDefinitionNodeMatcher.java6
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserQueryDefinitionTests.java10
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java7
3 files changed, 7 insertions, 16 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedQueryDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedQueryDefinitionNodeMatcher.java
index 2e0ab23..adcc2d9 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedQueryDefinitionNodeMatcher.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/untyped/UntypedQueryDefinitionNodeMatcher.java
@@ -36,12 +36,6 @@ public final class UntypedQueryDefinitionNodeMatcher implements org.zwobble.prec
return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNodeMatcher(submatchers);
}
- public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNodeMatcher withDatabaseSchema(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelExpressionNode> databaseSchema) {
- var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNode>>(this.submatchers);
- submatchers.add(org.zwobble.precisely.Matchers.has("databaseSchema", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNode::databaseSchema, (org.zwobble.precisely.Matcher) databaseSchema));
- return new org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNodeMatcher(submatchers);
- }
-
public org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNodeMatcher withStatements(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStatementNode>> statements) {
var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNode>>(this.submatchers);
submatchers.add(org.zwobble.precisely.Matchers.has("statements", org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNode::statements, (org.zwobble.precisely.Matcher) statements));
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserQueryDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserQueryDefinitionTests.java
index e7676c9..e5b5a45 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserQueryDefinitionTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserQueryDefinitionTests.java
@@ -5,7 +5,6 @@ import org.junit.jupiter.api.Test;
import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNodeMatcher.isUntypedQueryDefinitionNode;
import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedReferenceNodeMatcher.isUntypedReferenceNode;
import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedReturnNodeMatcher.isUntypedReturnNode;
-import static org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNodeMatcher.isUntypedTypeLevelReferenceNode;
import static org.zwobble.hobgoblin.compiler.parser.ParserTesting.parseString;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.equalTo;
@@ -15,14 +14,13 @@ public class ParserQueryDefinitionTests {
@Test
public void canParseQueryDefinitionWithNoStatements() {
var source = """
- query allAuthors() on BlogAppDatabase {
+ query allAuthors() {
}""";
var node = parseString(source, Parser::parseNamespaceStatement);
assertThat(node, isUntypedQueryDefinitionNode()
.withName(equalTo("allAuthors"))
- .withDatabaseSchema(isUntypedTypeLevelReferenceNode().withName(equalTo("BlogAppDatabase")))
.withStatements(isSequence())
);
}
@@ -30,7 +28,7 @@ public class ParserQueryDefinitionTests {
@Test
public void canParseQueryDefinitionWithSingleStatement() {
var source = """
- query allAuthors() on BlogAppDatabase {
+ query allAuthors() {
return x;
}""";
@@ -38,7 +36,6 @@ public class ParserQueryDefinitionTests {
assertThat(node, isUntypedQueryDefinitionNode()
.withName(equalTo("allAuthors"))
- .withDatabaseSchema(isUntypedTypeLevelReferenceNode().withName(equalTo("BlogAppDatabase")))
.withStatements(isSequence(
isUntypedReturnNode()
.withExpression(isUntypedReferenceNode()
@@ -52,7 +49,7 @@ public class ParserQueryDefinitionTests {
@Test
public void canParseQueryDefinitionWithMultipleStatements() {
var source = """
- query allAuthors() on BlogAppDatabase {
+ query allAuthors() {
return x;
return y;
}""";
@@ -61,7 +58,6 @@ public class ParserQueryDefinitionTests {
assertThat(node, isUntypedQueryDefinitionNode()
.withName(equalTo("allAuthors"))
- .withDatabaseSchema(isUntypedTypeLevelReferenceNode().withName(equalTo("BlogAppDatabase")))
.withStatements(isSequence(
isUntypedReturnNode()
.withExpression(isUntypedReferenceNode()
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 66be9a7..43ffb04 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
@@ -4,9 +4,11 @@ import org.junit.jupiter.api.Test;
import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedQueryDefinitionNode;
import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedReferenceNode;
import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedReturnNode;
-import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode;
import org.zwobble.hobgoblin.compiler.sources.NullSource;
-import org.zwobble.hobgoblin.compiler.types.*;
+import org.zwobble.hobgoblin.compiler.types.DatabaseSchema;
+import org.zwobble.hobgoblin.compiler.types.NamespaceName;
+import org.zwobble.hobgoblin.compiler.types.Table;
+import org.zwobble.hobgoblin.compiler.types.Types;
import static org.zwobble.hobgoblin.compiler.ast.typed.RelationTableMatcher.isRelationTable;
import static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher.isTypedQueryDefinitionNode;
@@ -19,7 +21,6 @@ public class TypeCheckerQueryDefinitionTests {
public void queryForAllTableRows() {
var untyped = UntypedQueryDefinitionNode.arbitrary()
.withName("allAuthors")
- .withDatabaseSchema(UntypedTypeLevelReferenceNode.arbitrary().withName("blogApp"))
.addStatement(UntypedReturnNode.arbitrary().withExpression(
UntypedReferenceNode.arbitrary().withName("authors")
))