Added test where the name of the library is different from the package's.
authorEsteve Fernandez <esteve@apache.org>
Tue, 29 May 2018 09:55:29 +0000 (11:55 +0200)
committerEsteve Fernandez <esteve@apache.org>
Tue, 29 May 2018 09:55:29 +0000 (11:55 +0200)
tests/testsuite/doc.rs

index cba714de6e71281f1a7bf6eeaf7daa3022d00078..a7483212c69d57a3cae4f5f06c46946245881974 100644 (file)
@@ -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() {