Skip to content

Commit 9ebd8fb

Browse files
committed
add documentation for semanticdb testing
1 parent 8305bd0 commit 9ebd8fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/docs/contributing/testing.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,17 @@ with `with-compiler` in their name.
134134
```
135135

136136
This mode can be run under `dotty-compiler-bootstrapped/testCompilation` to test on a bootstrapped Dotty compiler.
137+
138+
### SemanticDB tests
139+
140+
The output of the `extractSemanticDB` phase, enabled with `-Ysemanticdb` is tested with the bootstrapped JUnit test
141+
`dotty.tools.dotc.semanticdb.SemanticdbTests`. It uses source files in `tests/semanticdb/expect` to generate
142+
two kinds of output file that are compared with "expect files": placement of semanticdb symbol occurrences inline in
143+
sourcecode (`*.expect.scala`), for human verification by inspection; and secondly metap formatted output which outputs
144+
all information stored in semanticdb (`metac.expect`).
145+
Expect files are used as regression tests to detect changes in the compiler.
146+
147+
The test suite will create a new file if it detects any difference, which can be compared with the
148+
original expect file, or if the user wants to globally replace all expect files for semanticdb they can use
149+
`dotty-compiler-bootstrapped/test:runMain dotty.tools.dotc.semanticdb.updateExpect`, and compare the changes via version
150+
control.

0 commit comments

Comments
 (0)