51 lines
825 B
Go
51 lines
825 B
Go
|
package rfctime
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestAnyTimeInterface(t *testing.T) {
|
||
|
|
||
|
var v AnyTime
|
||
|
|
||
|
v = NowRFC3339Nano()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowRFC3339()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnix()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnixMilli()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnixNano()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = time.Now()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
}
|
||
|
|
||
|
func TestRFCTimeInterface(t *testing.T) {
|
||
|
var v RFCTime
|
||
|
|
||
|
v = NowRFC3339Nano()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowRFC3339()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnix()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnixMilli()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
v = NowUnixNano()
|
||
|
assertEqual(t, v.String(), v.String())
|
||
|
|
||
|
}
|