Add regression test for running `cargo test` twice

This commit is contained in:
Brian Koropoff 2014-07-20 17:02:09 -07:00
parent 876586a44d
commit 895f541192
2 changed files with 36 additions and 2 deletions

View File

@ -413,6 +413,20 @@ pub fn basic_bin_manifest(name: &str) -> String {
"#, name, name)
}
pub fn basic_lib_manifest(name: &str) -> String {
format!(r#"
[package]
name = "{}"
version = "0.5.0"
authors = ["wycats@example.com"]
[[lib]]
name = "{}"
"#, name, name)
}
pub static RUNNING: &'static str = " Running";
pub static COMPILING: &'static str = " Compiling";
pub static FRESH: &'static str = " Fresh";

View File

@ -1,7 +1,7 @@
use std::str;
use support::{project, execs, basic_bin_manifest, COMPILING, cargo_dir};
use support::{ResultTest};
use support::{project, execs, basic_bin_manifest, basic_lib_manifest};
use support::{COMPILING, cargo_dir, ResultTest};
use hamcrest::{assert_that, existing_file};
use cargo::util::process;
@ -284,3 +284,23 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\
compiling = COMPILING,
dir = p.root().display()).as_slice()));
})
// Regression test for running cargo-test twice with
// tests in an rlib
test!(cargo_test_twice {
let p = project("test_twice")
.file("Cargo.toml", basic_lib_manifest("test_twice").as_slice())
.file("src/test_twice.rs", r#"
#![crate_type = "rlib"]
#[test]
fn dummy_test() { }
"#);
p.cargo_process("cargo-build");
for _ in range(0u, 2) {
assert_that(p.process(cargo_dir().join("cargo-test")),
execs().with_status(0));
}
})