diff --git a/atomic_test.go b/atomic_test.go index 58e5dbe..41c4ab4 100644 --- a/atomic_test.go +++ b/atomic_test.go @@ -60,7 +60,7 @@ func TestInt32(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"40\""), &atom) + err := json.Unmarshal([]byte(`"40"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) @@ -98,7 +98,7 @@ func TestInt64(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"40\""), &atom) + err := json.Unmarshal([]byte(`"40"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) @@ -136,7 +136,7 @@ func TestUint32(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"40\""), &atom) + err := json.Unmarshal([]byte(`"40"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) @@ -174,7 +174,7 @@ func TestUint64(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"40\""), &atom) + err := json.Unmarshal([]byte(`"40"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) @@ -253,7 +253,7 @@ func TestFloat64(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"40.5\""), &atom) + err := json.Unmarshal([]byte(`"40.5"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) @@ -290,7 +290,7 @@ func TestDuration(t *testing.T) { }) t.Run("JSON/Unmarshal/Error", func(t *testing.T) { - err := json.Unmarshal([]byte("\"1000000000\""), &atom) + err := json.Unmarshal([]byte(`"1000000000"`), &atom) require.Error(t, err, "json.Unmarshal didn't error as expected.") assertErrorJSONUnmarshalType(t, err, "json.Unmarshal failed with unexpected error %v, want UnmarshalTypeError.", err) diff --git a/string_test.go b/string_test.go index c875ed1..8e1fcd2 100644 --- a/string_test.go +++ b/string_test.go @@ -46,11 +46,11 @@ func TestString(t *testing.T) { t.Run("JSON/Marshal", func(t *testing.T) { bytes, err := json.Marshal(atom) require.NoError(t, err, "json.Marshal errored unexpectedly.") - require.Equal(t, []byte("\"bcd\""), bytes, "json.Marshal encoded the wrong bytes.") + require.Equal(t, []byte(`"bcd"`), bytes, "json.Marshal encoded the wrong bytes.") }) t.Run("JSON/Unmarshal", func(t *testing.T) { - err := json.Unmarshal([]byte("\"abc\""), &atom) + err := json.Unmarshal([]byte(`"abc"`), &atom) require.NoError(t, err, "json.Unmarshal errored unexpectedly.") require.Equal(t, "abc", atom.Load(), "json.Unmarshal didn't set the correct value.") })