From 9c2000bde9b0fb47c246fab96f52ba20eaa7c0e2 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Mon, 14 Mar 2011 10:17:40 -0700 Subject: [PATCH] Bug 637643 - Tests. r=async.processingjs@yahoo.com --HG-- extra : rebase_source : 190f79659ffb1305726347310d6c7bb4f4f7d2b1 --- js/src/tests/js1_8_5/extensions/jstests.list | 1 + .../typedarray-subarray-of-subarray.js | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 js/src/tests/js1_8_5/extensions/typedarray-subarray-of-subarray.js diff --git a/js/src/tests/js1_8_5/extensions/jstests.list b/js/src/tests/js1_8_5/extensions/jstests.list index 9868008eac57..11da8b41dbbb 100644 --- a/js/src/tests/js1_8_5/extensions/jstests.list +++ b/js/src/tests/js1_8_5/extensions/jstests.list @@ -1,6 +1,7 @@ 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 diff --git a/js/src/tests/js1_8_5/extensions/typedarray-subarray-of-subarray.js b/js/src/tests/js1_8_5/extensions/typedarray-subarray-of-subarray.js new file mode 100644 index 000000000000..fcfb031cb5f0 --- /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!");