blob: cf41cd0ae1517037f6e6e9f41b1128921f5fd8aa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package main
import (
"testing"
"time"
)
func TestMarshalTime(t *testing.T) {
now := time.Now().Truncate(time.Second)
b := marshalTime(now)
got, ok := unmarshalTime(b)
if !ok {
t.Fatalf("Failed round trip")
}
if !got.Equal(now) {
t.Errorf("Failed round trip. unmarshalTime(%v) = %v, want %v", b, got, now)
}
}
|