MCPcopy Index your code
hub / github.com/maruel/panicparse / zapPointers

Function zapPointers

stack/source_test.go:1637–1654  ·  view source on GitHub ↗

zapPointers zaps out pointers in got.

(t *testing.T, want, got *Stack)

Source from the content-addressed store, hash-verified

1635
1636// zapPointers zaps out pointers in got.
1637func zapPointers(t *testing.T, want, got *Stack) {
1638 for i := range got.Calls {
1639 if i >= len(want.Calls) {
1640 // When using GOTRACEBACK=2, it'll include runtime.main() and
1641 // runtime.goexit(). Ignore these since they could be changed in a future
1642 // version.
1643 got.Calls = got.Calls[:len(want.Calls)]
1644 break
1645 }
1646 gotArgs := got.Calls[i].Args
1647 ptrsToReplace := zapPointersInArgs(t, want.Calls[i].Args, gotArgs)
1648 for _, ptr := range ptrsToReplace {
1649 for k := range gotArgs.Processed {
1650 gotArgs.Processed[k] = strings.Replace(gotArgs.Processed[k], ptr, pointerStr, -1)
1651 }
1652 }
1653 }
1654}
1655
1656func zapPointersInArgs(t *testing.T, want, got Args) (ptrs []string) {
1657 for j := range got.Values {

Callers 1

testAugmentCommonFunction · 0.85

Calls 1

zapPointersInArgsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…