@@ -71,6 +71,7 @@ impl TestCase {
71
71
}
72
72
}
73
73
74
+ #[ allow( dead_code) ]
74
75
pub async fn read_result ( & self ) -> String {
75
76
use async_std:: prelude:: * ;
76
77
let mut result = String :: new ( ) ;
@@ -80,6 +81,7 @@ impl TestCase {
80
81
result
81
82
}
82
83
84
+ #[ allow( dead_code) ]
83
85
pub async fn read_expected ( & self ) -> String {
84
86
use async_std:: prelude:: * ;
85
87
let mut expected = std:: string:: String :: new ( ) ;
@@ -92,15 +94,16 @@ impl TestCase {
92
94
expected
93
95
}
94
96
97
+ #[ allow( dead_code) ]
95
98
pub ( crate ) async fn assert ( self ) {
96
99
let mut actual = self . read_result ( ) . await ;
97
100
let mut expected = self . read_expected ( ) . await ;
98
101
assert ! ( !actual. is_empty( ) , "Received empty reply" ) ;
99
102
assert ! ( !expected. is_empty( ) , "Missing expected fixture" ) ;
100
103
101
104
// munge actual and expected so that we don't rely on dates matching exactly
102
- munge_date ( & mut expected , & mut actual ) ;
103
- pretty_assertions:: assert_eq!( expected , actual ) ;
105
+ munge_date ( & mut actual , & mut expected ) ;
106
+ pretty_assertions:: assert_eq!( actual , expected ) ;
104
107
}
105
108
}
106
109
@@ -109,14 +112,16 @@ pub(crate) fn fixture_path(relative_path: &str) -> PathBuf {
109
112
directory. join ( "tests" ) . join ( relative_path)
110
113
}
111
114
112
- pub ( crate ) fn munge_date ( expected : & mut String , actual : & mut String ) {
115
+ pub ( crate ) fn munge_date ( actual : & mut String , expected : & mut String ) {
113
116
if let Some ( i) = expected. find ( "{DATE}" ) {
114
117
match actual. find ( "date: " ) {
115
118
Some ( j) => {
116
119
let eol = actual[ j + 6 ..] . find ( "\r \n " ) . expect ( "missing eol" ) ;
117
120
expected. replace_range ( i..i + 6 , & actual[ j + 6 ..j + 6 + eol] ) ;
118
121
}
119
- None => expected. replace_range ( i..i + 6 , "" ) ,
122
+ None => {
123
+ expected. replace_range ( i..i + 6 , "" ) ;
124
+ }
120
125
}
121
126
}
122
127
}
0 commit comments