(t *testing.T)
| 235 | } |
| 236 | |
| 237 | func TestArraySortNonStdArray(t *testing.T) { |
| 238 | const SCRIPT = ` |
| 239 | const array = [undefined, 'c', /*hole*/, 'b', undefined, /*hole*/, 'a', 'd']; |
| 240 | |
| 241 | Object.defineProperty(array, '2', { |
| 242 | get() { |
| 243 | array.pop(); |
| 244 | array.pop(); |
| 245 | return this.foo; |
| 246 | }, |
| 247 | set(v) { |
| 248 | this.foo = v; |
| 249 | } |
| 250 | }); |
| 251 | |
| 252 | array.sort(); |
| 253 | |
| 254 | assert.sameValue(array[0], 'b'); |
| 255 | assert.sameValue(array[1], 'c'); |
| 256 | assert.sameValue(array[3], undefined); |
| 257 | assert.sameValue(array[4], undefined); |
| 258 | assert.sameValue('5' in array, false); |
| 259 | assert.sameValue(array.hasOwnProperty('5'), false); |
| 260 | assert.sameValue(array.length, 6); |
| 261 | assert.sameValue(array.foo, undefined); |
| 262 | |
| 263 | assert.sameValue(array[2], undefined); |
| 264 | assert.sameValue(array.length, 4); |
| 265 | ` |
| 266 | testScriptWithTestLib(SCRIPT, _undefined, t) |
| 267 | } |
| 268 | |
| 269 | func TestArrayConcat(t *testing.T) { |
| 270 | const SCRIPT = ` |
nothing calls this directly
no test coverage detected
searching dependent graphs…