mirror of https://github.com/stretchr/testify.git
fix linting errors in /assert package
parent
edff5a049b
commit
ab6dc32628
|
@ -150,7 +150,7 @@ func TestGreater(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, Greater(out, currCase.less, currCase.greater))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.Greater")
|
||||
}
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ func TestGreaterOrEqual(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, GreaterOrEqual(out, currCase.less, currCase.greater))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.GreaterOrEqual")
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ func TestLess(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, Less(out, currCase.greater, currCase.less))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.Less")
|
||||
}
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ func TestLessOrEqual(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, LessOrEqual(out, currCase.greater, currCase.less))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.LessOrEqual")
|
||||
}
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ func TestPositive(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, Positive(out, currCase.e))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.Positive")
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ func TestNegative(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, Negative(out, currCase.e))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
Contains(t, out.helpers, "github.com/stretchr/testify/assert.Negative")
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ func Test_compareTwoValuesNotComparableValues(t *testing.T) {
|
|||
}{
|
||||
{v1: CompareStruct{}, v2: CompareStruct{}},
|
||||
{v1: map[string]int{}, v2: map[string]int{}},
|
||||
{v1: make([]int, 5, 5), v2: make([]int, 5, 5)},
|
||||
{v1: make([]int, 5), v2: make([]int, 5)},
|
||||
} {
|
||||
compareResult := compareTwoValues(mockT, currCase.v1, currCase.v2, []CompareType{compareLess, compareEqual, compareGreater}, "testFailMessage")
|
||||
False(t, compareResult)
|
||||
|
|
|
@ -46,7 +46,7 @@ func TestIsIncreasing(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, IsIncreasing(out, currCase.collection))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ func TestIsNonIncreasing(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, IsNonIncreasing(out, currCase.collection))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ func TestIsDecreasing(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, IsDecreasing(out, currCase.collection))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,6 +181,6 @@ func TestIsNonDecreasing(t *testing.T) {
|
|||
} {
|
||||
out := &outputT{buf: bytes.NewBuffer(nil)}
|
||||
False(t, IsNonDecreasing(out, currCase.collection))
|
||||
Contains(t, string(out.buf.Bytes()), currCase.msg)
|
||||
Contains(t, out.buf.String(), currCase.msg)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -856,7 +856,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{})
|
|||
h.Helper()
|
||||
}
|
||||
if subset == nil {
|
||||
return Fail(t, fmt.Sprintf("nil is the empty set which is a subset of every set"), msgAndArgs...)
|
||||
return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
|
||||
}
|
||||
|
||||
subsetValue := reflect.ValueOf(subset)
|
||||
|
@ -1165,7 +1165,7 @@ func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs
|
|||
bf, bok := toFloat(actual)
|
||||
|
||||
if !aok || !bok {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be numerical", msgAndArgs...)
|
||||
}
|
||||
|
||||
if math.IsNaN(af) && math.IsNaN(bf) {
|
||||
|
@ -1173,7 +1173,7 @@ func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs
|
|||
}
|
||||
|
||||
if math.IsNaN(af) {
|
||||
return Fail(t, fmt.Sprintf("Expected must not be NaN"), msgAndArgs...)
|
||||
return Fail(t, "Expected must not be NaN", msgAndArgs...)
|
||||
}
|
||||
|
||||
if math.IsNaN(bf) {
|
||||
|
@ -1196,7 +1196,7 @@ func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAn
|
|||
if expected == nil || actual == nil ||
|
||||
reflect.TypeOf(actual).Kind() != reflect.Slice ||
|
||||
reflect.TypeOf(expected).Kind() != reflect.Slice {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be slice", msgAndArgs...)
|
||||
}
|
||||
|
||||
actualSlice := reflect.ValueOf(actual)
|
||||
|
@ -1306,7 +1306,7 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m
|
|||
if expected == nil || actual == nil ||
|
||||
reflect.TypeOf(actual).Kind() != reflect.Slice ||
|
||||
reflect.TypeOf(expected).Kind() != reflect.Slice {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be slice", msgAndArgs...)
|
||||
}
|
||||
|
||||
actualSlice := reflect.ValueOf(actual)
|
||||
|
|
|
@ -1575,8 +1575,7 @@ func testAutogeneratedFunction() {
|
|||
t := struct {
|
||||
io.Closer
|
||||
}{}
|
||||
var c io.Closer
|
||||
c = t
|
||||
c := t
|
||||
c.Close()
|
||||
}
|
||||
|
||||
|
@ -2224,7 +2223,7 @@ func ExampleValueAssertionFunc() {
|
|||
|
||||
dumbParse := func(input string) interface{} {
|
||||
var x interface{}
|
||||
json.Unmarshal([]byte(input), &x)
|
||||
_ = json.Unmarshal([]byte(input), &x)
|
||||
return x
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ func TestHTTPStatusesWrapper(t *testing.T) {
|
|||
|
||||
func httpHelloName(w http.ResponseWriter, r *http.Request) {
|
||||
name := r.FormValue("name")
|
||||
w.Write([]byte(fmt.Sprintf("Hello, %s!", name)))
|
||||
_, _ = w.Write([]byte(fmt.Sprintf("Hello, %s!", name)))
|
||||
}
|
||||
|
||||
func TestHTTPRequestWithNoParams(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue