Update stretchr/testify godep

Fix panic in tests using mock due to stretchr/testify#180
This commit is contained in:
Dr. Stefan Schimanski 2015-07-11 10:54:18 +02:00
parent 36fa535c58
commit 05cf9043b5
3 changed files with 31 additions and 4 deletions

6
Godeps/Godeps.json generated
View File

@ -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",

View File

@ -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

View File

@ -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()
})
}