MCPcopy Create free account
hub / github.com/DoNewsCode/core / TestDuration_IsZero

Function TestDuration_IsZero

config/time_test.go:112–131  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

110}
111
112func TestDuration_IsZero(t *testing.T) {
113 tests := []struct {
114 name string
115 val time.Duration
116 want bool
117 }{
118 {">0", 1, false},
119 {"<0", -1, false},
120 {"=0", 0, true},
121 }
122 for _, tt := range tests {
123 t.Run(tt.name, func(t *testing.T) {
124 t.Parallel()
125 d := Duration{tt.val}
126 if got := d.IsZero(); got != tt.want {
127 t.Errorf("IsZero() = %v, want %v", got, tt.want)
128 }
129 })
130 }
131}
132
133func TestDuration_UnmarshalText(t *testing.T) {
134 var d Duration

Callers

nothing calls this directly

Calls 2

IsZeroMethod · 0.95
RunMethod · 0.45

Tested by

no test coverage detected