projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
16561: Replace ListenAddr with per-internal-url ListenURL.
[arvados.git]
/
sdk
/
go
/
arvados
/
duration_test.go
diff --git
a/sdk/go/arvados/duration_test.go
b/sdk/go/arvados/duration_test.go
index 257a2b4ef54156d65b22bafb3152cc067de6cd13..6a198e69400201f803566b4e19022158956c50be 100644
(file)
--- a/
sdk/go/arvados/duration_test.go
+++ b/
sdk/go/arvados/duration_test.go
@@
-23,6
+23,7
@@
func (s *DurationSuite) TestMarshalJSON(c *check.C) {
c.Check(err, check.IsNil)
c.Check(d.D, check.Equals, Duration(time.Second+234*time.Millisecond))
buf, err := json.Marshal(d)
c.Check(err, check.IsNil)
c.Check(d.D, check.Equals, Duration(time.Second+234*time.Millisecond))
buf, err := json.Marshal(d)
+ c.Check(err, check.IsNil)
c.Check(string(buf), check.Equals, `{"D":"1.234s"}`)
for _, trial := range []struct {
c.Check(string(buf), check.Equals, `{"D":"1.234s"}`)
for _, trial := range []struct {
@@
-49,13
+50,13
@@
func (s *DurationSuite) TestUnmarshalJSON(c *check.C) {
D Duration
}
err := json.Unmarshal([]byte(`{"D":1.234}`), &d)
D Duration
}
err := json.Unmarshal([]byte(`{"D":1.234}`), &d)
- c.Check(err, check.ErrorMatches, `
missing unit in duration 1.234
`)
+ c.Check(err, check.ErrorMatches, `
.*missing unit in duration "?1\.234"?
`)
err = json.Unmarshal([]byte(`{"D":"1.234"}`), &d)
err = json.Unmarshal([]byte(`{"D":"1.234"}`), &d)
- c.Check(err, check.ErrorMatches, `.*missing unit in duration
1.234
`)
+ c.Check(err, check.ErrorMatches, `.*missing unit in duration
"?1\.234"?
`)
err = json.Unmarshal([]byte(`{"D":"1"}`), &d)
err = json.Unmarshal([]byte(`{"D":"1"}`), &d)
- c.Check(err, check.ErrorMatches, `.*missing unit in duration
1
`)
+ c.Check(err, check.ErrorMatches, `.*missing unit in duration
"?1"?
`)
err = json.Unmarshal([]byte(`{"D":"foobar"}`), &d)
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)
err = json.Unmarshal([]byte(`{"D":"60s"}`), &d)
c.Check(err, check.IsNil)
c.Check(d.D.Duration(), check.Equals, time.Minute)