summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/ExampleTests.java42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ExampleTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/ExampleTests.java
index a51ec14..77248f7 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/ExampleTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/ExampleTests.java
@@ -34,28 +34,26 @@ public class ExampleTests {
var rustOutputPath = verifyRustOutput(exampleSet);
verifyTypescriptOutput(exampleSet);
- // TODO: make detection more robust
- if (exampleSet.name().contains("transient-0")) {
- var transient0OutputDirs = Stream.of(javaOutputPath, rustOutputPath)
- .map(outputPath -> outputPath.orElseThrow().resolve("transient-0"))
- .toList();
-
- var names = transient0OutputDirs.stream()
- .flatMap(outputPath -> Arrays.stream(outputPath.toFile().listFiles()).map(file -> file.getName()))
- .collect(Collectors.toSet())
- .stream()
- .sorted()
- .toList();
-
- for (var name : names) {
- var expectedBytes = Optional.<byte[]>empty();
- for (var transient0OutputDir : transient0OutputDirs) {
- var actualBytes = Files.readAllBytes(transient0OutputDir.resolve(name));
- if (expectedBytes.isEmpty()) {
- expectedBytes = Optional.of(actualBytes);
- } else {
- assertThat(Arrays.equals(actualBytes, expectedBytes.get()), equalTo(true));
- }
+ var transient0OutputDirs = Stream.of(javaOutputPath, rustOutputPath)
+ .map(outputPath -> outputPath.orElseThrow().resolve("transient-0"))
+ .filter(transient0OutputPath -> transient0OutputPath.toFile().exists())
+ .toList();
+
+ var names = transient0OutputDirs.stream()
+ .flatMap(outputPath -> Arrays.stream(outputPath.toFile().listFiles()).map(file -> file.getName()))
+ .collect(Collectors.toSet())
+ .stream()
+ .sorted()
+ .toList();
+
+ for (var name : names) {
+ var expectedBytes = Optional.<byte[]>empty();
+ for (var transient0OutputDir : transient0OutputDirs) {
+ var actualBytes = Files.readAllBytes(transient0OutputDir.resolve(name));
+ if (expectedBytes.isEmpty()) {
+ expectedBytes = Optional.of(actualBytes);
+ } else {
+ assertThat(Arrays.equals(actualBytes, expectedBytes.get()), equalTo(true));
}
}
}