test -f go.mod if grep -Eq '^[[:space:]]*require[[:space:](]' go.mod; then echo "go.mod declares a forbidden third-party dependency" >&2 exit 1 fi go build ./cmd/toml-decoder printf 'answer = 42\n' | ./toml-decoder >"$stage_dir/valid.json" 2>"$stage_dir/valid.err" test ! -s "$stage_dir/valid.err" python - "$stage_dir/valid.json" <<'PY' import json import sys with open(sys.argv[1], encoding="utf-8") as stream: decoded = json.load(stream) assert decoded == {"answer": {"type": "integer", "value": "42"}} PY if printf 'answer = [\n' | ./toml-decoder >"$stage_dir/invalid.out" 2>"$stage_dir/invalid.err"; then echo "malformed TOML exited successfully" >&2 exit 1 fi test ! -s "$stage_dir/invalid.out" test -s "$stage_dir/invalid.err"