(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestCollectMappingSources(t *testing.T) { |
| 105 | const startAddress uint64 = 0x40000 |
| 106 | const url = "http://example.com" |
| 107 | for _, tc := range []struct { |
| 108 | file, buildID string |
| 109 | want plugin.MappingSources |
| 110 | }{ |
| 111 | {"/usr/bin/binary", "buildId", mappingSources("buildId", url, startAddress)}, |
| 112 | {"/usr/bin/binary", "", mappingSources("/usr/bin/binary", url, startAddress)}, |
| 113 | {"", "", mappingSources(url, url, startAddress)}, |
| 114 | } { |
| 115 | p := &profile.Profile{ |
| 116 | Mapping: []*profile.Mapping{ |
| 117 | { |
| 118 | File: tc.file, |
| 119 | BuildID: tc.buildID, |
| 120 | Start: startAddress, |
| 121 | }, |
| 122 | }, |
| 123 | } |
| 124 | got := collectMappingSources(p, url) |
| 125 | if !reflect.DeepEqual(got, tc.want) { |
| 126 | t.Errorf("%s:%s, want %v, got %v", tc.file, tc.buildID, tc.want, got) |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | func TestUnsourceMappings(t *testing.T) { |
| 132 | for _, tc := range []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…