aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-04-08 19:07:33 +0100
committerMichael Williamson <mike@zwobble.org>2026-04-08 19:07:33 +0100
commit3424818dd7a0f878f43f52e6c12ba4493997e7e4 (patch)
treebbc0be46d26ed10c7ffc2b73560e11e8e57142f1
parent4c67c6f5bf3df6ffe54d4cd148db8ffab60c4ea6 (diff)
Add disabled test for functions with multiple return values
-rw-r--r--src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java40
1 files changed, 40 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 eed0e9f3..7d82bbae 100644
--- a/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java
+++ b/src/test/java/org/shedlang/compiler/patio/PatioExampleTests.java
@@ -1,5 +1,6 @@
package org.shedlang.compiler.patio;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.patio.instructions.Patio;
import org.shedlang.compiler.patio.instructions.PatioInstruction;
@@ -822,6 +823,45 @@ public abstract class PatioExampleTests {
));
}
+ @Disabled
+ @Test
+ public void canCallFunctionWithMultipleReturnValuesDefinedInModule() throws IOException, InterruptedException {
+ var calledFunction = PatioFunctionDefinition.builder()
+ .withName("f")
+ .addLocal(PatioLocal.param("x", PatioTypes.INT))
+ .addLocal(PatioLocal.val("xPlus5", PatioTypes.INT))
+ .addReturnType(PatioTypes.INT)
+ .addReturnType(PatioTypes.INT)
+ .addBodyInstruction(Patio.intAdd(Patio.localRef("xPlus5"), Patio.localRef("x"), Patio.intConst(5)))
+ .addBodyInstruction(Patio.return_(List.of(
+ Patio.localRef("x"),
+ Patio.localRef("xPlus5")
+ )))
+ .build();
+
+ var patioFunction = PatioFunctionDefinition.builder()
+ .withName(FUNCTION_NAME)
+ .addLocal(Patio.val("x", PatioTypes.INT))
+ .addLocal(Patio.val("y", PatioTypes.INT))
+ .addBodyInstruction(Patio.call(
+ List.of(Patio.localRef("x"), Patio.localRef("y")),
+ calledFunction.name(),
+ List.of(Patio.intConst(42))
+ ))
+ .addBodyInstruction(emitInt(Patio.localRef("x")))
+ .addBodyInstruction(emitInt(Patio.localRef("y")))
+ .addBodyInstruction(Patio.returnVoid())
+ .build();
+ var patio = Patio.compilationUnit(List.of(calledFunction, patioFunction));
+
+ var result = run(patio);
+
+ assertThat(result, isSequence(
+ isInt(42),
+ isInt(47)
+ ));
+ }
+
@Test
public void canCallPointerToFunctionDefinedInModule() throws IOException, InterruptedException {
var calledFunction = PatioFunctionDefinition.builder()