diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-03-30 22:37:51 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-03-30 22:37:51 +0100 |
| commit | 20fc2b92d7e04a35fdce0eb7de909710e132c39a (patch) | |
| tree | dc62262e79456b6674736d88979b2f240b91c142 /src | |
| parent | 8858ac50734d720e8a923917603b41201fd63e4c (diff) | |
Generate main function for patio-to-cranelift tests
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java b/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java index 58e7a2c4..78efb888 100644 --- a/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java +++ b/src/test/java/org/shedlang/compiler/backends/cranelift/PatioToCraneliftTests.java @@ -5,19 +5,47 @@ import org.shedlang.compiler.backends.llvm.LlvmTarget; import org.shedlang.compiler.backends.paths.PartialTargetPath; import org.shedlang.compiler.patio.PatioCompilationUnit; import org.shedlang.compiler.patio.PatioExampleTests; +import org.shedlang.compiler.patio.PatioFunctionDefinition; +import org.shedlang.compiler.patio.PatioVisibility; +import org.shedlang.compiler.patio.instructions.Patio; +import org.shedlang.compiler.patio.types.PatioTypes; import org.shedlang.compiler.runtime.ShedRuntime; +import org.shedlang.compiler.sources.Sources; import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.testing.TestProcessRunner; +import org.shedlang.compiler.util.Lists; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Optional; @Disabled public class PatioToCraneliftTests extends PatioExampleTests { @Override protected ExecutionResult executeCompilationUnit(PatioCompilationUnit patio) throws IOException, InterruptedException { + var main = new PatioFunctionDefinition( + "main", + PatioVisibility.PUBLIC, + List.of(), + PatioTypes.INT32, + List.of( + Patio.call( + Optional.empty(), + FUNCTION_NAME, + List.of() + ), + Patio.return_(Patio.int32Const(0)) + ), + Sources.NULL + ); + + patio = new PatioCompilationUnit( + Lists.concat(patio.elements(), List.of(main)), + patio.source() + ); + Files.createDirectories(Path.of("tests-tmp")); var workingDirectory = Files.createTempDirectory(Path.of("tests-tmp"), "PatioToCraneliftTests"); |
