add ISO 3166-1 source verification test - #17
Conversation
The country table is hand-maintained; this proves every (alpha2, alpha3, numeric) triple against a committed snapshot of the Debian iso-codes project's ISO 3166-1 data, with XK as the one documented entry beyond the standard. The snapshot stays repository-only via the package include list, so its LGPL terms never enter the published crate. Signed-off-by: Stefan Grönke <stefan@gronke.net>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 268 268
=========================================
Hits 268 268 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
hmm, when I do a package and extract test which is what crates.io does, I get Anyone running the test suite from the crates.io package — which is exactly what distro packagers do, ironically the Debian folks this fixture comes from — get a compile failure. cargo package's verify step doesn't catch it because it only builds the lib. Current main doesn't have this problem, so it's a genuine regression introduced by this PR. We could just exclude iso_oracle.rs from the package which seems simple enough. Is that something you'd be willing to do? |
This is a proposal, offered as working code so the discussion has something concrete; happy to adjust or drop any part of it.
The
country!table in lib.rs is maintained by hand, and it is correct: every (alpha2, alpha3, numeric) triple matches the ISO 3166-1 data of the Debian iso-codes project (the transcription of the official ISO publication that most distributions ship), withXKas the deliberate user-assigned extra.What the crate cannot currently prove is that this stays true: ISO amends the standard occasionally, and nothing would notice a divergence today.
This PR adds that proof:
tests/iso_oracle.rscompares the full table against a committed snapshot of iso-codes'iso_3166-1.json, failing on any difference in either direction, with a documented exception list (XK).includelist shipstests/*.rsalone, so the published crate remains exactlyApache-2.0 OR MIT. For the repository itself the fixture's terms are handled the way LICENSE-UNICODE already handles the CLDR data:tests/fixtures/README.mdcarries the source and copyright notice, and the LGPL-2.1 text sits next to the file it covers, scoped to it alone. If you would rather keep the repository entirely free of LGPL material, the same check can instead read/usr/share/iso-codes/json/iso_3166-1.jsonfrom the CI runner after installing the iso-codes package (skipping gracefully where it is absent); say the word and I rework it that way.No CI changes required: the existing workflow's
cargo test --all-featurespicks the test up.