use std::fs;
#[test]
fn checked_in_check_schema_matches_generator() {
let actual_schema = schemars::schema_for!(pathlint::lint::CheckOutcomeView);
let actual =
serde_json::to_string_pretty(&actual_schema).expect("schemars must serialize to JSON");
let on_disk = fs::read_to_string("schemas/check.schema.json")
.expect("schemas/check.schema.json must exist; run `cargo run --bin gen_check_schema > schemas/check.schema.json`");
let actual_normalized = actual.replace("\r\n", "\n");
let on_disk_normalized = on_disk.replace("\r\n", "\n");
assert_eq!(
actual_normalized.trim_end(),
on_disk_normalized.trim_end(),
"checked-in schemas/check.schema.json is out of date. \
Regenerate with: cargo run --bin gen_check_schema > schemas/check.schema.json"
);
}