aboutsummaryrefslogtreecommitdiffstats
path: root/pktline/decoder_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2015-10-23 12:05:02 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2015-10-23 12:05:02 +0200
commit214e1dca024fb6da5ed65564d2de734df5dc2127 (patch)
tree0c2805a0676006690a8053ae8ccee388ccfc83fe /pktline/decoder_test.go
parent70923099e61fa33f0bc5256d2f938fa44c4df10e (diff)
downloadgo-git-214e1dca024fb6da5ed65564d2de734df5dc2127.tar.gz
format/pktline: review and improving coverage
Diffstat (limited to 'pktline/decoder_test.go')
-rw-r--r--pktline/decoder_test.go70
1 files changed, 0 insertions, 70 deletions
diff --git a/pktline/decoder_test.go b/pktline/decoder_test.go
deleted file mode 100644
index 7899cc8..0000000
--- a/pktline/decoder_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package pktline
-
-import (
- "strings"
- "testing"
-
- . "gopkg.in/check.v1"
-)
-
-func Test(t *testing.T) { TestingT(t) }
-
-type DecoderSuite struct{}
-
-var _ = Suite(&DecoderSuite{})
-
-func (s *DecoderSuite) TestReadLine(c *C) {
- j := &Decoder{strings.NewReader("0006a\n")}
-
- line, err := j.ReadLine()
- c.Assert(err, IsNil)
- c.Assert(line, Equals, "a\n")
-}
-
-func (s *DecoderSuite) TestReadLineBufferUnderflow(c *C) {
- j := &Decoder{strings.NewReader("00e7a\n")}
-
- line, err := j.ReadLine()
- c.Assert(err, Equals, ErrUnderflow)
- c.Assert(line, Equals, "")
-}
-
-func (s *DecoderSuite) TestReadLineBufferInvalidLen(c *C) {
- j := &Decoder{strings.NewReader("0001foo\n")}
-
- line, err := j.ReadLine()
- c.Assert(err, Equals, ErrInvalidLen)
- c.Assert(line, Equals, "")
-}
-
-func (s *DecoderSuite) TestReadBlock(c *C) {
- j := &Decoder{strings.NewReader("0006a\n")}
-
- lines, err := j.ReadBlock()
- c.Assert(err, IsNil)
- c.Assert(lines, HasLen, 1)
- c.Assert(lines[0], Equals, "a\n")
-}
-
-func (s *DecoderSuite) TestReadBlockWithFlush(c *C) {
- j := &Decoder{strings.NewReader("0006a\n0006b\n00000006c\n")}
-
- lines, err := j.ReadBlock()
- c.Assert(err, IsNil)
- c.Assert(lines, HasLen, 2)
- c.Assert(lines[0], Equals, "a\n")
- c.Assert(lines[1], Equals, "b\n")
-}
-
-func (s *DecoderSuite) TestReadAll(c *C) {
- j := &Decoder{strings.NewReader("0006a\n0006b\n00000006c\n0006d\n0006e\n")}
-
- lines, err := j.ReadAll()
- c.Assert(err, IsNil)
- c.Assert(lines, HasLen, 5)
- c.Assert(lines[0], Equals, "a\n")
- c.Assert(lines[1], Equals, "b\n")
- c.Assert(lines[2], Equals, "c\n")
- c.Assert(lines[3], Equals, "d\n")
- c.Assert(lines[4], Equals, "e\n")
-}