js/src/jit-test/tests/parallel/surfaces-2.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/parallel/surfaces-2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +// ParallelArray methods throw when passed a this-value that isn't a ParallelArray.
     1.5 +
     1.6 +load(libdir + "asserts.js");
     1.7 +
     1.8 +function testcase(obj, fn) {
     1.9 +    assertEq(typeof fn, "function");
    1.10 +    var args = Array.slice(arguments, 2);
    1.11 +    assertThrowsInstanceOf(function () { fn.apply(obj, args); }, TypeError);
    1.12 +}
    1.13 +
    1.14 +function test(obj) {
    1.15 +    function f() {}
    1.16 +    testcase(obj, ParallelArray.prototype.map, f);
    1.17 +    testcase(obj, ParallelArray.prototype.reduce, f);
    1.18 +    testcase(obj, ParallelArray.prototype.scan, f);
    1.19 +    testcase(obj, ParallelArray.prototype.scatter, [0]);
    1.20 +    testcase(obj, ParallelArray.prototype.filter, [0]);
    1.21 +    testcase(obj, ParallelArray.prototype.flatten);
    1.22 +    testcase(obj, ParallelArray.prototype.partition, 2);
    1.23 +    testcase(obj, ParallelArray.prototype.get, [1]);
    1.24 +}
    1.25 +
    1.26 +// FIXME(bug 844887) check type of this
    1.27 +// if (getBuildConfiguration().parallelJS) {
    1.28 +// test(ParallelArray.prototype);
    1.29 +// test(Object.create(new ParallelArray));
    1.30 +// test({});
    1.31 +// test(null);
    1.32 +// test(undefined);
    1.33 +// }

mercurial