kos/util/reflect/reflect_test.go

19 lines
256 B
Go
Raw Normal View History

2023-08-07 14:57:16 +08:00
package reflect
import (
"testing"
"time"
)
func TestSet(t *testing.T) {
type hack struct {
Duration time.Duration
2024-02-22 17:53:31 +08:00
Enable bool
2023-08-07 14:57:16 +08:00
}
h := &hack{}
2024-02-22 17:53:31 +08:00
Set(h, "Duration", "1111111111111111")
Set(h, "Enable", "T")
2023-08-07 14:57:16 +08:00
t.Log(h.Duration)
2024-02-22 17:53:31 +08:00
t.Log(h.Enable)
2023-08-07 14:57:16 +08:00
}