Skip to content

fix(assert): pass custom message through InEpsilonSlice#1899

Open
leno23 wants to merge 1 commit into
stretchr:masterfrom
leno23:fix/in-epsilon-slice-message
Open

fix(assert): pass custom message through InEpsilonSlice#1899
leno23 wants to merge 1 commit into
stretchr:masterfrom
leno23:fix/in-epsilon-slice-message

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

  • InEpsilonSlice now forwards msgAndArgs to each per-element InEpsilon call
  • Keeps the existing "at index %d" hint and appends caller-provided context
  • Adds a regression test asserting custom messages appear in failure output

Fixes #763

Problem

InEpsilonSlice loops over elements and calls InEpsilon, but only passed an index hint and omitted msgAndArgs. Failures therefore lacked caller-provided context that other assertions include under Messages:.

InDeltaSlice already forwarded msgAndArgs; this aligns InEpsilonSlice with that behavior.

Test plan

  • go test ./assert/ -run TestInEpsilonSlice -v
  • Added TestInEpsilonSliceMessage verifying custom message appears in failure output

InEpsilonSlice delegates to InEpsilon per element but did not forward
msgAndArgs, so failure output omitted caller-provided context. Forward
the message args alongside the existing index hint.

Fixes stretchr#763

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assert.InEpsilonSlice doesn't print the message

1 participant