@@ -6,7 +6,10 @@ use std::path::Path;
66use std:: process:: { Command as StdCommand , ExitStatus , Output , Stdio } ;
77
88use 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+ } ;
1013
1114use build_helper:: drop_bomb:: DropBomb ;
1215
@@ -192,13 +195,27 @@ impl CompletedProcess {
192195 self
193196 }
194197
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+
195205 /// Checks that `stdout` contains `expected`.
196206 #[ track_caller]
197207 pub fn assert_stdout_contains < S : AsRef < str > > ( & self , expected : S ) -> & Self {
198208 assert_contains ( & self . stdout_utf8 ( ) , expected) ;
199209 self
200210 }
201211
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+
202219 /// Checks that trimmed `stderr` matches trimmed `expected`.
203220 #[ track_caller]
204221 pub fn assert_stderr_equals < S : AsRef < str > > ( & self , expected : S ) -> & Self {
@@ -213,13 +230,27 @@ impl CompletedProcess {
213230 self
214231 }
215232
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+
216240 /// Checks that `stderr` does not contain `unexpected`.
217241 #[ track_caller]
218242 pub fn assert_stderr_not_contains < S : AsRef < str > > ( & self , unexpected : S ) -> & Self {
219243 assert_not_contains ( & self . stdout_utf8 ( ) , unexpected) ;
220244 self
221245 }
222246
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+
223254 #[ track_caller]
224255 pub fn assert_exit_code ( & self , code : i32 ) -> & Self {
225256 assert ! ( self . output. status. code( ) == Some ( code) ) ;
0 commit comments