[libcxx-commits] [libcxx] Update testing documentation with testing guidelines. (PR #87928)

Christopher Di Bella via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 16 13:44:08 PDT 2024


================
@@ -180,6 +180,38 @@ The tests of libc++ are stored in libc++'s testing related subdirectories:
   ``libcxx/test/libcxx``. The structure of this directories follows the
   structure of ``libcxx/test/std``.
 
+Principles of testing
+---------------------
+
+Tests are a practical way to validate the correctness of the code. As such, they contain pragmatic trade offs between
+the cost of writing and maintaining the tests and the value they provide. Please consider the following principles when
+writing tests:
+
+- **Consider the next reader**
+
+    Tests should be obvious to the future reader. Avoid too much boiler plate or other
----------------
cjdb wrote:

We should avoid terms like "obvious", as that's a subjective metric. Things that are obvious to you might not be obvious to me, and vice versa.
```suggestion
    Unit tests should be written so that anyone who lacks context can immediately identify that they are correct. Avoid too much boiler plate or other
```

https://github.com/llvm/llvm-project/pull/87928


More information about the libcxx-commits mailing list