@@ -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,25 @@ fn encode_custom_algorithm_openssh() {
663663/// Common behavior of all encoding tests
664664#[ cfg( feature = "alloc" ) ]
665665fn encoding_test ( private_key : & str ) {
666+ #[ cfg_attr( not( feature = "std" ) , allow( unused_variables) ) ]
667+ let key = round_trip_test ( private_key) ;
668+
669+ #[ cfg( feature = "std" ) ]
670+ if !matches ! ( key. algorithm( ) , Algorithm :: Other ( _) ) {
671+ encoding_integration_test ( key)
672+ }
673+ }
674+
675+ #[ cfg( feature = "alloc" ) ]
676+ fn round_trip_test ( private_key : & str ) -> PrivateKey {
666677 let key = PrivateKey :: from_openssh ( private_key) . unwrap ( ) ;
667678
668679 // Ensure key round-trips
669680 let pem = key. to_openssh ( LineEnding :: LF ) . unwrap ( ) ;
670681 let key2 = PrivateKey :: from_openssh ( & * pem) . unwrap ( ) ;
671682 assert_eq ! ( key, key2) ;
672683
673- #[ cfg( feature = "std" ) ]
674- if !matches ! ( key. algorithm( ) , Algorithm :: Other ( _) ) {
675- encoding_integration_test ( key)
676- }
684+ key
677685}
678686
679687/// Parse PEM encoded using `PrivateKey::to_openssh` using the `ssh-keygen` utility.
0 commit comments