diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-08-28 13:48:39 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-08-28 13:48:39 +0100 |
| commit | 3ce11f3a242c2287a14d5f5a4ae230b4c79beaaa (patch) | |
| tree | 0b73e903f3510815eda72058d84d852f4657b682 /src/test/java | |
| parent | e64daf38c0b6c98ccd75af777c58708c395b1b95 (diff) | |
Add <= and >= operators to Java AST
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java | 26 |
1 files changed, 26 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 de39610..6ccf789 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 @@ -1460,6 +1460,19 @@ public class JavaWriterTests { } @Test + public void binaryOperationGreaterThanOrEqual() throws IOException { + var java = new JavaBinaryOperation( + JavaBinaryOperator.GREATER_THAN_OR_EQUAL, + new JavaRef(JavaIdentifier.of("x")), + new JavaIntegerLiteral(42) + ); + + var string = write(writer -> writer.writeTopLevelExpression(java)); + + assertThat(string, equalTo("x >= 42")); + } + + @Test public void binaryOperationLeftShift() throws IOException { var java = JavaBinaryOperation.arbitrary() .withOperator(JavaBinaryOperator.LEFT_SHIFT) @@ -1486,6 +1499,19 @@ public class JavaWriterTests { } @Test + public void binaryOperationLessThanOrEqual() throws IOException { + var java = new JavaBinaryOperation( + JavaBinaryOperator.LESS_THAN_OR_EQUAL, + new JavaRef(JavaIdentifier.of("x")), + new JavaIntegerLiteral(42) + ); + + var string = write(writer -> writer.writeTopLevelExpression(java)); + + assertThat(string, equalTo("x <= 42")); + } + + @Test public void binaryOperationLogicalAnd() throws IOException { var java = new JavaBinaryOperation( JavaBinaryOperator.LOGICAL_AND, |
