zapPointers zaps out pointers in got.
(t *testing.T, want, got *Stack)
| 1635 | |
| 1636 | // zapPointers zaps out pointers in got. |
| 1637 | func 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 | |
| 1656 | func zapPointersInArgs(t *testing.T, want, got Args) (ptrs []string) { |
| 1657 | for j := range got.Values { |
no test coverage detected
searching dependent graphs…