@@ -26,6 +26,7 @@ use cargo_test_support::{
26
26
thread_wait_timeout, Execs , Project ,
27
27
} ;
28
28
use itertools:: Itertools ;
29
+ use regex:: Regex ;
29
30
30
31
use super :: config:: GlobalContextBuilder ;
31
32
@@ -749,7 +750,6 @@ fn both_git_and_http_index_cleans() {
749
750
drop ( lock) ;
750
751
}
751
752
752
- #[ allow( deprecated) ]
753
753
#[ cargo_test]
754
754
fn clean_gc_dry_run ( ) {
755
755
// Basic `clean --gc --dry-run` test.
@@ -778,10 +778,24 @@ fn clean_gc_dry_run() {
778
778
. chain ( cache. iter ( ) )
779
779
. map ( |p| p. to_str ( ) . unwrap ( ) )
780
780
. join ( "\n " ) ;
781
+ let expected = {
782
+ let root = paths:: root ( ) . display ( ) . to_string ( ) ;
783
+ let re_crate = Regex :: new ( r"-[a-z0-9]{16}\b" ) . unwrap ( ) ;
784
+ let re_pack = Regex :: new ( r"pack-[a-z0-9]{40}" ) . unwrap ( ) ;
785
+ let p = expected_files. replace ( & root, "[ROOT]" ) ;
786
+ let p = if cfg ! ( windows) {
787
+ p. replace ( "\\ " , "/" )
788
+ } else {
789
+ p
790
+ } ;
791
+ let p = re_crate. replace_all ( & p, "-[HASH]" ) ;
792
+ let p = re_pack. replace_all ( & p, "pack-[HASH]" ) ;
793
+ format ! ( "{p}\n " )
794
+ } ;
781
795
782
796
p. cargo ( "clean gc --dry-run -v -Zgc" )
783
797
. masquerade_as_nightly_cargo ( & [ "gc" ] )
784
- . with_stdout_unordered ( & expected_files )
798
+ . with_stdout_data ( expected . clone ( ) . unordered ( ) )
785
799
. with_stderr_data ( str![ [ r#"
786
800
[SUMMARY] [FILE_NUM] files, [FILE_SIZE]B total
787
801
[WARNING] no files deleted due to --dry-run
@@ -792,7 +806,7 @@ fn clean_gc_dry_run() {
792
806
// Again, make sure the information is still tracked.
793
807
p. cargo ( "clean gc --dry-run -v -Zgc" )
794
808
. masquerade_as_nightly_cargo ( & [ "gc" ] )
795
- . with_stdout_unordered ( & expected_files )
809
+ . with_stdout_data ( expected . unordered ( ) )
796
810
. with_stderr_data ( str![ [ r#"
797
811
[SUMMARY] [FILE_NUM] files, [FILE_SIZE]B total
798
812
[WARNING] no files deleted due to --dry-run
0 commit comments