@@ -40,7 +40,6 @@ use crate::diff;
40
40
use crate :: paths;
41
41
use anyhow:: { bail, Context , Result } ;
42
42
use serde_json:: Value ;
43
- use std:: env;
44
43
use std:: fmt;
45
44
use std:: path:: Path ;
46
45
use std:: str;
@@ -84,7 +83,7 @@ pub fn assert_ui() -> snapbox::Assert {
84
83
let root_url = url:: Url :: from_file_path ( & root) . unwrap ( ) . to_string ( ) ;
85
84
86
85
let mut subs = snapbox:: Redactions :: new ( ) ;
87
- subs. extend ( [ ( "[EXE]" , std :: env :: consts :: EXE_SUFFIX ) ] )
86
+ subs. extend ( MIN_LITERAL_REDACTIONS . into_iter ( ) . cloned ( ) )
88
87
. unwrap ( ) ;
89
88
subs. insert ( "[ROOT]" , root) . unwrap ( ) ;
90
89
subs. insert ( "[ROOTURL]" , root_url) . unwrap ( ) ;
@@ -98,6 +97,8 @@ pub fn assert_ui() -> snapbox::Assert {
98
97
. redact_with ( subs)
99
98
}
100
99
100
+ static MIN_LITERAL_REDACTIONS : & [ ( & str , & str ) ] = & [ ( "[EXE]" , std:: env:: consts:: EXE_SUFFIX ) ] ;
101
+
101
102
/// Normalizes the output so that it can be compared against the expected value.
102
103
fn normalize_actual ( actual : & str , cwd : Option < & Path > ) -> String {
103
104
// It's easier to read tabs in outputs if they don't show up as literal
@@ -226,7 +227,6 @@ fn substitute_macros(input: &str) -> String {
226
227
( "[SUMMARY]" , " Summary" ) ,
227
228
( "[FIXED]" , " Fixed" ) ,
228
229
( "[FIXING]" , " Fixing" ) ,
229
- ( "[EXE]" , env:: consts:: EXE_SUFFIX ) ,
230
230
( "[IGNORED]" , " Ignored" ) ,
231
231
( "[INSTALLED]" , " Installed" ) ,
232
232
( "[REPLACED]" , " Replaced" ) ,
@@ -244,6 +244,9 @@ fn substitute_macros(input: &str) -> String {
244
244
( "[GENERATED]" , " Generated" ) ,
245
245
] ;
246
246
let mut result = input. to_owned ( ) ;
247
+ for & ( pat, subst) in MIN_LITERAL_REDACTIONS {
248
+ result = result. replace ( pat, subst)
249
+ }
247
250
for & ( pat, subst) in & macros {
248
251
result = result. replace ( pat, subst)
249
252
}
0 commit comments