@@ -615,7 +615,7 @@ fn round_trip_non_utf8_comment_openssh() {
615615#[ cfg( feature = "alloc" ) ]
616616#[ test]
617617fn encode_dsa_openssh ( ) {
618- encoding_test ( OPENSSH_DSA_EXAMPLE )
618+ round_trip_test ( OPENSSH_DSA_EXAMPLE ) ;
619619}
620620
621621#[ cfg( all( feature = "alloc" , feature = "p256" ) ) ]
@@ -663,17 +663,24 @@ fn encode_custom_algorithm_openssh() {
663663/// Common behavior of all encoding tests
664664#[ cfg( feature = "alloc" ) ]
665665fn encoding_test ( private_key : & str ) {
666+ let key = round_trip_test ( private_key) ;
667+
668+ #[ cfg( feature = "std" ) ]
669+ if !matches ! ( key. algorithm( ) , Algorithm :: Other ( _) ) {
670+ encoding_integration_test ( key)
671+ }
672+ }
673+
674+ #[ cfg( feature = "alloc" ) ]
675+ fn round_trip_test ( private_key : & str ) -> PrivateKey {
666676 let key = PrivateKey :: from_openssh ( private_key) . unwrap ( ) ;
667677
668678 // Ensure key round-trips
669679 let pem = key. to_openssh ( LineEnding :: LF ) . unwrap ( ) ;
670680 let key2 = PrivateKey :: from_openssh ( & * pem) . unwrap ( ) ;
671681 assert_eq ! ( key, key2) ;
672682
673- #[ cfg( feature = "std" ) ]
674- if !matches ! ( key. algorithm( ) , Algorithm :: Other ( _) ) {
675- encoding_integration_test ( key)
676- }
683+ key
677684}
678685
679686/// Parse PEM encoded using `PrivateKey::to_openssh` using the `ssh-keygen` utility.
0 commit comments