Better names for tests
This commit is contained in:
+5
-5
@@ -5,35 +5,35 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEmptyStringIsEmptyReason(t *testing.T) {
|
func TestEmptyReasonWhenEmptyString(t *testing.T) {
|
||||||
r := &nethttp.Response{Status: ""}
|
r := &nethttp.Response{Status: ""}
|
||||||
if GetReason(r) != "" {
|
if GetReason(r) != "" {
|
||||||
t.Errorf("We consider an empty status line to have an empty reason")
|
t.Errorf("We consider an empty status line to have an empty reason")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOnlyCodeIsEmptyReason(t *testing.T) {
|
func TestEmptyReasonWhenOnlyCode(t *testing.T) {
|
||||||
r := &nethttp.Response{Status: "200"}
|
r := &nethttp.Response{Status: "200"}
|
||||||
if GetReason(r) != "" {
|
if GetReason(r) != "" {
|
||||||
t.Errorf("We consider an status line with just the status code to have an empty reason")
|
t.Errorf("We consider an status line with just the status code to have an empty reason")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOnlyCodePlusSpaceIsEmptyReason(t *testing.T) {
|
func TestEmptyReasonWhenOnlyCodePlusSpace(t *testing.T) {
|
||||||
r := &nethttp.Response{Status: "200 "}
|
r := &nethttp.Response{Status: "200 "}
|
||||||
if GetReason(r) != "" {
|
if GetReason(r) != "" {
|
||||||
t.Errorf("We consider an status line with just the status code to have an empty reason")
|
t.Errorf("We consider an status line with just the status code to have an empty reason")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOneWordReason(t *testing.T) {
|
func TestReasonOfOneWord(t *testing.T) {
|
||||||
r := &nethttp.Response{Status: "200 FOO"}
|
r := &nethttp.Response{Status: "200 FOO"}
|
||||||
if GetReason(r) != "FOO" {
|
if GetReason(r) != "FOO" {
|
||||||
t.Errorf("Unexpected reason found")
|
t.Errorf("Unexpected reason found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMultiWordReason(t *testing.T) {
|
func TestReasonOfMultipleWords(t *testing.T) {
|
||||||
r := &nethttp.Response{Status: "200 FOO BAR BAZ"}
|
r := &nethttp.Response{Status: "200 FOO BAR BAZ"}
|
||||||
if GetReason(r) != "FOO BAR BAZ" {
|
if GetReason(r) != "FOO BAR BAZ" {
|
||||||
t.Errorf("Unexpected reason found")
|
t.Errorf("Unexpected reason found")
|
||||||
|
|||||||
Reference in New Issue
Block a user