Skip to content

add documentation for semanticdb testing #7923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/docs/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,17 @@ with `with-compiler` in their name.
```

This mode can be run under `dotty-compiler-bootstrapped/testCompilation` to test on a bootstrapped Dotty compiler.

### SemanticDB tests

The output of the `extractSemanticDB` phase, enabled with `-Ysemanticdb` is tested with the bootstrapped JUnit test
`dotty.tools.dotc.semanticdb.SemanticdbTests`. It uses source files in `tests/semanticdb/expect` to generate
two kinds of output file that are compared with "expect files": placement of semanticdb symbol occurrences inline in
sourcecode (`*.expect.scala`), for human verification by inspection; and secondly metap formatted output which outputs
all information stored in semanticdb (`metac.expect`).
Expect files are used as regression tests to detect changes in the compiler.

The test suite will create a new file if it detects any difference, which can be compared with the
original expect file, or if the user wants to globally replace all expect files for semanticdb they can use
`dotty-compiler-bootstrapped/test:runMain dotty.tools.dotc.semanticdb.updateExpect`, and compare the changes via version
control.