diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-04-22 11:34:09 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-04-22 11:34:09 +0100 |
| commit | 3f54b73a61e2fbe29e6e33dff4bb0b6e8bbf31f1 (patch) | |
| tree | 7aac2e9f396182a54a258d97e06c357ac280d5d9 /src/test/java/org | |
| parent | 371a4e8db3aa6fdc0a6d144351e9c0169c13badf (diff) | |
Parse empty struct definitions
Diffstat (limited to 'src/test/java/org')
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java new file mode 100644 index 0000000..8c692fd --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/parser/ParserStructDefinitionTests.java @@ -0,0 +1,27 @@ +package org.zwobble.hobgoblin.compiler.parser; + +import org.junit.jupiter.api.Test; +import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode; + +import static org.zwobble.hobgoblin.compiler.parser.ParserTesting.parseString; +import static org.zwobble.precisely.AssertThat.assertThat; +import static org.zwobble.precisely.Matchers.*; + +public class ParserStructDefinitionTests { + @Test + public void emptyStruct() { + var source = """ + struct Point { + }"""; + + var node = parseString( + source, + Parser::parseNamespaceStatement + ); + + assertThat(node, instanceOf( + UntypedStructDefinitionNode.class, + has("name", UntypedStructDefinitionNode::name, equalTo("Point")) + )); + } +} |
