Commit aedbe653 authored by Jacob Hoffman-Andrews's avatar Jacob Hoffman-Andrews
Browse files

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.
parent 01e22934
Loading
Loading
Loading
Loading
+6 −21
Original line number Diff line number Diff line
@@ -36,27 +36,12 @@ fn test_debug() {
    let cert = include_bytes!("../../test/cert.pem");
    let cert = X509::from_pem(cert).unwrap();
    let debugged = format!("{:#?}", cert);
    let expected = r#"X509 {
    serial_number: "8771F7BDEE982FA5",
    signature_algorithm: sha256WithRSAEncryption,
    issuer: [
        countryName = "AU",
        stateOrProvinceName = "Some-State",
        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);
    assert!(debugged.contains(r#"serial_number: "8771F7BDEE982FA5""#));
    assert!(debugged.contains(r#"signature_algorithm: sha256WithRSAEncryption"#));
    assert!(debugged.contains(r#"countryName = "AU""#));
    assert!(debugged.contains(r#"stateOrProvinceName = Some-State"#));
    assert!(debugged.contains(r#"not_before: Aug 14 17:00:03 2016 GMT"#));
    assert!(debugged.contains(r#"not_after: Aug 12 17:00:03 2026 GMT"#));
}

#[test]