Mark test helpers as such

This commit is contained in:
Matthew Huxtable 2018-05-04 16:47:08 +01:00 committed by Mike Farah
parent 8072e66d46
commit 56a0771cd1

View File

@ -41,19 +41,21 @@ func parseData(rawData string) yaml.MapSlice {
} }
func assertResult(t *testing.T, expectedValue interface{}, actualValue interface{}) { func assertResult(t *testing.T, expectedValue interface{}, actualValue interface{}) {
t.Helper()
if expectedValue != actualValue { if expectedValue != actualValue {
t.Error("Expected <", expectedValue, "> but got <", actualValue, ">", fmt.Sprintf("%T", actualValue)) t.Error("Expected <", expectedValue, "> but got <", actualValue, ">", fmt.Sprintf("%T", actualValue))
} }
} }
func assertResultComplex(t *testing.T, expectedValue interface{}, actualValue interface{}) { func assertResultComplex(t *testing.T, expectedValue interface{}, actualValue interface{}) {
t.Helper()
if !reflect.DeepEqual(expectedValue, actualValue) { if !reflect.DeepEqual(expectedValue, actualValue) {
t.Error("Expected <", expectedValue, "> but got <", actualValue, ">", fmt.Sprintf("%T", actualValue)) t.Error("Expected <", expectedValue, "> but got <", actualValue, ">", fmt.Sprintf("%T", actualValue))
} }
} }
func assertResultWithContext(t *testing.T, expectedValue interface{}, actualValue interface{}, context interface{}) { func assertResultWithContext(t *testing.T, expectedValue interface{}, actualValue interface{}, context interface{}) {
t.Helper()
if expectedValue != actualValue { if expectedValue != actualValue {
t.Error(context) t.Error(context)
t.Error(": expected <", expectedValue, "> but got <", actualValue, ">") t.Error(": expected <", expectedValue, "> but got <", actualValue, ">")