mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
add more test case for reflect
This commit is contained in:
parent
fa917b0b77
commit
a74decc47d
|
@ -48,4 +48,19 @@ func Test_reflectMergeStructFields(t *testing.T) {
|
||||||
reflectMergeStructFields(b, a)
|
reflectMergeStructFields(b, a)
|
||||||
assert.Equal(t, types.IntervalWindow{Interval: types.Interval5m, Window: 9}, b.IntervalWindow)
|
assert.Equal(t, types.IntervalWindow{Interval: types.Interval5m, Window: 9}, b.IntervalWindow)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("skip different type but the same name", func(t *testing.T) {
|
||||||
|
a := &struct {
|
||||||
|
A float64
|
||||||
|
}{
|
||||||
|
A: 1.99,
|
||||||
|
}
|
||||||
|
b := &struct {
|
||||||
|
A string
|
||||||
|
}{}
|
||||||
|
reflectMergeStructFields(b, a)
|
||||||
|
assert.Equal(t, "", b.A)
|
||||||
|
assert.Equal(t, 1.99, a.A)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user