aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-03-29 09:17:31 +0100
committerMichael Williamson <mike@zwobble.org>2026-03-29 09:17:31 +0100
commit05bd9a969a89c070d683928727fece4ab9eaa490 (patch)
treedd4df132b5939f019829e0f6e2a89a1020cfb2ac /src/test/java
parent17c745e977dbe696d3293b363d0aa36cdbf35e9c (diff)
Add minimal Patio example
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java
index 893e93ef..41185d38 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java
@@ -23,6 +23,25 @@ public abstract class PatioExampleTests {
protected static final String FUNCTION_NAME = "run";
@Test
+ public void intConstCreatesConstantIntValue() throws IOException, InterruptedException {
+ var patioFunction = PatioFunctionDefinition.builder()
+ .withName(FUNCTION_NAME)
+ .withReturnType(PatioTypes.VOID)
+ .addBodyInstruction(emitInt(Patio.intConst(42)))
+ .addBodyInstruction(Patio.returnVoid())
+ .build();
+ var patio = Patio.compilationUnit(List.of(
+ patioFunction
+ ));
+
+ var result = run(patio);
+
+ assertThat(result, isSequence(
+ isInt(42)
+ ));
+ }
+
+ @Test
public void canLoadDataElementInt() throws IOException, InterruptedException {
var patioDataElement = new PatioDataElementImmutableDefinition(
"answer",