From 9de4242330fe137133327533f24073613da8d201 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 30 Aug 2026 11:16:26 +0100 Subject: Add export names statement to TypeScript AST --- .../lang/typescript/TypescriptWriterTests.java | 14 ++++++++ .../ast/TypescriptExportNamesStatementMatcher.java | 41 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptExportNamesStatementMatcher.java (limited to 'src/test/java') 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 { + 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> submatchers; + + private TypescriptExportNamesStatementMatcher( + java.util.List> 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 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> names) { + var submatchers = new java.util.ArrayList>(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 +} -- cgit v1.2.3