switch separator test to use GetFramer

This commit is contained in:
Joel Wetzell
2025-12-24 18:17:57 -06:00
parent efdcbae5c4
commit 460d2f051d

View File

@@ -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"),