@@ -39,18 +39,21 @@ impl TestCase {
3939 ) -> TestCase {
4040 let request_fixture = File :: open ( fixture_path ( & request_file_path) )
4141 . await
42- . expect ( & format ! (
43- "Could not open request fixture file: {:?}" ,
44- & fixture_path( request_file_path)
45- ) ) ;
46-
47- let response_fixture =
48- File :: open ( fixture_path ( & response_file_path) )
49- . await
50- . expect ( & format ! (
42+ . unwrap_or_else ( |_| {
43+ panic ! (
44+ "Could not open request fixture file: {:?}" ,
45+ & fixture_path( request_file_path)
46+ )
47+ } ) ;
48+
49+ let response_fixture = File :: open ( fixture_path ( & response_file_path) )
50+ . await
51+ . unwrap_or_else ( |_| {
52+ panic ! (
5153 "Could not open response fixture file: {:?}" ,
5254 & fixture_path( response_file_path)
53- ) ) ;
55+ )
56+ } ) ;
5457
5558 let temp = tempfile:: tempfile ( ) . expect ( "Failed to create tempfile" ) ;
5659 let result = Arc :: new ( Mutex :: new ( temp. into ( ) ) ) ;
@@ -107,18 +110,15 @@ pub(crate) fn fixture_path(relative_path: &str) -> PathBuf {
107110}
108111
109112pub ( crate ) fn munge_date ( expected : & mut String , actual : & mut String ) {
110- match expected. find ( "{DATE}" ) {
111- Some ( i) => {
112- println ! ( "{}" , expected) ;
113- match actual. find ( "date: " ) {
114- Some ( j) => {
115- let eol = actual[ j + 6 ..] . find ( "\r \n " ) . expect ( "missing eol" ) ;
116- expected. replace_range ( i..i + 6 , & actual[ j + 6 ..j + 6 + eol] ) ;
117- }
118- None => expected. replace_range ( i..i + 6 , "" ) ,
113+ if let Some ( i) = expected. find ( "{DATE}" ) {
114+ println ! ( "{}" , expected) ;
115+ match actual. find ( "date: " ) {
116+ Some ( j) => {
117+ let eol = actual[ j + 6 ..] . find ( "\r \n " ) . expect ( "missing eol" ) ;
118+ expected. replace_range ( i..i + 6 , & actual[ j + 6 ..j + 6 + eol] ) ;
119119 }
120+ None => expected. replace_range ( i..i + 6 , "" ) ,
120121 }
121- None => { }
122122 }
123123}
124124
0 commit comments