snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s
Some checks failed
master / ci (push) Failing after 0s
This commit is contained in:
47
internal/name_test.go
Normal file
47
internal/name_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package internal_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ThreeDotsLabs/watermill/internal"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type testStruct struct{}
|
||||
|
||||
type stringerStruct struct{}
|
||||
|
||||
func (stringerStruct) String() string {
|
||||
return "stringer"
|
||||
}
|
||||
|
||||
func TestStructName(t *testing.T) {
|
||||
testCases := []struct {
|
||||
Name string
|
||||
Struct interface{}
|
||||
ExpectedName string
|
||||
}{
|
||||
{
|
||||
Name: "simple_struct",
|
||||
Struct: testStruct{},
|
||||
ExpectedName: "internal_test.testStruct",
|
||||
},
|
||||
{
|
||||
Name: "pointer_struct",
|
||||
Struct: &testStruct{},
|
||||
ExpectedName: "internal_test.testStruct",
|
||||
},
|
||||
{
|
||||
Name: "stringer",
|
||||
Struct: stringerStruct{},
|
||||
ExpectedName: "stringer",
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
s := internal.StructName(c.Struct)
|
||||
assert.Equal(t, c.ExpectedName, s)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user