summaryrefslogtreecommitdiffstats
path: root/roseh.moe_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'roseh.moe_test.go')
-rw-r--r--roseh.moe_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/roseh.moe_test.go b/roseh.moe_test.go
new file mode 100644
index 0000000..cf41cd0
--- /dev/null
+++ b/roseh.moe_test.go
@@ -0,0 +1,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)
+ }
+}