@@ -1027,7 +1027,7 @@ impl TestCommand {
10271027 eyre:: eyre!( "{}" , self . make_error_message( out, expected_fail) )
10281028 }
10291029
1030- fn make_error_message ( & self , out : & Output , expected_fail : bool ) -> String {
1030+ pub fn make_error_message ( & self , out : & Output , expected_fail : bool ) -> String {
10311031 let msg = if expected_fail {
10321032 "expected failure but command succeeded!"
10331033 } else {
@@ -1071,6 +1071,12 @@ pub trait OutputExt {
10711071
10721072 /// Ensure the command wrote the expected data to `stderr`.
10731073 fn stderr_matches_path ( & self , expected_path : impl AsRef < Path > ) ;
1074+
1075+ /// Returns the stderr as lossy string
1076+ fn stderr_lossy ( & self ) -> String ;
1077+
1078+ /// Returns the stdout as lossy string
1079+ fn stdout_lossy ( & self ) -> String ;
10741080}
10751081
10761082/// Patterns to remove from fixtures before comparing output
@@ -1118,6 +1124,14 @@ impl OutputExt for Output {
11181124 let err = lossy_string ( & self . stderr ) ;
11191125 similar_asserts:: assert_eq!( normalize_output( & err) , normalize_output( & expected) ) ;
11201126 }
1127+
1128+ fn stderr_lossy ( & self ) -> String {
1129+ lossy_string ( & self . stderr )
1130+ }
1131+
1132+ fn stdout_lossy ( & self ) -> String {
1133+ lossy_string ( & self . stdout )
1134+ }
11211135}
11221136
11231137/// Returns the fixture path depending on whether the current terminal is tty
0 commit comments