diff options
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java | 19 |
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", |
