bbgo_origin/pkg/dynamic/call_test.go
c9s e2ab363e64
dynamic: add CallStructFieldsMethod for map struct field call
Signed-off-by: c9s <yoanlin93@gmail.com>
2022-06-30 15:49:18 +08:00

30 lines
492 B
Go

package dynamic
import (
"testing"
"github.com/stretchr/testify/assert"
)
type callTest struct {
ChildCall1 *childCall1
ChildCall2 *childCall2
}
type childCall1 struct{}
func (c *childCall1) Subscribe(a int) {}
type childCall2 struct{}
func (c *childCall2) Subscribe(a int) {}
func TestCallStructFieldsMethod(t *testing.T) {
c := &callTest{
ChildCall1: &childCall1{},
ChildCall2: &childCall2{},
}
err := CallStructFieldsMethod(c, "Subscribe", 10)
assert.NoError(t, err)
}