smtpd/wrap_test.go
2016-02-12 01:26:50 +00:00

25 lines
769 B
Go

package smtpd
import (
"testing"
)
func TestWrap(t *testing.T) {
cases := map[string]string{
"foobar": "foobar",
"foobar quux": "foobar quux",
"foobar\r\n": "foobar\r\n",
"foobar\r\nquux": "foobar\r\nquux",
"foobar quux foobar quux foobar quux foobar quux foobar quux foobar quux foobar quux foobar quux": "foobar quux foobar quux foobar quux foobar quux foobar quux foobar quux foobar\r\n\tquux foobar quux",
"foobar quux foobar quux foobar quux foobar quux foobar quux foobar\r\n\tquux foobar quux foobar quux": "foobar quux foobar quux foobar quux foobar quux foobar quux foobar\r\n\tquux foobar quux foobar quux",
}
for k, v := range cases {
if string(wrap([]byte(k))) != v {
t.Fatal("Didn't wrap correctly.")
}
}
}