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

Function TestArrayCircularReferenceAccessOK

builtin_array_circular_test.go:91–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestArrayCircularReferenceAccessOK(t *testing.T) {
92 const SCRIPT = `
93 // These operations should still work fine
94 var T = [1, 2, 3];
95 T[42] = T;
96
97 // Accessing circular reference is OK
98 var same = T[42] === T;
99
100 // Accessing elements through circular reference is OK
101 var first = T[42][0];
102
103 // Deep nesting is OK
104 var deep = T[42][42][42][42][42][0];
105
106 same && first === 1 && deep === 1;
107 `
108 testScript(SCRIPT, valueTrue, t)
109}
110
111func TestArrayCircularReferenceComparison(t *testing.T) {
112 const SCRIPT = `

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…