Skip to content

Commit

Permalink
test(alias): extra error context for cmd aliasing failure
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Sep 14, 2022
1 parent 79b98dc commit 08c6cdd
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions tests/testsuite/cargo_alias_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ fn alias_incorrect_config_type() {

p.cargo("b-cargo-test -v")
.with_status(101)
.with_stderr_contains(
.with_stderr(
"\
[ERROR] invalid configuration for key `alias.b-cargo-test`
expected a list, but found a integer for [..]",
[ERROR] alias `b-cargo-test` has unresolvable definition: b-cargo-test
Caused by:
invalid configuration for key `alias.b-cargo-test`
expected a list, but found a integer for [..]",
)
.run();
}
Expand All @@ -45,8 +48,19 @@ fn alias_malformed_config_string() {

p.cargo("b-cargo-test -v")
.with_status(101)
.with_stderr_contains(
.with_stderr(
"\
error: alias `b-cargo-test` has unresolvable definition: b-cargo-test
Caused by:
[..]
Caused by:
[..]
Caused by:
[..]
Caused by:
TOML parse error at line [..]
|
Expand Down Expand Up @@ -75,8 +89,22 @@ fn alias_malformed_config_list() {

p.cargo("b-cargo-test -v")
.with_status(101)
.with_stderr_contains(
.with_stderr(
"\
[ERROR] alias `b-cargo-test` has unresolvable definition: b-cargo-test
Caused by:
[..]
Caused by:
[..]
Caused by:
failed to parse key `alias`
Caused by:
failed to parse key `b-cargo-test`
Caused by:
expected string but found integer in list
",
Expand Down Expand Up @@ -191,7 +219,7 @@ fn default_args_alias() {
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
This was previously accepted but is being phased out; it will become a hard error in a future release.
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
error: alias echo has unresolvable recursive definition: echo -> echo
[ERROR] alias `echo` has recursive definition: echo -> echo
",
)
.run();
Expand All @@ -203,7 +231,7 @@ error: alias echo has unresolvable recursive definition: echo -> echo
[WARNING] user-defined alias `echo` is shadowing an external subcommand found at: `[ROOT]/cargo-echo/target/debug/cargo-echo[EXE]`
This was previously accepted but is being phased out; it will become a hard error in a future release.
For more information, see issue #10049 <https://github.com/rust-lang/cargo/issues/10049>.
error: alias test-1 has unresolvable recursive definition: test-1 -> echo -> echo
[ERROR] alias `test-1` has recursive definition: test-1 -> echo -> echo
",
)
.run();
Expand Down Expand Up @@ -239,14 +267,14 @@ fn corecursive_alias() {
p.cargo("test-1")
.with_status(101)
.with_stderr(
"error: alias test-1 has unresolvable recursive definition: test-1 -> test-2 -> test-3 -> test-1",
"[ERROR] alias `test-1` has recursive definition: test-1 -> test-2 -> test-3 -> test-1",
)
.run();

p.cargo("test-2")
.with_status(101)
.with_stderr(
"error: alias test-2 has unresolvable recursive definition: test-2 -> test-3 -> test-1 -> test-2",
"[ERROR] alias `test-2` has recursive definition: test-2 -> test-3 -> test-1 -> test-2",
)
.run();
}
Expand Down

0 comments on commit 08c6cdd

Please sign in to comment.