first commit

way too late.
This commit is contained in:
didier amyot committed 2015-02-06 22:03:05 -08:00
commit d4f7dc57fc
53 files changed
+3518

No files matched your search

+37
View File
@@ -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()
}
}