Repository navigation
test(lsp): snapshot the rename tests - #2264
Merged
Merged
Conversation
Give each rename case its own fixture and an insta snapshot, in the same style as the other LSP suites. The shared in-memory VFS and the structural asserts on package paths, symbol selection, and text edits are gone. Production rename behavior is unchanged. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peefy <Peefy@users.noreply.github.com>
Virtual fixture paths now always start with `/`, which `VfsPath::new_virtual_path` requires. Real source-map keys use the normalized VFS spelling so applying edits can find the file, and the on-file test canonicalizes its temp directory before renaming. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Peefy <Peefy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1374.
Summary
renamewas the last open item on the LSP unit-test checklist. Those tests asserted structural results of internal helpers (package_path_to_file_path,select_symbol, exactTextEdits) and shared one in-memory VFS. This PR splits them into per-test fixtures andinstasnapshots, in the same style as goto-def, hover, find-refs, formatting, semantic tokens, inlay hints, signature help, and completion.package_path_test_snapshot!,select_symbol_test_snapshot!,rename_symbol_test_snapshot!,rename_on_code_test_snapshot!, orrename_on_file_test_snapshot!.src/test_data/rename/<case>/. The e2e workspace insrc/test_data/rename_test/is left in place. The mutablerename_on_filecopy is gone; the on-file test copies its fixture into a temp directory and snapshots the written sources.apply_rename_changessnapshots the rewritten file instead ofassert_eq!.Production rename behavior is unchanged. The diff stays in
crates/tools/src/LSPtests, fixtures, and snapshots.The e2e server helpers (
Server::open_file,Server::rename, and the rest) were already in place, and the other checklist suites were already converted. This finishes the checklist.Tests
cargo test --manifest-path crates/tools/src/LSP/Cargo.toml --lib rename— 16 passed (14 snapshot tests plus the existing e2erename_testandrename_debug_test).