Skip to content

Commit 3754744

Browse files
committed
test(samefileanchor): round-3 review fixes for helpers_test.go
- Promote assert.Contains/NotContains to require in TestInsertDisambiguated for the pre-seeded-collision sub-case: both checks are preconditions for the follow-up insertDisambiguated call; if either fails the subsequent state is wrong and the fix-3 assertion can give a false pass. - Add assert.Equal(slugsAST, slugsL0) to TestCollectSlugs so the stated invariant ("both paths produce the same slug set", rule.go comment) is directly verified, not just implied by per-key Contains checks. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LadV5k6SsAQEgoVQmWVQh3
1 parent c87ca75 commit 3754744

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

internal/rules/samefileanchor/helpers_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func TestInsertDisambiguated(t *testing.T) {
104104
slugs2 := map[string]struct{}{"fix": {}, "fix-1": {}}
105105
counts2 := map[string]int{}
106106
insertDisambiguated(slugs2, counts2, "fix")
107-
assert.Contains(t, slugs2, "fix-2", "inner loop skips pre-existing fix-1")
108-
assert.NotContains(t, slugs2, "fix-3", "stops at first free slot")
107+
require.Contains(t, slugs2, "fix-2", "inner loop skips pre-existing fix-1")
108+
require.NotContains(t, slugs2, "fix-3", "stops at first free slot")
109109
// A follow-up insertion verifies that counts2 was written back correctly
110110
// (counts2["fix"]==2 means the next probe starts at 3, not re-scanning from 1).
111111
insertDisambiguated(slugs2, counts2, "fix")
@@ -286,4 +286,5 @@ func TestCollectSlugs(t *testing.T) {
286286
slugsL0 := collectSlugs(fLines)
287287
assert.Contains(t, slugsL0, "one")
288288
assert.Contains(t, slugsL0, "two")
289+
assert.Equal(t, slugsAST, slugsL0, "AST and Layer0 paths must produce identical slug sets")
289290
}

0 commit comments

Comments
 (0)