From 05bd9a969a89c070d683928727fece4ab9eaa490 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 29 Mar 2026 09:17:31 +0100 Subject: Add minimal Patio example --- .../shedlang/compiler/patio/PatioExampleTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/test/java') 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 @@ -22,6 +22,25 @@ import static org.zwobble.precisely.Matchers.*; 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( -- cgit v1.2.3