// Test using Println("hello", 23, "world") or using Printf("hello %d world", 23)
func testPrint(t *testing.T, flag int, prefix string, pattern string, useFormat bool) {
- buf := new(bytes.Buffer)
+ buf := new(strings.Builder)
SetOutput(buf)
SetFlags(flag)
SetPrefix(prefix)
func TestOutput(t *testing.T) {
const testString = "test"
- var b bytes.Buffer
+ var b strings.Builder
l := New(&b, "", 0)
l.Println(testString)
if expect := testString + "\n"; b.String() != expect {
}
func TestUTCFlag(t *testing.T) {
- var b bytes.Buffer
+ var b strings.Builder
l := New(&b, "Test:", LstdFlags)
l.SetFlags(Ldate | Ltime | LUTC)
// Verify a log message looks right in the right time zone. Quantize to the second only.
}
func TestEmptyPrintCreatesLine(t *testing.T) {
- var b bytes.Buffer
+ var b strings.Builder
l := New(&b, "Header:", LstdFlags)
l.Print()
l.Println("non-empty")