File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,15 @@ pub trait Profile: PartialEq + Debug + Eq + Clone {
3131 }
3232}
3333
34+ #[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
3435#[ derive( Debug , PartialEq , Eq , Clone ) ]
3536/// Parse certificates with rfc5280-compliant checks
3637pub struct Rfc5280 ;
3738
3839impl Profile for Rfc5280 { }
3940
4041#[ cfg( feature = "hazmat" ) ]
42+ #[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
4143#[ derive( Debug , PartialEq , Eq , Clone ) ]
4244/// Parse raw x509 certificate and disable all the checks
4345pub struct Raw ;
Original file line number Diff line number Diff line change @@ -446,3 +446,22 @@ fn load_certificate_chains() {
446446
447447 assert_eq ! ( chain. len( ) , 4 , "4 certificates are expected in this chain" ) ;
448448}
449+
450+ #[ cfg( feature = "arbitrary" ) ]
451+ #[ test]
452+ // Purpose of this check is to ensure the arbitraty trait is provided for certificate variants
453+ #[ allow( unused) ]
454+ fn certificate_arbitrary ( ) {
455+ fn check_arbitrary < ' a > ( _arbitrary : impl arbitrary:: Arbitrary < ' a > ) { }
456+
457+ fn check_certificate ( certificate : x509_cert:: Certificate ) {
458+ check_arbitrary ( certificate) ;
459+ }
460+
461+ #[ cfg( feature = "hazmat" ) ]
462+ fn check_raw_certificate (
463+ certificate : x509_cert:: certificate:: CertificateInner < x509_cert:: certificate:: Raw > ,
464+ ) {
465+ check_arbitrary ( certificate) ;
466+ }
467+ }
You can’t perform that action at this time.
0 commit comments