test(lsp): update find_section_range test for any-level heading match
CI / cargo fmt --check (push) Successful in 56s
CI / cargo clippy (push) Successful in 1m5s
CI / cargo test (push) Successful in 1m2s
CI / editor keymaps (push) Successful in 2m4s

The prior commit (e849ac9) intentionally removed the h1-only
restriction from find_section_range so VimwikiGenerateTagLinks stays
idempotent under non-h1 tag headings. The accompanying test still
asserted the old h1-only behavior and now fails.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-14 19:34:01 +00:00
parent ab6b5f6d73
commit 3ef70e4b7c
+5 -3
View File
@@ -343,11 +343,13 @@ fn find_section_range_misses_when_absent() {
}
#[test]
fn find_section_range_only_matches_h1() {
fn find_section_range_matches_any_heading_level() {
// Section replacement accepts any heading level so
// VimwikiGenerateTagLinks stays idempotent when tag sections live
// under non-h1 headings (e.g. `== Tag: foo ==`).
let src = "== Contents ==\n- [[A]]\n";
let ast = parse(src);
// h2 — should not match.
assert!(ops::find_section_range(&ast, "Contents").is_none());
assert!(ops::find_section_range(&ast, "Contents").is_some());
}
// ===== toc_edit =====