Skip to content

Commit 493eb34

Browse files
committed
Note that harness=false enables cfg(test).
1 parent c2ff762 commit 493eb34

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/doc/src/reference/cargo-targets.md

+4
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ default is `true` for all targets.
248248
If set to `false`, then you are responsible for defining a `main()` function
249249
to run tests and benchmarks.
250250

251+
Tests have the [`cfg(test)` conditional expression][cfg-test] enabled whether
252+
or not the harness is enabled.
253+
251254
#### The `edition` field
252255

253256
The `edition` field defines the [Rust edition] the target will use. If not
@@ -353,6 +356,7 @@ autobins = false
353356
[`cargo install`]: ../commands/cargo-install.md
354357
[`cargo run`]: ../commands/cargo-run.md
355358
[`cargo test`]: ../commands/cargo-test.md
359+
[cfg-test]: ../../reference/conditional-compilation.html#test
356360
[crate types]: ../../reference/linkage.html
357361
[crates.io]: https://crates.io/
358362
[customized]: #configuring-a-target

0 commit comments

Comments
 (0)