diff options
Diffstat (limited to 'src/test/java')
2 files changed, 57 insertions, 0 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java index 3967c2b..aa0dc96 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java @@ -791,6 +791,24 @@ public class JavaWriterTests { } @Test + public void falseLiteral() throws IOException { + var java = new JavaBooleanLiteral(false); + + var string = write(writer -> writer.writeExpression(java)); + + assertThat(string, equalTo("false")); + } + + @Test + public void trueLiteral() throws IOException { + var java = new JavaBooleanLiteral(true); + + var string = write(writer -> writer.writeExpression(java)); + + assertThat(string, equalTo("true")); + } + + @Test public void integerLiteral() throws IOException { var java = new JavaIntegerLiteral(42); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBooleanLiteralMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBooleanLiteralMatcher.java new file mode 100644 index 0000000..56308d4 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/ast/JavaBooleanLiteralMatcher.java @@ -0,0 +1,39 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.java.ast; + +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher imports + +public class JavaBooleanLiteralMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> { + public static org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher isJavaBooleanLiteral() { + return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher(java.util.List.of()); + } + + private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteral>> submatchers; + + private JavaBooleanLiteralMatcher(java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteral>> 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.java.ast.JavaBooleanLiteral.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher withValue(org.zwobble.precisely.Matcher<? super Boolean> value) { + var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteral>>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("value", org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteral::value, value)); + return new org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.java.ast.JavaBooleanLiteralMatcher body +} |
