Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import (
"github.com/stretchr/testify/assert/yaml"
)

const stackFrameBufferSize = 10

//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl"

// TestingT is an interface wrapper around *testing.T
Expand Down Expand Up @@ -217,8 +215,10 @@ func CallerInfo() []string {
var line int
var name string

callers := []string{}
const stackFrameBufferSize = 10
pcs := make([]uintptr, stackFrameBufferSize)

callers := []string{}
offset := 1

for {
Expand Down Expand Up @@ -273,13 +273,14 @@ func CallerInfo() []string {
isTest(name, "Example") {
break
}

if !more {
break
}
}
// We know we already have less than a buffer's worth of frames
offset += stackFrameBufferSize

// Next batch
offset += cap(pcs)
}

return callers
Expand Down