Update test logs for uniformity and consistency

Many minor fixes to make test logs more consistent and correct a
mispelling.

Standardize on "[%i] got X but expected Y" for log messages. Using
a consistent layout makes it easier to read the test results. This
was mostly changing "Got" to "got". Swapped the order of values on
several calls to bring them in line with the convention.

A few log messages had a sequence number added to identify the
exact scenario that failed. Otherwise, there would be no way to
ascertain which failed When there are many scenarios.

Correct spelling of "expected."

Fixes #1028
Merged be2097e1ad

[close #1040]
This commit is contained in:
bep
2015-04-05 21:03:16 +02:00
committed by spf13
parent 2b91b480d0
commit a52e508d46
7 changed files with 26 additions and 25 deletions

View File

@@ -271,7 +271,7 @@ func TestIn(t *testing.T) {
result := In(this.v1, this.v2)
if result != this.expect {
t.Errorf("[%d] Got %v but expected %v", i, result, this.expect)
t.Errorf("[%d] got %v but expected %v", i, result, this.expect)
}
}
}
@@ -310,7 +310,7 @@ func TestSlicestr(t *testing.T) {
continue
}
if !reflect.DeepEqual(result, this.expect) {
t.Errorf("[%d] Got %s but expected %s", i, result, this.expect)
t.Errorf("[%d] got %s but expected %s", i, result, this.expect)
}
}
}
@@ -350,7 +350,7 @@ func TestSubstr(t *testing.T) {
continue
}
if !reflect.DeepEqual(result, this.expect) {
t.Errorf("[%d] Got %s but expected %s", i, result, this.expect)
t.Errorf("[%d] got %s but expected %s", i, result, this.expect)
}
}
}
@@ -380,7 +380,7 @@ func TestSplit(t *testing.T) {
continue
}
if !reflect.DeepEqual(result, this.expect) {
t.Errorf("[%d] Got %s but expected %s", i, result, this.expect)
t.Errorf("[%d] got %s but expected %s", i, result, this.expect)
}
}
}
@@ -413,20 +413,20 @@ func TestIntersect(t *testing.T) {
continue
}
if !reflect.DeepEqual(results, this.expect) {
t.Errorf("[%d] Got %v but expected %v", i, results, this.expect)
t.Errorf("[%d] got %v but expected %v", i, results, this.expect)
}
}
_, err1 := Intersect("not an array or slice", []string{"a"})
if err1 == nil {
t.Error("Excpected error for non array as first arg")
t.Error("Expected error for non array as first arg")
}
_, err2 := Intersect([]string{"a"}, "not an array or slice")
if err2 == nil {
t.Error("Excpected error for non array as second arg")
t.Error("Expected error for non array as second arg")
}
}
@@ -1225,3 +1225,4 @@ func TestSafeURL(t *testing.T) {
}
}
}