MCPcopy
hub / github.com/apache/devlake / TestNilIfZeroTime

Function TestNilIfZeroTime

backend/core/utils/time_test.go:26–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func TestNilIfZeroTime(t *testing.T) {
27 type args struct {
28 t *time.Time
29 }
30 tests := []struct {
31 name string
32 args args
33 want *time.Time
34 }{
35 {
36 name: "Empty date should be nil",
37 args: args{nil},
38 want: nil,
39 },
40 {
41 name: "Zero date should be nil",
42 args: args{&time.Time{}},
43 want: nil,
44 },
45 }
46 for _, tt := range tests {
47 t.Run(tt.name, func(t *testing.T) {
48 assert.Equalf(t, tt.want, NilIfZeroTime(tt.args.t), "NilIfZeroTime(%v)", tt.args.t)
49 })
50 }
51}

Callers

nothing calls this directly

Calls 2

NilIfZeroTimeFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected