@@ -26,6 +26,7 @@ use cargo_test_support::{
2626 thread_wait_timeout, Execs , Project ,
2727} ;
2828use itertools:: Itertools ;
29+ use regex:: Regex ;
2930
3031use super :: config:: GlobalContextBuilder ;
3132
@@ -749,7 +750,6 @@ fn both_git_and_http_index_cleans() {
749750 drop ( lock) ;
750751}
751752
752- #[ allow( deprecated) ]
753753#[ cargo_test]
754754fn clean_gc_dry_run ( ) {
755755 // Basic `clean --gc --dry-run` test.
@@ -778,10 +778,24 @@ fn clean_gc_dry_run() {
778778 . chain ( cache. iter ( ) )
779779 . map ( |p| p. to_str ( ) . unwrap ( ) )
780780 . 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+ } ;
781795
782796 p. cargo ( "clean gc --dry-run -v -Zgc" )
783797 . masquerade_as_nightly_cargo ( & [ "gc" ] )
784- . with_stdout_unordered ( & expected_files )
798+ . with_stdout_data ( expected . clone ( ) . unordered ( ) )
785799 . with_stderr_data ( str![ [ r#"
786800[SUMMARY] [FILE_NUM] files, [FILE_SIZE]B total
787801[WARNING] no files deleted due to --dry-run
@@ -792,7 +806,7 @@ fn clean_gc_dry_run() {
792806 // Again, make sure the information is still tracked.
793807 p. cargo ( "clean gc --dry-run -v -Zgc" )
794808 . masquerade_as_nightly_cargo ( & [ "gc" ] )
795- . with_stdout_unordered ( & expected_files )
809+ . with_stdout_data ( expected . unordered ( ) )
796810 . with_stderr_data ( str![ [ r#"
797811[SUMMARY] [FILE_NUM] files, [FILE_SIZE]B total
798812[WARNING] no files deleted due to --dry-run
0 commit comments