Skip to content

Commit 11507dd

Browse files
committed
Auto merge of #1460 - apasel422:1459, r=alexcrichton
closes #1459
2 parents 7ffc0c5 + a18b2e5 commit 11507dd

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/cargo/ops/cargo_test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ pub fn run_tests(manifest_path: &Path,
2424

2525
let libs = compile.package.targets().iter()
2626
.filter(|t| t.doctested())
27-
.map(|t| (t.src_path(), t.name()));
27+
.map(|t| (t.src_path(), t.name(), t.crate_name()));
2828

29-
for (lib, name) in libs {
29+
for (lib, name, crate_name) in libs {
3030
try!(config.shell().status("Doc-tests", name));
3131
let mut p = try!(compile.rustdoc_process(&compile.package));
3232
p.arg("--test").arg(lib)
33-
.arg("--crate-name").arg(name)
33+
.arg("--crate-name").arg(&crate_name)
3434
.arg("-L").arg(&compile.root_output)
3535
.arg("-L").arg(&compile.deps_output)
3636
.cwd(compile.package.root());

tests/test_cargo_test.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,3 +1400,22 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
14001400
14011401
", compiling = COMPILING, running = RUNNING, doctest = DOCTEST)))
14021402
});
1403+
1404+
test!(dashes_to_underscores {
1405+
let p = project("foo")
1406+
.file("Cargo.toml", r#"
1407+
[package]
1408+
name = "foo-bar"
1409+
version = "0.0.1"
1410+
authors = []
1411+
"#)
1412+
.file("src/lib.rs", r#"
1413+
/// ```
1414+
/// assert_eq!(foo_bar::foo(), 1);
1415+
/// ```
1416+
pub fn foo() -> i32 { 1 }
1417+
"#);
1418+
1419+
assert_that(p.cargo_process("test"),
1420+
execs().with_status(0));
1421+
});

0 commit comments

Comments
 (0)