(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestFromLabelAdaptersToLabelsWithCopy(t *testing.T) { |
| 119 | input := []LabelAdapter{{Name: "hello", Value: "world"}} |
| 120 | expected := labels.FromStrings("hello", "world") |
| 121 | actual := FromLabelAdaptersToLabelsWithCopy(input) |
| 122 | |
| 123 | assert.Equal(t, expected, actual) |
| 124 | |
| 125 | final := FromLabelsToLabelAdapters(actual) |
| 126 | // All strings must be copied. |
| 127 | assert.NotEqual(t, uintptr(unsafe.Pointer(&input[0].Name)), uintptr(unsafe.Pointer(&final[0].Name))) |
| 128 | assert.NotEqual(t, uintptr(unsafe.Pointer(&input[0].Value)), uintptr(unsafe.Pointer(&final[0].Value))) |
| 129 | } |
| 130 | |
| 131 | func BenchmarkFromLabelAdaptersToLabelsWithCopy(b *testing.B) { |
| 132 | input := []LabelAdapter{ |
nothing calls this directly
no test coverage detected