From dc7ec1b4b3c50d39e122b3c87c343343fcbdc70b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 01:15:28 +0000 Subject: [PATCH] test: strengthen weak assert_ne in nested_marker_detection_matches_replacement The test used assert_ne!(result, input) which only verified the output differed from the input. Since replace_marker is deterministic, the expected output is predictable: the outer braces are preserved while only the inner {{ workspace }} is substituted. Replace with assert_eq! asserting the exact output "{{ bad REPL }}". This catches regressions where replacement occurs at the wrong span (e.g. swallowing the outer braces, or replacing the wrong occurrence). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/compile/codemods/0004_legacy_path_markers.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/compile/codemods/0004_legacy_path_markers.rs b/src/compile/codemods/0004_legacy_path_markers.rs index 53c387c7..78472e69 100644 --- a/src/compile/codemods/0004_legacy_path_markers.rs +++ b/src/compile/codemods/0004_legacy_path_markers.rs @@ -372,10 +372,13 @@ mod tests { // `false` for a value that would actually be rewritten. let input = "{{ bad {{ workspace }} }}"; assert!(contains_template_marker(input, "workspace")); - assert_ne!( + // The outer `{{ bad ... }}` span does not match because its interior + // (`"bad {{ workspace"`) is not the marker name. Only the inner + // `{{ workspace }}` is replaced, leaving the surrounding braces intact. + assert_eq!( replace_marker(input, "workspace", "REPL"), - input, - "replace_marker should substitute the inner marker" + "{{ bad REPL }}", + "replace_marker should substitute only the inner {{ workspace }} marker" ); } }