重构error code
This commit is contained in:
@@ -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}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user