From e1856cf8ec7b078efe154d3d321e93ab9c0359f4 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Sun, 3 Apr 2022 13:58:52 +0200
Subject: [PATCH] Move testing page to repo
---
CONTRIBUTING.md | 8 +++++---
doc/dev/style-guide.rst | 2 +-
doc/dev/testing.rst | 26 ++++++++++++++++++++++++++
doc/index.rst | 1 +
4 files changed, 33 insertions(+), 4 deletions(-)
create mode 100644 doc/dev/testing.rst
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9a14faa0..e388ac80 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -99,8 +99,9 @@ If possible, you should also add tests for the things you write.
However, this is not always possible, for example when working on modules.
But at least isolated components should be tested.
-See the [testing page](https://github.com/polybar/polybar/wiki/Testing) on the
-wiki for more information.
+See the [testing
+page](https://polybar.readthedocs.io/en/latest/dev/testing.html) in the
+documentation.
Also don't hesitate to ask for help, testing isn't that mature in polybar yet
and some things may be harder/impossible to test right now.
@@ -154,7 +155,8 @@ repo.
### Style
-Please read our [style guide](https://github.com/polybar/polybar/wiki/Style-Guide).
+Please read our [style
+guide](https://polybar.readthedocs.io/en/latest/dev/style-guide.html).
## Donations
diff --git a/doc/dev/style-guide.rst b/doc/dev/style-guide.rst
index 817b7410..82bed253 100644
--- a/doc/dev/style-guide.rst
+++ b/doc/dev/style-guide.rst
@@ -11,7 +11,7 @@ We use ``clang-format`` for code formatting, the style rules are defined in
``.clang-format``, before submitting a PR, make sure to run the following command
on all the C++ files you changed:
-.. code-block:: bash
+.. code-block:: shell
clang-format -style=file -i
diff --git a/doc/dev/testing.rst b/doc/dev/testing.rst
new file mode 100644
index 00000000..7e9de837
--- /dev/null
+++ b/doc/dev/testing.rst
@@ -0,0 +1,26 @@
+Testing
+=======
+
+Polybar uses `googletest `_ as its
+testing and mocking framework.
+Tests live in the ``tests/`` directory; they can be enabled during cmake with
+``-DBUILD_TESTS=ON`` and compiled with ``make all_unit_tests``.
+
+Each test gets its own executable in ``build/tests``, which can be executed to run
+a specific test.
+
+Running all tests is preferably done with the following command:
+
+.. code-block:: shell
+
+ make check
+
+This runs all available tests and prints the output in color for failed tests
+only.
+
+Adding New Tests
+----------------
+
+All new tests need to be added to the ``tests/CMakeLists.txt`` file. Have a look
+at the other unit tests in ``tests/unit_tests`` to see how to write tests for your
+code.
diff --git a/doc/index.rst b/doc/index.rst
index 08502f18..13ba749a 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -34,6 +34,7 @@ Welcome to the official polybar documentation.
:caption: Developer Documentation:
dev/style-guide
+ dev/testing
dev/release-workflow
Getting Help