first commit
way too late.
This commit is contained in:
commit
d4f7dc57fc
53 files changed
+3518
No files matched your search
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestWrite404Error(t *testing.T) {
|
||||
rw := httptest.NewRecorder()
|
||||
Write404Error(rw)
|
||||
if rw.Code != 404 {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func TestWrite500Error(t *testing.T) {
|
||||
rw := httptest.NewRecorder()
|
||||
Write500Error(rw, errors.New("blah"))
|
||||
if rw.Code != 500 {
|
||||
t.Error()
|
||||
}
|
||||
if string(rw.Body.Bytes()) != "server error" {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
|
||||
func TestWrite400Error(t *testing.T) {
|
||||
rw := httptest.NewRecorder()
|
||||
Write400Error(rw, errors.New("blah"))
|
||||
if rw.Code != 400 {
|
||||
t.Error()
|
||||
}
|
||||
if string(rw.Body.Bytes()) != "blah" {
|
||||
t.Error()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user