Skip to content

Commit

Permalink
Complete the testing for decoding datetime with UTC offset
Browse files Browse the repository at this point in the history
Kudos to @nathany who wrote:

> It looks like the simple struct below should include a few more fields
> and answer should do a comparison of these to complete the testing.

in his code review for Pull Request #182.
  • Loading branch information
anthonyfok committed Jun 26, 2017
1 parent 8b58b60 commit afe6997
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ age = 250
andrew = "gallant"
kait = "brady"
now = 1987-07-05T05:45:00Z
nowCanada = 2017-06-22T02:14:36-06:00
nowChina = 2017-06-22T16:15:21+08:00
nowEast = 2017-06-22T16:15:21+08:00
nowWest = 2017-06-22T02:14:36-06:00
yesOrNo = true
pi = 3.14
colors = [
Expand All @@ -40,6 +40,8 @@ cauchy = "cat 2"
Pi float64
YesOrNo bool
Now time.Time
NowEast time.Time
NowWest time.Time
Andrew string
Kait string
My map[string]cats
Expand All @@ -55,11 +57,21 @@ cauchy = "cat 2"
if err != nil {
panic(err)
}
nowEast, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-06-22T16:15:21+08:00")
if err != nil {
panic(err)
}
nowWest, err := time.Parse("2006-01-02T15:04:05-07:00", "2017-06-22T02:14:36-06:00")
if err != nil {
panic(err)
}
var answer = simple{
Age: 250,
Andrew: "gallant",
Kait: "brady",
Now: now,
NowEast: nowEast,
NowWest: nowWest,
YesOrNo: true,
Pi: 3.14,
Colors: [][]string{
Expand Down

0 comments on commit afe6997

Please sign in to comment.