tile38/internal/log/log_test.go
tidwall c084aeedc2 Code cleanup
This commit cleans up various Go code in the internal directory.
- Ensures comments on exported functions
- Changes all *Server receiver in all files to be "s", instead
  of mixed "c", "s", "server", etc.
- Silenced Go warnings for if/else with returns.
- Cleaned up import ordering.
2019-10-30 10:17:59 -07:00

26 lines
385 B
Go

package log
import (
"bytes"
"io/ioutil"
"strings"
"testing"
)
func TestLog(t *testing.T) {
f := &bytes.Buffer{}
SetOutput(f)
Printf("hello %v", "everyone")
if !strings.HasSuffix(f.String(), "hello everyone\n") {
t.Fatal("fail")
}
}
func BenchmarkLogPrintf(t *testing.B) {
SetOutput(ioutil.Discard)
t.ResetTimer()
for i := 0; i < t.N; i++ {
Printf("X %s", "Y")
}
}