mirror of
https://github.com/labstack/echo.git
synced 2025-03-17 21:08:05 +02:00
adding tests for setting log output and prefix to make coveralls happy
This commit is contained in:
parent
4ad737c418
commit
be8a2212d8
15
echo_test.go
15
echo_test.go
@ -1,6 +1,7 @@
|
||||
package echo
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@ -41,6 +42,20 @@ func TestEcho(t *testing.T) {
|
||||
assert.Equal(t, http.StatusInternalServerError, rec.Code)
|
||||
}
|
||||
|
||||
func TestLogger(t *testing.T) {
|
||||
prefix := "extremely-long-prefix-string-that-wont-exist"
|
||||
e := New()
|
||||
|
||||
var b bytes.Buffer
|
||||
out := bufio.NewWriter(&b)
|
||||
|
||||
e.logger.SetPrefix(prefix)
|
||||
e.logger.SetOutput(out)
|
||||
e.logger.Print("test")
|
||||
|
||||
assert.Contains(t, "extremely-long-prefix-string", b.String())
|
||||
}
|
||||
|
||||
func TestEchoIndex(t *testing.T) {
|
||||
e := New()
|
||||
e.Index("_fixture/index.html")
|
||||
|
Loading…
x
Reference in New Issue
Block a user