Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
test(md_help): isolate fenced comment regression (#3923)
Maximilian Rooseb0432aec301
diff --git a/src/md_help.rs b/src/md_help.rsindex 1a3fd3dcd..cc29e8097 100644--- a/src/md_help.rs+++ b/src/md_help.rs@@ -724,40 +724,13 @@ mod tests {#[test]fn test_html_comment_inside_a_code_block_is_content() {- // The comment branch used to run before the fence check, so a fenced- // line that happened to be an HTML comment was swallowed instead of- // rendered. The picker's `pr` and comments panes render arbitrary forge- // markdown through this function, where a fenced HTML sample is- // ordinary content — and a fenced `<!-- wt list -->` would additionally- // arm the chop marker for whatever block came next.- let result = render_markdown_flush("```html\n<!-- a comment -->\n<p>body</p>\n```", None);+ // Forge markdown can contain fenced HTML samples. A comment inside the+ // fence is content even when it matches a docs expansion marker.+ let result = render_markdown_flush("```html\n<!-- wt list -->\n<p>body</p>\n```", None);assert_snapshot!(result, @"- [2m<!-- a comment -->[0m+ [2m<!-- wt list -->[0m[2m<p>body</p>[0m");-- // The gutter path renders it too, and the marker inside the fence does- // not leak into the following block. Only the trailing `console`- // block's rendering depends on `syntax-highlighting`, so its- // expectation is per configuration; the containment the test is- // about is asserted either way.- let guttered =- render_markdown_in_help("```\n<!-- wt list -->\n```\n\n```console\n$ wt\n```");- #[cfg(feature = "syntax-highlighting")]- assert_snapshot!(guttered, @"- [107m [0m [2m<!-- wt list -->[0m-- [107m [0m [2m[0m[2m[34mwt[0m- ");- #[cfg(not(feature = "syntax-highlighting"))]- assert_snapshot!(guttered, @"- [107m [0m [2m<!-- wt list -->[0m-- [107m [0m wt- ");-- // Outside a fence it is still a marker, not content.- assert_snapshot!(render_markdown_in_help("<!-- wt list -->"), @"");}#[test]diff --git a/tests/CLAUDE.md b/tests/CLAUDE.mdindex 0a5db101a..1e6c87d25 100644--- a/tests/CLAUDE.md+++ b/tests/CLAUDE.md@@ -670,36 +670,6 @@ assert!(!result.contains("error"));Import `assert_snapshot` directly (`use insta::assert_snapshot;`) rather thanusing the qualified `insta::assert_snapshot!` form.-**A snapshot of styled output bakes `syntax-highlighting` into the-expectation.** That feature is on by default, so `test (linux|macos|windows)`-and `fast-checks` build with it and never disagree. `ci`'s `feature-check` job-does run `cargo check --bin wt --no-default-features --features cli` on every-PR, but `cargo check` never compiles `#[cfg(test)]` code, so the snapshot is-never built there; the only job that *runs the tests* on that combination is-`feature-powerset` in `nightly`, which on a `src/`-only PR is skipped. A-snapshot that captures a highlighted `console` block therefore merges green and-turns `main`'s next nightly cron red (#3908 → #3916). Where the colouring is-incidental to what the test asserts, give the expectation per configuration-rather than gating the whole assertion — gating drops the test on the one-combination that catches this:--```rust-// The trailing console block renders coloured with the feature and plain-// without. Only the arm matching the active configuration compiles, so fill-// the pair with two runs: `cargo insta test --accept`, then the same command-// with `--no-default-features --features cli --bin wt`.-#[cfg(feature = "syntax-highlighting")]-assert_snapshot!(guttered, @"<highlighted rendering>");-#[cfg(not(feature = "syntax-highlighting"))]-assert_snapshot!(guttered, @"<plain rendering>");-```--Reproduce the plain side locally with `cargo test --no-default-features---features cli --bin wt <filter>`; the highlighted side is the default build.-A PR that fixes a `feature-powerset` failure gets the `nightly` label:-nightly's gate ORs that label against its Cargo/toolchain paths filter, so-without it the job that proves the fix is skipped on the PR carrying it.-For first-time snapshot creation, leave the inline value empty (`@""`), thenrun `cargo insta test --accept` to fill it.