Bug 637643 - Tests. r=async.processingjs@yahoo.com, a=dveditz
authorJeff Walden <jwalden@mit.edu>
Mon, 14 Mar 2011 10:17:40 -0700
changeset 63391 eb53226a3a99f9e336761c7bdf2dd3469b67e7c4
parent 63390 707a1efe98328aa136d1db1646c216d8ab9ea50a
child 63392 abab3297c82f5719b9ae44132bf0222c73c92b2f
push id47
push userjwalden@mit.edu
push dateFri, 08 Apr 2011 20:51:16 +0000
reviewersasync.processingjs, dveditz
bugs637643
milestone2.0.1pre
Bug 637643 - Tests. r=async.processingjs@yahoo.com, a=dveditz
js/src/tests/js1_8_5/extensions/jstests.list
js/src/tests/js1_8_5/extensions/typedarray-subarray-of-subarray.js
--- a/js/src/tests/js1_8_5/extensions/jstests.list
+++ b/js/src/tests/js1_8_5/extensions/jstests.list
@@ -1,11 +1,12 @@
 url-prefix ../../jsreftest.html?test=js1_8_5/extensions/
 script typedarray.js
 script typedarray-prototype.js
+script typedarray-subarray-of-subarray.js
 skip-if(!xulRuntime.shell) script worker-error.js  # these tests sometimes hang in browser, bug 559954, bug 562333
 skip-if(!xulRuntime.shell) script worker-error-propagation.js
 skip-if(!xulRuntime.shell) script worker-fib.js
 skip-if(!xulRuntime.shell) script worker-init.js
 skip-if(!xulRuntime.shell) script worker-simple.js
 skip-if(!xulRuntime.shell) script worker-terminate.js
 skip-if(!xulRuntime.shell) script worker-timeout.js
 script scripted-proxies.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/js1_8_5/extensions/typedarray-subarray-of-subarray.js
@@ -0,0 +1,33 @@
+// Any copyright is dedicated to the Public Domain.
+// http://creativecommons.org/licenses/publicdomain/
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 637643;
+var summary =
+  "new Int8Array([1, 2, 3]).subarray(1).subarray(1)[0] === 3";
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+var ta = new Int8Array([1, 2, 3]);
+assertEq(ta.length, 3);
+assertEq(ta[0], 1);
+assertEq(ta[1], 2);
+assertEq(ta[2], 3);
+
+var sa1 = ta.subarray(1);
+assertEq(sa1.length, 2);
+assertEq(sa1[0], 2);
+assertEq(sa1[1], 3);
+
+var sa2 = sa1.subarray(1);
+assertEq(sa2.length, 1);
+assertEq(sa2[0], 3);
+
+if (typeof reportCompare === "function")
+  reportCompare(true, true);
+
+print("All tests passed!");