Skip to content

Commit 08c6cdd

Browse files
committed
test(alias): extra error context for cmd aliasing failure
1 parent 79b98dc commit 08c6cdd

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

tests/testsuite/cargo_alias_config.rs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ fn alias_incorrect_config_type() {
2121

2222
p.cargo("b-cargo-test -v")
2323
.with_status(101)
24-
.with_stderr_contains(
24+
.with_stderr(
2525
"\
26-
[ERROR] invalid configuration for key `alias.b-cargo-test`
27-
expected a list, but found a integer for [..]",
26+
[ERROR] alias `b-cargo-test` has unresolvable definition: b-cargo-test
27+
28+
Caused by:
29+
invalid configuration for key `alias.b-cargo-test`
30+
expected a list, but found a integer for [..]",
2831
)
2932
.run();
3033
}
@@ -45,8 +48,19 @@ fn alias_malformed_config_string() {
4548

4649
p.cargo("b-cargo-test -v")
4750
.with_status(101)
48-
.with_stderr_contains(
51+
.with_stderr(
4952
"\
53+
error: alias `b-cargo-test` has unresolvable definition: b-cargo-test
54+
55+
Caused by:
56+
[..]
57+
58+
Caused by:
59+
[..]
60+
61+
Caused by:
62+
[..]
63+
5064
Caused by:
5165
TOML parse error at line [..]
5266
|
@@ -75,8 +89,22 @@ fn alias_malformed_config_list() {
7589

7690
p.cargo("b-cargo-test -v")
7791
.with_status(101)
78-
.with_stderr_contains(
92+
.with_stderr(
7993
"\
94+
[ERROR] alias `b-cargo-test` has unresolvable definition: b-cargo-test
95+
96+
Caused by:
97+
[..]
98+
99+
Caused by:
100+
[..]
101+
102+
Caused by:
103+
failed to parse key `alias`
104+
105+
Caused by:
106+
failed to parse key `b-cargo-test`
107+
80108
Caused by:
81109
expected string but found integer in list
82110
",
@@ -191,7 +219,7 @@ fn default_args_alias() {
191219
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
192220
This was previously accepted but is being phased out; it will become a hard error in a future release.
193221
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
194-
error: alias echo has unresolvable recursive definition: echo -> echo
222+
[ERROR] alias `echo` has recursive definition: echo -> echo
195223
",
196224
)
197225
.run();
@@ -203,7 +231,7 @@ error: alias echo has unresolvable recursive definition: echo -> echo
203231
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
204232
This was previously accepted but is being phased out; it will become a hard error in a future release.
205233
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
206-
error: alias test-1 has unresolvable recursive definition: test-1 -> echo -> echo
234+
[ERROR] alias `test-1` has recursive definition: test-1 -> echo -> echo
207235
",
208236
)
209237
.run();
@@ -239,14 +267,14 @@ fn corecursive_alias() {
239267
p.cargo("test-1")
240268
.with_status(101)
241269
.with_stderr(
242-
"error: alias test-1 has unresolvable recursive definition: test-1 -> test-2 -> test-3 -> test-1",
270+
"[ERROR] alias `test-1` has recursive definition: test-1 -> test-2 -> test-3 -> test-1",
243271
)
244272
.run();
245273

246274
p.cargo("test-2")
247275
.with_status(101)
248276
.with_stderr(
249-
"error: alias test-2 has unresolvable recursive definition: test-2 -> test-3 -> test-1 -> test-2",
277+
"[ERROR] alias `test-2` has recursive definition: test-2 -> test-3 -> test-1 -> test-2",
250278
)
251279
.run();
252280
}

0 commit comments

Comments
 (0)