[librsvg/hospitality] CONTRIBUTING.md: Note on adding tests
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/hospitality] CONTRIBUTING.md: Note on adding tests
- Date: Fri, 19 Jan 2018 03:06:08 +0000 (UTC)
commit 788cd43dbbcae08adea875e7e01bbdef62173348
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Jan 18 20:55:18 2018 -0600
CONTRIBUTING.md: Note on adding tests
tests/README.md: Note on unit tests vs. black box tests
CONTRIBUTING.md | 6 ++++++
tests/README.md | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+)
---
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8e5bd41..4bc99b7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -121,6 +121,11 @@ libtool --mode=execute ./rsvg-convert -o foo.png foo.svg
Then you can view the resulting `foo.png` image. Alternatively, you
can use `./rsvg-view-3` for a quick-and-dirty SVG viewer.
+**Please update the test suite** with a suitable example file once you
+have things working (or before even writing code, if you like
+test-driven development), so we can avoid regressions later. The test
+suite is documented in [`tests/README.md`][tests-readme].
+
[coc]: code_of_conduct.md
[gitlab]: https://gitlab.gnome.org/GNOME/librsvg
[bugs-browse]: https://gitlab.gnome.org/GNOME/librsvg/issues
@@ -128,3 +133,4 @@ can use `./rsvg-view-3` for a quick-and-dirty SVG viewer.
[tests-readme]: tests/README.md
[blog]: https://people.gnome.org/~federico/blog/librsvg-build-infrastructure.html
[toplevel-makefile]: Makefile.am
+[tests-readme]: tests/README.md
diff --git a/tests/README.md b/tests/README.md
index 622f52b..533048b 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -30,9 +30,32 @@ These are all "black box tests": they run the library with its public
API, and test the results. They do not test the library's internals;
just the output.
+
+Unit tests
+----------
+
Additionally, the library's source code has smaller unit tests for
particular sections of the code.
+**It is better to catch errors early**, in the unit tests, if
+possible. The test suite in this directory is for black box tests,
+which run the library as a normal program would use it.
+
+* **What should be in a unit test** - a small test of an algorithm; a
+ check for computed values given some starting values; checks for
+ edge cases.
+
+* **What should be in these black-box tests** - rendering tests that
+ exercise a particular part of the code; CSS cascading tests; images
+ that expose bugs and that we want to avoid regressing on later.
+
+For example, there are unit tests of the path data parser (the `<path
+d="M10 10 L20 20 ...">` element and its `d` attribute, to ensure that
+the parser handles all the path commands and catches errors
+appropriately. Correspondingly, there are a bunch of black-box tests
+that exercise particular features of path rendering ("does this
+actually draw a line, or an arc?").
+
Running the test suite
----------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]