2025-11-01 03:49:02 +01:00
|
|
|
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())
|
2025-11-01 05:14:20 +01:00
|
|
|
w.Write([]byte("\nfoo bar\n\nbaz \nqux quux\n"))
|
|
|
|
|
w.Flush()
|
2025-11-01 03:49:02 +01:00
|
|
|
if b.String() != "foo bar baz qux quux" {
|
|
|
|
|
t.Fatal(b.String())
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|