summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-06-12 15:54:26 +0100
committerMichael Williamson <mike@zwobble.org>2026-06-12 16:05:11 +0100
commit466f13161c82289a17b761207da6bdfa4d78596c (patch)
tree306240ee038a7b45f5d802e12c7b3645e4b06f9c /src
parentfd9194f391ffacc09be78014fe30e17ead83201e (diff)
Add toMatcher() method
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
index 0a85c95..46d68ef 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
@@ -105,7 +105,13 @@ public class JavaPreciselyMatchersGenerator implements Generator {
JavaTypeRef.topLevel(List.of("org", "zwobble", "precisely"), "MatchResult"),
List.of(new JavaParam(JavaTypeRef.OBJECT, "actual")),
new JavaBlock(List.of(
- new JavaReturn(new JavaNullLiteral())
+ new JavaReturn(
+ new JavaMethodCall(
+ new JavaMethodCall(new JavaRef("this"), "toMatcher", List.of()),
+ "match",
+ List.of(new JavaRef("actual"))
+ )
+ )
))
),
new JavaMethodDeclaration(
@@ -114,6 +120,21 @@ public class JavaPreciselyMatchersGenerator implements Generator {
JavaTypeRef.topLevel(List.of("org", "zwobble", "precisely"), "TextTree"),
List.of(),
new JavaBlock(List.of(
+ new JavaReturn(
+ new JavaMethodCall(
+ new JavaMethodCall(new JavaRef("this"), "toMatcher", List.of()),
+ "describe",
+ List.of()
+ )
+ )
+ ))
+ ),
+ new JavaMethodDeclaration(
+ "toMatcher",
+ JavaMethodKind.INSTANCE,
+ JavaTypeRef.topLevelGeneric(List.of("org", "zwobble", "precisely"), "Matcher", List.of(JavaTypeRef.OBJECT)),
+ List.of(),
+ new JavaBlock(List.of(
new JavaReturn(new JavaNullLiteral())
))
)