@@ -137,7 +137,7 @@ impl Assert {
137
137
Self { output, redactions }
138
138
}
139
139
140
- /// Extend the redaction rules used in the currrent assertion with new values.
140
+ /// Extends the redaction rules used in the current assertion with new values.
141
141
pub fn extend_redactions (
142
142
& mut self ,
143
143
vars : impl IntoIterator < Item = ( & ' static str , impl Into < RedactedValue > ) > ,
@@ -148,6 +148,7 @@ impl Assert {
148
148
self
149
149
}
150
150
151
+ /// Removes the existing redaction rules used in the current assertion.
151
152
pub fn remove_redactions ( & mut self , vars : impl IntoIterator < Item = & ' static str > ) -> & mut Self {
152
153
for var in vars {
153
154
self . redactions
@@ -157,6 +158,11 @@ impl Assert {
157
158
self
158
159
}
159
160
161
+ /// Performs the redaction based on the existing rules.
162
+ pub fn redact ( & self , input : & str ) -> String {
163
+ self . redactions . redact ( input)
164
+ }
165
+
160
166
/// Asserts that the command exited with an ok status.
161
167
pub fn is_ok ( & self ) -> & Self {
162
168
assert ! ( self . output. ok) ;
@@ -171,7 +177,7 @@ impl Assert {
171
177
172
178
/// Asserts that the command exited with the given `expected` stdout pattern.
173
179
pub fn with_stdout ( & self , expected : impl IntoData ) -> & Self {
174
- let stdout = self . redactions . redact ( & self . output . stdout ) ;
180
+ let stdout = self . redact ( & self . output . stdout ) ;
175
181
assert_data_eq ! ( & stdout, expected) ;
176
182
self
177
183
}
@@ -187,7 +193,7 @@ impl Assert {
187
193
188
194
/// Asserts that the command exited with the given `expected` stderr pattern.
189
195
pub fn with_stderr ( & self , expected : impl IntoData ) -> & Self {
190
- let stderr = self . redactions . redact ( & self . output . stderr ) ;
196
+ let stderr = self . redact ( & self . output . stderr ) ;
191
197
assert_data_eq ! ( & stderr, expected) ;
192
198
self
193
199
}
0 commit comments