diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-30 11:16:26 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-30 11:17:39 +0100 |
| commit | 9de4242330fe137133327533f24073613da8d201 (patch) | |
| tree | a921ea5a3a1c3c331027d24c3b58ce2fdfe5b0a4 /src/test/java | |
| parent | f0f663b188cdc365628511636ea92946d2d1842c (diff) | |
Add export names statement to TypeScript AST
Diffstat (limited to 'src/test/java')
2 files changed, 55 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriterTests.java index 5c32084..bc02855 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/TypescriptWriterTests.java @@ -113,6 +113,20 @@ public class TypescriptWriterTests { )); } + // === Export statements === + + @Test + public void exportNamesStatement() throws IOException { + var typescript = TypescriptExportNamesStatement.arbitrary() + .addName(id("x")) + .addName(id("y")) + .build(); + + var string = write(writer -> writer.writeStatement(typescript)); + + assertThat(string, equalTo("export {x, y};")); + } + // === Expression statements === @Test diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptExportNamesStatementMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptExportNamesStatementMatcher.java new file mode 100644 index 0000000..0acb02f --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptExportNamesStatementMatcher.java @@ -0,0 +1,41 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.typescript.ast; + +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher imports + +public final class TypescriptExportNamesStatementMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher isTypescriptExportNamesStatement() { + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatement>> submatchers; + + private TypescriptExportNamesStatementMatcher( + java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatement>> 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.output.lang.typescript.ast.TypescriptExportNamesStatement.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher withNames(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptIdentifier>> names) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatement>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("names", org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatement::names, (org.zwobble.precisely.Matcher) names)); + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher body +} |
