Make tests narrower.

Evidently the behavior on different platforms is different with regards
to whether the final element in a list gets a comma or not, so we can't
do a fully-string comparison of the debug output.
This commit is contained in:
Jacob Hoffman-Andrews 2020-06-03 21:30:15 -07:00
parent 01e229346c
commit aedbe6537b
1 changed files with 6 additions and 21 deletions

View File

@ -36,27 +36,12 @@ fn test_debug() {
let cert = include_bytes!("../../test/cert.pem"); let cert = include_bytes!("../../test/cert.pem");
let cert = X509::from_pem(cert).unwrap(); let cert = X509::from_pem(cert).unwrap();
let debugged = format!("{:#?}", cert); let debugged = format!("{:#?}", cert);
let expected = r#"X509 { assert!(debugged.contains(r#"serial_number: "8771F7BDEE982FA5""#));
serial_number: "8771F7BDEE982FA5", assert!(debugged.contains(r#"signature_algorithm: sha256WithRSAEncryption"#));
signature_algorithm: sha256WithRSAEncryption, assert!(debugged.contains(r#"countryName = "AU""#));
issuer: [ assert!(debugged.contains(r#"stateOrProvinceName = Some-State"#));
countryName = "AU", assert!(debugged.contains(r#"not_before: Aug 14 17:00:03 2016 GMT"#));
stateOrProvinceName = "Some-State", assert!(debugged.contains(r#"not_after: Aug 12 17:00:03 2026 GMT"#));
organizationName = "Internet Widgits Pty Ltd",
],
subject: [
countryName = "AU",
stateOrProvinceName = "Some-State",
organizationName = "Internet Widgits Pty Ltd",
commonName = "foobar.com",
],
not_before: Aug 14 17:00:03 2016 GMT,
not_after: Aug 12 17:00:03 2026 GMT,
public_key: PKey {
algorithm: "RSA",
},
}"#;
assert_eq!(expected, debugged);
} }
#[test] #[test]