-
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.
- Loading branch information
1 parent
fa64658
commit b75dd6b
Showing
7 changed files
with
596 additions
and
28 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -380,6 +380,107 @@ hello world | |
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn dependency_in_submodule_via_path_base() { | ||
// Using a submodule prevents the dependency from being discovered during the directory walk, | ||
// so Cargo will need to follow the path dependency to discover it. | ||
|
||
let git_project = git::new("dep1", |project| { | ||
project | ||
.file(".cargo/config.toml", "[path-bases]\nsubmodules = 'submods'") | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "dep1" | ||
version = "0.5.0" | ||
edition = "2015" | ||
authors = ["[email protected]"] | ||
[dependencies.dep2] | ||
version = "0.5.0" | ||
path = "dep2" | ||
base = "submodules" | ||
[lib] | ||
name = "dep1" | ||
"#, | ||
) | ||
.file( | ||
"src/dep1.rs", | ||
r#" | ||
extern crate dep2; | ||
pub fn hello() -> &'static str { | ||
dep2::hello() | ||
} | ||
"#, | ||
) | ||
}); | ||
|
||
let git_project2 = git::new("dep2", |project| { | ||
project | ||
.file("Cargo.toml", &basic_lib_manifest("dep2")) | ||
.file( | ||
"src/dep2.rs", | ||
r#" | ||
pub fn hello() -> &'static str { | ||
"hello world" | ||
} | ||
"#, | ||
) | ||
}); | ||
|
||
let repo = git2::Repository::open(&git_project.root()).unwrap(); | ||
let url = git_project2.root().to_url().to_string(); | ||
git::add_submodule(&repo, &url, Path::new("submods/dep2")); | ||
git::commit(&repo); | ||
|
||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
&format!( | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.5.0" | ||
edition = "2015" | ||
authors = ["[email protected]"] | ||
[dependencies.dep1] | ||
version = "0.5.0" | ||
git = '{}' | ||
[[bin]] | ||
name = "foo" | ||
"#, | ||
git_project.url() | ||
), | ||
) | ||
.file( | ||
"src/foo.rs", | ||
&main_file(r#""{}", dep1::hello()"#, &["dep1"]), | ||
) | ||
.build(); | ||
|
||
p.cargo("build").run(); | ||
|
||
assert!(p.bin("foo").is_file()); | ||
|
||
p.process(&p.bin("foo")) | ||
.with_stdout_data(str![[r#" | ||
hello world | ||
"#]]) | ||
.run(); | ||
} | ||
|
||
#[cargo_test] | ||
fn cargo_compile_with_malformed_nested_paths() { | ||
let git_project = git::new("dep1", |project| { | ||
|
Oops, something went wrong.