README.md 820 Bytes
Newer Older
1 2
# JavaScript tests with expected output

3 4
Tests in `test/message` pass if the output matches the expected output.
Message tests are particularly useful when checking for exact error messages.
5 6 7 8 9 10 11 12 13 14 15 16 17

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.

18 19 20 21
You can use a regex in the expected output instead of the exact
path:

```
22 23
*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a'
```
24

25 26 27
Empty lines are ignored in the comparison, but whitespaces are not.

Exact details of the test runner are in [testcfg.py](testcfg.py).