@@ -272,7 +272,7 @@ impl Options {
272
272
273
273
// The default console test runner. It accepts the command line
274
274
// arguments and a vector of test_descs.
275
- pub fn test_main ( args : & [ String ] , tests : Vec < TestDescAndFn > , options : Options ) {
275
+ pub fn test_main ( args : & [ String ] , tests : Vec < TestDescAndFn > , options : Option < Options > ) {
276
276
let mut opts = match parse_opts ( args) {
277
277
Some ( Ok ( o) ) => o,
278
278
Some ( Err ( msg) ) => {
@@ -281,8 +281,9 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn>, options: Options) {
281
281
}
282
282
None => return ,
283
283
} ;
284
-
285
- opts. options = options;
284
+ if let Some ( options) = options {
285
+ opts. options = options;
286
+ }
286
287
if opts. list {
287
288
if let Err ( e) = list_tests_console ( & opts, tests) {
288
289
eprintln ! ( "error: io error when listing tests: {:?}" , e) ;
@@ -323,7 +324,7 @@ pub fn test_main_static(tests: &[&TestDescAndFn]) {
323
324
_ => panic ! ( "non-static tests passed to test::test_main_static" ) ,
324
325
} )
325
326
. collect ( ) ;
326
- test_main ( & args, owned_tests, Options :: new ( ) )
327
+ test_main ( & args, owned_tests, None )
327
328
}
328
329
329
330
/// Invoked when unit tests terminate. Should panic if the unit
@@ -468,6 +469,11 @@ fn optgroups() -> getopts::Options {
468
469
json = Output a json document" ,
469
470
"pretty|terse|json" ,
470
471
)
472
+ . optflag (
473
+ "" ,
474
+ "show-output" ,
475
+ "Show captured stdout of successful tests"
476
+ )
471
477
. optopt (
472
478
"Z" ,
473
479
"" ,
@@ -667,7 +673,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
667
673
format,
668
674
test_threads,
669
675
skip : matches. opt_strs ( "skip" ) ,
670
- options : Options :: new ( ) ,
676
+ options : Options :: new ( ) . display_output ( matches . opt_present ( "show-output" ) ) ,
671
677
} ;
672
678
673
679
Some ( Ok ( test_opts) )
0 commit comments