MCPcopy Create free account
hub / github.com/apache/fory / TestReadUTF16LE_SurrogatePair

Function TestReadUTF16LE_SurrogatePair

go/fory/string_test.go:79–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestReadUTF16LE_SurrogatePair(t *testing.T) {
80 // Test UTF-16 surrogate pair for emoji: 🎉 (U+1F389)
81 // UTF-16: D83C DF89 (surrogate pair)
82 // Little-endian bytes: 3C D8 89 DF
83 data := []byte{0x3C, 0xD8, 0x89, 0xDF}
84 buf := NewByteBuffer(data)
85 err := &Error{}
86
87 result := readUTF16LE(buf, 4, err)
88
89 require.False(t, err.HasError())
90 require.Equal(t, "🎉", result)
91}
92
93func TestReadLatin1_OOM_Bug(t *testing.T) {
94 // We claim a massive size of 10,000 bytes, but provide an empty buffer.

Callers

nothing calls this directly

Calls 4

HasErrorMethod · 0.95
NewByteBufferFunction · 0.85
readUTF16LEFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected