()
| 170 | |
| 171 | |
| 172 | function 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 | |
| 193 | TestNonArrayWithAccessors(); |
| 194 |
no test coverage detected
searching dependent graphs…