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

Function TestSparseArraySetLengthWithPropItems

array_sparse_test.go:7–23  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func TestSparseArraySetLengthWithPropItems(t *testing.T) {
8 const SCRIPT = `
9 var a = [1,2,3,4];
10 a[100000] = 5;
11 var thrown = false;
12
13 Object.defineProperty(a, "2", {value: 42, configurable: false, writable: false});
14 try {
15 Object.defineProperty(a, "length", {value: 0, writable: false});
16 } catch (e) {
17 thrown = e instanceof TypeError;
18 }
19 thrown && a.length === 3;
20 `
21
22 testScript(SCRIPT, valueTrue, t)
23}
24
25func TestSparseArraySwitch(t *testing.T) {
26 vm := New()

Callers

nothing calls this directly

Calls 1

testScriptFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…