Skip to content

Commit 2035e7d

Browse files
authored
Merge pull request #1739 from ccoveille-forks/asserter-gofumpt
Format assertions files with gofumpt
2 parents 016e2e9 + 9bcca2f commit 2035e7d

File tree

2 files changed

+14
-72
lines changed

2 files changed

+14
-72
lines changed

assert/assertions.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ the problem actually occurred in calling code.*/
212212
// of each stack frame leading from the current test to the assert call that
213213
// failed.
214214
func CallerInfo() []string {
215-
216215
var pc uintptr
217216
var file string
218217
var line int
@@ -493,7 +492,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{})
493492
}
494493

495494
return true
496-
497495
}
498496

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

549547
same, ok := samePointers(expected, actual)
550548
if !ok {
551-
//fails when the arguments are not pointers
549+
// fails when the arguments are not pointers
552550
return !(Fail(t, "Both arguments must be pointers", msgAndArgs...))
553551
}
554552

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

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

630628
return true
631-
632629
}
633630

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

685682
return Equal(t, expected, actual, msgAndArgs...)
686-
687683
}
688684

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

734730
// isEmpty gets whether the specified object is considered empty or not.
735731
func isEmpty(object interface{}) bool {
736-
737732
// get nil case out of the way
738733
if object == nil {
739734
return true
@@ -774,7 +769,6 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
774769
}
775770

776771
return pass
777-
778772
}
779773

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

795789
return pass
796-
797790
}
798791

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

839832
return true
840-
841833
}
842834

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

854846
return true
855-
856847
}
857848

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

877868
return true
878-
879869
}
880870

881871
// NotEqualValues asserts that two objects are not equal even when converted to the same type
@@ -898,7 +888,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte
898888
// return (true, false) if element was not found.
899889
// return (true, true) if element was found.
900890
func containsElement(list interface{}, element interface{}) (ok, found bool) {
901-
902891
listValue := reflect.ValueOf(list)
903892
listType := reflect.TypeOf(list)
904893
if listType == nil {
@@ -933,7 +922,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) {
933922
}
934923
}
935924
return true, false
936-
937925
}
938926

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

958946
return true
959-
960947
}
961948

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

981968
return true
982-
983969
}
984970

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

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

17421727
return !match
1743-
17441728
}
17451729

17461730
// Zero asserts that i is the zero value for its type.

0 commit comments

Comments
 (0)