From 60e5dcf5946c8af35823b75588ae4e6a8722cac4 Mon Sep 17 00:00:00 2001 From: yxxhero Date: Fri, 16 Jun 2023 10:32:33 +0800 Subject: [PATCH] add timeFormat unitest Signed-off-by: yxxhero --- recovery_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/recovery_test.go b/recovery_test.go index fa8ab894..f329271f 100644 --- a/recovery_test.go +++ b/recovery_test.go @@ -12,6 +12,7 @@ import ( "strings" "syscall" "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -246,3 +247,20 @@ func TestRecoveryWithWriterWithCustomRecovery(t *testing.T) { SetMode(TestMode) } + +func TestTimeFormat(t *testing.T) { + tests := []struct { + t time.Time + want string + }{ + { + t: time.Date(2009, 11, 10, 23, 0, 0, 0, time.UTC), + want: "2009/11/10 - 23:00:00", + }, + } + + for _, tt := range tests { + got := timeFormat(tt.t) + assert.Equal(t, tt.want, got) + } +}