summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-05-29 17:08:55 +0100
committerMichael Williamson <mike@zwobble.org>2026-05-29 17:08:55 +0100
commitae55e6e9f177ac8505298abc0839d82d90dddb38 (patch)
tree0489672942a321b0491d0afe9d55862298b9e4ed /src/test
parente97fdb3a32e6c5eaae65d50001a2156ff8752f22 (diff)
Support Java method without body
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/output/lang/java/JavaWriterTests.java17
1 files changed, 17 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 c349ec1..fd282f9 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
@@ -309,6 +309,23 @@ public class JavaWriterTests {
}
@Test
+ public void emptyMethodWithoutBody() throws IOException {
+ var java = new JavaMethodDeclaration(
+ "a",
+ JavaMethodKind.INSTANCE,
+ JavaTypeRef.VOID,
+ List.of(),
+ Optional.empty()
+ );
+
+ var string = write(writer -> writer.writeMethodDeclaration(java));
+
+ assertThat(string, equalTo("""
+ public void a();"""
+ ));
+ }
+
+ @Test
public void emptyInstanceMethod() throws IOException {
var java = new JavaMethodDeclaration(
"a",