@@ -13,6 +13,7 @@ fn invalid_timestsamp() {
1313 name : b"Name" . as_bstr ( ) ,
1414 email : b"[email protected] " . as_bstr ( ) , 1515 time : "1312735823 +051800" ,
16+ raw : None ,
1617 } ;
1718 assert_eq ! (
1819 CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-timestamp.txt" ) )
@@ -36,10 +37,12 @@ fn invalid_email_of_committer() {
3637 name : b"Gregor Hartmann" . as_bstr ( ) ,
3738 email : b"gh <Gregor Hartmann<[email protected] " . as_bstr ( ) , 3839 time : "1282910542 +0200" ,
40+ raw : Some ( b"Gregor Hartmann<gh <Gregor Hartmann<[email protected] >>" . as_bstr ( ) ) , 3941 } ;
42+ let fixture = fixture_name ( "commit" , "invalid-actor.txt" ) ;
43+ let commit_ref = CommitRef :: from_bytes ( & fixture) . expect ( "ignore strangely formed actor format and round-trip" ) ;
4044 assert_eq ! (
41- CommitRef :: from_bytes( & fixture_name( "commit" , "invalid-actor.txt" ) )
42- . expect( "ignore strangely formed actor format" ) ,
45+ commit_ref,
4346 CommitRef {
4447 tree: b"220738fd4199e95a2b244465168366a73ebdf271" . as_bstr( ) ,
4548 parents: [ b"209fbe2d632761b30b7b17422914e11b93692833" . as_bstr( ) ] . into( ) ,
@@ -50,6 +53,11 @@ fn invalid_email_of_committer() {
5053 extra_headers: vec![ ]
5154 }
5255 ) ;
56+ let mut buf = Vec :: new ( ) ;
57+ commit_ref
58+ . write_to ( & mut buf)
59+ . expect ( "serialized commits with malformed actors should succeed" ) ;
60+ assert_eq ! ( buf, fixture) ;
5361}
5462
5563#[ test]
@@ -184,6 +192,7 @@ fn pre_epoch() -> crate::Result {
184192 name : "Législateur" . into ( ) ,
185193 email : "" . into ( ) ,
186194 time : "-5263834140 +0009" ,
195+ raw : None ,
187196 } ;
188197 assert_eq ! (
189198 CommitRef :: from_bytes( & fixture_name( "commit" , "pre-epoch.txt" ) ) ?,
@@ -206,6 +215,7 @@ fn double_dash_special_time_offset() -> crate::Result {
206215 name : "name" . into ( ) ,
207216 email : "[email protected] " . into ( ) , 208217 time : "1288373970 --700" ,
218+ raw : None ,
209219 } ;
210220 assert_eq ! (
211221 CommitRef :: from_bytes( & fixture_name( "commit" , "double-dash-date-offset.txt" ) ) ?,
@@ -228,6 +238,7 @@ fn with_trailer() -> crate::Result {
228238 name : "Kim Altintop" . into ( ) ,
229239 email : "[email protected] " . into ( ) , 230240 time : "1631514803 +0200" ,
241+ raw : None ,
231242 } ;
232243 let backing = fixture_name ( "commit" , "message-with-footer.txt" ) ;
233244 let commit = CommitRef :: from_bytes ( & backing) ?;
0 commit comments