cargo/tests/test_cargo_compile_path_deps.rs

79 lines
1.7 KiB
Rust
Raw Normal View History

use support::{ResultTest,project,execs,main_file};
2014-06-18 00:05:29 +00:00
use hamcrest::{assert_that,existing_file};
use cargo;
use cargo::util::{process};
2014-06-18 00:05:29 +00:00
fn setup() {
}
test!(cargo_compile_with_nested_deps_shorthand {
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"
"#)
.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()
}
"#)
.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"
"#)
.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"));
})