diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js b/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js new file mode 100644 index 0000000000..269cecf346 --- /dev/null +++ b/js/src/tests/test262/built-ins/Map/prototype/clear/map-data-list-is-preserved.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-map.prototype.clear +description: > + The existing [[MapData]] List is preserved. +info: | + The existing [[MapData]] List is preserved because there may be existing + MapIterator objects that are suspended midway through iterating over that + List. + + Map.prototype.clear ( ) + + ... + 4. Let entries be the List that is the value of M’s [[MapData]] internal slot. + 5. Repeat for each Record {[[key]], [[value]]} p that is an element of + entries, + a. Set p.[[key]] to empty. + b. Set p.[[value]] to empty. + 6. Return undefined. +---*/ + +var m = new Map([ + [1, 1], + [2, 2], + [3, 3] +]); +var e = m.entries(); + +e.next(); +m.clear(); + +var n = e.next(); +assert.sameValue(n.value, undefined); +assert.sameValue(n.done, true); + +reportCompare(0, 0); |