diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-09-04 15:22:06 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-09-04 15:25:14 +0100 |
| commit | 94ca8de6bc11f194bdf3a0415aad2eb66e222c45 (patch) | |
| tree | 691279348a97897379c03d8c5f66ea63333babb1 /src/test/java | |
| parent | 8b1ee9a26a378a4456e800be314ab765be94b368 (diff) | |
Add custom code to TypeScript output
Diffstat (limited to 'src/test/java')
2 files changed, 65 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 a5081d0..56c51f5 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 @@ -25,6 +25,11 @@ public class TypescriptWriterTests { assertThat(string, equalTo(""" // Generated by hobgoblin. + // Custom area start: imports + // Custom area end: imports + + // Custom area start: body + // Custom area end: body """ )); } @@ -45,11 +50,21 @@ public class TypescriptWriterTests { assertThat(string, equalTo(""" // Generated by hobgoblin. + // Custom area start: imports + // Custom area end: imports + class X { + // Custom area start: X, body + // Custom area end: X, body } class Y { + // Custom area start: Y, body + // Custom area end: Y, body } + + // Custom area start: body + // Custom area end: body """ )); } @@ -68,6 +83,8 @@ public class TypescriptWriterTests { assertThat(string, equalTo(""" class X { + // Custom area start: X, body + // Custom area end: X, body }""" )); } @@ -84,6 +101,8 @@ public class TypescriptWriterTests { assertThat(string, equalTo(""" class X<Y, Z> { + // Custom area start: X, body + // Custom area end: X, body }""" )); } @@ -110,6 +129,9 @@ public class TypescriptWriterTests { public a; public b; + + // Custom area start: X, body + // Custom area end: X, body }""" )); } @@ -129,6 +151,8 @@ public class TypescriptWriterTests { * def */ class X { + // Custom area start: X, body + // Custom area end: X, body }""" )); } diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptCustomAreaMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptCustomAreaMatcher.java new file mode 100644 index 0000000..8d8a077 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/typescript/ast/TypescriptCustomAreaMatcher.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.TypescriptCustomAreaMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher imports + +public final class TypescriptCustomAreaMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher isTypescriptCustomArea() { + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomArea>> submatchers; + + private TypescriptCustomAreaMatcher( + java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomArea>> 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.TypescriptCustomArea.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher withName(org.zwobble.precisely.Matcher<? super String> name) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomArea>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomArea::name, (org.zwobble.precisely.Matcher) name)); + return new org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.typescript.ast.TypescriptCustomAreaMatcher body +} |
