MCPcopy Create free account
hub / github.com/dop251/goja / TestStringFromUTF16

Function TestStringFromUTF16

string_test.go:152–167  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestStringFromUTF16(t *testing.T) {
153 s := StringFromUTF16([]uint16{})
154 if s.Length() != 0 || !s.SameAs(asciiString("")) {
155 t.Fatal(s)
156 }
157
158 s = StringFromUTF16([]uint16{0xD800})
159 if s.Length() != 1 || s.CharAt(0) != 0xD800 {
160 t.Fatal(s)
161 }
162
163 s = StringFromUTF16([]uint16{'A', 'B'})
164 if !s.SameAs(asciiString("AB")) {
165 t.Fatal(s)
166 }
167}
168
169func TestStringBuilder(t *testing.T) {
170 t.Run("writeUTF8String-switch", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

StringFromUTF16Function · 0.85
asciiStringTypeAlias · 0.85
LengthMethod · 0.65
SameAsMethod · 0.65
CharAtMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…