@@ -6,7 +6,10 @@ use std::path::Path;
6
6
use std:: process:: { Command as StdCommand , ExitStatus , Output , Stdio } ;
7
7
8
8
use crate :: util:: handle_failed_output;
9
- use crate :: { assert_contains, assert_equals, assert_not_contains} ;
9
+ use crate :: {
10
+ assert_contains, assert_contains_regex, assert_equals, assert_not_contains,
11
+ assert_not_contains_regex,
12
+ } ;
10
13
11
14
use build_helper:: drop_bomb:: DropBomb ;
12
15
@@ -192,13 +195,27 @@ impl CompletedProcess {
192
195
self
193
196
}
194
197
198
+ /// Checks that `stdout` does not contain the regex pattern `unexpected`.
199
+ #[ track_caller]
200
+ pub fn assert_stdout_not_contains_regex < S : AsRef < str > > ( & self , unexpected : S ) -> & Self {
201
+ assert_not_contains_regex ( & self . stdout_utf8 ( ) , unexpected) ;
202
+ self
203
+ }
204
+
195
205
/// Checks that `stdout` contains `expected`.
196
206
#[ track_caller]
197
207
pub fn assert_stdout_contains < S : AsRef < str > > ( & self , expected : S ) -> & Self {
198
208
assert_contains ( & self . stdout_utf8 ( ) , expected) ;
199
209
self
200
210
}
201
211
212
+ /// Checks that `stdout` contains the regex pattern `expected`.
213
+ #[ track_caller]
214
+ pub fn assert_stdout_contains_regex < S : AsRef < str > > ( & self , expected : S ) -> & Self {
215
+ assert_contains_regex ( & self . stdout_utf8 ( ) , expected) ;
216
+ self
217
+ }
218
+
202
219
/// Checks that trimmed `stderr` matches trimmed `expected`.
203
220
#[ track_caller]
204
221
pub fn assert_stderr_equals < S : AsRef < str > > ( & self , expected : S ) -> & Self {
@@ -213,13 +230,27 @@ impl CompletedProcess {
213
230
self
214
231
}
215
232
233
+ /// Checks that `stderr` contains the regex pattern `expected`.
234
+ #[ track_caller]
235
+ pub fn assert_stderr_contains_regex < S : AsRef < str > > ( & self , expected : S ) -> & Self {
236
+ assert_contains_regex ( & self . stderr_utf8 ( ) , expected) ;
237
+ self
238
+ }
239
+
216
240
/// Checks that `stderr` does not contain `unexpected`.
217
241
#[ track_caller]
218
242
pub fn assert_stderr_not_contains < S : AsRef < str > > ( & self , unexpected : S ) -> & Self {
219
243
assert_not_contains ( & self . stdout_utf8 ( ) , unexpected) ;
220
244
self
221
245
}
222
246
247
+ /// Checks that `stderr` does not contain the regex pattern `unexpected`.
248
+ #[ track_caller]
249
+ pub fn assert_stderr_not_contains_regex < S : AsRef < str > > ( & self , unexpected : S ) -> & Self {
250
+ assert_not_contains_regex ( & self . stdout_utf8 ( ) , unexpected) ;
251
+ self
252
+ }
253
+
223
254
#[ track_caller]
224
255
pub fn assert_exit_code ( & self , code : i32 ) -> & Self {
225
256
assert ! ( self . output. status. code( ) == Some ( code) ) ;
0 commit comments