@@ -667,4 +667,35 @@ mod encoded_dep_info {
667667 fn round_trip_with_checksums ( ) {
668668 gen_test ( true ) ;
669669 }
670+
671+ #[ test]
672+ fn path_type_is_u8_max ( ) {
673+ #[ rustfmt:: skip]
674+ let data = [
675+ 0x01 , 0x00 , 0x00 , 0x00 , 0xff , // magic marker
676+ 0x01 , // version
677+ 0x01 , 0x00 , 0x00 , 0x00 , // # of files
678+ 0x00 , // path type
679+ 0x04 , 0x00 , 0x00 , 0x00 , // len of path
680+ 0x72 , 0x75 , 0x73 , 0x74 , // path bytes ("rust")
681+ 0x00 , // cksum exists?
682+ 0x00 , 0x00 , 0x00 , 0x00 , // # of env vars
683+ ] ;
684+ // The current cargo doesn't recognize the magic marker.
685+ assert ! ( EncodedDepInfo :: parse( & data) . is_none( ) ) ;
686+ }
687+
688+ #[ test]
689+ fn parse_v0_fingerprint_dep_info ( ) {
690+ #[ rustfmt:: skip]
691+ let data = [
692+ 0x01 , 0x00 , 0x00 , 0x00 , // # of files
693+ 0x00 , // path type
694+ 0x04 , 0x00 , 0x00 , 0x00 , // len of path
695+ 0x72 , 0x75 , 0x73 , 0x74 , // path bytes: "rust"
696+ 0x00 , 0x00 , 0x00 , 0x00 , // # of env vars
697+ ] ;
698+ // Cargo can't recognize v0 after `-Zchecksum-freshess` added.
699+ assert ! ( EncodedDepInfo :: parse( & data) . is_none( ) ) ;
700+ }
670701}
0 commit comments