mirror of https://github.com/tc39/test262.git
parent
ceeefa3196
commit
73a8a7dcf9
|
@ -3,28 +3,38 @@
|
|||
|
||||
/*---
|
||||
description: >
|
||||
Elements removed from array after find has been called should not
|
||||
be visited
|
||||
Elements removed from array after find has been called should be
|
||||
visited
|
||||
---*/
|
||||
|
||||
var elementsVisited;
|
||||
|
||||
elementsVisited = 0;
|
||||
|
||||
[1, 'string', 2].find(function (v, i, arr) {
|
||||
elementsVisited++;
|
||||
var stringIndex = arr.indexOf('string');
|
||||
if (stringIndex !== -1) delete arr[stringIndex];
|
||||
if (v === 'string') {
|
||||
$ERROR('#1: \'string\' should not exist, it has been deleted');
|
||||
}
|
||||
if (v === undefined) {
|
||||
$ERROR('#2: deleted element should not be visited');
|
||||
}
|
||||
});
|
||||
|
||||
if (elementsVisited !== 3) {
|
||||
$ERROR('#2: deleted elements should be visited');
|
||||
}
|
||||
|
||||
elementsVisited = 0;
|
||||
|
||||
[1, 'string', 2].find(function (v, i, arr) {
|
||||
elementsVisited++;
|
||||
var stringIndex = arr.indexOf('string');
|
||||
if (stringIndex !== -1) arr.splice(stringIndex, 1);
|
||||
if (v === 'string') {
|
||||
$ERROR('#3: \'string\' should not exist, it has been deleted');
|
||||
}
|
||||
if (v === undefined) {
|
||||
$ERROR('#4: deleted element should not be visited');
|
||||
}
|
||||
});
|
||||
|
||||
if (elementsVisited !== 3) {
|
||||
$ERROR('#4: deleted elements should be visited');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue