(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestContextNewStringUTF16(t *testing.T) { |
| 122 | useStableOwnerHooksForLegacySubtests(t) |
| 123 | |
| 124 | rt := NewRuntime() |
| 125 | defer rt.Close() |
| 126 | ctx := rt.NewContext() |
| 127 | defer ctx.Close() |
| 128 | |
| 129 | ascii := ctx.NewStringUTF16([]uint16{'o', 'k'}) |
| 130 | require.NotNil(t, ascii) |
| 131 | defer ascii.Free() |
| 132 | require.True(t, ascii.IsString()) |
| 133 | require.Equal(t, "ok", ascii.ToString()) |
| 134 | |
| 135 | empty := ctx.NewStringUTF16(nil) |
| 136 | require.NotNil(t, empty) |
| 137 | defer empty.Free() |
| 138 | require.Equal(t, "", empty.ToString()) |
| 139 | |
| 140 | wide := ctx.NewStringUTF16([]uint16{0xD800}) |
| 141 | require.NotNil(t, wide) |
| 142 | defer wide.Free() |
| 143 | utf16, err := wide.ToStringUTF16() |
| 144 | require.NoError(t, err) |
| 145 | require.Equal(t, []uint16{0xD800}, utf16) |
| 146 | |
| 147 | var nilCtx *Context |
| 148 | require.Nil(t, nilCtx.NewStringUTF16([]uint16{'x'})) |
| 149 | |
| 150 | closedRT := NewRuntime() |
| 151 | closedCtx := closedRT.NewContext() |
| 152 | closedCtx.Close() |
| 153 | require.Nil(t, closedCtx.NewStringUTF16([]uint16{'x'})) |
| 154 | closedRT.Close() |
| 155 | } |
| 156 | |
| 157 | func TestContextExceptionPrimitiveFallback(t *testing.T) { |
| 158 | useStableOwnerHooksForLegacySubtests(t) |
nothing calls this directly
no test coverage detected