mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Test: install with path outside current workspace
Make up this test case to reflect the current incorrect behavior.
This commit is contained in:
parent
1c034752de
commit
d323ad672c
@ -7,7 +7,7 @@ use cargo_test_support::cross_compile;
|
||||
use cargo_test_support::git;
|
||||
use cargo_test_support::registry::{self, registry_path, registry_url, Package};
|
||||
use cargo_test_support::{
|
||||
basic_manifest, cargo_process, no_such_file_err_msg, project, symlink_supported, t,
|
||||
basic_manifest, cargo_process, no_such_file_err_msg, project, project_in, symlink_supported, t,
|
||||
};
|
||||
|
||||
use cargo_test_support::install::{
|
||||
@ -493,6 +493,57 @@ but found cargo.toml please try to rename it to Cargo.toml. --path must point to
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn install_relative_path_outside_current_ws() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "bar"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
|
||||
[workspace]
|
||||
members = ["baz"]
|
||||
"#,
|
||||
)
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.file(
|
||||
"baz/Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "baz"
|
||||
version = "0.1.0"
|
||||
authors = []
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
foo = "1"
|
||||
"#,
|
||||
)
|
||||
.file("baz/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
let _bin_project = project_in("bar")
|
||||
.file("src/main.rs", "fn main() {}")
|
||||
.build();
|
||||
|
||||
p.cargo("install --path ../bar/foo")
|
||||
.with_status(101)
|
||||
.with_stderr(
|
||||
"\
|
||||
[ERROR] current package believes it's in a workspace when it's not:
|
||||
current: [CWD]/../bar/foo/Cargo.toml
|
||||
workspace: [CWD]/Cargo.toml
|
||||
|
||||
this may be fixable by adding `../bar/foo` to the `workspace.members` [..]
|
||||
Alternatively, [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn multiple_crates_error() {
|
||||
let p = git::repo(&paths::root().join("foo"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user