gf/util/gconv/gconv_z_unit_time_test.go
2019-07-29 21:01:19 +08:00

26 lines
683 B
Go

// Copyright 2018 gf Author(https://github.com/gogf/gf). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package gconv_test
import (
"testing"
"time"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/test/gtest"
"github.com/gogf/gf/util/gconv"
)
func Test_Time(t *testing.T) {
gtest.Case(t, func() {
t1 := "2011-10-10 01:02:03.456"
gtest.AssertEQ(gconv.GTime(t1), gtime.NewFromStr(t1))
gtest.AssertEQ(gconv.Time(t1), gtime.NewFromStr(t1).Time)
gtest.AssertEQ(gconv.Duration(100), 100*time.Nanosecond)
})
}