0

Document test-only classes in C++ style guide

Paraphrase discussion results (Guideline for test-only classes) from
chromium-dev.

Bug: None
Change-Id: Ib392e7f6af3aebe10805e18eb9d42061138f6283
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2910095
Commit-Queue: Roland Bock <rbock@google.com>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885068}
This commit is contained in:
Roland Bock
2021-05-20 16:59:53 +00:00
committed by Chromium LUCI CQ
parent 641775813a
commit 1f21a73868

@ -43,6 +43,12 @@ status of Chromium's C++ support is covered in more detail in
`ForTesting` is the conventional suffix although similar patterns, such as
`ForTest`, are also accepted. These suffixes are checked at presubmit time
to ensure the functions are called only by test files.
* 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.
## Code formatting