/
githubmirror
/
GoFrame
Обзор
Документация
Войти
/
githubmirror
/
GoFrame
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
os/gtime/gtime_z_unit_feature_sql_test.go
42 строки
780 B
John Guo
t.Assert(err, nil) -> t.AssertNil(err)
10 мар 2022, 06:36
10 мар 2022, 06:36
546b6b1
Код
Авторство
О чём код?
package gtime_test import ( "testing" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" ) func TestTime_Scan(t1 *testing.T) { gtest.C(t1, func(t *gtest.T) { tt := gtime.Time{} // test string s := gtime.Now().String() t.Assert(tt.Scan(s), nil) t.Assert(tt.String(), s) // test nano n := gtime.TimestampNano() t.Assert(tt.Scan(n), nil) t.Assert(tt.TimestampNano(), n) // test nil none := (*gtime.Time)(nil) t.Assert(none.Scan(nil), nil) t.Assert(none, nil) }) } func TestTime_Value(t1 *testing.T) { gtest.C(t1, func(t *gtest.T) { tt := gtime.Now() s, err := tt.Value() t.AssertNil(err) t.Assert(s, tt.Time) // test nil none := (*gtime.Time)(nil) s, err = none.Value() t.AssertNil(err) t.Assert(s, nil) }) }