mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Tighten up some tests
This commit is contained in:
parent
d29910068c
commit
16df1ab41e
@ -97,32 +97,28 @@ test!(cargo_compile_with_root_dev_deps {
|
||||
[dev-dependencies.bar]
|
||||
|
||||
version = "0.5.0"
|
||||
path = "bar"
|
||||
path = "../bar"
|
||||
|
||||
[[bin]]
|
||||
|
||||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
|
||||
let p2 = project("bar")
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
|
||||
name = "bar"
|
||||
version = "0.5.0"
|
||||
authors = ["wycats@example.com"]
|
||||
|
||||
[[lib]]
|
||||
|
||||
name = "bar"
|
||||
"#)
|
||||
.file("bar/src/bar.rs", r#"
|
||||
.file("src/lib.rs", r#"
|
||||
pub fn gimme() -> &'static str {
|
||||
"zoidberg"
|
||||
}
|
||||
"#)
|
||||
;
|
||||
"#);
|
||||
|
||||
p2.build();
|
||||
assert_that(p.cargo_process("cargo-build"),
|
||||
execs().with_stdout(format!("{} bar v0.5.0 (file:{})\n\
|
||||
{} foo v0.5.0 (file:{})\n",
|
||||
|
@ -47,13 +47,36 @@ test!(test_with_lib_dep {
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
"#)
|
||||
.file("src/lib.rs", "pub fn foo(){}")
|
||||
.file("src/lib.rs", "
|
||||
pub fn foo(){}
|
||||
#[test] fn lib_test() {}
|
||||
")
|
||||
.file("src/main.rs", "
|
||||
extern crate foo;
|
||||
|
||||
fn main() {}
|
||||
|
||||
#[test]
|
||||
fn bin_test() {}
|
||||
");
|
||||
|
||||
assert_that(p.cargo_process("cargo-test"), execs().with_status(0));
|
||||
assert_that(p.cargo_process("cargo-test"),
|
||||
execs().with_status(0)
|
||||
.with_stdout(format!("\
|
||||
{compiling} foo v0.0.1 (file:{dir})
|
||||
|
||||
running 1 test
|
||||
test bin_test ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
|
||||
|
||||
|
||||
running 1 test
|
||||
test lib_test ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
|
||||
|
||||
", compiling = COMPILING, dir = p.root().display()).as_slice()));
|
||||
})
|
||||
|
||||
test!(test_with_deep_lib_dep {
|
||||
|
Loading…
x
Reference in New Issue
Block a user