Skip to content

Commit 6c0ff91

Browse files
committed
test(config-include): migrate to snapshot testing
1 parent fa75220 commit 6c0ff91

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

tests/testsuite/config_include.rs

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -317,19 +317,18 @@ fn missing_file() {
317317
.build_err();
318318
assert_error(
319319
gctx.unwrap_err(),
320-
&format!(
321-
"\
320+
str![[r#"
322321
could not load Cargo configuration
323322
324323
Caused by:
325-
failed to load config include `missing.toml` from `[..]/.cargo/config.toml`
324+
failed to load config include `missing.toml` from `[ROOT]/.cargo/config.toml`
326325
327326
Caused by:
328-
failed to read configuration file `[..]/.cargo/missing.toml`
327+
failed to read configuration file `[ROOT]/.cargo/missing.toml`
329328
330329
Caused by:
331-
[NOT_FOUND]",
332-
),
330+
[NOT_FOUND]
331+
"#]],
333332
);
334333
}
335334

@@ -342,11 +341,12 @@ fn wrong_file_extension() {
342341
.build_err();
343342
assert_error(
344343
gctx.unwrap_err(),
345-
"\
344+
str![[r#"
346345
could not load Cargo configuration
347346
348347
Caused by:
349-
expected a config include path ending with `.toml`, but found `config.png` from `[ROOT]/.cargo/config.toml`",
348+
expected a config include path ending with `.toml`, but found `config.png` from `[ROOT]/.cargo/config.toml`
349+
"#]],
350350
);
351351
}
352352

@@ -361,20 +361,21 @@ fn cycle() {
361361
.build_err();
362362
assert_error(
363363
gctx.unwrap_err(),
364-
"\
364+
str![[r#"
365365
could not load Cargo configuration
366366
367367
Caused by:
368-
failed to load config include `one.toml` from `[..]/.cargo/config.toml`
368+
failed to load config include `one.toml` from `[ROOT]/.cargo/config.toml`
369369
370370
Caused by:
371-
failed to load config include `two.toml` from `[..]/.cargo/one.toml`
371+
failed to load config include `two.toml` from `[ROOT]/.cargo/one.toml`
372372
373373
Caused by:
374-
failed to load config include `config.toml` from `[..]/.cargo/two.toml`
374+
failed to load config include `config.toml` from `[ROOT]/.cargo/two.toml`
375375
376376
Caused by:
377-
config `include` cycle detected with path `[..]/.cargo/config.toml`",
377+
config `include` cycle detected with path `[ROOT]/.cargo/config.toml`
378+
"#]],
378379
);
379380
}
380381

@@ -407,11 +408,12 @@ fn bad_format() {
407408
.build_err();
408409
assert_error(
409410
gctx.unwrap_err(),
410-
"\
411+
str![[r#"
411412
could not load Cargo configuration
412413
413414
Caused by:
414-
`include` expected a string or list, but found integer in `[..]/.cargo/config.toml`",
415+
`include` expected a string or list, but found integer in `[ROOT]/.cargo/config.toml`
416+
"#]],
415417
);
416418
}
417419

@@ -424,19 +426,18 @@ fn cli_include_failed() {
424426
.build_err();
425427
assert_error(
426428
gctx.unwrap_err(),
427-
&format!(
428-
"\
429+
str![[r#"
429430
failed to load --config include
430431
431432
Caused by:
432433
failed to load config include `foobar.toml` from `--config cli option`
433434
434435
Caused by:
435-
failed to read configuration file `[..]/foobar.toml`
436+
failed to read configuration file `[ROOT]/foobar.toml`
436437
437438
Caused by:
438-
[NOT_FOUND]"
439-
),
439+
[NOT_FOUND]
440+
"#]],
440441
);
441442
}
442443

@@ -457,12 +458,12 @@ fn cli_merge_failed() {
457458
// Maybe this error message should mention it was from an include file?
458459
assert_error(
459460
gctx.unwrap_err(),
460-
"\
461-
failed to merge --config key `foo` into `[..]/.cargo/config.toml`
461+
str![[r#"
462+
failed to merge --config key `foo` into `[ROOT]/.cargo/config.toml`
462463
463464
Caused by:
464-
failed to merge config value from `[..]/.cargo/other.toml` into `[..]/.cargo/config.toml`: \
465-
expected array, but found string",
465+
failed to merge config value from `[ROOT]/.cargo/other.toml` into `[ROOT]/.cargo/config.toml`: expected array, but found string
466+
"#]],
466467
);
467468
}
468469

0 commit comments

Comments
 (0)