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

Unified Diff: test/mjsunit/external-array.js

Issue 6805010: Make "length" and "BYTES_PER_ELEMENT" properties of typed arrays accessible. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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
« no previous file with comments | « samples/shell.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/external-array.js
diff --git a/test/mjsunit/external-array.js b/test/mjsunit/external-array.js
index 5c04b5571e5ada76a4356fb4cbe6e688ea6c494d..228e8f06f6d19fe6d805f870521793ef9531bd54 100644
--- a/test/mjsunit/external-array.js
+++ b/test/mjsunit/external-array.js
@@ -38,3 +38,24 @@ for (var i = 0; i < 1000000; i++) {
assertEquals(0, a[0]);
assertEquals(0, a[1]);
+
+// Test the correct behavior of the |length| property (which is read-only).
+a = new Int32Array(42);
+assertEquals(42, a.length);
+a.length = 2;
+assertEquals(42, a.length);
+assertTrue(delete a.length);
+a.length = 2
+assertEquals(2, a.length);
+
+// Test the correct behavior of the |BYTES_PER_ELEMENT| property (which is
+// "constant", but not read-only).
+a = new Int32Array(2);
+assertEquals(4, a.BYTES_PER_ELEMENT);
+a.BYTES_PER_ELEMENT = 42;
+assertEquals(42, a.BYTES_PER_ELEMENT);
+a = new Uint8Array(2);
+assertEquals(1, a.BYTES_PER_ELEMENT);
+a = new Int16Array(2);
+assertEquals(2, a.BYTES_PER_ELEMENT);
+
« no previous file with comments | « samples/shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698