diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-01-11 11:30:27 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-01-11 11:30:27 +0000 |
| commit | 470b1fab1f9d99d6c85f479e28ea1c424e671e0a (patch) | |
| tree | 45c3b520d5dd2b38e3a2671e55068957808763c0 /src/main/java | |
| parent | acb019f53eefaee7dd7ab6e808cab0a0daa0b91f (diff) | |
Create separate config file for examples
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/config/ExampleConfig.java | 20 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/config/ProjectConfig.java | 10 |
2 files changed, 0 insertions, 30 deletions
diff --git a/src/main/java/org/shedlang/compiler/config/ExampleConfig.java b/src/main/java/org/shedlang/compiler/config/ExampleConfig.java deleted file mode 100644 index 065eaaac..00000000 --- a/src/main/java/org/shedlang/compiler/config/ExampleConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.shedlang.compiler.config; - -import org.shedlang.compiler.config.json.Json5ObjectWithSource; -import org.zwobble.json5.values.Json5String; - -import java.util.Optional; - -public record ExampleConfig( - String bin, - Optional<String> expectedOutput, - Optional<String> expectedError -) { - public static ExampleConfig fromJson5(Json5ObjectWithSource object) { - return new ExampleConfig( - object.getString("bin").value(), - object.getStringOrNone("expectedOutput").map(Json5String::value), - object.getStringOrNone("expectedError").map(Json5String::value) - ); - } -} diff --git a/src/main/java/org/shedlang/compiler/config/ProjectConfig.java b/src/main/java/org/shedlang/compiler/config/ProjectConfig.java index 7a4974e4..4ed85f1f 100644 --- a/src/main/java/org/shedlang/compiler/config/ProjectConfig.java +++ b/src/main/java/org/shedlang/compiler/config/ProjectConfig.java @@ -11,7 +11,6 @@ import java.util.List; public record ProjectConfig( Path root, List<BinConfig> bins, - List<ExampleConfig> examples, List<ProfileConfig> profiles ) { public static ProjectConfig read(Path projectPath) throws IOException { @@ -32,7 +31,6 @@ public record ProjectConfig( return new ProjectConfig( root, binsFromToml(object), - examplesFromToml(object), profilesFromToml(object) ); } @@ -45,14 +43,6 @@ public record ProjectConfig( .toList(); } - public static List<ExampleConfig> examplesFromToml(Json5ObjectWithSource object) { - return object.getArrayOfObjects("examples") - .orElseGet(() -> List.of()) - .stream() - .map(example -> ExampleConfig.fromJson5(example)) - .toList(); - } - public static List<ProfileConfig> profilesFromToml(Json5ObjectWithSource object) { return object.getArrayOfObjects("profiles") .orElseGet(() -> List.of()) |
