mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
switch separator test to use GetFramer
This commit is contained in:
@@ -17,7 +17,7 @@ func TestGoodSeparatorFramer(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "new line separator",
|
name: "new line separator",
|
||||||
framer: framer.NewByteSeparatorFramer([]byte{0x0a}),
|
framer: framer.GetFramer("LF"),
|
||||||
input: []byte("Hello\nWorld\nThis is a test\n"),
|
input: []byte("Hello\nWorld\nThis is a test\n"),
|
||||||
expected: [][]byte{
|
expected: [][]byte{
|
||||||
[]byte("Hello"),
|
[]byte("Hello"),
|
||||||
@@ -26,9 +26,20 @@ func TestGoodSeparatorFramer(t *testing.T) {
|
|||||||
},
|
},
|
||||||
buffer: []byte{},
|
buffer: []byte{},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "CR separator",
|
||||||
|
framer: framer.GetFramer("CR"),
|
||||||
|
input: []byte("Hello\rWorld\rThis is a test\r"),
|
||||||
|
expected: [][]byte{
|
||||||
|
[]byte("Hello"),
|
||||||
|
[]byte("World"),
|
||||||
|
[]byte("This is a test"),
|
||||||
|
},
|
||||||
|
buffer: []byte{},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "CRLF separator",
|
name: "CRLF separator",
|
||||||
framer: framer.NewByteSeparatorFramer([]byte{0x0d, 0x0a}),
|
framer: framer.GetFramer("CRLF"),
|
||||||
input: []byte("Hello\r\nWorld\r\nThis is a test\r\n"),
|
input: []byte("Hello\r\nWorld\r\nThis is a test\r\n"),
|
||||||
expected: [][]byte{
|
expected: [][]byte{
|
||||||
[]byte("Hello"),
|
[]byte("Hello"),
|
||||||
@@ -39,7 +50,7 @@ func TestGoodSeparatorFramer(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "extra data after separator",
|
name: "extra data after separator",
|
||||||
framer: framer.NewByteSeparatorFramer([]byte{0x0d, 0x0a}),
|
framer: framer.GetFramer("CRLF"),
|
||||||
input: []byte("Hello\r\nWorld\r\nThis is a test\r\nextra"),
|
input: []byte("Hello\r\nWorld\r\nThis is a test\r\nextra"),
|
||||||
expected: [][]byte{
|
expected: [][]byte{
|
||||||
[]byte("Hello"),
|
[]byte("Hello"),
|
||||||
|
|||||||
Reference in New Issue
Block a user