mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
Update stretchr/testify godep
Fix panic in tests using mock due to stretchr/testify#180
This commit is contained in:
parent
36fa535c58
commit
05cf9043b5
6
Godeps/Godeps.json
generated
6
Godeps/Godeps.json
generated
@ -496,15 +496,15 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stretchr/testify/assert",
|
||||
"Rev": "7e4a149930b09fe4c2b134c50ce637457ba6e966"
|
||||
"Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stretchr/testify/mock",
|
||||
"Rev": "7e4a149930b09fe4c2b134c50ce637457ba6e966"
|
||||
"Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/stretchr/testify/require",
|
||||
"Rev": "7e4a149930b09fe4c2b134c50ce637457ba6e966"
|
||||
"Rev": "089c7181b8c728499929ff09b62d3fdd8df8adff"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/syndtr/gocapability/capability",
|
||||
|
7
Godeps/_workspace/src/github.com/stretchr/testify/assert/assertions.go
generated
vendored
7
Godeps/_workspace/src/github.com/stretchr/testify/assert/assertions.go
generated
vendored
@ -84,6 +84,11 @@ func CallerInfo() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// This is a huge edge case, but it will panic if this is the case, see #180
|
||||
if file == "<autogenerated>" {
|
||||
break
|
||||
}
|
||||
|
||||
parts := strings.Split(file, "/")
|
||||
dir := parts[len(parts)-2]
|
||||
file = parts[len(parts)-1]
|
||||
@ -296,7 +301,7 @@ func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
}
|
||||
|
||||
if !success {
|
||||
Fail(t, "Expected not to be nil.", msgAndArgs...)
|
||||
Fail(t, "Expected value not to be nil.", msgAndArgs...)
|
||||
}
|
||||
|
||||
return success
|
||||
|
22
Godeps/_workspace/src/github.com/stretchr/testify/assert/assertions_test.go
generated
vendored
22
Godeps/_workspace/src/github.com/stretchr/testify/assert/assertions_test.go
generated
vendored
@ -2,6 +2,7 @@ package assert
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"math"
|
||||
"regexp"
|
||||
"testing"
|
||||
@ -789,3 +790,24 @@ func TestRegexp(t *testing.T) {
|
||||
True(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str))
|
||||
}
|
||||
}
|
||||
|
||||
func testAutogeneratedFunction() {
|
||||
defer func() {
|
||||
if err := recover(); err == nil {
|
||||
panic("did not panic")
|
||||
}
|
||||
CallerInfo()
|
||||
}()
|
||||
t := struct {
|
||||
io.Closer
|
||||
}{}
|
||||
var c io.Closer
|
||||
c = t
|
||||
c.Close()
|
||||
}
|
||||
|
||||
func TestCallerInfoWithAutogeneratedFunctions(t *testing.T) {
|
||||
NotPanics(t, func() {
|
||||
testAutogeneratedFunction()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user