Skip to content

Commit 46abb66

Browse files
committed
remove gocheck and use testify/assert
1 parent e528c2f commit 46abb66

File tree

4 files changed

+174
-272
lines changed

4 files changed

+174
-272
lines changed

decoder_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"reflect"
88
"strings"
99
"testing"
10+
11+
"github.com/stretchr/testify/assert"
1012
)
1113

1214
func TestBool(t *testing.T) {
@@ -203,9 +205,8 @@ func validateDecoding(t *testing.T, tests map[string]interface{}) {
203205

204206
var result interface{}
205207
_, err := d.decode(0, reflect.ValueOf(&result))
206-
if err != nil {
207-
t.Error(err)
208-
}
208+
assert.Nil(t, err)
209+
209210
if !reflect.DeepEqual(result, expected) {
210211
// A big case statement would produce nicer errors
211212
t.Errorf("Output was incorrect: %s %s", inputStr, expected)
@@ -215,9 +216,7 @@ func validateDecoding(t *testing.T, tests map[string]interface{}) {
215216

216217
func TestPointers(t *testing.T) {
217218
bytes, err := ioutil.ReadFile("test-data/test-data/maps-with-pointers.raw")
218-
if err != nil {
219-
t.Error(err)
220-
}
219+
assert.Nil(t, err)
221220
d := decoder{bytes}
222221

223222
expected := map[uint]map[string]string{
@@ -232,9 +231,7 @@ func TestPointers(t *testing.T) {
232231
for offset, expectedValue := range expected {
233232
var actual map[string]string
234233
_, err := d.decode(offset, reflect.ValueOf(&actual))
235-
if err != nil {
236-
t.Error(err)
237-
}
234+
assert.Nil(t, err)
238235
if !reflect.DeepEqual(actual, expectedValue) {
239236
t.Errorf("Decode for pointer at %d failed", offset)
240237
}

0 commit comments

Comments
 (0)