Skip to content

Commit

Permalink
make tests actually verify what we're trying to
Browse files Browse the repository at this point in the history
  • Loading branch information
coxley committed Nov 20, 2024
1 parent 5092876 commit 67b70f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions testproto/unique/unique_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ func TestUnmarshalSameMemory(t *testing.T) {
m3 := &UniqueFieldExtension{}
require.NoError(t, m3.UnmarshalVT(b))

require.Equal(t, unsafe.StringData(m2.Foo), unsafe.StringData(m3.Foo))
require.Same(t, unsafe.StringData(m2.Foo), unsafe.StringData(m3.Foo), "string field")

keys2 := slices.Collect(maps.Keys(m2.Bar))
keys3 := slices.Collect(maps.Keys(m3.Bar))
require.Len(t, keys2, 1)
require.Len(t, keys3, 1)
require.Equal(t, unsafe.StringData(keys2[0]), unsafe.StringData(keys3[0]))
require.Same(t, unsafe.StringData(keys2[0]), unsafe.StringData(keys3[0]), "string key")

values2 := slices.Collect(maps.Values(m2.Baz))
values3 := slices.Collect(maps.Values(m3.Baz))
require.Len(t, values2, 1)
require.Len(t, values2, 1)
require.Equal(t, unsafe.StringData(values2[0]), unsafe.StringData(values3[0]))
require.Same(t, unsafe.StringData(values2[0]), unsafe.StringData(values3[0]), "string value")
}
2 changes: 1 addition & 1 deletion vtproto/ext.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 67b70f6

Please sign in to comment.