Skip to content

Commit

Permalink
More test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed May 30, 2015
1 parent a9e49e2 commit b9eec15
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 353 deletions.
2 changes: 1 addition & 1 deletion context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestContext(t *testing.T) {
tpl := &Template{
templates: template.Must(template.New("hello").Parse("Hello, {{.}}!")),
}
c.echo.renderer = tpl
c.echo.SetRenderer(tpl)
err = c.Render(http.StatusOK, "hello", "Joe")
if assert.NoError(t, err) {
assert.Equal(t, http.StatusOK, rec.Code)
Expand Down
9 changes: 3 additions & 6 deletions echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ func (e *Echo) WebSocket(path string, h HandlerFunc) {
}

func (e *Echo) add(method, path string, h Handler) {
e.router.Add(method, e.prefix+path, wrapHandler(h), e)
key := runtime.FuncForPC(reflect.ValueOf(h).Pointer()).Name()
e.uris[key] = path
e.router.Add(method, e.prefix+path, wrapHandler(h), e)
}

// Index serves index file.
Expand Down Expand Up @@ -335,10 +335,7 @@ func serveFile(dir, file string, c *Context) error {
return NewHTTPError(http.StatusNotFound)
}

fi, err := f.Stat()
if err != nil {
return NewHTTPError(http.StatusNotFound)
}
fi, _ := f.Stat()
if fi.IsDir() {
return NewHTTPError(http.StatusForbidden)
}
Expand Down Expand Up @@ -538,7 +535,7 @@ func wrapHandler(h Handler) HandlerFunc {
return nil
}
default:
panic("echo unknown handler")
panic("echo => unknown handler")
}
}

Expand Down
Loading

0 comments on commit b9eec15

Please sign in to comment.