michael@0: // ParallelArray methods throw when passed a this-value that isn't a ParallelArray. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: michael@0: function testcase(obj, fn) { michael@0: assertEq(typeof fn, "function"); michael@0: var args = Array.slice(arguments, 2); michael@0: assertThrowsInstanceOf(function () { fn.apply(obj, args); }, TypeError); michael@0: } michael@0: michael@0: function test(obj) { michael@0: function f() {} michael@0: testcase(obj, ParallelArray.prototype.map, f); michael@0: testcase(obj, ParallelArray.prototype.reduce, f); michael@0: testcase(obj, ParallelArray.prototype.scan, f); michael@0: testcase(obj, ParallelArray.prototype.scatter, [0]); michael@0: testcase(obj, ParallelArray.prototype.filter, [0]); michael@0: testcase(obj, ParallelArray.prototype.flatten); michael@0: testcase(obj, ParallelArray.prototype.partition, 2); michael@0: testcase(obj, ParallelArray.prototype.get, [1]); michael@0: } michael@0: michael@0: // FIXME(bug 844887) check type of this michael@0: // if (getBuildConfiguration().parallelJS) { michael@0: // test(ParallelArray.prototype); michael@0: // test(Object.create(new ParallelArray)); michael@0: // test({}); michael@0: // test(null); michael@0: // test(undefined); michael@0: // }