2014-06-18 00:40:22 +00:00
|
|
|
use support::{ResultTest,project,execs,main_file};
|
2014-06-18 00:05:29 +00:00
|
|
|
use hamcrest::{assert_that,existing_file};
|
|
|
|
use cargo;
|
2014-06-18 00:40:22 +00:00
|
|
|
use cargo::util::{process};
|
2014-06-18 00:05:29 +00:00
|
|
|
|
|
|
|
fn setup() {
|
|
|
|
}
|
|
|
|
|
|
|
|
test!(cargo_compile_with_nested_deps_shorthand {
|
2014-06-18 00:40:22 +00:00
|
|
|
let p = project("foo")
|
2014-06-18 00:05:29 +00:00
|
|
|
.file("Cargo.toml", r#"
|
|
|
|
[project]
|
|
|
|
|
|
|
|
name = "foo"
|
|
|
|
version = "0.5.0"
|
|
|
|
authors = ["wycats@example.com"]
|
|
|
|
|
|
|
|
[dependencies.bar]
|
|
|
|
|
|
|
|
version = "0.5.0"
|
|
|
|
path = "bar"
|
|
|
|
|
|
|
|
[[bin]]
|
|
|
|
|
|
|
|
name = "foo"
|
|
|
|
"#)
|
2014-06-19 23:45:19 +00:00
|
|
|
.file("src/foo.rs",
|
|
|
|
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
2014-06-18 00:05:29 +00:00
|
|
|
.file("bar/Cargo.toml", r#"
|
|
|
|
[project]
|
|
|
|
|
|
|
|
name = "bar"
|
|
|
|
version = "0.5.0"
|
|
|
|
authors = ["wycats@example.com"]
|
|
|
|
|
|
|
|
[dependencies.baz]
|
|
|
|
|
|
|
|
version = "0.5.0"
|
|
|
|
path = "baz"
|
|
|
|
|
|
|
|
[[lib]]
|
|
|
|
|
|
|
|
name = "bar"
|
|
|
|
"#)
|
|
|
|
.file("bar/src/bar.rs", r#"
|
|
|
|
extern crate baz;
|
|
|
|
|
|
|
|
pub fn gimme() -> String {
|
|
|
|
baz::gimme()
|
|
|
|
}
|
|
|
|
"#)
|
2014-06-18 00:40:22 +00:00
|
|
|
.file("bar/baz/Cargo.toml", r#"
|
2014-06-18 00:05:29 +00:00
|
|
|
[project]
|
|
|
|
|
|
|
|
name = "baz"
|
|
|
|
version = "0.5.0"
|
|
|
|
authors = ["wycats@example.com"]
|
|
|
|
|
|
|
|
[[lib]]
|
|
|
|
|
|
|
|
name = "baz"
|
|
|
|
"#)
|
2014-06-18 00:40:22 +00:00
|
|
|
.file("bar/baz/src/baz.rs", r#"
|
2014-06-18 00:05:29 +00:00
|
|
|
pub fn gimme() -> String {
|
|
|
|
"test passed".to_str()
|
|
|
|
}
|
|
|
|
"#);
|
|
|
|
|
|
|
|
p.cargo_process("cargo-compile")
|
|
|
|
.exec_with_output()
|
|
|
|
.assert();
|
|
|
|
|
|
|
|
assert_that(&p.root().join("target/foo"), existing_file());
|
|
|
|
|
|
|
|
assert_that(
|
|
|
|
cargo::util::process("foo").extra_path(p.root().join("target")),
|
|
|
|
execs().with_stdout("test passed\n"));
|
|
|
|
})
|