@@ -39,18 +39,21 @@ impl TestCase {
39
39
) -> TestCase {
40
40
let request_fixture = File :: open ( fixture_path ( & request_file_path) )
41
41
. 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 ! (
51
53
"Could not open response fixture file: {:?}" ,
52
54
& fixture_path( response_file_path)
53
- ) ) ;
55
+ )
56
+ } ) ;
54
57
55
58
let temp = tempfile:: tempfile ( ) . expect ( "Failed to create tempfile" ) ;
56
59
let result = Arc :: new ( Mutex :: new ( temp. into ( ) ) ) ;
@@ -107,18 +110,15 @@ pub(crate) fn fixture_path(relative_path: &str) -> PathBuf {
107
110
}
108
111
109
112
pub ( 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] ) ;
119
119
}
120
+ None => expected. replace_range ( i..i + 6 , "" ) ,
120
121
}
121
- None => { }
122
122
}
123
123
}
124
124
0 commit comments