0

Update the text around testonly targets

We write our tests alongside the production code that our tests test, so
the current styleguide guidance around using a `test/` subdirectory is
a bit confusing. In Chromium we only appear to use this for support code
in `testonly` targets, so this CL clarifies that and provides a brief
example.

R=danakj@chromium.org

Bug: N/A
Change-Id: I75b7cf5db6338e9cb84ec6af6e2bffd8995eb7f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3041161
Commit-Queue: Dominic Farolino <dom@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#903512}
This commit is contained in:
Dominic Farolino
2021-07-20 16:42:40 +00:00
committed by Chromium LUCI CQ
parent 81a907bc97
commit 200a14ec66

@ -46,9 +46,12 @@ status of Chromium's C++ support is covered in more detail in
* Classes used only for testing should be in a GN build target that is
marked `testonly=true`. Tests can depend on such targets, but production
code can not.
* The code for `testonly` targets should be placed in a `test/` subdirectory.
For test classes used across multiple directories, it might make sense to
move them into a nested `test` namespace for clarity.
* While test files generally appear alongside the production code they test,
support code for `testonly` targets should be placed in a `test/` subdirectory.
For example, see `//mojo/core/core_unittest.cc` and
`//mojo/core/test/mojo_test_base.cc`. For test classes used across multiple
directories, it might make sense to move them into a nested `test` namespace for
clarity.
* Despite the Google C++ style guide
[deprecating](https://google.github.io/styleguide/cppguide.html#File_Names)
the `_unittest.cc` suffix for unit test files, in Chromium we still use this