@@ -604,7 +604,7 @@ pub(crate) fn write_file_recorded(
604
604
let hash = Sha256 :: new ( ) . chain_update ( content. as_ref ( ) ) . finalize ( ) ;
605
605
let encoded_hash = format ! ( "sha256={}" , BASE64URL_NOPAD . encode( & hash) ) ;
606
606
record. push ( RecordEntry {
607
- path : relative_path. display ( ) . to_string ( ) ,
607
+ path : relative_path. portable_display ( ) . to_string ( ) ,
608
608
hash : Some ( encoded_hash) ,
609
609
size : Some ( content. as_ref ( ) . len ( ) as u64 ) ,
610
610
} ) ;
@@ -741,7 +741,8 @@ mod test {
741
741
use crate :: Error ;
742
742
743
743
use super :: {
744
- get_script_executable, parse_email_message_file, parse_wheel_file, read_record_file, Script ,
744
+ get_script_executable, parse_email_message_file, parse_wheel_file, read_record_file,
745
+ write_installer_metadata, RecordEntry , Script ,
745
746
} ;
746
747
747
748
#[ test]
@@ -1016,4 +1017,36 @@ mod test {
1016
1017
1017
1018
Ok ( ( ) )
1018
1019
}
1020
+
1021
+ #[ test]
1022
+ fn test_write_installer_metadata ( ) {
1023
+ let temp_dir = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
1024
+ let site_packages = temp_dir. path ( ) ;
1025
+ let mut record: Vec < RecordEntry > = Vec :: new ( ) ;
1026
+ temp_dir
1027
+ . child ( "foo-0.1.0.dist-info" )
1028
+ . create_dir_all ( )
1029
+ . unwrap ( ) ;
1030
+ write_installer_metadata (
1031
+ site_packages,
1032
+ "foo-0.1.0" ,
1033
+ true ,
1034
+ None ,
1035
+ None ,
1036
+ Some ( "uv" ) ,
1037
+ & mut record,
1038
+ )
1039
+ . unwrap ( ) ;
1040
+ let expected = [
1041
+ "foo-0.1.0.dist-info/REQUESTED" ,
1042
+ "foo-0.1.0.dist-info/INSTALLER" ,
1043
+ ]
1044
+ . map ( ToString :: to_string)
1045
+ . to_vec ( ) ;
1046
+ let actual = record
1047
+ . into_iter ( )
1048
+ . map ( |entry| entry. path )
1049
+ . collect :: < Vec < String > > ( ) ;
1050
+ assert_eq ! ( expected, actual) ;
1051
+ }
1019
1052
}
0 commit comments