You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description::new().text(format!("where the result of applying {actual:?} to the callable `{}` is {actual_result:?}",self.callable_description)).nested(self.inner_matcher.explain_match(&actual_result))
157
+
Description::new()
158
+
.text(format!("which, results into {actual_result:?}",))
159
+
.nested(self.describe(self.matches(actual)))
169
160
}
170
161
}
171
162
}
172
163
173
164
#[cfg(test)]
174
165
mod tests {
175
166
usecrate::prelude::*;
167
+
use indoc::indoc;
176
168
177
169
#[test]
178
170
fnresult_of_match_with_value() -> Result<()>{
@@ -192,9 +184,17 @@ mod tests {
192
184
let result = verify_that!(0, result_of!(|value| value - 1, eq(2)));
193
185
verify_that!(
194
186
result,
195
-
err(displays_as(contains_substring(
196
-
"where the result of applying 0 to the callable `|value| value - 1` is -1 which isn't equal to 2"
197
-
)))
187
+
err(displays_as(contains_substring(indoc!(
188
+
"
189
+
Value of: 0
190
+
Expected: by applying |value| value - 1,
191
+
is equal to 2
192
+
Actual: 0,
193
+
which, results into -1
194
+
by applying |value| value - 1,
195
+
isn't equal to 2
196
+
"
197
+
))))
198
198
)
199
199
}
200
200
@@ -203,9 +203,17 @@ mod tests {
203
203
let result = verify_that!(0, result_of!(|value| { value - 1}, eq(2)));
204
204
verify_that!(
205
205
result,
206
-
err(displays_as(contains_substring(
207
-
"where the result of applying 0 to the callable `|value| { value - 1 }` is -1 which isn't equal to 2"
208
-
)))
206
+
err(displays_as(contains_substring(indoc!(
207
+
"
208
+
Value of: 0
209
+
Expected: by applying |value| { value - 1 },
210
+
is equal to 2
211
+
Actual: 0,
212
+
which, results into -1
213
+
by applying |value| { value - 1 },
214
+
isn't equal to 2
215
+
"
216
+
))))
209
217
)
210
218
}
211
219
@@ -224,9 +232,17 @@ mod tests {
224
232
);
225
233
verify_that!(
226
234
result,
227
-
err(displays_as(contains_substring(
228
-
"where the result of applying 0 to the callable `|value| { let dec = value - 1; let inc = dec + 1; inc - 2 }` is -2 which isn't equal to 2"
229
-
)))
235
+
err(displays_as(contains_substring(indoc!(
236
+
"
237
+
Value of: 0
238
+
Expected: by applying |value| { let dec = value - 1; let inc = dec + 1; inc - 2 },
239
+
is equal to 2
240
+
Actual: 0,
241
+
which, results into -2
242
+
by applying |value| { let dec = value - 1; let inc = dec + 1; inc - 2 },
243
+
isn't equal to 2
244
+
"
245
+
))))
230
246
)
231
247
}
232
248
@@ -238,9 +254,17 @@ mod tests {
238
254
let result = verify_that!(0, result_of!(dec_by_one, eq(2)));
239
255
verify_that!(
240
256
result,
241
-
err(displays_as(contains_substring(
242
-
"where the result of applying 0 to the callable `dec_by_one` is -1 which isn't equal to 2"
243
-
)))
257
+
err(displays_as(contains_substring(indoc!(
258
+
"
259
+
Value of: 0
260
+
Expected: by applying dec_by_one,
261
+
is equal to 2
262
+
Actual: 0,
263
+
which, results into -1
264
+
by applying dec_by_one,
265
+
isn't equal to 2
266
+
"
267
+
))))
244
268
)
245
269
}
246
270
@@ -267,9 +291,16 @@ mod tests {
267
291
let result = verify_that!("world", result_of_ref!(|s:&str| s.to_uppercase(), eq("HELLO")));
268
292
verify_that!(
269
293
result,
270
-
err(displays_as(contains_substring(
271
-
"where the result of applying \"world\" to the callable `|s: &str| s.to_uppercase()` is \"WORLD\"\n which isn't equal to \"HELLO\""
0 commit comments