diff --git a/pointer.go b/pointer.go index d975773..d970c7c 100644 --- a/pointer.go +++ b/pointer.go @@ -264,7 +264,7 @@ func (p *Pointer) set(node, data any, nameProvider *swag.NameProvider) error { knd := reflect.ValueOf(node).Kind() if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { - return fmt.Errorf("only structs, pointers, maps and slices are supported for setting values") + return errors.New("only structs, pointers, maps and slices are supported for setting values") } if nameProvider == nil { diff --git a/pointer_test.go b/pointer_test.go index a789154..6f378e9 100644 --- a/pointer_test.go +++ b/pointer_test.go @@ -94,7 +94,7 @@ func TestEscaping(t *testing.T) { result, _, err := p.Get(testDocumentJSON) require.NoError(t, err, "input: %v", ins[i]) - assert.Equal(t, outs[i], result, "input: %v", ins[i]) + assert.InDeltaf(t, outs[i], result, 1e-6, "input: %v", ins[i]) } } @@ -352,15 +352,15 @@ func TestObject(t *testing.T) { result, _, err := p.Get(testDocumentJSON) require.NoError(t, err) - assert.Equal(t, outs[i], result) + assert.InDelta(t, outs[i], result, 1e-6) result, _, err = p.Get(testStructJSONDoc) require.NoError(t, err) - assert.EqualValues(t, outs[i], result) + assert.InDelta(t, outs[i], result, 1e-6) result, _, err = p.Get(testStructJSONPtr) require.NoError(t, err) - assert.EqualValues(t, outs[i], result) + assert.InDelta(t, outs[i], result, 1e-6) } }