test(lsp): update find_section_range test for any-level heading match
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:
@@ -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 =====
|
||||
|
||||
Reference in New Issue
Block a user