From 6194d284f5559acc5f23a402f577bac655878f92 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 14 Jul 2026 18:41:17 +0100 Subject: Rename java-junit to java --- examples/03-inductive-data-types/hobgoblin.json5 | 2 +- .../output/java-junit/.gitignore | 2 -- .../output/java-junit/pom.xml | 1 - .../java/org/zwobble/example/ArithmeticTests.java | 34 ---------------------- .../03-inductive-data-types/output/java/.gitignore | 2 ++ .../03-inductive-data-types/output/java/pom.xml | 1 + .../java/org/zwobble/example/ArithmeticTests.java | 34 ++++++++++++++++++++++ 7 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 examples/03-inductive-data-types/output/java-junit/.gitignore delete mode 120000 examples/03-inductive-data-types/output/java-junit/pom.xml delete mode 100644 examples/03-inductive-data-types/output/java-junit/src/test/java/org/zwobble/example/ArithmeticTests.java create mode 100644 examples/03-inductive-data-types/output/java/.gitignore create mode 120000 examples/03-inductive-data-types/output/java/pom.xml create mode 100644 examples/03-inductive-data-types/output/java/src/test/java/org/zwobble/example/ArithmeticTests.java (limited to 'examples/03-inductive-data-types') diff --git a/examples/03-inductive-data-types/hobgoblin.json5 b/examples/03-inductive-data-types/hobgoblin.json5 index 8a073ac..12713d4 100644 --- a/examples/03-inductive-data-types/hobgoblin.json5 +++ b/examples/03-inductive-data-types/hobgoblin.json5 @@ -8,7 +8,7 @@ generators: [ { generator: "java-types", - path: "output/java-junit/src/gen/java", + path: "output/java/src/gen/java", }, { generator: "rust-types", diff --git a/examples/03-inductive-data-types/output/java-junit/.gitignore b/examples/03-inductive-data-types/output/java-junit/.gitignore deleted file mode 100644 index ff511d4..0000000 --- a/examples/03-inductive-data-types/output/java-junit/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/src/gen/ -/target/ diff --git a/examples/03-inductive-data-types/output/java-junit/pom.xml b/examples/03-inductive-data-types/output/java-junit/pom.xml deleted file mode 120000 index 445fa65..0000000 --- a/examples/03-inductive-data-types/output/java-junit/pom.xml +++ /dev/null @@ -1 +0,0 @@ -../../../templates/java-junit/pom.xml \ No newline at end of file diff --git a/examples/03-inductive-data-types/output/java-junit/src/test/java/org/zwobble/example/ArithmeticTests.java b/examples/03-inductive-data-types/output/java-junit/src/test/java/org/zwobble/example/ArithmeticTests.java deleted file mode 100644 index 5623af5..0000000 --- a/examples/03-inductive-data-types/output/java-junit/src/test/java/org/zwobble/example/ArithmeticTests.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.zwobble.example; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Test; -import org.zwobble.example.types.arithmetic.Add; -import org.zwobble.example.types.arithmetic.Const; -import org.zwobble.example.types.arithmetic.Expression; - -public class ArithmeticTests { - @Test - public void eval() { - Expression expression = new Add( - new Add( - new Const(42), - new Const(47) - ), - new Const(52) - ); - - int result = eval(expression); - - assertEquals(result, 141); - } - - private int eval(Expression expression) { - return switch (expression) { - case Add(var left, var right) -> - eval(left) + eval(right); - - case Const(var value) -> - value; - }; - } -} diff --git a/examples/03-inductive-data-types/output/java/.gitignore b/examples/03-inductive-data-types/output/java/.gitignore new file mode 100644 index 0000000..ff511d4 --- /dev/null +++ b/examples/03-inductive-data-types/output/java/.gitignore @@ -0,0 +1,2 @@ +/src/gen/ +/target/ diff --git a/examples/03-inductive-data-types/output/java/pom.xml b/examples/03-inductive-data-types/output/java/pom.xml new file mode 120000 index 0000000..445fa65 --- /dev/null +++ b/examples/03-inductive-data-types/output/java/pom.xml @@ -0,0 +1 @@ +../../../templates/java-junit/pom.xml \ No newline at end of file diff --git a/examples/03-inductive-data-types/output/java/src/test/java/org/zwobble/example/ArithmeticTests.java b/examples/03-inductive-data-types/output/java/src/test/java/org/zwobble/example/ArithmeticTests.java new file mode 100644 index 0000000..5623af5 --- /dev/null +++ b/examples/03-inductive-data-types/output/java/src/test/java/org/zwobble/example/ArithmeticTests.java @@ -0,0 +1,34 @@ +package org.zwobble.example; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.Test; +import org.zwobble.example.types.arithmetic.Add; +import org.zwobble.example.types.arithmetic.Const; +import org.zwobble.example.types.arithmetic.Expression; + +public class ArithmeticTests { + @Test + public void eval() { + Expression expression = new Add( + new Add( + new Const(42), + new Const(47) + ), + new Const(52) + ); + + int result = eval(expression); + + assertEquals(result, 141); + } + + private int eval(Expression expression) { + return switch (expression) { + case Add(var left, var right) -> + eval(left) + eval(right); + + case Const(var value) -> + value; + }; + } +} -- cgit v1.2.3