1
0
mirror of synced 2024-11-25 06:26:03 +03:00

go1.14 fixes

This commit is contained in:
Pavel 2020-04-08 14:06:15 +03:00
parent d5a94653da
commit f144d5c1c1
3 changed files with 33 additions and 5 deletions

View File

@ -97,9 +97,5 @@ func TestOriginator(t *testing.T) {
assert.Equal(t, err, ErrInvalidOriginator)
})
t.Run("MarshalJSON_Invalid", func(t *testing.T) {
data, err := json.Marshal(Originator(3))
assert.Nil(t, data)
assert.EqualError(t, err, "json: error calling MarshalJSON for type v1.Originator: invalid originator")
})
t.Run("MarshalJSON_Invalid", OriginatorMarshalJSONInvalid)
}

16
v1/types_test_1.13.go Normal file
View File

@ -0,0 +1,16 @@
// +build !go1.14
package v1
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func OriginatorMarshalJSONInvalid(t *testing.T) {
data, err := json.Marshal(Originator(3))
assert.Nil(t, data)
assert.EqualError(t, err, "json: error calling MarshalJSON for type v1.Originator: invalid originator")
}

16
v1/types_test_1.14.go Normal file
View File

@ -0,0 +1,16 @@
// +build go1.14
package v1
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/assert"
)
func OriginatorMarshalJSONInvalid(t *testing.T) {
data, err := json.Marshal(Originator(3))
assert.Nil(t, data)
assert.EqualError(t, err, "json: error calling MarshalText for type v1.Originator: invalid originator")
}