X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6e8530d7d4c7fffe5697fe7269141f8bfef11e68..eccb6ba135ebe1bc73bdeeed89150d3c4ee26126:/sdk/go/arvados/duration_test.go diff --git a/sdk/go/arvados/duration_test.go b/sdk/go/arvados/duration_test.go index fa0ef0aeca..40344d061b 100644 --- a/sdk/go/arvados/duration_test.go +++ b/sdk/go/arvados/duration_test.go @@ -56,8 +56,18 @@ func (s *DurationSuite) TestUnmarshalJSON(c *check.C) { err = json.Unmarshal([]byte(`{"D":"1"}`), &d) c.Check(err, check.ErrorMatches, `.*missing unit in duration "?1"?`) err = json.Unmarshal([]byte(`{"D":"foobar"}`), &d) - c.Check(err, check.ErrorMatches, `.*invalid duration "foobar"`) + c.Check(err, check.ErrorMatches, `.*invalid duration "?foobar"?`) err = json.Unmarshal([]byte(`{"D":"60s"}`), &d) c.Check(err, check.IsNil) c.Check(d.D.Duration(), check.Equals, time.Minute) + + d.D = Duration(time.Second) + err = json.Unmarshal([]byte(`{"D":"0"}`), &d) + c.Check(err, check.IsNil) + c.Check(d.D.Duration(), check.Equals, time.Duration(0)) + + d.D = Duration(time.Second) + err = json.Unmarshal([]byte(`{"D":0}`), &d) + c.Check(err, check.IsNil) + c.Check(d.D.Duration(), check.Equals, time.Duration(0)) }