Adds an opt-in harness that runs PureYAML over the canonical YAML 1.2 corpus (github.com/yaml/yaml-test-suite) and reports a parse-level pass rate: a should-parse case must parse, a should-error case must be rejected. The data is fetched into a gitignored location by scripts/fetch-yaml-test-suite.sh, never vendored, and the run is gated behind PUREYAML_RUN_YAML_TEST_SUITE=1 so the default suite is unaffected. This turns 'best YAML library' from an assertion into a tracked number. Baseline: 211/333 (63.4%) parse-level: 177/255 valid documents parse, 34/78 invalid documents are rejected. So 78 valid docs are not yet parsed and 44 invalid docs are wrongly accepted. The stricter value-level check against each case's in.json is the next step.
24 lines
950 B
Bash
Executable File
24 lines
950 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Fetch the official YAML test-suite (the canonical YAML 1.2 conformance corpus) into a gitignored
|
|
# location for the opt-in conformance run. The data is not vendored, keeping the package free of
|
|
# external content; this script puts it under .build/ (ignored) like the other fetched corpora.
|
|
#
|
|
# Usage:
|
|
# bash scripts/fetch-yaml-test-suite.sh
|
|
# PUREYAML_RUN_YAML_TEST_SUITE=1 swift test --filter YAMLTestSuiteConformanceTests
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
DEST="$ROOT_DIR/.build/yaml-test-suite"
|
|
|
|
if [ -d "$DEST/.git" ]; then
|
|
git -C "$DEST" fetch --quiet --depth 1 origin data
|
|
git -C "$DEST" reset --hard --quiet FETCH_HEAD
|
|
else
|
|
rm -rf "$DEST"
|
|
git clone --quiet --depth 1 --branch data https://github.com/yaml/yaml-test-suite "$DEST"
|
|
fi
|
|
|
|
cases="$(find "$DEST" -maxdepth 2 -name in.yaml | wc -l | tr -d ' ')"
|
|
echo "yaml-test-suite ready at $DEST ($cases cases)"
|