-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
language: go | ||
|
||
go: | ||
- 1.2 | ||
- 1.3 | ||
- 1.4 | ||
- 1.5 | ||
- 1.6 | ||
- 1.7 | ||
- 1.8 | ||
- 1.9 | ||
- 1.10 | ||
- tip | ||
|
||
script: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package golf | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ( | ||
ErrChunkTooSmall = errors.New("chunk size is too small, it must be at least 13") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,44 @@ | ||
package golf | ||
|
||
import ( | ||
. "gopkg.in/check.v1" | ||
"github.com/aphistic/sweet" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func (s *GolfSuite) TestGenDefaultMessageWithFormatNoParams(c *C) { | ||
func (s *GolfSuite) TestGenDefaultMessageWithFormatNoParams(t sweet.T) { | ||
cl, err := NewClient() | ||
c.Assert(cl, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(cl).ToNot(BeNil()) | ||
|
||
l, err := cl.NewLogger() | ||
c.Assert(l, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(l).ToNot(BeNil()) | ||
|
||
DefaultLogger(l) | ||
|
||
// Tests to make sure a string won't be double-formatted if | ||
// no paramters are passed to the format string | ||
msg := genDefaultMsg(nil, 1, "%2b") | ||
c.Check(msg.Level, Equals, 1) | ||
c.Check(msg.ShortMessage, Equals, "%2b") | ||
c.Check(msg.Attrs, IsNil) | ||
Expect(msg.Level).To(Equal(1)) | ||
Expect(msg.ShortMessage).To(Equal("%2b")) | ||
Expect(msg.Attrs).To(BeNil()) | ||
} | ||
|
||
func (s *GolfSuite) TestGenDefaultMessageWithFormat(c *C) { | ||
func (s *GolfSuite) TestGenDefaultMessageWithFormat(t sweet.T) { | ||
cl, err := NewClient() | ||
c.Assert(cl, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(cl).ToNot(BeNil()) | ||
|
||
l, err := cl.NewLogger() | ||
c.Assert(l, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(l).ToNot(BeNil()) | ||
|
||
DefaultLogger(l) | ||
|
||
// Tests to make sure a string will be formatted if | ||
// paramters are passed to the format string | ||
msg := genDefaultMsg(nil, 1, "%2b", true) | ||
c.Check(msg.Level, Equals, 1) | ||
c.Check(msg.ShortMessage, Equals, "%!b(bool=true)") | ||
c.Check(msg.Attrs, IsNil) | ||
Expect(msg.Level).To(Equal(1)) | ||
Expect(msg.ShortMessage).To(Equal("%!b(bool=true)")) | ||
Expect(msg.Attrs).To(BeNil()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
package golf | ||
|
||
import . "gopkg.in/check.v1" | ||
import ( | ||
"github.com/aphistic/sweet" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func (s *GolfSuite) TestGenMessageWithFormatNoParams(c *C) { | ||
func (s *GolfSuite) TestGenMessageWithFormatNoParams(t sweet.T) { | ||
cl, err := NewClient() | ||
c.Assert(cl, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(cl).ToNot(BeNil()) | ||
|
||
l, err := cl.NewLogger() | ||
c.Assert(l, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(l).ToNot(BeNil()) | ||
|
||
// Tests to make sure a string won't be double-formatted if | ||
// no paramters are passed to the format string | ||
msg := l.genMsg(nil, 1, "%2b") | ||
c.Check(msg.Level, Equals, 1) | ||
c.Check(msg.ShortMessage, Equals, "%2b") | ||
c.Check(msg.Attrs, IsNil) | ||
Expect(msg.Level).To(Equal(1)) | ||
Expect(msg.ShortMessage).To(Equal("%2b")) | ||
Expect(msg.Attrs).To(BeNil()) | ||
} | ||
|
||
func (s *GolfSuite) TestGenMessageWithFormat(c *C) { | ||
func (s *GolfSuite) TestGenMessageWithFormat(t sweet.T) { | ||
cl, err := NewClient() | ||
c.Assert(cl, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(cl).ToNot(BeNil()) | ||
|
||
l, err := cl.NewLogger() | ||
c.Assert(l, NotNil) | ||
c.Assert(err, IsNil) | ||
Expect(err).To(BeNil()) | ||
Expect(l).ToNot(BeNil()) | ||
|
||
// Tests to make sure a string will be formatted if | ||
// paramters are passed to the format string | ||
msg := l.genMsg(nil, 1, "%2b", true) | ||
c.Check(msg.Level, Equals, 1) | ||
c.Check(msg.ShortMessage, Equals, "%!b(bool=true)") | ||
c.Check(msg.Attrs, IsNil) | ||
Expect(msg.Level).To(Equal(1)) | ||
Expect(msg.ShortMessage).To(Equal("%!b(bool=true)")) | ||
Expect(msg.Attrs).To(BeNil()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters