Skip to content

Commit 1fa8da2

Browse files
committed
Auto merge of #12288 - weihanglo:doc-tweak, r=ehuss
docs: some tweaks around `cargo test`
2 parents 2cf2c32 + 1320573 commit 1fa8da2

File tree

5 files changed

+19
-37
lines changed

5 files changed

+19
-37
lines changed

src/doc/man/cargo-test.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ on writing doc tests.
5959

6060
### Working directory of tests
6161

62-
The working directory of every test is set to the root directory of the package
63-
the test belongs to.
64-
Setting the working directory of tests to the package's root directory makes it
62+
The working directory when running each unit and integration test is set to the
63+
root directory of the package the test belongs to.
64+
Setting the working directory of tests to the package's root directory makes it
6565
possible for tests to reliably access the package's files using relative paths,
6666
regardless from where `cargo test` was executed from.
6767

6868
For documentation tests, the working directory when invoking `rustdoc` is set to
6969
the workspace root directory, and is also the directory `rustdoc` uses as the
7070
compilation directory of each documentation test.
7171
The working directory when running each documentation test is set to the root
72-
directory of the package the test belongs to, and is controlled via `rustdoc`s
72+
directory of the package the test belongs to, and is controlled via `rustdoc`'s
7373
`--test-run-directory` option.
7474

7575
## OPTIONS

src/doc/man/generated_txt/cargo-test.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ DESCRIPTION
5353
information on writing doc tests.
5454

5555
Working directory of tests
56-
The working directory of every test is set to the root directory of the
57-
package the test belongs to. Setting the working directory of tests to
58-
the package’s root directory makes it possible for tests to reliably
59-
access the package’s files using relative paths, regardless from where
60-
cargo test was executed from.
56+
The working directory when running each unit and integration test is set
57+
to the root directory of the package the test belongs to. Setting the
58+
working directory of tests to the package’s root directory makes it
59+
possible for tests to reliably access the package’s files using
60+
relative paths, regardless from where cargo test was executed from.
6161

6262
For documentation tests, the working directory when invoking rustdoc is
6363
set to the workspace root directory, and is also the directory rustdoc
6464
uses as the compilation directory of each documentation test. The
6565
working directory when running each documentation test is set to the
6666
root directory of the package the test belongs to, and is controlled via
67-
rustdocs --test-run-directory option.
67+
rustdoc’s --test-run-directory option.
6868

6969
OPTIONS
7070
Test Options

src/doc/src/commands/cargo-test.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ on writing doc tests.
5959

6060
### Working directory of tests
6161

62-
The working directory of every test is set to the root directory of the package
63-
the test belongs to.
64-
Setting the working directory of tests to the package's root directory makes it
62+
The working directory when running each unit and integration test is set to the
63+
root directory of the package the test belongs to.
64+
Setting the working directory of tests to the package's root directory makes it
6565
possible for tests to reliably access the package's files using relative paths,
6666
regardless from where `cargo test` was executed from.
6767

6868
For documentation tests, the working directory when invoking `rustdoc` is set to
6969
the workspace root directory, and is also the directory `rustdoc` uses as the
7070
compilation directory of each documentation test.
7171
The working directory when running each documentation test is set to the root
72-
directory of the package the test belongs to, and is controlled via `rustdoc`s
72+
directory of the package the test belongs to, and is controlled via `rustdoc`'s
7373
`--test-run-directory` option.
7474

7575
## OPTIONS

src/doc/src/reference/unstable.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,24 +1185,6 @@ cargo +nightly -Zunstable-options config get build.rustflags
11851185
If no config value is included, it will display all config values. See the
11861186
`--help` output for more options available.
11871187

1188-
### `doctest-in-workspace`
1189-
1190-
* Tracking Issue: [#9427](https://github.com/rust-lang/cargo/issues/9427)
1191-
1192-
The `-Z doctest-in-workspace` flag changes the behavior of the current working
1193-
directory used when running doctests. Historically, Cargo has run `rustdoc
1194-
--test` relative to the root of the package, with paths relative from that
1195-
root. However, this is inconsistent with how `rustc` and `rustdoc` are
1196-
normally run in a workspace, where they are run relative to the workspace
1197-
root. This inconsistency causes problems in various ways, such as when passing
1198-
RUSTDOCFLAGS with relative paths, or dealing with diagnostic output.
1199-
1200-
The `-Z doctest-in-workspace` flag causes cargo to switch to running `rustdoc`
1201-
from the root of the workspace. It also passes the `--test-run-directory` to
1202-
`rustdoc` so that when *running* the tests, they are run from the root of the
1203-
package. This preserves backwards compatibility and is consistent with how
1204-
normal unittests are run.
1205-
12061188
### rustc `--print`
12071189

12081190
* Tracking Issue: [#9357](https://github.com/rust-lang/cargo/issues/9357)
@@ -1799,4 +1781,4 @@ The [`cargo logout`] command has been stabilized in the 1.70 release.
17991781
The `-Z doctest-in-workspace` option for `cargo test` has been stabilized and
18001782
enabled by default in the 1.72 release. See the
18011783
[`cargo test` documentation](../commands/cargo-test.md#working-directory-of-tests)
1802-
for more information about the working directory for compiling and running tests.
1784+
for more information about the working directory for compiling and running tests.

src/etc/man/cargo-test.1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ and may change in the future; beware of depending on it.
5454
See the \fIrustdoc book\fR <https://doc.rust\-lang.org/rustdoc/> for more information
5555
on writing doc tests.
5656
.SS "Working directory of tests"
57-
The working directory of every test is set to the root directory of the package
58-
the test belongs to.
59-
Setting the working directory of tests to the package\[cq]s root directory makes it
57+
The working directory when running each unit and integration test is set to the
58+
root directory of the package the test belongs to.
59+
Setting the working directory of tests to the package\[cq]s root directory makes it
6060
possible for tests to reliably access the package\[cq]s files using relative paths,
6161
regardless from where \fBcargo test\fR was executed from.
6262
.sp
6363
For documentation tests, the working directory when invoking \fBrustdoc\fR is set to
6464
the workspace root directory, and is also the directory \fBrustdoc\fR uses as the
6565
compilation directory of each documentation test.
6666
The working directory when running each documentation test is set to the root
67-
directory of the package the test belongs to, and is controlled via \fBrustdoc\fRs
67+
directory of the package the test belongs to, and is controlled via \fBrustdoc\fR\[cq]s
6868
\fB\-\-test\-run\-directory\fR option.
6969
.SH "OPTIONS"
7070
.SS "Test Options"

0 commit comments

Comments
 (0)