diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-09-27 10:47:31 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-09-27 10:47:31 +0100 |
| commit | 44bc89a7d3c587d26110983a806f933ac3de4333 (patch) | |
| tree | f80895a3135a0aac77680cb023d4789a0dcee5be /src/test/java | |
| parent | b70f537b17bd0aa5a06635b5c34e79613e5e5ce9 (diff) | |
Extract TypescriptNamedExport
Diffstat (limited to 'src/test/java')
3 files changed, 49 insertions, 4 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 ff10ffe..8e7daa4 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 @@ -221,8 +221,8 @@ public class TypescriptWriterTests { @Test public void exportNamesStatement() throws IOException { var typescript = TypescriptExportNamesStatement.arbitrary() - .addName(id("x")) - .addName(id("y")) + .addExport(export(id("x"))) + .addExport(export(id("y"))) .build(); var string = write(writer -> writer.writeStatement(typescript)); @@ -596,6 +596,10 @@ public class TypescriptWriterTests { // == Utilities == + private static TypescriptNamedExport export(TypescriptIdentifier name) { + return TypescriptNamedExport.arbitrary().withExportName(name).build(); + } + private static TypescriptIdentifier id(String name) { return TypescriptIdentifier.of(name); } 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 index 0acb02f..6d1bdb6 100644 --- 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 @@ -30,9 +30,9 @@ public final class TypescriptExportNamesStatementMatcher implements org.zwobble. 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) { + public org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher withExports(org.zwobble.precisely.Matcher<? super java.util.List<org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExport>> exports) { 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)); + submatchers.add(org.zwobble.precisely.Matchers.has("exports", org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatement::exports, (org.zwobble.precisely.Matcher) exports)); return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptExportNamesStatementMatcher(submatchers); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptNamedExportMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptNamedExportMatcher.java new file mode 100644 index 0000000..b5d514e --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptNamedExportMatcher.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.TypescriptNamedExportMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher imports + +public final class TypescriptNamedExportMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher isTypescriptNamedExport() { + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExport>> submatchers; + + private TypescriptNamedExportMatcher( + java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExport>> 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.TypescriptNamedExport.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher withExportName(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptIdentifier> exportName) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExport>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("exportName", org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExport::exportName, (org.zwobble.precisely.Matcher) exportName)); + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptNamedExportMatcher body +} |
