From c37a1a46853e4410c060e2ee6d71c033f57eb2eb Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 16 Sep 2023 15:23:15 +0100 Subject: Move ExecutionResult to testing package --- .../java/org/shedlang/compiler/backends/ExampleTests.java | 2 +- .../org/shedlang/compiler/backends/llvm/ExecutionResult.java | 11 ----------- .../compiler/backends/llvm/LlvmPatioCodeGenTests.java | 1 + .../compiler/backends/wasm/WasmPatioCodeGenTests.java | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 src/test/java/org/shedlang/compiler/backends/llvm/ExecutionResult.java (limited to 'src/test/java/org/shedlang/compiler/backends') diff --git a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java index f3903746..5a6a7cbc 100644 --- a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java @@ -3,7 +3,7 @@ package org.shedlang.compiler.backends; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.shedlang.compiler.ShedCompiler; -import org.shedlang.compiler.backends.llvm.ExecutionResult; +import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.config.ProjectConfig; import org.shedlang.compiler.errors.SourceError; import org.shedlang.compiler.filesystem.ShedCompilerFiles; diff --git a/src/test/java/org/shedlang/compiler/backends/llvm/ExecutionResult.java b/src/test/java/org/shedlang/compiler/backends/llvm/ExecutionResult.java deleted file mode 100644 index d977d70d..00000000 --- a/src/test/java/org/shedlang/compiler/backends/llvm/ExecutionResult.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.shedlang.compiler.backends.llvm; - -public record ExecutionResult(int exitCode, String stdout, String stderr) { - public ExecutionResult throwOnError() { - if (exitCode == 0) { - return this; - } else { - throw new AssertionError("exit code was " + exitCode + "\nstdout:\n" + stdout + "\nstderr:\n" + stderr); - } - } -} diff --git a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGenTests.java b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGenTests.java index 56bcfe6b..d6c13d78 100644 --- a/src/test/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGenTests.java +++ b/src/test/java/org/shedlang/compiler/backends/llvm/LlvmPatioCodeGenTests.java @@ -11,6 +11,7 @@ import org.shedlang.compiler.backends.llvm.ir.ast.types.LlvmTypes; import org.shedlang.compiler.filesystem.ShedCompilerFiles; import org.shedlang.compiler.patio.PatioExampleTests; import org.shedlang.compiler.patio.ast.PatioCompilationUnit; +import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.testing.TestProcessRunner; import java.io.IOException; diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGenTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGenTests.java index 7df0f65c..a0ef3592 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGenTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/WasmPatioCodeGenTests.java @@ -1,6 +1,6 @@ package org.shedlang.compiler.backends.wasm; -import org.shedlang.compiler.backends.llvm.ExecutionResult; +import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.backends.wasm.structure.WasmBinaryFormat; import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmCall; import org.shedlang.compiler.backends.wasm.structure.ast.instructions.WasmExpression; -- cgit v1.2.3