summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-07-04 23:12:31 +0100
committerMichael Williamson <mike@zwobble.org>2026-07-04 23:12:31 +0100
commit42e002e600dab7ddfe1181dc1c2b331eda9557d7 (patch)
treec64d548650618a0e18a5005fa7331df1b2f96e91 /src/test/java
parent444c252a1f345f392a9cb8238597ea7bcb96e6fa (diff)
Add left shift to Java AST
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java13
1 files changed, 13 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 25b2c9f..c487515 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
@@ -849,6 +849,19 @@ public class JavaWriterTests {
}
@Test
+ public void binaryOperationUnsignedLeftShift() throws IOException {
+ var java = JavaBinaryOperation.arbitrary()
+ .withOperator(JavaBinaryOperator.LEFT_SHIFT)
+ .withLeft(JavaRef.arbitrary().withName(JavaIdentifier.of("x")))
+ .withRight(JavaRef.arbitrary().withName(JavaIdentifier.of("y")))
+ .build();
+
+ var string = write(writer -> writer.writeTopLevelExpression(java));
+
+ assertThat(string, equalTo("x << y"));
+ }
+
+ @Test
public void binaryOperationUnsignedRightShift() throws IOException {
var java = JavaBinaryOperation.arbitrary()
.withOperator(JavaBinaryOperator.UNSIGNED_RIGHT_SHIFT)