aboutsummaryrefslogtreecommitdiff
path: root/docs/TESTS.md
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-10 18:58:38 +0000
committerAleksey Kladov <[email protected]>2018-01-10 18:58:38 +0000
commit4c10c31be339ef3082f142061d83149af2a30ec8 (patch)
tree2343fbe5933e9d02b557d597c26c350825b6691f /docs/TESTS.md
parent5ea7e5fb7ab9f9ed762c8b5220ba01a29796a871 (diff)
D: start documenting stuff
Diffstat (limited to 'docs/TESTS.md')
-rw-r--r--docs/TESTS.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/TESTS.md b/docs/TESTS.md
new file mode 100644
index 000000000..8005ec9da
--- /dev/null
+++ b/docs/TESTS.md
@@ -0,0 +1,30 @@
1# libsyntax2.0 testing infrastructure
2
3Libsyntax2.0 tests are in the `tests/data` directory. Each test is a
4pair of files, an `.rs` file with Rust code and a `.txt` file with a
5human-readable representation of syntax tree.
6
7The test suite is intended to be independent from a particular parser:
8that's why it is just a list of files.
9
10The test suite is intended to be progressive: that is, if you want to
11write a Rust parser, you can TDD it by working through the test in
12order. That's why each test file begins with the number. Generally,
13tests should be added in order of the appearance of corresponding
14functionality in libsytnax2.0. If a bug in parser is uncovered, a
15**new** test should be created instead of modifying an existing one:
16it is preferable to have a gazillion of small isolated test files,
17rather than a single file which covers all edge cases. It's okay for
18files to have the same name except for the leading number. In general,
19test suite should be append-only: old tests should not be modified,
20new tests should be created instead.
21
22
23Note that only `ok` tests are normative: `err` tests test error
24recovery and it is totally ok for a parser to not implement any error
25recovery at all. However, for libsyntax2.0 we do care about error
26recovery, and we do care about precise and useful error messages.
27
28
29Contribution opportunity: design and implement testing infrastructure
30for validators.