use support::{ResultTest,project,execs,main_file}; use hamcrest::{assert_that,existing_file}; use cargo; use cargo::util::{process}; fn setup() { } test!(cargo_compile_with_nested_deps_shorthand { let p = project("foo") .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" "#) .file("src/foo.rs", main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice()) .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() } "#) .file("bar/baz/Cargo.toml", r#" [project] name = "baz" version = "0.5.0" authors = ["wycats@example.com"] [[lib]] name = "baz" "#) .file("bar/baz/src/baz.rs", r#" 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")); })