|
|
@@ -572,66 +572,7 @@ var unmarshalTests = []struct {
|
|
|
},
|
|
|
{
|
|
|
"a: 2015-02-24T18:19:39Z\n",
|
|
|
- map[string]time.Time{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
|
|
|
- },
|
|
|
-
|
|
|
- // Timestamps
|
|
|
- {
|
|
|
- // Date only.
|
|
|
- "a: 2015-01-01\n",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // RFC3339
|
|
|
- "a: 2015-02-24T18:19:39.12Z\n",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 2, 24, 18, 19, 39, .12e9, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // RFC3339 with short dates.
|
|
|
- "a: 2015-2-3T3:4:5Z",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 2, 3, 3, 4, 5, 0, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // ISO8601 lower case t
|
|
|
- "a: 2015-02-24t18:19:39Z\n",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // space separate, no time zone
|
|
|
- "a: 2015-02-24 18:19:39\n",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 2, 24, 18, 19, 39, 0, time.UTC)},
|
|
|
- },
|
|
|
- // Some cases not currently handled. Uncomment these when
|
|
|
- // the code is fixed.
|
|
|
- // {
|
|
|
- // // space separated with time zone
|
|
|
- // "a: 2001-12-14 21:59:43.10 -5",
|
|
|
- // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)},
|
|
|
- // },
|
|
|
- // {
|
|
|
- // // arbitrary whitespace between fields
|
|
|
- // "a: 2001-12-14 \t\t \t21:59:43.10 \t Z",
|
|
|
- // map[string]interface{}{"a": time.Date(2001, 12, 14, 21, 59, 43, .1e9, time.UTC)},
|
|
|
- // },
|
|
|
- {
|
|
|
- // explicit string tag
|
|
|
- "a: !!str 2015-01-01",
|
|
|
- map[string]interface{}{"a": "2015-01-01"},
|
|
|
- },
|
|
|
- {
|
|
|
- // explicit timestamp tag on quoted string
|
|
|
- "a: !!timestamp \"2015-01-01\"",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // explicit timestamp tag on unquoted string
|
|
|
- "a: !!timestamp 2015-01-01",
|
|
|
- map[string]interface{}{"a": time.Date(2015, 1, 1, 0, 0, 0, 0, time.UTC)},
|
|
|
- },
|
|
|
- {
|
|
|
- // quoted string that's a valid timestamp
|
|
|
- "a: \"2015-01-01\"",
|
|
|
- map[string]interface{}{"a": "2015-01-01"},
|
|
|
+ map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)},
|
|
|
},
|
|
|
|
|
|
// Encode empty lists as zero-length slices.
|