@@ -272,7 +272,7 @@ impl Options {
272272
273273// The default console test runner. It accepts the command line
274274// 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 > ) {
276276 let mut opts = match parse_opts ( args) {
277277 Some ( Ok ( o) ) => o,
278278 Some ( Err ( msg) ) => {
@@ -281,8 +281,9 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn>, options: Options) {
281281 }
282282 None => return ,
283283 } ;
284-
285- opts. options = options;
284+ if let Some ( options) = options {
285+ opts. options = options;
286+ }
286287 if opts. list {
287288 if let Err ( e) = list_tests_console ( & opts, tests) {
288289 eprintln ! ( "error: io error when listing tests: {:?}" , e) ;
@@ -323,7 +324,7 @@ pub fn test_main_static(tests: &[&TestDescAndFn]) {
323324 _ => panic ! ( "non-static tests passed to test::test_main_static" ) ,
324325 } )
325326 . collect ( ) ;
326- test_main ( & args, owned_tests, Options :: new ( ) )
327+ test_main ( & args, owned_tests, None )
327328}
328329
329330/// Invoked when unit tests terminate. Should panic if the unit
@@ -468,6 +469,11 @@ fn optgroups() -> getopts::Options {
468469 json = Output a json document" ,
469470 "pretty|terse|json" ,
470471 )
472+ . optflag (
473+ "" ,
474+ "show-output" ,
475+ "Show captured stdout of successful tests"
476+ )
471477 . optopt (
472478 "Z" ,
473479 "" ,
@@ -667,7 +673,7 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
667673 format,
668674 test_threads,
669675 skip : matches. opt_strs ( "skip" ) ,
670- options : Options :: new ( ) ,
676+ options : Options :: new ( ) . display_output ( matches . opt_present ( "show-output" ) ) ,
671677 } ;
672678
673679 Some ( Ok ( test_opts) )
0 commit comments