reflect_test.go 256 B

123456789101112131415161718
  1. package reflect
  2. import (
  3. "testing"
  4. "time"
  5. )
  6. func TestSet(t *testing.T) {
  7. type hack struct {
  8. Duration time.Duration
  9. Enable bool
  10. }
  11. h := &hack{}
  12. Set(h, "Duration", "1111111111111111")
  13. Set(h, "Enable", "T")
  14. t.Log(h.Duration)
  15. t.Log(h.Enable)
  16. }