Skip to content

Adds testing for semantic lookups#202

Open
JonatanWaern wants to merge 8 commits into
mainfrom
vibecoded-testing
Open

Adds testing for semantic lookups#202
JonatanWaern wants to merge 8 commits into
mainfrom
vibecoded-testing

Conversation

@JonatanWaern
Copy link
Copy Markdown
Contributor

@JonatanWaern JonatanWaern commented Mar 2, 2026

Framework code is vibecoded, tests are largely manually made

Signed-off-by: Jonatan Waernjonatan.waern@intel.com

@JonatanWaern
Copy link
Copy Markdown
Contributor Author

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

@JonatanWaern JonatanWaern force-pushed the vibecoded-testing branch 2 times, most recently from 8c8cb01 to a66560a Compare March 2, 2026 15:04
@JonatanWaern JonatanWaern marked this pull request as ready for review March 9, 2026 09:52
@JonatanWaern JonatanWaern requested review from TSonono and Copilot March 9, 2026 09:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_testing constructor in src/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.

Comment thread src/test/test_files/simple_symbolic.dml
Comment thread src/test/lsp_lookup_tests.rs
Comment thread src/test/lsp_lookup_tests.rs Outdated
Comment thread src/test/test_files/basic_lookup.dml Outdated
Comment thread src/test/test_files/multi_level.dml
Comment thread src/test/test_files/multi_level.dml Outdated
Comment thread src/test/test_files/multi_level.dml Outdated
Comment thread src/test/test_files/multi_level.dml
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Comment thread src/analysis/scope.rs
Comment thread src/test/lsp_lookup_tests.rs Outdated
Comment on lines +273 to +283
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());
}
Comment thread src/test/test_files/multi_level.dml Outdated
Comment thread src/test/test_files/multi_level.dml Outdated
Comment thread src/test/test_files/basic_lookup.dml Outdated
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Comment thread src/analysis/scope.rs
Comment thread src/test/fuzzing_tests.rs
Comment thread src/file_tests.rs
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Signed-off-by: Jonatan Waern <jonatan.waern@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants