diff options
Diffstat (limited to 'common/collections/slice_test.go')
-rw-r--r-- | common/collections/slice_test.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/common/collections/slice_test.go b/common/collections/slice_test.go index fd8eb24f1..3ebfe6d11 100644 --- a/common/collections/slice_test.go +++ b/common/collections/slice_test.go @@ -15,10 +15,9 @@ package collections import ( "errors" - "fmt" "testing" - "github.com/alecthomas/assert" + qt "github.com/frankban/quicktest" ) var _ Slicer = (*tstSlicer)(nil) @@ -34,15 +33,15 @@ type testSlicerInterface interface { type testSlicerInterfaces []testSlicerInterface type tstSlicerIn1 struct { - name string + TheName string } type tstSlicerIn2 struct { - name string + TheName string } type tstSlicer struct { - name string + TheName string } func (p *tstSlicerIn1) Slice(in interface{}) (interface{}, error) { @@ -75,11 +74,11 @@ func (p *tstSlicerIn2) Slice(in interface{}) (interface{}, error) { } func (p *tstSlicerIn1) Name() string { - return p.name + return p.TheName } func (p *tstSlicerIn2) Name() string { - return p.name + return p.TheName } func (p *tstSlicer) Slice(in interface{}) (interface{}, error) { @@ -100,6 +99,7 @@ type tstSlicers []*tstSlicer func TestSlice(t *testing.T) { t.Parallel() + c := qt.New(t) for i, test := range []struct { args []interface{} @@ -114,12 +114,11 @@ func TestSlice(t *testing.T) { {[]interface{}{&tstSlicerIn1{"a"}, &tstSlicerIn2{"b"}}, testSlicerInterfaces{&tstSlicerIn1{"a"}, &tstSlicerIn2{"b"}}}, {[]interface{}{&tstSlicerIn1{"a"}, &tstSlicer{"b"}}, []interface{}{&tstSlicerIn1{"a"}, &tstSlicer{"b"}}}, } { - errMsg := fmt.Sprintf("[%d] %v", i, test.args) + errMsg := qt.Commentf("[%d] %v", i, test.args) result := Slice(test.args...) - assert.Equal(t, test.expected, result, errMsg) + c.Assert(test.expected, qt.DeepEquals, result, errMsg) } - assert.Len(t, Slice(), 0) } |