(t *testing.T)
| 129 | } |
| 130 | |
| 131 | func TestUnsourceMappings(t *testing.T) { |
| 132 | for _, tc := range []struct { |
| 133 | os, file, buildID, want string |
| 134 | }{ |
| 135 | {"any", "/usr/bin/binary", "buildId", "/usr/bin/binary"}, |
| 136 | {"any", "http://example.com", "", ""}, |
| 137 | {"windows", `C:\example.exe`, "", `C:\example.exe`}, |
| 138 | {"windows", `c:/example.exe`, "", `c:/example.exe`}, |
| 139 | } { |
| 140 | t.Run(tc.file+"-"+tc.os, func(t *testing.T) { |
| 141 | if tc.os != "any" && tc.os != runtime.GOOS { |
| 142 | t.Skipf("%s only test", tc.os) |
| 143 | } |
| 144 | |
| 145 | p := &profile.Profile{ |
| 146 | Mapping: []*profile.Mapping{ |
| 147 | { |
| 148 | File: tc.file, |
| 149 | BuildID: tc.buildID, |
| 150 | }, |
| 151 | }, |
| 152 | } |
| 153 | unsourceMappings(p) |
| 154 | if got := p.Mapping[0].File; got != tc.want { |
| 155 | t.Errorf("%s:%s, want %s, got %s", tc.file, tc.buildID, tc.want, got) |
| 156 | } |
| 157 | }) |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | type testObj struct { |
| 162 | home string |
nothing calls this directly
no test coverage detected
searching dependent graphs…