package org.shedlang.compiler.backends; import org.shedlang.compiler.config.json.Json5ObjectWithSource; import org.zwobble.json5.values.Json5String; import java.nio.file.Path; import java.util.Optional; import java.util.OptionalLong; public record ExampleConfig( Path projectPath, String bin, OptionalLong expectedExitCode, Optional expectedOutput, Optional expectedError ) { public static ExampleConfig fromJson5( Path root, Json5ObjectWithSource object ) { return new ExampleConfig( root.resolve(object.getString("project").value()), object.getString("bin").value(), object.getLongOrNone("expectedExitCode"), object.getStringOrNone("expectedOutput").map(Json5String::value), object.getStringOrNone("expectedError").map(Json5String::value) ); } }