diff options
Diffstat (limited to 'src/test/java/org/zwobble')
6 files changed, 31 insertions, 17 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java index 36e7202..a6f7e45 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.output.lang.java; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.output.CodeWriter; import org.zwobble.hobgoblin.compiler.output.lang.java.ast.*; @@ -17,7 +18,7 @@ public class JavaWriterTests { var java = new JavaClassDeclaration( "Rectangle", List.of(), - "" + DocComment.EMPTY ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -42,7 +43,7 @@ public class JavaWriterTests { JavaTypeRef.VOID ) ), - "" + DocComment.EMPTY ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -63,7 +64,7 @@ public class JavaWriterTests { var java = new JavaClassDeclaration( "Point", List.of(), - "A 2D point." + new DocComment("A 2D point.") ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -80,7 +81,7 @@ public class JavaWriterTests { var java = new JavaInterfaceDeclaration( "Shape", List.of(), - "" + DocComment.EMPTY ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -99,7 +100,7 @@ public class JavaWriterTests { new JavaTypeRef(List.of("abc", "def"), "One", List.of()), new JavaTypeRef(List.of("abc", "def"), "Two", List.of()) ), - "" + DocComment.EMPTY ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -115,7 +116,7 @@ public class JavaWriterTests { var java = new JavaInterfaceDeclaration( "Shape", List.of(), - "A 2D shape." + new DocComment("A 2D shape.") ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -133,7 +134,7 @@ public class JavaWriterTests { "Point", List.of(), List.of(), - "" + DocComment.EMPTY ); var string = write(writer -> writer.writeTypeDeclaration(java)); @@ -150,7 +151,7 @@ public class JavaWriterTests { "Point", List.of(), List.of(), - "A 2D point." + new DocComment("A 2D point.") ); var string = write(writer -> writer.writeTypeDeclaration(java)); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java index a0394ce..6c90356 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.parser; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode; @@ -87,7 +88,11 @@ public class ParserStructDefinitionTests { assertThat(node, instanceOf( UntypedStructDefinitionNode.class, - has("docComment", UntypedStructDefinitionNode::docComment, equalTo("A 2D point.\n\nPositive y is up.\n")) + has( + "docComment", + UntypedStructDefinitionNode::docComment, + equalTo(new DocComment("A 2D point.\n\nPositive y is up.\n")) + ) )); } } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserSumDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserSumDefinitionTests.java index c512c6f..34b94fc 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserSumDefinitionTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserSumDefinitionTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.parser; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedSumVariantDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedTypeLevelReferenceNode; @@ -94,7 +95,11 @@ public class ParserSumDefinitionTests { assertThat(node, instanceOf( UntypedSumDefinitionNode.class, - has("docComment", UntypedSumDefinitionNode::docComment, equalTo("A 2D shape.\n")) + has( + "docComment", + UntypedSumDefinitionNode::docComment, + equalTo(new DocComment("A 2D shape.\n")) + ) )); } } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerNamespaceTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerNamespaceTests.java index 1bb84d1..de0ffec 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerNamespaceTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerNamespaceTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.typechecker; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceNode; import org.zwobble.hobgoblin.compiler.ast.typed.TypedStructDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedNamespaceNode; @@ -23,7 +24,7 @@ public class TypeCheckerNamespaceTests { new UntypedStructDefinitionNode( "X", List.of(), - "", + DocComment.EMPTY, NullSource.INSTANCE ) ), diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java index 117bce4..336c496 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.typechecker; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceNode; import org.zwobble.hobgoblin.compiler.ast.typed.TypedStructDefinitionNode; import org.zwobble.hobgoblin.compiler.ast.typed.TypedStructFieldDefinitionNode; @@ -27,7 +28,7 @@ public class TypeCheckerStructDefinitionTests { var untyped = new UntypedStructDefinitionNode( "X", List.of(), - "", + DocComment.EMPTY, NullSource.INSTANCE ); var context = TypeCheckerContextArb.namespaceContext(NamespaceName.of("a", "b")); @@ -54,7 +55,7 @@ public class TypeCheckerStructDefinitionTests { new UntypedStructFieldDefinitionNode("a", UntypedArb.typeLevelReference("Int32"), NullSource.INSTANCE), new UntypedStructFieldDefinitionNode("b", UntypedArb.typeLevelReference("Int64"), NullSource.INSTANCE) ), - "", + DocComment.EMPTY, NullSource.INSTANCE ); var context = TypeCheckerContextArb.namespaceContext(NamespaceName.of("a", "b")); @@ -104,7 +105,7 @@ public class TypeCheckerStructDefinitionTests { List.of( new UntypedStructFieldDefinitionNode("value", UntypedArb.typeLevelReference("Y"), NullSource.INSTANCE) ), - "", + DocComment.EMPTY, NullSource.INSTANCE ), new UntypedStructDefinitionNode( @@ -112,7 +113,7 @@ public class TypeCheckerStructDefinitionTests { List.of( new UntypedStructFieldDefinitionNode("value", UntypedArb.typeLevelReference("Int32"), NullSource.INSTANCE) ), - "", + DocComment.EMPTY, NullSource.INSTANCE ) ), diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerSumDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerSumDefinitionTests.java index a037bdf..1d968d6 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerSumDefinitionTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerSumDefinitionTests.java @@ -1,6 +1,7 @@ package org.zwobble.hobgoblin.compiler.typechecker; import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.DocComment; import org.zwobble.hobgoblin.compiler.ast.typed.*; import org.zwobble.hobgoblin.compiler.ast.untyped.*; import org.zwobble.hobgoblin.compiler.sources.NullSource; @@ -18,7 +19,7 @@ public class TypeCheckerSumDefinitionTests { var untyped = new UntypedSumDefinitionNode( "X", List.of(), - "", + DocComment.EMPTY, NullSource.INSTANCE ); var context = TypeCheckerContextArb.namespaceContext(NamespaceName.of("a", "b")); @@ -45,7 +46,7 @@ public class TypeCheckerSumDefinitionTests { new UntypedSumVariantDefinitionNode(UntypedArb.typeLevelReference("Rectangle"), NullSource.INSTANCE), new UntypedSumVariantDefinitionNode(UntypedArb.typeLevelReference("Triangle"), NullSource.INSTANCE) ), - "", + DocComment.EMPTY, NullSource.INSTANCE ); var context = TypeCheckerContextArb.namespaceContext(NamespaceName.of("a", "b")); |
