etcdhttp: add tests for ParseBool/ParseUint64 helpers

release-2.0
Jonathan Boulle 2014-09-10 12:05:36 -07:00
parent e736a11ac4
commit bed63cddf7
1 changed files with 20 additions and 0 deletions

View File

@ -32,6 +32,26 @@ func mustNewRequest(t *testing.T, p string) *http.Request {
}
}
func TestParseBool(t *testing.T) {
got, err := parseBool("")
if got != false {
t.Fatalf("got %t, want %t", got, false)
}
if err != nil {
t.Fatalf("got err=%v, want err=%v", err, nil)
}
}
func TestParseUint64(t *testing.T) {
got, err := parseUint64("")
if got != 0 {
t.Fatalf("got %d, want %d", got, 0)
}
if err != nil {
t.Fatalf("got err=%v, want err=%v", err, nil)
}
}
func TestBadParseRequest(t *testing.T) {
tests := []struct {
in *http.Request