Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kaswen-Wilk committed Dec 30, 2024
1 parent 688992a commit f199b16
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 16 deletions.
2 changes: 1 addition & 1 deletion assert/assertion_format.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assert/assertion_forward.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ 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 ok bool
var file string
Expand Down Expand Up @@ -475,6 +476,7 @@ 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 @@ -529,7 +531,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 @@ -548,7 +550,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 @@ -609,6 +611,7 @@ 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 @@ -663,6 +666,7 @@ 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 @@ -712,6 +716,7 @@ 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 @@ -752,6 +757,7 @@ 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 @@ -770,6 +776,7 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
}

return pass

}

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

return true

}

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

return true

}

// NotEqual asserts that the specified values are NOT equal.
Expand All @@ -849,6 +858,7 @@ 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 @@ -871,6 +881,7 @@ 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 @@ -905,6 +916,7 @@ 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 @@ -927,6 +939,7 @@ 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 @@ -949,6 +962,7 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
}

return true

}

// Subset asserts that the specified list(array, slice...) or map contains all
Expand Down Expand Up @@ -1654,6 +1668,7 @@ 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 @@ -1689,6 +1704,7 @@ 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

0 comments on commit f199b16

Please sign in to comment.