From 2fd3228525858f594361eba345ff31087f8a917a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 3 Feb 2018 22:39:01 +0300 Subject: Document inline tests infra --- docs/TESTS.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'docs/TESTS.md') diff --git a/docs/TESTS.md b/docs/TESTS.md index 8005ec9da..db06dbebc 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -19,12 +19,26 @@ files to have the same name except for the leading number. In general, test suite should be append-only: old tests should not be modified, new tests should be created instead. - Note that only `ok` tests are normative: `err` tests test error recovery and it is totally ok for a parser to not implement any error recovery at all. However, for libsyntax2.0 we do care about error recovery, and we do care about precise and useful error messages. +There are also so-called "inline tests". They appear as the comments +with a `test` header in the source code, like this: + +```rust +// test fn_basic +// fn foo() {} +fn fn_item(p: &mut Parser) { + // ... +} +``` + +You can run `cargo collect-tests` command to collect all inline tests +into `tests/data/inline` directory. The main advantage of inline tests +is that they help to illustrate what the relevant code is doing. + Contribution opportunity: design and implement testing infrastructure for validators. -- cgit v1.2.3