mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
add timeFormat unitest
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
parent
d4a64265f2
commit
60e5dcf594
@ -12,6 +12,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@ -246,3 +247,20 @@ func TestRecoveryWithWriterWithCustomRecovery(t *testing.T) {
|
|||||||
|
|
||||||
SetMode(TestMode)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user