You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/04/16 19:53:19 UTC
[incubator-trafficcontrol] 02/02: hardcode timezone for time JSON
test
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-trafficcontrol.git
commit 8d1c155a4d066dd7c28f987bc8dfee0ee7e8e796
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Mon Apr 16 13:37:25 2018 -0600
hardcode timezone for time JSON test
---
lib/go-tc/time_test.go | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/go-tc/time_test.go b/lib/go-tc/time_test.go
index 4339994..223d558 100644
--- a/lib/go-tc/time_test.go
+++ b/lib/go-tc/time_test.go
@@ -25,16 +25,21 @@ import (
"time"
)
-var jsonTests = []struct {
- time Time
- json string
-}{
- {Time{Time: time.Date(9999, 4, 12, 23, 20, 50, 520*1e6, time.Local)}, `"9999-04-12 23:20:50-07"`},
- {Time{Time: time.Date(1996, 12, 19, 16, 39, 57, 0, time.UTC)}, `"1996-12-19 16:39:57+00"`},
-}
-
// TestJSON tests that we get format tc uses for lastUpdated fields
-func TestJSON(t *testing.T) {
+func TestTimeJSON(t *testing.T) {
+ mst, err := time.LoadLocation("MST")
+ if err != nil {
+ t.Fatalf("unable to get MST location: %v", err)
+ }
+
+ var jsonTests = []struct {
+ time Time
+ json string
+ }{
+ {Time{Time: time.Date(9999, 4, 12, 23, 20, 50, 520*1e6, mst)}, `"9999-04-12 23:20:50-07"`},
+ {Time{Time: time.Date(1996, 12, 19, 16, 39, 57, 0, time.UTC)}, `"1996-12-19 16:39:57+00"`},
+ }
+
for _, tm := range jsonTests {
got, err := json.Marshal(tm.time)
--
To stop receiving notification emails like this one, please contact
mitchell852@apache.org.