(t *testing.T)
| 252 | } |
| 253 | |
| 254 | func TestMarshalTimeJson(t *testing.T) { |
| 255 | var timesToMarshal = []struct { |
| 256 | in time.Time |
| 257 | out string |
| 258 | }{ |
| 259 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", -6*60*60)), |
| 260 | out: "\"2018-05-30T09:30:10-06:00\""}, |
| 261 | {in: time.Date(2018, 5, 30, 9, 30, 10, 500000000, time.UTC), |
| 262 | out: "\"2018-05-30T09:30:10.5Z\""}, |
| 263 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", -23*60*60)), |
| 264 | out: "\"2018-05-30T09:30:10-23:00\""}, |
| 265 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", -24*60*60)), |
| 266 | out: "\"2018-05-30T09:30:10-24:00\""}, |
| 267 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 23*60*60)), |
| 268 | out: "\"2018-05-30T09:30:10+23:00\""}, |
| 269 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 23*60*60+58*60)), |
| 270 | out: "\"2018-05-30T09:30:10+23:58\""}, |
| 271 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 24*60*60)), |
| 272 | out: "\"2018-05-30T09:30:10+24:00\""}, |
| 273 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", -30*60*60)), |
| 274 | out: "\"2018-05-30T09:30:10-30:00\""}, |
| 275 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 30*60*60)), |
| 276 | out: "\"2018-05-30T09:30:10+30:00\""}, |
| 277 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 45*60*60)), |
| 278 | out: "\"2018-05-30T09:30:10+45:00\""}, |
| 279 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 45*60*60+34*60)), |
| 280 | out: "\"2018-05-30T09:30:10+45:34\""}, |
| 281 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 49*60*60+59*60)), |
| 282 | out: "\"2018-05-30T09:30:10+49:59\""}, |
| 283 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", -99*60*60)), |
| 284 | out: "\"2018-05-30T09:30:10-99:00\""}, |
| 285 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 99*60*60)), |
| 286 | out: "\"2018-05-30T09:30:10+99:00\""}, |
| 287 | {in: time.Date(2018, 5, 30, 9, 30, 10, 0, time.FixedZone("", 100*60*60+23*60)), |
| 288 | out: "\"2018-05-30T09:30:10+100:23\""}, |
| 289 | } |
| 290 | |
| 291 | for _, tc := range timesToMarshal { |
| 292 | out, err := marshalTimeJson(tc.in) |
| 293 | require.NoError(t, err) |
| 294 | require.Equal(t, tc.out, string(out)) |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | func TestMarshalFloat(t *testing.T) { |
| 299 | var ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…