Skip to content

Commit

Permalink
docs(cargo-test): clarify the cwd is for running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jun 18, 2023
1 parent c4312a4 commit fa08d67
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/doc/man/cargo-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ on writing doc tests.

### Working directory of tests

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

Expand Down
11 changes: 5 additions & 6 deletions src/doc/man/generated_txt/cargo-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ DESCRIPTION
information on writing doc tests.

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

For documentation tests, the working directory when invoking rustdoc is
set to the workspace root directory, and is also the directory rustdoc
Expand Down Expand Up @@ -480,4 +480,3 @@ SEE ALSO
cargo(1), cargo-bench(1), types of tests
<https://doc.rust-lang.org/cargo/reference/cargo-targets.html#tests>,
how to write tests <https://doc.rust-lang.org/rustc/tests/index.html>

6 changes: 3 additions & 3 deletions src/doc/src/commands/cargo-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ on writing doc tests.

### Working directory of tests

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

Expand Down
6 changes: 3 additions & 3 deletions src/etc/man/cargo-test.1
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ and may change in the future; beware of depending on it.
See the \fIrustdoc book\fR <https://doc.rust\-lang.org/rustdoc/> for more information
on writing doc tests.
.SS "Working directory of tests"
The working directory of every test is set to the root directory of the package
the test belongs to.
Setting the working directory of tests to the package\[cq]s root directory makes it
The working directory when running each unit and integration test is set to the
root directory of the package the test belongs to.
Setting the working directory of tests to the package\[cq]s root directory makes it
possible for tests to reliably access the package\[cq]s files using relative paths,
regardless from where \fBcargo test\fR was executed from.
.sp
Expand Down

0 comments on commit fa08d67

Please sign in to comment.