MCPcopy Create free account
hub / github.com/actiontech/dtle / TestPrettifyDurationOutput

Function TestPrettifyDurationOutput

driver/mysql/base/utils_test.go:37–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestPrettifyDurationOutput(t *testing.T) {
38 type args struct {
39 d time.Duration
40 }
41 tests := []struct {
42 name string
43 args args
44 want string
45 }{
46 {"ZeroNumber", args{0}, "0s"},
47 {"negativeNum", args{-10}, "0s"},
48 {"lessOneSecond", args{1011212}, "0s"},
49 {"oneSecond", args{time.Second}, "1s"},
50 {"oneMin", args{time.Minute}, "1m0s"},
51 {"oneHour", args{time.Hour}, "1h0m0s"},
52 {"1h17m6s", args{time.Hour*1 + time.Minute*17 + time.Second*6}, "1h17m6s"},
53 }
54 for _, tt := range tests {
55 t.Run(tt.name, func(t *testing.T) {
56 if got := PrettifyDurationOutput(tt.args.d); got != tt.want {
57 t.Errorf("PrettifyDurationOutput() = %v, want %v", got, tt.want)
58 }
59 })
60 }
61}
62
63//var userAndPwd = "root:pass"
64//var testAddr = "127.0.0.1:33061"

Callers

nothing calls this directly

Calls 2

PrettifyDurationOutputFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected