From 517f94350bd4dabe0b681b5da2febdbf76e37585 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 30 Jul 2023 20:08:11 +0100 Subject: Add var example --- examples/var/shed.toml | 9 +++++++++ examples/var/src/HelloWorld.shed | 5 +++++ .../org/shedlang/compiler/backends/llvm/LlvmExampleTests.java | 2 +- .../org/shedlang/compiler/backends/wasm/WasmExampleTests.java | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 examples/var/shed.toml create mode 100644 examples/var/src/HelloWorld.shed diff --git a/examples/var/shed.toml b/examples/var/shed.toml new file mode 100644 index 00000000..156fa7c6 --- /dev/null +++ b/examples/var/shed.toml @@ -0,0 +1,9 @@ +[shed] +main = "HelloWorld" + +[[shed.bins]] +name = "hello-world" + +[[shed.examples]] +bin = "hello-world" +expected-output = "hello, world" diff --git a/examples/var/src/HelloWorld.shed b/examples/var/src/HelloWorld.shed new file mode 100644 index 00000000..ff8c1041 --- /dev/null +++ b/examples/var/src/HelloWorld.shed @@ -0,0 +1,5 @@ +fun main() ! Io -> Unit { + var message = "hello, "; + assign message := message + "world\n"; + print!(message); +} diff --git a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmExampleTests.java b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmExampleTests.java index c8ba623e..bdf3e8c2 100644 --- a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmExampleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmExampleTests.java @@ -23,6 +23,6 @@ public class LlvmExampleTests extends ExampleTests { @Override protected boolean isDisabled(String testName) { - return false; + return testName.equals("var"); } } diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmExampleTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmExampleTests.java index fe6ef323..021ca38e 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/WasmExampleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmExampleTests.java @@ -23,6 +23,6 @@ public class WasmExampleTests extends ExampleTests { @Override protected boolean isDisabled(String testName) { - return false; + return testName.equals("var"); } } -- cgit v1.2.3