Adds testing for semantic lookups#202
Conversation
|
This testing revealed quite a few bugs in the lookup methodoly on methods, the tests currently do support 'expected' errors with ! or ? annotations, but I may add additional commits on the PR to fix individual bugs before un-drafting this |
8c8cb01 to
a66560a
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a test framework and a set of annotation-based integration tests for semantic LSP lookups (goto-definition, goto-declaration, goto-implementation, find-references) in the DML Language Server. It also adds a #[cfg(test)] constructor new_for_testing to InitActionContext to support test setup, and fixes a missing newline at the end of semantic_lookup.rs.
Changes:
- New annotation-driven test framework (
lsp_lookup_tests.rs) with helpers for loading DML files, parsing@loc/@goto-*annotations, running semantic lookups, and comparing results. - Five new DML test fixture files covering basic lookups, multi-level template inheritance, cross-file references, simple symbolic tests, and goto-implementation scenarios.
- Test-only
InitActionContext::new_for_testingconstructor insrc/actions/mod.rs.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/test/lsp_lookup_tests.rs |
New annotation-based test framework and integration tests for all semantic lookup operations |
src/test/mod.rs |
Declares lsp_lookup_tests as a #[cfg(test)] submodule |
src/actions/mod.rs |
Adds new_for_testing constructor for InitActionContext, used by the new tests |
src/actions/semantic_lookup.rs |
Trivial: adds missing trailing newline |
src/test/test_files/basic_lookup.dml |
DML fixture for basic LSP lookup tests |
src/test/test_files/multi_level.dml |
DML fixture for multi-level template inheritance tests |
src/test/test_files/simple_symbolic.dml |
DML fixture for simple symbolic annotation tests |
src/test/test_files/goto_impl_test.dml |
DML fixture for goto-implementation tests |
src/test/test_files/cross_file_main.dml |
DML fixture for cross-file reference tests (main file) |
src/test/test_files/imported_file.dml |
DML fixture for cross-file reference tests (imported file) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
This error was introduced by 46000fc, but this fix is smaller than a full revert Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Largely written in iterations by copilot Signed-off-by: Jonatan Waern<jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
1767399 to
5cb14d5
Compare
| if let Some(m) = RE_OP_NO_COL.find(line) { | ||
| // Report missing column specifiers (test writer error) | ||
| let arrow_offset = m.as_str().find("->") | ||
| .expect("BUG: RE_OP_NO_COL matched without '->' present"); | ||
| let prefix_end = m.start() + arrow_offset; | ||
| let prefix_text = &line[m.start()..prefix_end]; | ||
| if !RE_OP.is_match(line) { | ||
| panic!("annotation '{}' is missing a column: use {}[col]->target\n \ | ||
| on line {}: {}", | ||
| m.as_str(), prefix_text, line_num + 1, line.trim()); | ||
| } |
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
09878d8 to
7999a9c
Compare
Framework code is vibecoded, tests are largely manually made
Signed-off-by: Jonatan Waernjonatan.waern@intel.com