]> git.proxmox.com Git - cargo.git/commitdiff
Add tests
authorAaron Hill <aa1ronham@gmail.com>
Thu, 12 Sep 2019 17:38:10 +0000 (13:38 -0400)
committerAaron Hill <aa1ronham@gmail.com>
Thu, 12 Sep 2019 17:38:10 +0000 (13:38 -0400)
tests/testsuite/build_script.rs
tests/testsuite/profile_targets.rs
tests/testsuite/rename_deps.rs
tests/testsuite/rustdoc.rs
tests/testsuite/test.rs

index 04db56f90541aebb0d144d494a1b7427911cb7d1..c4f39f3ff7af348435caa1a6cd66f7d1639d87d9 100644 (file)
@@ -813,7 +813,7 @@ fn testing_and_such() {
 [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
 [RUNNING] `[..]/foo-[..][EXE]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]`",
+[RUNNING] `rustdoc [..]--test [..]`",
         )
         .with_stdout_contains_n("running 0 tests", 2)
         .run();
@@ -2747,7 +2747,7 @@ fn doctest_receives_build_link_args() {
 
     p.cargo("test -v")
         .with_stderr_contains(
-            "[RUNNING] `rustdoc --test [..] --crate-name foo [..]-L native=bar[..]`",
+            "[RUNNING] `rustdoc [..]--test [..] --crate-name foo [..]-L native=bar[..]`",
         )
         .run();
 }
index 7a85f481401b4d0070448cc04096f4efce8db574..718ec2fb21158da90ba2a3fdfdfb2264a40bfccf 100644 (file)
@@ -306,7 +306,7 @@ fn profile_selection_test() {
 [RUNNING] `[..]/deps/foo-[..]`
 [RUNNING] `[..]/deps/test1-[..]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]
+[RUNNING] `rustdoc [..]--test [..]
 ").run();
     p.cargo("test -vv")
         .with_stderr_unordered(
@@ -319,7 +319,7 @@ fn profile_selection_test() {
 [RUNNING] `[..]/deps/foo-[..]`
 [RUNNING] `[..]/deps/test1-[..]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]
+[RUNNING] `rustdoc [..]--test [..]
 ",
         )
         .run();
@@ -371,7 +371,7 @@ fn profile_selection_test_release() {
 [RUNNING] `[..]/deps/foo-[..]`
 [RUNNING] `[..]/deps/test1-[..]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]`
+[RUNNING] `rustdoc [..]--test [..]`
 ").run();
     p.cargo("test --release -vv")
         .with_stderr_unordered(
@@ -384,7 +384,7 @@ fn profile_selection_test_release() {
 [RUNNING] `[..]/deps/foo-[..]`
 [RUNNING] `[..]/deps/test1-[..]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]
+[RUNNING] `rustdoc [..]--test [..]
 ",
         )
         .run();
@@ -633,7 +633,7 @@ fn profile_selection_doc() {
 [COMPILING] bar [..]
 [DOCUMENTING] bar [..]
 [RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..]
-[RUNNING] `rustdoc --crate-name bar bar/src/lib.rs [..]
+[RUNNING] `rustdoc [..]--crate-name bar bar/src/lib.rs [..]
 [RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]
 [COMPILING] bdep [..]
 [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link -C codegen-units=1 -C debuginfo=2 [..]
@@ -642,7 +642,7 @@ fn profile_selection_doc() {
 [RUNNING] `[..]target/debug/build/foo-[..]/build-script-build`
 [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0
 [DOCUMENTING] foo [..]
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]
 [FINISHED] dev [unoptimized + debuginfo] [..]
 ").run();
 }
index fc4858163f229058d6ec986c3753d3e9122fcde8..e94ac67eec79c8a3eb450b6d227edec6ae41e789 100644 (file)
@@ -263,7 +263,7 @@ fn can_run_doc_tests() {
         .with_stderr_contains(
             "\
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [CWD]/src/lib.rs \
+[RUNNING] `rustdoc [..]--test [CWD]/src/lib.rs \
         [..] \
         --extern bar=[CWD]/target/debug/deps/libbar-[..].rlib \
         --extern baz=[CWD]/target/debug/deps/libbar-[..].rlib \
index 195b47c0342c6e65ca92a04d56e7a9062b8848b0..50e613eeb0b387ad8466cb59e07c3e843cacb3f6 100644 (file)
@@ -1,4 +1,4 @@
-use crate::support::{basic_manifest, project};
+use crate::support::{basic_manifest, is_nightly, project};
 
 #[cargo_test]
 fn rustdoc_simple() {
@@ -8,7 +8,7 @@ fn rustdoc_simple() {
         .with_stderr(
             "\
 [DOCUMENTING] foo v0.0.1 ([CWD])
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
         -o [CWD]/target/doc \
         [..] \
         -L dependency=[CWD]/target/debug/deps`
@@ -26,7 +26,7 @@ fn rustdoc_args() {
         .with_stderr(
             "\
 [DOCUMENTING] foo v0.0.1 ([CWD])
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
         -o [CWD]/target/doc \
         [..] \
         --cfg=foo \
@@ -66,7 +66,7 @@ fn rustdoc_foo_with_bar_dependency() {
 [CHECKING] bar v0.0.1 ([..])
 [RUNNING] `rustc [..]bar/src/lib.rs [..]`
 [DOCUMENTING] foo v0.0.1 ([CWD])
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
         -o [CWD]/target/doc \
         [..] \
         --cfg=foo \
@@ -105,7 +105,7 @@ fn rustdoc_only_bar_dependency() {
         .with_stderr(
             "\
 [DOCUMENTING] bar v0.0.1 ([..])
-[RUNNING] `rustdoc --crate-name bar [..]bar/src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name bar [..]bar/src/lib.rs [..]\
         -o [CWD]/target/doc \
         [..] \
         --cfg=foo \
@@ -127,7 +127,7 @@ fn rustdoc_same_name_documents_lib() {
         .with_stderr(
             "\
 [DOCUMENTING] foo v0.0.1 ([..])
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
         -o [CWD]/target/doc \
         [..] \
         --cfg=foo \
@@ -161,6 +161,39 @@ fn features() {
         .run();
 }
 
+#[cargo_test]
+fn proc_macro_crate_type() {
+    // NOTE - Remove this once 'rustdoc --crate-type'
+    // rides to stable
+    if !is_nightly() {
+        return;
+    }
+    let p = project()
+        .file(
+            "Cargo.toml",
+            r#"
+            [package]
+            name = "foo"
+            version = "0.0.1"
+            authors = []
+
+            [lib]
+            proc-macro = true
+
+        "#,
+        )
+        .file("src/lib.rs", "")
+        .build();
+
+    p.cargo("rustdoc --verbose")
+        .with_stderr_contains(
+            "\
+[RUNNING] `rustdoc --crate-type proc-macro [..]`
+",
+        )
+        .run();
+}
+
 #[cargo_test]
 #[cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))]
 fn rustdoc_target() {
@@ -170,7 +203,7 @@ fn rustdoc_target() {
         .with_stderr(
             "\
 [DOCUMENTING] foo v0.0.1 ([..])
-[RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\
+[RUNNING] `rustdoc [..]--crate-name foo src/lib.rs [..]\
     --target x86_64-unknown-linux-gnu \
     -o [CWD]/target/x86_64-unknown-linux-gnu/doc \
     [..] \
index d9e73f8b0a43f99870a0186158cc52a1d957228e..bfb6e0e11c5bc36d0800b984a83935fdc9e80664 100644 (file)
@@ -97,7 +97,7 @@ fn cargo_test_release() {
 [RUNNING] `[..]target/release/deps/foo-[..][EXE]`
 [RUNNING] `[..]target/release/deps/test-[..][EXE]`
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]lib.rs[..]`",
+[RUNNING] `rustdoc [..]--test [..]lib.rs[..]`",
         )
         .with_stdout_contains_n("test test ... ok", 2)
         .with_stdout_contains("running 0 tests")
@@ -2702,7 +2702,7 @@ fn pass_correct_cfgs_flags_to_rustdoc() {
         .with_stderr_contains(
             "\
 [DOCTEST] feature_a
-[RUNNING] `rustdoc --test [..]mock_serde_codegen[..]`",
+[RUNNING] `rustdoc [..]--test [..]mock_serde_codegen[..]`",
         )
         .run();
 
@@ -2710,7 +2710,7 @@ fn pass_correct_cfgs_flags_to_rustdoc() {
         .with_stderr_contains(
             "\
 [DOCTEST] foo
-[RUNNING] `rustdoc --test [..]feature_a[..]`",
+[RUNNING] `rustdoc [..]--test [..]feature_a[..]`",
         )
         .run();
 }