From 3d63b12f7c73e3249496d2db1d5113a9c9c2fb7a Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Tue, 29 May 2018 11:55:29 +0200 Subject: [PATCH] Added test where the name of the library is different from the package's. --- tests/testsuite/doc.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index cba714de6..a7483212c 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1480,6 +1480,39 @@ fn doc_workspace_open_help_message() { ); } +#[test] +fn doc_workspace_open_different_library_and_package_names() { + let p = project("foo") + .file( + "Cargo.toml", + r#" + [workspace] + members = ["foo"] + "#, + ) + .file( + "foo/Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + [lib] + name = "foolib" + "#, + ) + .file("foo/src/lib.rs", "") + .build(); + + // The order in which bar is compiled or documented is not deterministic + assert_that( + p.cargo("doc").arg("--open").env("BROWSER", "echo"), + execs() + .with_status(0) + .with_stderr_contains("[..] Documenting foo v0.1.0 ([..])") + .with_stderr_contains("[..] Opening [..]/foo/target/doc/foolib/index.html") + ); +} + #[test] fn doc_edition() { if !cargotest::is_nightly() { -- 2.30.2