-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #13335 - hi-rustin:rustin-patch-same-name, r=weihanglo
fix: use spec id instead of name to match package
- Loading branch information
Showing
2 changed files
with
91 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1566,3 +1566,49 @@ fn run_link_system_path_macos() { | |
p2.cargo("run").env(VAR, &libdir).run(); | ||
p2.cargo("test").env(VAR, &libdir).run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn run_binary_with_same_name_as_dependency() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.5.0" | ||
authors = [] | ||
[dependencies] | ||
foo = { path = "foo" } | ||
"#, | ||
) | ||
.file( | ||
"src/main.rs", | ||
r#" | ||
fn main() {} | ||
"#, | ||
) | ||
.file( | ||
"foo/Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
authors = [] | ||
[lib] | ||
name = "foo" | ||
path = "foo.rs" | ||
"#, | ||
) | ||
.file("foo/foo.rs", "") | ||
.build(); | ||
p.cargo("run").run(); | ||
p.cargo("check -p [email protected]").run(); | ||
p.cargo("run -p [email protected]").run(); | ||
p.cargo("run -p [email protected]").run(); | ||
p.cargo("run -p [email protected]") | ||
.with_status(101) | ||
.with_stderr("[ERROR] package(s) `[email protected]` not found in workspace `[..]`") | ||
.run(); | ||
} |