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",
|
||||
framer: framer.NewByteSeparatorFramer([]byte{0x0a}),
|
||||
framer: framer.GetFramer("LF"),
|
||||
input: []byte("Hello\nWorld\nThis is a test\n"),
|
||||
expected: [][]byte{
|
||||
[]byte("Hello"),
|
||||
@@ -26,9 +26,20 @@ func TestGoodSeparatorFramer(t *testing.T) {
|
||||
},
|
||||
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",
|
||||
framer: framer.NewByteSeparatorFramer([]byte{0x0d, 0x0a}),
|
||||
framer: framer.GetFramer("CRLF"),
|
||||
input: []byte("Hello\r\nWorld\r\nThis is a test\r\n"),
|
||||
expected: [][]byte{
|
||||
[]byte("Hello"),
|
||||
@@ -39,7 +50,7 @@ func TestGoodSeparatorFramer(t *testing.T) {
|
||||
},
|
||||
{
|
||||
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"),
|
||||
expected: [][]byte{
|
||||
[]byte("Hello"),
|
||||
|
||||
Reference in New Issue
Block a user