[testing] Add initial documentation for test/message.
R=adamk@chromium.org, mstarzinger@chromium.org BUG= Change-Id: Ibac495e93b523bd034cc9f2d9e3a43cf38c9ab14 Reviewed-on: https://chromium-review.googlesource.com/463368 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Franziska Hinkelmann <franzih@chromium.org> Cr-Commit-Position: refs/heads/master@{#44280}
This commit is contained in:
parent
de74e1ac84
commit
42003cb416
25
test/message/message.md
Normal file
25
test/message/message.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# JavaScript tests with expected output
|
||||||
|
|
||||||
|
Tests in test/message pass if the output matches the expected output. Message
|
||||||
|
tests are particularly useful when checking for exact error messages.
|
||||||
|
|
||||||
|
Tests and their expected output must have the same filename, with the `.js` and
|
||||||
|
`.out` extension.
|
||||||
|
|
||||||
|
```
|
||||||
|
foo.js
|
||||||
|
foo.out
|
||||||
|
```
|
||||||
|
|
||||||
|
**All tests must end with an exception**. The test runner does not
|
||||||
|
handle output from multiple runs, e.g., `--stress-opt`. Without an exception,
|
||||||
|
the output will be generated several times and the comparison will fail.
|
||||||
|
|
||||||
|
You can use a regex in the expected output. Instead of the exact
|
||||||
|
path. use
|
||||||
|
```
|
||||||
|
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a'
|
||||||
|
```
|
||||||
|
Empty lines are ignored in the comparison, but whitespaces are not.
|
||||||
|
|
||||||
|
Exact details of the test runner are in [testcfg.py](testcfg.py).
|
Loading…
Reference in New Issue
Block a user