diff --git a/decoder/decoder_native_test.go b/decoder/decoder_native_test.go index 9b435ca92..ebf287ed2 100644 --- a/decoder/decoder_native_test.go +++ b/decoder/decoder_native_test.go @@ -33,6 +33,21 @@ import ( "github.com/stretchr/testify/require" ) +func TestDecoder_OptionCaseSensitive(t *testing.T) { + var js = `{"a":1,"normallllll":1,"longllllllllllllllllllllllllllllllllll":1}` + type TS struct{ + A int + Normallllll int + Longllllllllllllllllllllllllllllllllll int + } + var obj = TS{} + d := NewDecoder(js) + d.SetOptions(OptionCaseSensitive) + err := d.Decode(&obj) + require.NoError(t, err) + require.Equal(t, TS{}, obj) +} + func BenchmarkSkipValidate(b *testing.B) { type skiptype struct { diff --git a/decoder/decoder_test.go b/decoder/decoder_test.go index 555751a5c..c58ed97a5 100644 --- a/decoder/decoder_test.go +++ b/decoder/decoder_test.go @@ -295,21 +295,6 @@ func TestDecoder_MapWithIndirectElement(t *testing.T) { assert.Equal(t, [129]byte{1, 2, 3, 4, 5}, v[""].A) } -func TestDecoder_OptionCaseSensitive(t *testing.T) { - var js = `{"a":1,"normallllll":1,"longllllllllllllllllllllllllllllllllll":1}` - type TS struct{ - A int - Normallllll int - Longllllllllllllllllllllllllllllllllll int - } - var obj = TS{} - d := NewDecoder(js) - d.SetOptions(OptionCaseSensitive) - err := d.Decode(&obj) - require.NoError(t, err) - require.Equal(t, TS{}, obj) -} - func BenchmarkDecoder_Generic_Sonic(b *testing.B) { var w interface{} _, _ = decode(TwitterJson, &w, true)