From 466f13161c82289a17b761207da6bdfa4d78596c Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 12 Jun 2026 15:54:26 +0100 Subject: Add toMatcher() method --- .../JavaPreciselyMatchersGenerator.java | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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( @@ -113,6 +119,21 @@ public class JavaPreciselyMatchersGenerator implements Generator { JavaMethodKind.INSTANCE, 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()) )) -- cgit v1.2.3