MCPcopy Index your code
hub / github.com/nodejs/node / TestNonArrayWithAccessors

Function TestNonArrayWithAccessors

deps/v8/test/mjsunit/array-sort.js:172–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170
171
172function TestNonArrayWithAccessors() {
173 // Regression test for issue 346, more info at URL
174 // http://code.google.com/p/v8/issues/detail?id=346
175 // Reported by nth10sd, test based on this report.
176 var x = {};
177 x[0] = 42;
178 x.__defineGetter__("1", function(){return this.foo;});
179 x.__defineSetter__("1", function(val){this.foo = val;});
180 x[1] = 49
181 x[3] = 37;
182 x.length = 4;
183 Array.prototype.sort.call(x);
184 // Behavior of sort with accessors is undefined. This accessor is
185 // well-behaved (acts like a normal property), so it should work.
186 assertEquals(4, x.length, "sortaccessors length");
187 assertEquals(37, x[0], "sortaccessors first");
188 assertEquals(42, x[1], "sortaccessors second");
189 assertEquals(49, x[2], "sortaccessors third")
190 assertFalse(3 in x, "sortaccessors fourth");
191}
192
193TestNonArrayWithAccessors();
194

Callers 1

array-sort.jsFile · 0.85

Calls 3

assertEqualsFunction · 0.50
assertFalseFunction · 0.50
callMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…