pass translated crate name to doc tests

closes #1459
This commit is contained in:
Andrew Paseltiner 2015-03-26 15:07:11 -04:00
parent 9f265c885e
commit a18b2e5078
2 changed files with 22 additions and 3 deletions

View file

@ -24,13 +24,13 @@ pub fn run_tests(manifest_path: &Path,
let libs = compile.package.targets().iter()
.filter(|t| t.doctested())
.map(|t| (t.src_path(), t.name()));
.map(|t| (t.src_path(), t.name(), t.crate_name()));
for (lib, name) in libs {
for (lib, name, crate_name) in libs {
try!(config.shell().status("Doc-tests", name));
let mut p = try!(compile.rustdoc_process(&compile.package));
p.arg("--test").arg(lib)
.arg("--crate-name").arg(name)
.arg("--crate-name").arg(&crate_name)
.arg("-L").arg(&compile.root_output)
.arg("-L").arg(&compile.deps_output)
.cwd(compile.package.root());

View file

@ -1400,3 +1400,22 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)))
});
test!(dashes_to_underscores {
let p = project("foo")
.file("Cargo.toml", r#"
[package]
name = "foo-bar"
version = "0.0.1"
authors = []
"#)
.file("src/lib.rs", r#"
/// ```
/// assert_eq!(foo_bar::foo(), 1);
/// ```
pub fn foo() -> i32 { 1 }
"#);
assert_that(p.cargo_process("test"),
execs().with_status(0));
});