Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: test/mjsunit/harmony/array-iterator.js

Issue 338323003: Add @@iterator to Array.prototype (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/array-iterator.js ('K') | « src/array-iterator.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/array-iterator.js
diff --git a/test/mjsunit/harmony/array-iterator.js b/test/mjsunit/harmony/array-iterator.js
index 2642d7b2318e3355ccd0a547207fbe089c1217f8..896878acf638a91db51d00b182d354039d40276b 100644
--- a/test/mjsunit/harmony/array-iterator.js
+++ b/test/mjsunit/harmony/array-iterator.js
@@ -36,6 +36,8 @@ function TestArrayPrototype() {
assertFalse(Array.prototype.propertyIsEnumerable('entries'));
assertFalse(Array.prototype.propertyIsEnumerable('values'));
assertFalse(Array.prototype.propertyIsEnumerable('keys'));
+
+ assertEquals(Array.prototype.values, Array.prototype[Symbol.iterator]);
}
TestArrayPrototype();
@@ -216,6 +218,24 @@ function TestForArrayEntries() {
TestForArrayEntries();
+function TestForArray() {
+ var buffer = [];
+ var array = [0, 'a', true, false, null, /* hole */, undefined, NaN];
+ var i = 0;
+ for (var value of array) {
+ buffer[i++] = value;
+ }
+
+ assertEquals(8, buffer.length);
+
+ for (var i = 0; i < buffer.length - 1; i++) {
+ assertEquals(array[i], buffer[i]);
+ }
+ assertTrue(isNaN(buffer[buffer.length - 1]));
+}
+TestForArrayValues();
+
+
function TestNonOwnSlots() {
var array = [0];
var iterator = array.values();
« src/array-iterator.js ('K') | « src/array-iterator.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698