From d0fefed9b627fbe0c1597ac29ed5f48ff2eb9064 Mon Sep 17 00:00:00 2001 From: Gustavo Niemeyer Date: Tue, 24 Feb 2015 19:53:31 -0300 Subject: [PATCH] Fix timezone handling in time tests. --- decode_test.go | 2 +- encode_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/decode_test.go b/decode_test.go index 593406b..04fdd9e 100644 --- a/decode_test.go +++ b/decode_test.go @@ -550,7 +550,7 @@ var unmarshalTests = []struct { map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, }, { - "a: 2015-02-24T15:19:39-03:00\n", + "a: 2015-02-24T18:19:39Z\n", map[string]time.Time{"a": time.Unix(1424801979, 0)}, }, diff --git a/encode_test.go b/encode_test.go index a948e17..ba68ad2 100644 --- a/encode_test.go +++ b/encode_test.go @@ -10,6 +10,7 @@ import ( . "gopkg.in/check.v1" "gopkg.in/yaml.v2" "net" + "os" ) var marshalIntTest = 123 @@ -297,7 +298,7 @@ var marshalTests = []struct { }, { map[string]time.Time{"a": time.Unix(1424801979, 0)}, - "a: 2015-02-24T15:19:39-03:00\n", + "a: 2015-02-24T18:19:39Z\n", }, // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible). @@ -308,6 +309,8 @@ var marshalTests = []struct { } func (s *S) TestMarshal(c *C) { + defer os.Setenv("TZ", os.Getenv("TZ")) + os.Setenv("TZ", "UTC") for _, item := range marshalTests { data, err := yaml.Marshal(item.value) c.Assert(err, IsNil)