Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ the problem actually occurred in calling code.*/
// of each stack frame leading from the current test to the assert call that
// failed.
func CallerInfo() []string {

var pc uintptr
var file string
var line int
Expand Down Expand Up @@ -493,7 +492,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{})
}

return true

}

// validateEqualArgs checks whether provided arguments can be safely used in the
Expand Down Expand Up @@ -548,7 +546,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}

same, ok := samePointers(expected, actual)
if !ok {
//fails when the arguments are not pointers
// fails when the arguments are not pointers
return !(Fail(t, "Both arguments must be pointers", msgAndArgs...))
}

Expand All @@ -567,7 +565,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}
func samePointers(first, second interface{}) (same bool, ok bool) {
firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second)
if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr {
return false, false //not both are pointers
return false, false // not both are pointers
}

firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second)
Expand Down Expand Up @@ -628,7 +626,6 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa
}

return true

}

// EqualExportedValues asserts that the types of two objects are equal and their public
Expand Down Expand Up @@ -683,7 +680,6 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}
}

return Equal(t, expected, actual, msgAndArgs...)

}

// NotNil asserts that the specified object is not nil.
Expand Down Expand Up @@ -733,7 +729,6 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {

// isEmpty gets whether the specified object is considered empty or not.
func isEmpty(object interface{}) bool {

// get nil case out of the way
if object == nil {
return true
Expand Down Expand Up @@ -774,7 +769,6 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
}

return pass

}

// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
Expand All @@ -793,7 +787,6 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
}

return pass

}

// getLen tries to get the length of an object.
Expand Down Expand Up @@ -837,7 +830,6 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
}

return true

}

// False asserts that the specified value is false.
Expand All @@ -852,7 +844,6 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
}

return true

}

// NotEqual asserts that the specified values are NOT equal.
Expand All @@ -875,7 +866,6 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{
}

return true

}

// NotEqualValues asserts that two objects are not equal even when converted to the same type
Expand All @@ -898,7 +888,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte
// return (true, false) if element was not found.
// return (true, true) if element was found.
func containsElement(list interface{}, element interface{}) (ok, found bool) {

listValue := reflect.ValueOf(list)
listType := reflect.TypeOf(list)
if listType == nil {
Expand Down Expand Up @@ -933,7 +922,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) {
}
}
return true, false

}

// Contains asserts that the specified string, list(array, slice...) or map contains the
Expand All @@ -956,7 +944,6 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
}

return true

}

// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
Expand All @@ -979,7 +966,6 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
}

return true

}

// Subset asserts that the list (array, slice, or map) contains all elements
Expand Down Expand Up @@ -1704,7 +1690,6 @@ func matchRegexp(rx interface{}, str interface{}) bool {
default:
return r.MatchString(fmt.Sprint(v))
}

}

// Regexp asserts that a specified regexp matches a string.
Expand Down Expand Up @@ -1740,7 +1725,6 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf
}

return !match

}

// Zero asserts that i is the zero value for its type.
Expand Down
Loading