Skip to content

Commit

Permalink
Merge pull request #10 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 1.5.1
  • Loading branch information
andyone authored May 11, 2018
2 parents 021b222 + fe62a70 commit ac05f57
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ func (c *ContainerID) UnmarshalJSON(b []byte) error {

// UnmarshalJSON is custom position unmarshaler
func (ep *ExtensionPosition) UnmarshalJSON(b []byte) error {
if string(b) == "none" {
*ep = -1
if string(b) == "\"none\"" {
*ep = ExtensionPosition(-1)
return nil
}

Expand Down
14 changes: 12 additions & 2 deletions confluence_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,27 @@ func (s *ConfluenceSuite) TestParamsEncoding(c *C) {
}

func (s *ConfluenceSuite) TestCustomUnmarshalers(c *C) {
var err error

d := &Date{}
d.UnmarshalJSON([]byte("\"2013-03-12T10:36:12.602+04:00\""))
err = d.UnmarshalJSON([]byte("\"2013-03-12T10:36:12.602+04:00\""))

c.Assert(err, IsNil)
c.Assert(d.Year(), Equals, 2013)
c.Assert(d.Month(), Equals, time.Month(3))
c.Assert(d.Day(), Equals, 12)

t := &Timestamp{}
t.UnmarshalJSON([]byte("1523059214803"))
err = t.UnmarshalJSON([]byte("1523059214803"))

c.Assert(err, IsNil)
c.Assert(t.Year(), Equals, 2018)
c.Assert(t.Month(), Equals, time.Month(4))
c.Assert(t.Day(), Equals, 7)

var e ExtensionPosition
err = e.UnmarshalJSON([]byte("\"none\""))

c.Assert(err, IsNil)
c.Assert(e, Equals, ExtensionPosition(-1))
}
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const (
NAME = "Go-Confluence"

// VERSION is package version
VERSION = "1.5.0"
VERSION = "1.5.1"
)

// ////////////////////////////////////////////////////////////////////////////////// //

0 comments on commit ac05f57

Please sign in to comment.