summaryrefslogtreecommitdiffstats
path: root/docs/HACKING.md
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-10-19 10:29:05 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-10-19 11:50:03 -0400
commit3b387d81e63893ed3fe3b45e3721fbcfb1c5dde0 (patch)
tree513c32eda43d92a8ed977f394492ba198bba1f3b /docs/HACKING.md
parente5972621ffa8864b18d3e303ac714fdbe231be74 (diff)
downloadbfs-3b387d81e63893ed3fe3b45e3721fbcfb1c5dde0.tar.xz
tests: Split test cases into separate files
Diffstat (limited to 'docs/HACKING.md')
-rw-r--r--docs/HACKING.md20
1 files changed, 14 insertions, 6 deletions
diff --git a/docs/HACKING.md b/docs/HACKING.md
index 08ddac2..c9bbe14 100644
--- a/docs/HACKING.md
+++ b/docs/HACKING.md
@@ -30,18 +30,26 @@ Tests
`bfs` includes an extensive test suite.
See the [build documentation](BUILDING.md#testing) for details on running the tests.
+Test cases are grouped by the standard or `find` implementation that supports the tested feature(s):
+
+| Group | Description |
+|---------------------------------|---------------------------------------|
+| [`tests/posix`](/tests/posix) | POSIX compatibility tests |
+| [`tests/bsd`](/tests/bsd) | BSD `find` features |
+| [`tests/gnu`](/tests/gnu) | GNU `find` features |
+| [`tests/common`](/tests/common) | Features common to BSD and GNU `find` |
+| [`tests/bfs`](/tests/bfs) | `bfs`-specific tests |
+
Both new features and bug fixes should have associated tests.
-To add a test, create a new function in `tests.sh` called `test_<something>`.
+To add a test, create a new `*.sh` file in the appropriate group.
Snapshot tests use the `bfs_diff` function to automatically compare the generated and expected outputs.
For example,
```bash
-function test_something() {
- bfs_diff basic -name something
-}
+# posix/something.sh
+bfs_diff basic -name something
```
`basic` is one of the directory trees generated for test cases; others include `links`, `loops`, `deep`, and `rainbow`.
-Run `./tests/tests.sh test_something --update` to generate the reference snapshot (and don't forget to `git add` it).
-Finally, add the test case to one of the arrays `posix_tests`, `bsd_tests`, `gnu_tests`, or `bfs_tests`, depending on which `find` implementations it should be compatible with.
+Run `./tests/tests.sh posix/something --update` to generate the reference snapshot (and don't forget to `git add` it).