重构error code

This commit is contained in:
2026-02-04 17:02:17 +08:00
parent cc9f3f21de
commit a58e507f92
44 changed files with 6095 additions and 1165 deletions

View File

@@ -15,17 +15,31 @@ fn decode_tal_fixtures_smoke() {
let raw = std::fs::read(path).expect("read TAL fixture");
let tal = Tal::decode_bytes(&raw).expect("decode TAL fixture");
assert!(!tal.ta_uris.is_empty(), "TA URI list must be non-empty: {path}");
assert!(!tal.subject_public_key_info_der.is_empty(), "SPKI DER must be non-empty: {path}");
assert!(
!tal.ta_uris.is_empty(),
"TA URI list must be non-empty: {path}"
);
assert!(
!tal.subject_public_key_info_der.is_empty(),
"SPKI DER must be non-empty: {path}"
);
for u in &tal.ta_uris {
assert!(matches!(u.scheme(), "rsync" | "https"), "scheme must be allowed: {u}");
assert!(!u.path().ends_with('/'), "TA URI must not be a directory: {u}");
assert!(
matches!(u.scheme(), "rsync" | "https"),
"scheme must be allowed: {u}"
);
assert!(
!u.path().ends_with('/'),
"TA URI must not be a directory: {u}"
);
}
// SPKI DER must be parseable as a DER object (typically a SEQUENCE).
let (rem, _obj) = parse_der(&tal.subject_public_key_info_der).expect("parse spki DER");
assert!(rem.is_empty(), "SPKI DER must not have trailing bytes: {path}");
assert!(
rem.is_empty(),
"SPKI DER must not have trailing bytes: {path}"
);
}
}