mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdhttp: add tests for ParseBool/ParseUint64 helpers
This commit is contained in:
parent
e736a11ac4
commit
bed63cddf7
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user