mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #14171 - heisen-li:dir_doc, r=weihanglo
test:migrate `doc/directory/docscrape` to snapbox ### What does this PR try to resolve? Complete the following file migration: ``` tests/testsuite/directory.rs tests/testsuite/doc.rs tests/testsuite/docscrape.rs ``` part of #14039
This commit is contained in:
commit
a0b280398c
@ -279,6 +279,7 @@ static E2E_LITERAL_REDACTIONS: &[(&str, &str)] = &[
|
|||||||
("[PUBLISHED]", " Published"),
|
("[PUBLISHED]", " Published"),
|
||||||
("[BLOCKING]", " Blocking"),
|
("[BLOCKING]", " Blocking"),
|
||||||
("[GENERATED]", " Generated"),
|
("[GENERATED]", " Generated"),
|
||||||
|
("[OPENING]", " Opening"),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Normalizes the output so that it can be compared against the expected value.
|
/// Normalizes the output so that it can be compared against the expected value.
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
//! Tests for directory sources.
|
//! Tests for directory sources.
|
||||||
|
|
||||||
#![allow(deprecated)]
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::str;
|
use std::str;
|
||||||
@ -12,6 +10,7 @@ use cargo_test_support::cargo_process;
|
|||||||
use cargo_test_support::git;
|
use cargo_test_support::git;
|
||||||
use cargo_test_support::paths;
|
use cargo_test_support::paths;
|
||||||
use cargo_test_support::registry::{cksum, Package};
|
use cargo_test_support::registry::{cksum, Package};
|
||||||
|
use cargo_test_support::str;
|
||||||
use cargo_test_support::{basic_manifest, project, t, ProjectBuilder};
|
use cargo_test_support::{basic_manifest, project, t, ProjectBuilder};
|
||||||
|
|
||||||
fn setup() {
|
fn setup() {
|
||||||
@ -107,14 +106,13 @@ fn simple() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[CHECKING] bar v0.1.0
|
[CHECKING] bar v0.1.0
|
||||||
[CHECKING] foo v0.1.0 ([CWD])
|
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,18 +145,17 @@ fn simple_install() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
cargo_process("install bar")
|
cargo_process("install bar")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[INSTALLING] bar v0.1.0
|
[INSTALLING] bar v0.1.0
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[COMPILING] foo v0.0.1
|
[COMPILING] foo v0.0.1
|
||||||
[COMPILING] bar v0.1.0
|
[COMPILING] bar v0.1.0
|
||||||
[FINISHED] `release` profile [optimized] target(s) in [..]s
|
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||||
[INSTALLING] [..]bar[..]
|
[INSTALLING] [..]bar[..]
|
||||||
[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`)
|
[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`)
|
||||||
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
|
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,11 +190,10 @@ fn simple_install_fail() {
|
|||||||
|
|
||||||
cargo_process("install bar")
|
cargo_process("install bar")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
" Installing bar v0.1.0
|
[INSTALLING] bar v0.1.0
|
||||||
error: failed to compile `bar v0.1.0`, intermediate artifacts can be found at `[..]`.
|
[ERROR] failed to compile `bar v0.1.0`, intermediate artifacts can be found at `[..]`.
|
||||||
To reuse those artifacts with a future compilation, set the environment variable \
|
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
|
||||||
`CARGO_TARGET_DIR` to that path.
|
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
no matching package found
|
no matching package found
|
||||||
@ -205,8 +201,8 @@ Caused by:
|
|||||||
perhaps you meant: bar or foo
|
perhaps you meant: bar or foo
|
||||||
location searched: registry `crates-io`
|
location searched: registry `crates-io`
|
||||||
required by package `bar v0.1.0`
|
required by package `bar v0.1.0`
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,18 +239,17 @@ fn install_without_feature_dep() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
cargo_process("install bar")
|
cargo_process("install bar")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[INSTALLING] bar v0.1.0
|
[INSTALLING] bar v0.1.0
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[COMPILING] foo v0.0.1
|
[COMPILING] foo v0.0.1
|
||||||
[COMPILING] bar v0.1.0
|
[COMPILING] bar v0.1.0
|
||||||
[FINISHED] `release` profile [optimized] target(s) in [..]s
|
[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
|
||||||
[INSTALLING] [..]bar[..]
|
[INSTALLING] [..]bar[..]
|
||||||
[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`)
|
[INSTALLED] package `bar v0.1.0` (executable `bar[EXE]`)
|
||||||
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
|
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,13 +281,12 @@ fn not_there() {
|
|||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[ERROR] no matching package named `bar` found
|
||||||
error: no matching package named `bar` found
|
location searched: registry `crates-io`
|
||||||
location searched: [..]
|
required by package `foo v0.1.0 ([ROOT]/foo)`
|
||||||
required by package `foo v0.1.0 ([..])`
|
|
||||||
",
|
"#]])
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,15 +327,14 @@ fn multiple() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[ADDING] bar v0.1.0 (latest: v0.2.0)
|
[ADDING] bar v0.1.0 (latest: v0.2.0)
|
||||||
[CHECKING] bar v0.1.0
|
[CHECKING] bar v0.1.0
|
||||||
[CHECKING] foo v0.1.0 ([CWD])
|
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,17 +365,16 @@ fn crates_io_then_directory() {
|
|||||||
.publish();
|
.publish();
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[UPDATING] `dummy-registry` index
|
||||||
[UPDATING] `[..]` index
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[DOWNLOADING] crates ...
|
[DOWNLOADING] crates ...
|
||||||
[DOWNLOADED] bar v0.1.0 ([..])
|
[DOWNLOADED] bar v0.1.0 (registry `dummy-registry`)
|
||||||
[CHECKING] bar v0.1.0
|
[CHECKING] bar v0.1.0
|
||||||
[CHECKING] foo v0.1.0 ([CWD])
|
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
@ -394,13 +386,12 @@ fn crates_io_then_directory() {
|
|||||||
v.build();
|
v.build();
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[CHECKING] bar v0.1.0
|
[CHECKING] bar v0.1.0
|
||||||
[CHECKING] foo v0.1.0 ([CWD])
|
[CHECKING] foo v0.1.0 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,9 +426,8 @@ fn crates_io_then_bad_checksum() {
|
|||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[ERROR] checksum for `bar v0.1.0` changed between lock files
|
||||||
error: checksum for `bar v0.1.0` changed between lock files
|
|
||||||
|
|
||||||
this could be indicative of a few possible errors:
|
this could be indicative of a few possible errors:
|
||||||
|
|
||||||
@ -447,8 +437,8 @@ this could be indicative of a few possible errors:
|
|||||||
|
|
||||||
unable to verify that `bar v0.1.0` is the same as when the lockfile was generated
|
unable to verify that `bar v0.1.0` is the same as when the lockfile was generated
|
||||||
|
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,18 +475,15 @@ fn bad_file_checksum() {
|
|||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
error: the listed checksum of `[..]lib.rs` has changed:
|
[ERROR] the listed checksum of `[ROOT]/index/bar/src/lib.rs` has changed:
|
||||||
expected: [..]
|
expected: [..]
|
||||||
actual: [..]
|
actual: [..]
|
||||||
|
|
||||||
directory sources are not intended to be edited, if modifications are \
|
directory sources are not intended to be edited, if modifications are required then it is recommended that `[patch]` is used with a forked copy of the source
|
||||||
required then it is recommended that `[patch]` is used with a forked copy of \
|
|
||||||
the source
|
"#]])
|
||||||
",
|
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -622,13 +609,12 @@ fn git_lock_file_doesnt_change() {
|
|||||||
));
|
));
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[CHECKING] git v0.5.0 ([..])
|
||||||
[CHECKING] [..]
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[CHECKING] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[FINISHED] [..]
|
|
||||||
",
|
"#]])
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
let lock2 = p.read_lockfile();
|
let lock2 = p.read_lockfile();
|
||||||
@ -676,9 +662,8 @@ fn git_override_requires_lockfile() {
|
|||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[ERROR] failed to get `git` as a dependency of package `foo v0.0.1 ([ROOT]/foo)`
|
||||||
[ERROR] failed to get `git` as a dependency of package `foo v0.0.1 ([..])`
|
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
failed to load source for dependency `git`
|
failed to load source for dependency `git`
|
||||||
@ -692,8 +677,8 @@ Caused by:
|
|||||||
|
|
||||||
remove the source replacement configuration, generate a lock file, and then
|
remove the source replacement configuration, generate a lock file, and then
|
||||||
restore the source replacement configuration to continue the build
|
restore the source replacement configuration to continue the build
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -748,13 +733,12 @@ fn workspace_different_locations() {
|
|||||||
p.cargo("check").cwd("foo").run();
|
p.cargo("check").cwd("foo").run();
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.cwd("bar")
|
.cwd("bar")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[CHECKING] bar [..]
|
[CHECKING] bar v0.1.0 ([ROOT]/foo/bar)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,21 +768,19 @@ fn version_missing() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
cargo_process("install bar")
|
cargo_process("install bar")
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[INSTALLING] bar v0.1.0
|
[INSTALLING] bar v0.1.0
|
||||||
error: failed to compile [..], intermediate artifacts can be found at `[..]`.
|
[ERROR] failed to compile [..], intermediate artifacts can be found at `[..]`.
|
||||||
To reuse those artifacts with a future compilation, set the environment variable \
|
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
|
||||||
`CARGO_TARGET_DIR` to that path.
|
|
||||||
|
|
||||||
Caused by:
|
Caused by:
|
||||||
failed to select a version for the requirement `foo = \"^2\"`
|
failed to select a version for the requirement `foo = "^2"`
|
||||||
candidate versions found which didn't match: 0.0.1
|
candidate versions found which didn't match: 0.0.1
|
||||||
location searched: directory source `[..] (which is replacing registry `[..]`)
|
location searched: directory source `[..] (which is replacing registry `[..]`)
|
||||||
required by package `bar v0.1.0`
|
required by package `bar v0.1.0`
|
||||||
perhaps a crate was updated and forgotten to be re-vendored?
|
perhaps a crate was updated and forgotten to be re-vendored?
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
//! Tests for the `cargo doc` command with `-Zrustdoc-scrape-examples`.
|
//! Tests for the `cargo doc` command with `-Zrustdoc-scrape-examples`.
|
||||||
|
|
||||||
#![allow(deprecated)]
|
use cargo_test_support::prelude::*;
|
||||||
|
|
||||||
use cargo_test_support::project;
|
use cargo_test_support::project;
|
||||||
|
use cargo_test_support::str;
|
||||||
|
|
||||||
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
|
#[cargo_test(nightly, reason = "rustdoc scrape examples flags are unstable")]
|
||||||
fn basic() {
|
fn basic() {
|
||||||
@ -23,24 +23,23 @@ fn basic() {
|
|||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
|
||||||
",
|
"#]])
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
let doc_html = p.read_file("target/doc/foo/fn.foo.html");
|
let doc_html = p.read_file("target/doc/foo/fn.foo.html");
|
||||||
@ -115,15 +114,18 @@ impl Foo {
|
|||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples --no-deps")
|
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples --no-deps")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr_unordered(
|
.with_stderr_data(
|
||||||
"\
|
str![[r#"
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[CHECKING] a v0.0.1 ([CWD]/crates/a)
|
[CHECKING] a v0.0.1 ([ROOT]/foo/crates/a)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html",
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
|
|
||||||
|
"#]]
|
||||||
|
.unordered(),
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
@ -402,25 +404,23 @@ fn cache() {
|
|||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
|
||||||
",
|
"#]])
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Zrustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
|
||||||
",
|
"#]])
|
||||||
)
|
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,27 +444,26 @@ fn no_fail_bad_lib() {
|
|||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr_unordered(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[WARNING] failed to check lib in package `foo` as a prerequisite for scraping examples from: example "ex", example "ex2"
|
||||||
warning: failed to check lib in package `foo` as a prerequisite for scraping examples from: example \"ex\", example \"ex2\"
|
|
||||||
Try running with `--verbose` to see the error message.
|
Try running with `--verbose` to see the error message.
|
||||||
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
||||||
warning: `foo` (lib) generated 1 warning
|
[WARNING] `foo` (lib) generated 1 warning
|
||||||
warning: failed to scan example \"ex\" in package `foo` for example code usage
|
[WARNING] failed to scan example "ex" in package `foo` for example code usage
|
||||||
Try running with `--verbose` to see the error message.
|
Try running with `--verbose` to see the error message.
|
||||||
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
||||||
warning: `foo` (example \"ex\") generated 1 warning
|
[WARNING] `foo` (example "ex") generated 1 warning
|
||||||
warning: failed to scan example \"ex2\" in package `foo` for example code usage
|
[WARNING] failed to scan example "ex2" in package `foo` for example code usage
|
||||||
Try running with `--verbose` to see the error message.
|
Try running with `--verbose` to see the error message.
|
||||||
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
||||||
warning: `foo` (example \"ex2\") generated 1 warning
|
[WARNING] `foo` (example "ex2") generated 1 warning
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
)
|
"#]].unordered())
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,14 +488,22 @@ fn fail_bad_build_script() {
|
|||||||
// `cargo doc` fails
|
// `cargo doc` fails
|
||||||
p.cargo("doc")
|
p.cargo("doc")
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains("[..]You shall not pass[..]")
|
.with_stderr_data(str![[r#"
|
||||||
|
...
|
||||||
|
[..]You shall not pass[..]
|
||||||
|
...
|
||||||
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
// scrape examples should fail whenever `cargo doc` fails.
|
// scrape examples should fail whenever `cargo doc` fails.
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains("[..]You shall not pass[..]")
|
.with_stderr_data(str![[r#"
|
||||||
|
...
|
||||||
|
[..]You shall not pass[..]
|
||||||
|
...
|
||||||
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,43 +527,44 @@ fn no_fail_bad_example() {
|
|||||||
|
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[WARNING] failed to scan example "ex1" in package `foo` for example code usage
|
||||||
warning: failed to scan example \"ex1\" in package `foo` for example code usage
|
|
||||||
Try running with `--verbose` to see the error message.
|
Try running with `--verbose` to see the error message.
|
||||||
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
If an example should not be scanned, then consider adding `doc-scrape-examples = false` to its `[[example]]` definition in Cargo.toml
|
||||||
warning: `foo` (example \"ex1\") generated 1 warning
|
[WARNING] `foo` (example "ex1") generated 1 warning
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
p.cargo("clean").run();
|
p.cargo("clean").run();
|
||||||
|
|
||||||
p.cargo("doc -v -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -v -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr_unordered(
|
.with_stderr_data(
|
||||||
"\
|
str![[r#"
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[RUNNING] `rustc --crate-name foo[..]
|
[RUNNING] `rustc --crate-name foo[..]
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[RUNNING] `rustdoc[..] --crate-name ex1[..]
|
[RUNNING] `rustdoc[..] --crate-name ex1[..]
|
||||||
[RUNNING] `rustdoc[..] --crate-name ex2[..]
|
[RUNNING] `rustdoc[..] --crate-name ex2[..]
|
||||||
[RUNNING] `rustdoc[..] --crate-name foo[..]
|
[RUNNING] `rustdoc[..] --crate-name foo[..]
|
||||||
error: expected one of `!` or `::`, found `NOT`
|
[ERROR] expected one of `!` or `::`, found `NOT`
|
||||||
--> examples/ex1.rs:1:6
|
--> examples/ex1.rs:1:6
|
||||||
|
|
|
|
||||||
1 | DOES NOT COMPILE
|
1 | DOES NOT COMPILE
|
||||||
| ^^^ expected one of `!` or `::`
|
| ^^^ expected one of `!` or `::`
|
||||||
|
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
|
"#]]
|
||||||
|
.unordered(),
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
@ -603,32 +611,33 @@ fn no_scrape_with_dev_deps() {
|
|||||||
// should be raised.
|
// should be raised.
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr(
|
.with_stderr_data(str![[r#"
|
||||||
"\
|
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
warning: Rustdoc did not scrape the following examples because they require dev-dependencies: ex
|
[WARNING] Rustdoc did not scrape the following examples because they require dev-dependencies: ex
|
||||||
If you want Rustdoc to scrape these examples, then add `doc-scrape-examples = true`
|
If you want Rustdoc to scrape these examples, then add `doc-scrape-examples = true`
|
||||||
to the [[example]] target configuration of at least one example.
|
to the [[example]] target configuration of at least one example.
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
)
|
"#]])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
// If --examples is provided, then the example is scanned.
|
// If --examples is provided, then the example is scanned.
|
||||||
p.cargo("doc --examples -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc --examples -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr_unordered(
|
.with_stderr_data(
|
||||||
"\
|
str![[r#"
|
||||||
[CHECKING] a v0.0.1 ([CWD]/a)
|
[CHECKING] a v0.0.1 ([ROOT]/foo/a)
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] a v0.0.1 ([CWD]/a)
|
[DOCUMENTING] a v0.0.1 ([ROOT]/foo/a)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
|
||||||
[GENERATED] [CWD]/target/doc/ex/index.html
|
[GENERATED] [ROOT]/foo/target/doc/ex/index.html
|
||||||
",
|
|
||||||
|
"#]]
|
||||||
|
.unordered(),
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
@ -671,16 +680,18 @@ fn use_dev_deps_if_explicitly_enabled() {
|
|||||||
// If --examples is not provided, then the example is never scanned.
|
// If --examples is not provided, then the example is never scanned.
|
||||||
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
p.cargo("doc -Zunstable-options -Z rustdoc-scrape-examples")
|
||||||
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
.masquerade_as_nightly_cargo(&["rustdoc-scrape-examples"])
|
||||||
.with_stderr_unordered(
|
.with_stderr_data(
|
||||||
"\
|
str![[r#"
|
||||||
[LOCKING] 2 packages to latest compatible versions
|
[LOCKING] 2 packages to latest compatible versions
|
||||||
[CHECKING] foo v0.0.1 ([CWD])
|
[CHECKING] a v0.0.1 ([ROOT]/foo/a)
|
||||||
[CHECKING] a v0.0.1 ([CWD]/a)
|
[CHECKING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[SCRAPING] foo v0.0.1 ([CWD])
|
[SCRAPING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[DOCUMENTING] foo v0.0.1 ([CWD])
|
[DOCUMENTING] foo v0.0.1 ([ROOT]/foo)
|
||||||
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
|
||||||
[GENERATED] [CWD]/target/doc/foo/index.html
|
[GENERATED] [ROOT]/foo/target/doc/foo/index.html
|
||||||
",
|
|
||||||
|
"#]]
|
||||||
|
.unordered(),
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user