From e03c43e1f929a127cc284393050475c2c9c6dd65 Mon Sep 17 00:00:00 2001 From: Cameron Walters Date: Mon, 29 Sep 2014 18:24:23 -0700 Subject: [PATCH] Adds a failing test for time output based on encoding.TextMarshaler --- formatter_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/formatter_test.go b/formatter_test.go index 1b55ae5..03f867f 100644 --- a/formatter_test.go +++ b/formatter_test.go @@ -5,6 +5,7 @@ import ( "io" "strings" "testing" + "time" "unsafe" ) @@ -259,3 +260,13 @@ func TestCycle(t *testing.T) { *iv = *i t.Logf("Example long interface cycle:\n%# v", Formatter(i)) } + +func TestTime(t *testing.T) { + date := time.Date(2006, 1, 2, 3, 4, 5, .678901e9, time.Local) + d, _ := date.MarshalText() + s := fmt.Sprintf("%# v", Formatter(date)) + + if s != string(d) { + t.Errorf("expected %s, got %s", string(d), s) + } +}