From 1538206609dbb88f10ff2525523096bab0c65740 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 10 Jun 2020 14:12:08 +0200 Subject: [PATCH] Explain inline tests --- docs/dev/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/dev/README.md b/docs/dev/README.md index 0330939b6ef..cf93135ee9b 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -303,6 +303,17 @@ Rather than talking in definitions and references, it talks in Strings and textu In general, API is centered around UI concerns -- the result of the call is what the user sees in the editor, and not what the compiler sees underneath. The results are 100% Rust specific though. +## Parser Tests + +Test for parser (`ra_parser`) live in `ra_syntax` crate (see `test_data` direcotory). +There are two kinds of tests: + +* Manually written test cases in `parser/ok` and `parser/error` +* "Inline" tests in `parser/inline` (these are generated) from comments in `ra_parser` crate. + +The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for. +If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test. + # Logging Logging is done by both rust-analyzer and VS Code, so it might be tricky to