summaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-05 12:50:02 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-05 12:50:02 +0100
commitde8478112ac78e9d67b3f6ca258786de559247eb (patch)
treebd2ec9e999d55faad195b9866a163254c34a24e4 /src/test/java/org/zwobble
parentca6307a275a2ab20c2606cea9a916e22225599dd (diff)
Add equality operators to Java AST
Diffstat (limited to 'src/test/java/org/zwobble')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java26
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 b888375..1ce78ea 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
@@ -881,6 +881,32 @@ public class JavaWriterTests {
}
@Test
+ public void binaryOperationEqualTo() throws IOException {
+ var java = new JavaBinaryOperation(
+ JavaBinaryOperator.EQUAL_TO,
+ new JavaRef(JavaIdentifier.of("x")),
+ new JavaRef(JavaIdentifier.of("y"))
+ );
+
+ var string = write(writer -> writer.writeTopLevelExpression(java));
+
+ assertThat(string, equalTo("x == y"));
+ }
+
+ @Test
+ public void binaryOperationNotEqualTo() throws IOException {
+ var java = new JavaBinaryOperation(
+ JavaBinaryOperator.NOT_EQUAL_TO,
+ new JavaRef(JavaIdentifier.of("x")),
+ new JavaRef(JavaIdentifier.of("y"))
+ );
+
+ var string = write(writer -> writer.writeTopLevelExpression(java));
+
+ assertThat(string, equalTo("x != y"));
+ }
+
+ @Test
public void binaryOperationUnsignedLeftShift() throws IOException {
var java = JavaBinaryOperation.arbitrary()
.withOperator(JavaBinaryOperator.LEFT_SHIFT)