@@ -242,10 +242,9 @@ mod should {
242
242
output. stderr. str ( ) ,
243
243
format!(
244
244
r#"
245
- --> {}/src/lib.rs:12 :33
245
+ --> {name }/src/lib.rs:14 :33
246
246
|
247
- 12 | fn error_cannot_resolve_fixture(no_fixture: u32) {{"# ,
248
- name
247
+ 14 | fn error_cannot_resolve_fixture(no_fixture: u32) {{"#
249
248
)
250
249
. unindent( )
251
250
) ;
@@ -260,11 +259,10 @@ mod should {
260
259
format!(
261
260
r#"
262
261
error[E0308]: mismatched types
263
- --> {}/src/lib.rs:8:18
264
- |
265
- 8 | let a: u32 = "";
266
- "# ,
267
- name
262
+ --> {name}/src/lib.rs:10:18
263
+ |
264
+ 10 | let a: u32 = "";
265
+ "#
268
266
)
269
267
. unindent( )
270
268
) ;
@@ -277,20 +275,19 @@ mod should {
277
275
assert_in ! (
278
276
output. stderr. str ( ) ,
279
277
format!(
280
- "
278
+ r# "
281
279
error[E0308]: mismatched types
282
- --> {}/src/lib.rs:16:29
283
- " ,
284
- name
280
+ --> {name}/src/lib.rs:17:29
281
+ "#
285
282
)
286
283
. unindent( )
287
284
) ;
288
285
289
286
assert_in ! (
290
287
output. stderr. str ( ) ,
291
- "
292
- 16 | fn error_fixture_wrong_type(fixture: String) {
293
- | ^^^^^^"
288
+ r# "
289
+ 17 | fn error_fixture_wrong_type(fixture: String) {}
290
+ | ^^^^^^"#
294
291
. unindent( )
295
292
) ;
296
293
}
@@ -304,12 +301,11 @@ mod should {
304
301
format!(
305
302
"
306
303
error: Missed argument: 'not_a_fixture' should be a test function argument.
307
- --> {}/src/lib.rs:19:11
304
+ --> {name }/src/lib.rs:19:11
308
305
|
309
306
19 | #[fixture(not_a_fixture(24))]
310
307
| ^^^^^^^^^^^^^
311
- " ,
312
- name
308
+ "
313
309
)
314
310
. unindent( )
315
311
) ;
@@ -324,15 +320,56 @@ mod should {
324
320
format!(
325
321
r#"
326
322
error: Duplicate argument: 'f' is already defined.
327
- --> {}/src/lib.rs:33 :23
323
+ --> {name }/src/lib.rs:32 :23
328
324
|
329
- 33 | #[fixture(f("first"), f("second"))]
325
+ 32 | #[fixture(f("first"), f("second"))]
330
326
| ^
331
- "# ,
332
- name
327
+ "#
328
+ )
329
+ . unindent( )
330
+ ) ;
331
+ }
332
+
333
+ #[ rstest]
334
+ fn on_destruct_implicit_fixture ( errors_rs : & ( Output , String ) ) {
335
+ let ( output, name) = errors_rs. clone ( ) ;
336
+
337
+ assert_in ! (
338
+ output. stderr. str ( ) ,
339
+ format!(
340
+ r#"
341
+ error: To destruct a fixture you should provide a path to resolve it by '#[from(...)]' attribute.
342
+ --> {name}/src/lib.rs:48:35
343
+ |
344
+ 48 | fn error_destruct_without_resolve(T(a): T) {{}}
345
+ | ^^^^^^^
346
+ "#
347
+ )
348
+ . unindent( )
349
+ ) ;
350
+ }
351
+
352
+ #[ rstest]
353
+ fn on_destruct_explicit_fixture_without_from ( errors_rs : & ( Output , String ) ) {
354
+ let ( output, name) = errors_rs. clone ( ) ;
355
+
356
+ assert_in ! (
357
+ output. stderr. str ( ) ,
358
+ format!(
359
+ r#"
360
+ error: To destruct a fixture you should provide a path to resolve it by '#[from(...)]' attribute.
361
+ --> {name}/src/lib.rs:51:57
362
+ |
363
+ 51 | fn error_destruct_without_resolve_also_with(#[with(21)] T(a): T) {{}}
364
+ | ^^^^^^^
365
+ "#
333
366
)
334
367
. unindent( )
335
368
) ;
369
+ assert_eq ! (
370
+ 1 ,
371
+ output. stderr. str ( ) . count( "51 | fn error_destruct_without" )
372
+ )
336
373
}
337
374
338
375
#[ fixture]
0 commit comments