Initial commit

This commit is contained in:
Ian Gulliver
2023-04-20 05:17:28 +00:00
parent 85d5f71d5d
commit 07b5bec219
5 changed files with 122 additions and 0 deletions

29
metadata_test.go Normal file
View File

@@ -0,0 +1,29 @@
package metadata_test
import (
"testing"
"github.com/gopatchy/metadata"
"github.com/stretchr/testify/require"
)
type TestType struct {
metadata.Metadata
Text string
}
func TestMetadata(t *testing.T) {
t.Parallel()
tt := &TestType{}
// Verify promoted field
tt.ID = "abc123"
m := metadata.GetMetadata(tt)
require.NotNil(t, m)
require.Equal(t, "abc123", m.ID)
metadata.ClearMetadata(tt)
require.Empty(t, tt.ID)
}