1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 func TestPrintfLine(t
*testing
.T
) {
15 w
:= NewWriter(bufio
.NewWriter(&buf
))
16 err
:= w
.PrintfLine("foo %d", 123)
17 if s
:= buf
.String(); s
!= "foo 123\r\n" || err
!= nil {
18 t
.Fatalf("s=%q; err=%s", s
, err
)
22 func TestDotWriter(t
*testing
.T
) {
24 w
:= NewWriter(bufio
.NewWriter(&buf
))
26 n
, err
:= d
.Write([]byte("abc\n.def\n..ghi\n.jkl\n."))
27 if n
!= 21 || err
!= nil {
28 t
.Fatalf("Write: %d, %s", n
, err
)
31 want
:= "abc\r\n..def\r\n...ghi\r\n..jkl\r\n..\r\n.\r\n"
32 if s
:= buf
.String(); s
!= want
{
33 t
.Fatalf("wrote %q", s
)