package textedit_test import ( "bytes" "code.squareroundforest.org/arpio/textedit" "testing" ) func TestSingleLine(t *testing.T) { t.Run("basic", func(t *testing.T) { var b bytes.Buffer w := textedit.New(&b, textedit.SingleLine()) w.Write([]byte("\nfoo bar\n\nbaz \nqux quux\n")) w.Flush() if b.String() != "foo bar baz qux quux" { t.Fatal(b.String()) } }) t.Run("two lines", func(t *testing.T) { var b bytes.Buffer w := textedit.New(&b, textedit.SingleLine()) w.Write([]byte("Some sample text...\nwith invalid chars.")) w.Flush() if b.String() != "Some sample text... with invalid chars." { t.Fatal(b.String()) } }) }