@@ -238,8 +238,10 @@ mod tests {
238
238
}
239
239
240
240
#[ cfg( windows) ]
241
- fn ends_with_case_insensitive ( text : & OsStr , suffix : & str ) -> Option < bool > {
242
- Some ( text. to_str ( ) ?. to_lowercase ( ) . ends_with ( & suffix. to_lowercase ( ) ) )
241
+ fn ends_with_case_insensitive ( full_text : & OsStr , literal_pattern : & str ) -> Option < bool > {
242
+ let folded_text = full_text. to_str ( ) ?. to_lowercase ( ) ;
243
+ let folded_pattern = literal_pattern. to_lowercase ( ) ;
244
+ Some ( folded_text. ends_with ( & folded_pattern) )
243
245
}
244
246
245
247
/// The common global program files paths on this system, by process and system architecture.
@@ -317,11 +319,11 @@ mod tests {
317
319
self . x86. as_os_str( ) ,
318
320
"Our program files path is exactly identical to the 32-bit one." ,
319
321
) ;
320
- for arch_suffix in [ " (x86)" , " (Arm)" ] {
321
- let has_arch_suffix = ends_with_case_insensitive ( self . current . as_os_str ( ) , arch_suffix )
322
+ for trailing_arch in [ " (x86)" , " (Arm)" ] {
323
+ let is_adorned = ends_with_case_insensitive ( self . current . as_os_str ( ) , trailing_arch )
322
324
. expect ( "Assume the test system's important directories are valid Unicode." ) ;
323
325
assert ! (
324
- !has_arch_suffix ,
326
+ !is_adorned ,
325
327
"The 32-bit program files directory name on a 32-bit system mentions no architecture." ,
326
328
) ;
327
329
}
@@ -369,14 +371,14 @@ mod tests {
369
371
/// Paths relative to process architecture specific program files directories.
370
372
#[ cfg( windows) ]
371
373
#[ derive( Clone , Debug ) ]
372
- struct GitBinSuffixes < ' a > {
374
+ struct RelativeGitBinPaths < ' a > {
373
375
x86 : & ' a Path ,
374
376
maybe_64bit : Option < & ' a Path > ,
375
377
}
376
378
377
379
#[ cfg( windows) ]
378
- impl < ' a > GitBinSuffixes < ' a > {
379
- /// Assert that `locations` has the given prefixes, and extract the suffixes.
380
+ impl < ' a > RelativeGitBinPaths < ' a > {
381
+ /// Assert that `locations` has the given path prefixes, and extract the suffixes.
380
382
fn assert_from ( pf : & ' a ProgramFilesPaths , locations : & ' static [ PathBuf ] ) -> Self {
381
383
match locations {
382
384
[ primary, secondary] => {
@@ -402,11 +404,11 @@ mod tests {
402
404
maybe_64bit : None ,
403
405
}
404
406
}
405
- other => panic ! ( "Got length {}, expected 1 or 2." , other. len( ) ) ,
407
+ other => panic ! ( "{:?} has length {}, expected 1 or 2." , other , other. len( ) ) ,
406
408
}
407
409
}
408
410
409
- /// Assert that the suffixes are the common per-architecture Git install locations.
411
+ /// Assert that the suffixes (relative subdirectories) are the common per-architecture Git install locations.
410
412
fn assert_architectures ( & self ) {
411
413
assert_eq ! ( self . x86, Path :: new( "Git/mingw32/bin" ) ) ;
412
414
@@ -428,7 +430,7 @@ mod tests {
428
430
429
431
// Check that `ALTERNATIVE_LOCATIONS` correspond to them, with the correct subdirectories.
430
432
let locations = super :: ALTERNATIVE_LOCATIONS . as_slice ( ) ;
431
- GitBinSuffixes :: assert_from ( & pf, locations) . assert_architectures ( ) ;
433
+ RelativeGitBinPaths :: assert_from ( & pf, locations) . assert_architectures ( ) ;
432
434
}
433
435
434
436
#[ test]
0 commit comments