goext/rfctime/interface_test.go

51 lines
869 B
Go
Raw Normal View History

2023-03-15 15:41:55 +01:00
package rfctime
import (
"testing"
"time"
)
func TestAnyTimeInterface(t *testing.T) {
var v AnyTime
v = NowRFC3339Nano()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowRFC3339()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnix()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnixMilli()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnixNano()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = time.Now()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
}
func TestRFCTimeInterface(t *testing.T) {
var v RFCTime
v = NowRFC3339Nano()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowRFC3339()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnix()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnixMilli()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
v = NowUnixNano()
2023-03-31 13:33:06 +02:00
tst.AssertEqual(t, v.String(), v.String())
2023-03-15 15:41:55 +01:00
}