You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
538 B
Go
26 lines
538 B
Go
1 year ago
|
package nbyte_test
|
||
|
|
||
|
import (
|
||
|
"git.noahlan.cn/noahlan/ntool/nbyte"
|
||
|
"git.noahlan.cn/noahlan/ntool/ntest/assert"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestBuffer_WriteAny(t *testing.T) {
|
||
|
buf := nbyte.NewBuffer()
|
||
|
|
||
|
buf.QuietWritef("ab-%s", "c")
|
||
|
buf.QuietWriteByte('d')
|
||
|
assert.Eq(t, "ab-cd", buf.ResetAndGet())
|
||
|
|
||
|
buf.QuietWriteString("ab", "-", "cd")
|
||
|
buf.MustWriteString("-ef")
|
||
|
assert.Eq(t, "ab-cd-ef", buf.ResetAndGet())
|
||
|
|
||
|
buf.WriteAny(23, "abc")
|
||
|
assert.Eq(t, "23abc", buf.ResetAndGet())
|
||
|
|
||
|
buf.Writeln("abc")
|
||
|
assert.Eq(t, "abc\n", buf.ResetAndGet())
|
||
|
}
|