goext/rfctime/interface_test.go

52 lines
918 B
Go
Raw Normal View History

2023-03-15 15:41:55 +01:00
package rfctime
import (
2023-06-06 21:18:40 +02:00
"gogs.mikescher.com/BlackForestBytes/goext/tst"
2023-03-15 15:41:55 +01:00
"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
}