Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify documentation around test target setting. #12032

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/doc/man/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ following targets of the selected packages:

The default behavior can be changed by setting the `bench` flag for the target
in the manifest settings. Setting examples to `bench = true` will build and
run the example as a benchmark. Setting targets to `bench = false` will stop
them from being benchmarked by default. Target selection options that take a
target by name ignore the `bench` flag and will always benchmark the given
run the example as a benchmark, replacing the example's `main` function with
the libtest harness.

Setting targets to `bench = false` will stop them from being bencharmked by
default. Target selection options that take a target by name (such as
`--example foo`) ignore the `bench` flag and will always benchmark the given
target.

See [Configuring a target](../reference/cargo-targets.html#configuring-a-target)
for more information on per-target settings.

{{> options-targets-bin-auto-built }}

{{> options-targets }}
Expand Down
11 changes: 9 additions & 2 deletions src/doc/man/cargo-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,20 @@ following targets of the selected packages:

The default behavior can be changed by setting the `test` flag for the target
in the manifest settings. Setting examples to `test = true` will build and run
the example as a test. Setting targets to `test = false` will stop them from
being tested by default. Target selection options that take a target by name
the example as a test, replacing the example's `main` function with the
libtest harness. If you don't want the `main` function replaced, also include
`harness = false`, in which case the example will be built and executed as-is.

Setting targets to `test = false` will stop them from being tested by default.
Target selection options that take a target by name (such as `--example foo`)
ignore the `test` flag and will always test the given target.

Doc tests for libraries may be disabled by setting `doctest = false` for the
library in the manifest.

See [Configuring a target](../reference/cargo-targets.html#configuring-a-target)
for more information on per-target settings.

{{> options-targets-bin-auto-built }}

{{> options-targets }}
Expand Down
15 changes: 11 additions & 4 deletions src/doc/man/generated_txt/cargo-bench.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,17 @@ OPTIONS

The default behavior can be changed by setting the bench flag for the
target in the manifest settings. Setting examples to bench = true will
build and run the example as a benchmark. Setting targets to bench =
false will stop them from being benchmarked by default. Target selection
options that take a target by name ignore the bench flag and will always
benchmark the given target.
build and run the example as a benchmark, replacing the example’s main
function with the libtest harness.

Setting targets to bench = false will stop them from being bencharmked
by default. Target selection options that take a target by name (such as
--example foo) ignore the bench flag and will always benchmark the given
target.

See Configuring a target
<https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target>
for more information on per-target settings.

Binary targets are automatically built if there is an integration test
or benchmark being selected to benchmark. This allows an integration
Expand Down
17 changes: 13 additions & 4 deletions src/doc/man/generated_txt/cargo-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,23 @@ OPTIONS

The default behavior can be changed by setting the test flag for the
target in the manifest settings. Setting examples to test = true will
build and run the example as a test. Setting targets to test = false
will stop them from being tested by default. Target selection options
that take a target by name ignore the test flag and will always test the
given target.
build and run the example as a test, replacing the example’s main
function with the libtest harness. If you don’t want the main function
replaced, also include harness = false, in which case the example will
be built and executed as-is.

Setting targets to test = false will stop them from being tested by
default. Target selection options that take a target by name (such as
--example foo) ignore the test flag and will always test the given
target.

Doc tests for libraries may be disabled by setting doctest = false for
the library in the manifest.

See Configuring a target
<https://doc.rust-lang.org/cargo/reference/cargo-targets.html#configuring-a-target>
for more information on per-target settings.

Binary targets are automatically built if there is an integration test
or benchmark being selected to test. This allows an integration test to
execute the binary to exercise and test its behavior. The
Expand Down
12 changes: 9 additions & 3 deletions src/doc/src/commands/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,17 @@ following targets of the selected packages:

The default behavior can be changed by setting the `bench` flag for the target
in the manifest settings. Setting examples to `bench = true` will build and
run the example as a benchmark. Setting targets to `bench = false` will stop
them from being benchmarked by default. Target selection options that take a
target by name ignore the `bench` flag and will always benchmark the given
run the example as a benchmark, replacing the example's `main` function with
the libtest harness.

Setting targets to `bench = false` will stop them from being bencharmked by
default. Target selection options that take a target by name (such as
`--example foo`) ignore the `bench` flag and will always benchmark the given
target.

See [Configuring a target](../reference/cargo-targets.html#configuring-a-target)
for more information on per-target settings.

Binary targets are automatically built if there is an integration test or
benchmark being selected to benchmark. This allows an integration
test to execute the binary to exercise and test its behavior.
Expand Down
11 changes: 9 additions & 2 deletions src/doc/src/commands/cargo-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,20 @@ following targets of the selected packages:

The default behavior can be changed by setting the `test` flag for the target
in the manifest settings. Setting examples to `test = true` will build and run
the example as a test. Setting targets to `test = false` will stop them from
being tested by default. Target selection options that take a target by name
the example as a test, replacing the example's `main` function with the
libtest harness. If you don't want the `main` function replaced, also include
`harness = false`, in which case the example will be built and executed as-is.

Setting targets to `test = false` will stop them from being tested by default.
Target selection options that take a target by name (such as `--example foo`)
ignore the `test` flag and will always test the given target.

Doc tests for libraries may be disabled by setting `doctest = false` for the
library in the manifest.

See [Configuring a target](../reference/cargo-targets.html#configuring-a-target)
for more information on per-target settings.

Binary targets are automatically built if there is an integration test or
benchmark being selected to test. This allows an integration
test to execute the binary to exercise and test its behavior.
Expand Down
12 changes: 9 additions & 3 deletions src/etc/man/cargo-bench.1
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,17 @@ available)
.sp
The default behavior can be changed by setting the \fBbench\fR flag for the target
in the manifest settings. Setting examples to \fBbench = true\fR will build and
run the example as a benchmark. Setting targets to \fBbench = false\fR will stop
them from being benchmarked by default. Target selection options that take a
target by name ignore the \fBbench\fR flag and will always benchmark the given
run the example as a benchmark, replacing the example\[cq]s \fBmain\fR function with
the libtest harness.
.sp
Setting targets to \fBbench = false\fR will stop them from being bencharmked by
default. Target selection options that take a target by name (such as
\fB\-\-example foo\fR) ignore the \fBbench\fR flag and will always benchmark the given
target.
.sp
See \fIConfiguring a target\fR <https://doc.rust\-lang.org/cargo/reference/cargo\-targets.html#configuring\-a\-target>
for more information on per\-target settings.
.sp
Binary targets are automatically built if there is an integration test or
benchmark being selected to benchmark. This allows an integration
test to execute the binary to exercise and test its behavior.
Expand Down
11 changes: 9 additions & 2 deletions src/etc/man/cargo-test.1
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,20 @@ available)
.sp
The default behavior can be changed by setting the \fBtest\fR flag for the target
in the manifest settings. Setting examples to \fBtest = true\fR will build and run
the example as a test. Setting targets to \fBtest = false\fR will stop them from
being tested by default. Target selection options that take a target by name
the example as a test, replacing the example\[cq]s \fBmain\fR function with the
libtest harness. If you don\[cq]t want the \fBmain\fR function replaced, also include
\fBharness = false\fR, in which case the example will be built and executed as\-is.
.sp
Setting targets to \fBtest = false\fR will stop them from being tested by default.
Target selection options that take a target by name (such as \fB\-\-example foo\fR)
ignore the \fBtest\fR flag and will always test the given target.
.sp
Doc tests for libraries may be disabled by setting \fBdoctest = false\fR for the
library in the manifest.
.sp
See \fIConfiguring a target\fR <https://doc.rust\-lang.org/cargo/reference/cargo\-targets.html#configuring\-a\-target>
for more information on per\-target settings.
.sp
Binary targets are automatically built if there is an integration test or
benchmark being selected to test. This allows an integration
test to execute the binary to exercise and test its behavior.
Expand Down