vendor: update all dependencies to latest versions

This commit is contained in:
Nick Craig-Wood 2018-01-16 13:20:59 +00:00
parent 8e83fb6fb9
commit 7d3a17725d
4878 changed files with 1974229 additions and 201215 deletions

View file

@ -155,6 +155,9 @@ func TestImplements(t *testing.T) {
if Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) {
t.Error("Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface")
}
if Implements(mockT, (*AssertionTesterInterface)(nil), nil) {
t.Error("Implements method should return false: nil does not implement AssertionTesterInterface")
}
}
@ -254,8 +257,8 @@ func TestEqualFormatting(t *testing.T) {
msgAndArgs []interface{}
want string
}{
{equalWant: "want", equalGot: "got", want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual: \"got\"\n"},
{equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual: \"got\"\n\t\t\r\tMessages: \thello, world!\n"},
{equalWant: "want", equalGot: "got", want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual : \"got\"\n"},
{equalWant: "want", equalGot: "got", msgAndArgs: []interface{}{"hello, %v!", "world"}, want: "\tassertions.go:[0-9]+: \r \r\tError Trace:\t\n\t\t\r\tError: \tNot equal: \n\t\t\r\t \texpected: \"want\"\n\t\t\r\t \tactual : \"got\"\n\t\t\r\tMessages: \thello, world!\n"},
} {
mockT := &bufferT{}
Equal(mockT, currCase.equalWant, currCase.equalGot, currCase.msgAndArgs...)
@ -553,6 +556,14 @@ func TestNotSubset(t *testing.T) {
}
}
func TestNotSubsetNil(t *testing.T) {
mockT := new(testing.T)
NotSubset(mockT, []string{"foo"}, nil)
if !mockT.Failed() {
t.Error("NotSubset on nil set should have failed the test")
}
}
func Test_includeElement(t *testing.T) {
list1 := []string{"Foo", "Bar"}
@ -604,6 +615,57 @@ func Test_includeElement(t *testing.T) {
False(t, found)
}
func TestElementsMatch(t *testing.T) {
mockT := new(testing.T)
if !ElementsMatch(mockT, nil, nil) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{}, []int{}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{1}, []int{1}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{1, 1}, []int{1, 1}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{1, 2}, []int{1, 2}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{1, 2}, []int{2, 1}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, [2]int{1, 2}, [2]int{2, 1}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []string{"hello", "world"}, []string{"world", "hello"}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []string{"hello", "hello"}, []string{"hello", "hello"}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []string{"hello", "hello", "world"}, []string{"hello", "world", "hello"}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, [3]string{"hello", "hello", "world"}, [3]string{"hello", "world", "hello"}) {
t.Error("ElementsMatch should return true")
}
if !ElementsMatch(mockT, []int{}, nil) {
t.Error("ElementsMatch should return true")
}
if ElementsMatch(mockT, []int{1}, []int{1, 1}) {
t.Error("ElementsMatch should return false")
}
if ElementsMatch(mockT, []int{1, 2}, []int{2, 2}) {
t.Error("ElementsMatch should return false")
}
if ElementsMatch(mockT, []string{"hello", "hello"}, []string{"hello"}) {
t.Error("ElementsMatch should return false")
}
}
func TestCondition(t *testing.T) {
mockT := new(testing.T)
@ -806,6 +868,15 @@ func TestEmpty(t *testing.T) {
var tiNP time.Time
var s *string
var f *os.File
sP := &s
x := 1
xP := &x
type TString string
type TStruct struct {
x int
s []int
}
True(t, Empty(mockT, ""), "Empty string is empty")
True(t, Empty(mockT, nil), "Nil is empty")
@ -817,6 +888,9 @@ func TestEmpty(t *testing.T) {
True(t, Empty(mockT, f), "Nil os.File pointer is empty")
True(t, Empty(mockT, tiP), "Nil time.Time pointer is empty")
True(t, Empty(mockT, tiNP), "time.Time is empty")
True(t, Empty(mockT, TStruct{}), "struct with zero values is empty")
True(t, Empty(mockT, TString("")), "empty aliased string is empty")
True(t, Empty(mockT, sP), "ptr to nil value is empty")
False(t, Empty(mockT, "something"), "Non Empty string is not empty")
False(t, Empty(mockT, errors.New("something")), "Non nil object is not empty")
@ -824,6 +898,9 @@ func TestEmpty(t *testing.T) {
False(t, Empty(mockT, 1), "Non-zero int value is not empty")
False(t, Empty(mockT, true), "True value is not empty")
False(t, Empty(mockT, chWithValue), "Channel with values is not empty")
False(t, Empty(mockT, TStruct{x: 1}), "struct with initialized values is empty")
False(t, Empty(mockT, TString("abc")), "non-empty aliased string is empty")
False(t, Empty(mockT, xP), "ptr to non-nil value is not empty")
}
func TestNotEmpty(t *testing.T) {
@ -1030,6 +1107,82 @@ func TestInDeltaSlice(t *testing.T) {
False(t, InDeltaSlice(mockT, "", nil, 1), "Expected non numeral slices to fail")
}
func TestInDeltaMapValues(t *testing.T) {
mockT := new(testing.T)
for _, tc := range []struct {
title string
expect interface{}
actual interface{}
f func(TestingT, bool, ...interface{}) bool
delta float64
}{
{
title: "Within delta",
expect: map[string]float64{
"foo": 1.0,
"bar": 2.0,
},
actual: map[string]float64{
"foo": 1.01,
"bar": 1.99,
},
delta: 0.1,
f: True,
},
{
title: "Within delta",
expect: map[int]float64{
1: 1.0,
2: 2.0,
},
actual: map[int]float64{
1: 1.0,
2: 1.99,
},
delta: 0.1,
f: True,
},
{
title: "Different number of keys",
expect: map[int]float64{
1: 1.0,
2: 2.0,
},
actual: map[int]float64{
1: 1.0,
},
delta: 0.1,
f: False,
},
{
title: "Within delta with zero value",
expect: map[string]float64{
"zero": 0.0,
},
actual: map[string]float64{
"zero": 0.0,
},
delta: 0.1,
f: True,
},
{
title: "With missing key with zero value",
expect: map[string]float64{
"zero": 0.0,
"foo": 0.0,
},
actual: map[string]float64{
"zero": 0.0,
"bar": 0.0,
},
f: False,
},
} {
tc.f(t, InDeltaMapValues(mockT, tc.expect, tc.actual, tc.delta), tc.title+"\n"+diff(tc.expect, tc.actual))
}
}
func TestInEpsilon(t *testing.T) {
mockT := new(testing.T)
@ -1168,6 +1321,28 @@ func TestNotZero(t *testing.T) {
}
}
func TestFileExists(t *testing.T) {
mockT := new(testing.T)
True(t, FileExists(mockT, "assertions.go"))
mockT = new(testing.T)
False(t, FileExists(mockT, "random_file"))
mockT = new(testing.T)
False(t, FileExists(mockT, "../_codegen"))
}
func TestDirExists(t *testing.T) {
mockT := new(testing.T)
False(t, DirExists(mockT, "assertions.go"))
mockT = new(testing.T)
False(t, DirExists(mockT, "random_dir"))
mockT = new(testing.T)
True(t, DirExists(mockT, "../_codegen"))
}
func TestJSONEq_EqualSONString(t *testing.T) {
mockT := new(testing.T)
True(t, JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`))