mirror of
https://github.com/tc39/test262.git
synced 2025-07-28 08:24:23 +02:00
Replace runTestCase with assert helpers [test/built-ins/Array/prototype/reduceRight]
This commit is contained in:
parent
df43797c70
commit
174f24b2f3
@ -4,13 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-0-1
|
||||
description: Array.prototype.reduceRight must exist as a function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var f = Array.prototype.reduceRight;
|
||||
if (typeof(f) === "function") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(typeof(f), "function", 'typeof(f)');
|
||||
|
@ -4,12 +4,6 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-0-2
|
||||
description: Array.prototype.reduceRight.length must be 1
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
if (Array.prototype.reduceRight.length === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.length, 1, 'Array.prototype.reduceRight.length');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-11
|
||||
description: Array.prototype.reduceRight applied to Date object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new Date();
|
||||
obj.length = 1;
|
||||
obj[0] = 1;
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
return obj instanceof Date;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-12
|
||||
description: Array.prototype.reduceRight applied to RegExp object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new RegExp();
|
||||
obj.length = 1;
|
||||
obj[0] = 1;
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
return o instanceof RegExp;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-14
|
||||
description: Array.prototype.reduceRight applied to Error object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new Error();
|
||||
obj.length = 1;
|
||||
obj[0] = 1;
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
return o instanceof Error;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-15
|
||||
description: Array.prototype.reduceRight applied to the Arguments object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -20,6 +17,5 @@ function testcase() {
|
||||
return arguments;
|
||||
}("a", "b"));
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, "a") && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, "a"), 'Array.prototype.reduceRight.call(obj, callbackfn, "a") !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-4
|
||||
description: Array.prototype.reduceRight applied to Boolean object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new Boolean(true);
|
||||
obj.length = 2;
|
||||
obj[0] = 11;
|
||||
@ -20,6 +17,5 @@ function testcase() {
|
||||
return obj instanceof Boolean;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-6
|
||||
description: Array.prototype.reduceRight applied to Number object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new Number(-128);
|
||||
obj.length = 2;
|
||||
obj[0] = 11;
|
||||
@ -20,6 +17,5 @@ function testcase() {
|
||||
return o instanceof Number;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-7
|
||||
description: Array.prototype.reduceRight applied to string primitive
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -16,6 +13,5 @@ function testcase() {
|
||||
return obj instanceof String;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call("hello\nworld\\!", callbackfn, "h") && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call("hello\nworld\\!", callbackfn, "h"), 'Array.prototype.reduceRight.call("hello\nworld\\!", callbackfn, "h") !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-8
|
||||
description: Array.prototype.reduceRight applied to String object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = new String("hello\nworld\\!");
|
||||
var accessed = false;
|
||||
|
||||
@ -17,6 +14,5 @@ function testcase() {
|
||||
return o instanceof String;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, "h") && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, "h"), 'Array.prototype.reduceRight.call(obj, callbackfn, "h") !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-1-9
|
||||
description: Array.prototype.reduceRight applied to Function object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = function (a, b) {
|
||||
return a + b;
|
||||
};
|
||||
@ -21,6 +18,5 @@ function testcase() {
|
||||
return o instanceof Function;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,25 +6,17 @@ es5id: 15.4.4.22-10-1
|
||||
description: >
|
||||
Array.prototype.reduceRight doesn't mutate the Array on which it
|
||||
is called on
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
var srcArr = [1,2,3,4,5];
|
||||
srcArr.reduceRight(callbackfn);
|
||||
if(srcArr[0] === 1 &&
|
||||
srcArr[1] === 2 &&
|
||||
srcArr[2] === 3 &&
|
||||
srcArr[3] === 4 &&
|
||||
srcArr[4] === 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(srcArr[0], 1, 'srcArr[0]');
|
||||
assert.sameValue(srcArr[1], 2, 'srcArr[1]');
|
||||
assert.sameValue(srcArr[2], 3, 'srcArr[2]');
|
||||
assert.sameValue(srcArr[3], 4, 'srcArr[3]');
|
||||
assert.sameValue(srcArr[4], 5, 'srcArr[4]');
|
||||
|
@ -6,20 +6,12 @@ es5id: 15.4.4.22-10-2
|
||||
description: >
|
||||
Array.prototype.reduceRight reduces array in descending order of
|
||||
indices
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
return prevVal + curVal;
|
||||
}
|
||||
var srcArr = ['1','2','3','4','5'];
|
||||
if(srcArr.reduceRight(callbackfn) === '54321')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(srcArr.reduceRight(callbackfn), '54321', 'srcArr.reduceRight(callbackfn)');
|
||||
|
@ -4,16 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-10-3
|
||||
description: Array.prototype.reduceRight - subclassed array with length 1
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
foo.prototype = [1];
|
||||
function foo() {}
|
||||
var f = new foo();
|
||||
|
||||
function cb(){}
|
||||
if(f.reduceRight(cb) === 1)
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.reduceRight(cb), 1, 'f.reduceRight(cb)');
|
||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.22-10-4
|
||||
description: >
|
||||
Array.prototype.reduceRight - subclassed array with length more
|
||||
than 1
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
foo.prototype = new Array(0, 1, 2, 3);
|
||||
function foo() {}
|
||||
var f = new foo();
|
||||
|
||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||
if(f.reduceRight(cb) === 6)
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.reduceRight(cb), 6, 'f.reduceRight(cb)');
|
||||
|
@ -6,20 +6,12 @@ es5id: 15.4.4.22-10-5
|
||||
description: >
|
||||
Array.prototype.reduceRight reduces array in descending order of
|
||||
indices(initialvalue present)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
return prevVal + curVal;
|
||||
}
|
||||
var srcArr = ['1','2','3','4','5'];
|
||||
if(srcArr.reduceRight(callbackfn,'6') === '654321')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(srcArr.reduceRight(callbackfn,'6'), '654321', 'srcArr.reduceRight(callbackfn,"6")');
|
||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.22-10-6
|
||||
description: >
|
||||
Array.prototype.reduceRight - subclassed array when initialvalue
|
||||
provided
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
foo.prototype = new Array(0, 1, 2, 3);
|
||||
function foo() {}
|
||||
var f = new foo();
|
||||
|
||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||
if(f.reduceRight(cb,"4") === "43210")
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.reduceRight(cb,"4"), "43210", 'f.reduceRight(cb,"4")');
|
||||
|
@ -6,16 +6,12 @@ es5id: 15.4.4.22-10-7
|
||||
description: >
|
||||
Array.prototype.reduceRight - subclassed array when length to 1
|
||||
and initialvalue provided
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
foo.prototype = [1];
|
||||
function foo() {}
|
||||
var f = new foo();
|
||||
|
||||
function cb(prevVal, curVal, idx, obj){return prevVal + curVal;}
|
||||
if(f.reduceRight(cb,"4") === "41")
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(f.reduceRight(cb,"4"), "41", 'f.reduceRight(cb,"4")');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-10-8
|
||||
description: Array.prototype.reduceRight doesn't visit expandos
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var callCnt = 0;
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
@ -20,10 +17,4 @@ function testcase() {
|
||||
|
||||
srcArr.reduceRight(callbackfn);
|
||||
|
||||
if(callCnt == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(callCnt, 4, 'callCnt');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-1
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own data property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var obj = {
|
||||
0: 12,
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-10
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an inherited accessor property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var Con = function () { };
|
||||
|
||||
@ -37,6 +34,5 @@ function testcase() {
|
||||
child[2] = 9;
|
||||
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn, 11), 'Array.prototype.reduceRight.call(child, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-11
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own accessor property without a get function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,5 @@ function testcase() {
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 111) === 111 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(obj, callbackfn, 111)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-13
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to the Array-like object that
|
||||
'length' is inherited accessor property without a get function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -31,6 +28,5 @@ function testcase() {
|
||||
child[0] = 11;
|
||||
child[1] = 12;
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn, 111) === 111 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(child, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(child, callbackfn, 111)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-14
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to the Array-like object that
|
||||
'length' property doesn't exist
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = { 0: 11, 1: 12 };
|
||||
var accessed = false;
|
||||
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
return curVal > 10;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 111) === 111 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(obj, callbackfn, 111)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-17
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to the Arguments object, which
|
||||
implements its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var arg;
|
||||
var accessed = false;
|
||||
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
return Array.prototype.reduceRight.call(arguments, callbackfn, 11);
|
||||
};
|
||||
|
||||
return func(12, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(func(12, 11), 'func(12, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-19
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Function object, which
|
||||
implements its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var fun = function (a, b) {
|
||||
return a + b;
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(fun, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(fun, callbackfn, 11), 'Array.prototype.reduceRight.call(fun, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-2
|
||||
description: >
|
||||
Array.prototype.reduceRight - 'length' is own data property on an
|
||||
Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -18,6 +15,5 @@ function testcase() {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
return [12, 11].reduceRight(callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert([12, 11].reduceRight(callbackfn, 11), '[12, 11].reduceRight(callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-3
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own data property that overrides an inherited data property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = true;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -29,6 +26,5 @@ function testcase() {
|
||||
child[1] = 11;
|
||||
child[2] = 9;
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn), 'Array.prototype.reduceRight.call(child, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own data property that overrides an inherited accessor
|
||||
property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -39,6 +36,5 @@ function testcase() {
|
||||
child[1] = 11;
|
||||
child[2] = 9;
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn), 'Array.prototype.reduceRight.call(child, callbackfn) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-6
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an inherited data property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var proto = { length: 2 };
|
||||
var Con = function () { };
|
||||
@ -26,6 +23,5 @@ function testcase() {
|
||||
return obj.length === 2;
|
||||
}
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn1, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn1, 11), 'Array.prototype.reduceRight.call(child, callbackfn1, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-2-7
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own accessor property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = true;
|
||||
var obj = {};
|
||||
obj[0] = 12;
|
||||
@ -29,6 +26,5 @@ function testcase() {
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own accessor property that overrides an inherited data
|
||||
property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -37,6 +34,5 @@ function testcase() {
|
||||
child[1] = 11;
|
||||
child[2] = 9;
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn, 11) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn, 11), 'Array.prototype.reduceRight.call(child, callbackfn, 11) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight applied to Array-like object, 'length'
|
||||
is an own accessor property that overrides an inherited accessor
|
||||
property
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn1(prevVal, curVal, idx, obj) {
|
||||
@ -41,6 +38,5 @@ function testcase() {
|
||||
child[1] = 11;
|
||||
child[2] = 9;
|
||||
|
||||
return Array.prototype.reduceRight.call(child, callbackfn1, 111) && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(Array.prototype.reduceRight.call(child, callbackfn1, 111), 'Array.prototype.reduceRight.call(child, callbackfn1, 111) !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -4,11 +4,8 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-3-1
|
||||
description: Array.prototype.reduceRight - value of 'length' is undefined
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -17,6 +14,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: undefined };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-10
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is NaN)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: NaN };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-11
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing a positive number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: "2" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-12
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing a negative number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 11, 1: 12, 2: 9, length: "-4294967294" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && !testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert.sameValue(testResult2, false, 'testResult2');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-13
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing a decimal number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: "2.5" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-14
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing -Infinity
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed2 = false;
|
||||
|
||||
function callbackfn2(prevVal, curVal, idx, obj) {
|
||||
@ -19,7 +16,5 @@ function testcase() {
|
||||
|
||||
var obj2 = { 0: 9, length: "-Infinity" };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj2, callbackfn2, 2) === 2 &&
|
||||
!accessed2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj2, callbackfn2, 2), 2, 'Array.prototype.reduceRight.call(obj2, callbackfn2, 2)');
|
||||
assert.sameValue(accessed2, false, 'accessed2');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-15
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing an exponential number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: "2E0" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-16
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing a hex number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: "0x0002" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-17
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string
|
||||
containing a number with leading zeros
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: "0002.00" };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-18
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a string that
|
||||
can't convert to a number
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, 1: 8, length: "two" };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 11) === 11 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 11), 11, 'Array.prototype.reduceRight.call(obj, callbackfn, 11)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-19
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is an object which
|
||||
has an own toString method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -44,6 +41,7 @@ function testcase() {
|
||||
// resulting string to a number.
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2 && toStringAccessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-2
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to an Array-like object,
|
||||
'length' is 0 (length overridden to false(type conversion))
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(preVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: false };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-20
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is an Object which
|
||||
has an own valueOf method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -39,6 +36,7 @@ function testcase() {
|
||||
};
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2 && valueOfAccessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - 'length' is an object that has an
|
||||
own valueOf method that returns an object and toString method that
|
||||
returns a string
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -45,6 +42,8 @@ function testcase() {
|
||||
};
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2 && valueOfAccessed && toStringAccessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight uses inherited valueOf method when
|
||||
'length' is an object with an own toString and inherited valueOf
|
||||
methods
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
var valueOfAccessed = false;
|
||||
@ -51,6 +48,8 @@ function testcase() {
|
||||
};
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2 && valueOfAccessed && !toStringAccessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||
assert.sameValue(toStringAccessed, false, 'toStringAccessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-24
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a positive
|
||||
non-integer, ensure truncation occurs in the proper direction
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 0: 12, 1: 11, 2: 9, length: 2.685 };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-25
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a negative
|
||||
non-integer
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -32,6 +29,6 @@ function testcase() {
|
||||
};
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && !testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert.sameValue(testResult2, false, 'testResult2');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-3
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is 0)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: 0 };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-4
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is +0)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: +0 };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-5
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is -0)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(preVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: -0 };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-6
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is positive)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 1: 11, 2: 9, length: 2 };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert(testResult2, 'testResult2 !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-7
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is negative)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult1 = true;
|
||||
var testResult2 = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -27,6 +24,6 @@ function testcase() {
|
||||
var obj = { 1: 11, 2: 9, length: -4294967294 };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, 1);
|
||||
return testResult1 && !testResult2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult1, 'testResult1 !== true');
|
||||
assert.sameValue(testResult2, false, 'testResult2');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-3-9
|
||||
description: >
|
||||
Array.prototype.reduceRight - value of 'length' is a number (value
|
||||
is -Infinity)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -19,6 +16,5 @@ function testcase() {
|
||||
|
||||
var obj = { 0: 9, length: -Infinity };
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn, 1) === 1 && !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)');
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -4,17 +4,12 @@
|
||||
/*---
|
||||
es5id: 15.4.4.22-4-12
|
||||
description: Array.prototype.reduceRight - 'callbackfn' is a function
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var initialValue = 0;
|
||||
function callbackfn(accum, val, idx, obj) {
|
||||
accum += val;
|
||||
return accum;
|
||||
}
|
||||
|
||||
return 20 === [11, 9].reduceRight(callbackfn, initialValue);
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue([11, 9].reduceRight(callbackfn, initialValue), 20, '[11, 9].reduceRight(callbackfn, initialValue)');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-8-b-2
|
||||
description: >
|
||||
Array.prototype.reduceRight - modifications to length don't change
|
||||
number of iterations in step 9
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var called = 0;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
called++;
|
||||
@ -27,6 +25,5 @@ function testcase() {
|
||||
|
||||
var preVal = arr.reduceRight(callbackfn);
|
||||
|
||||
return preVal === 11 && called === 2;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(preVal, 11, 'preVal');
|
||||
assert.sameValue(called, 2, 'called');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-3
|
||||
description: >
|
||||
Array.prototype.reduceRight - while loop is breaken once
|
||||
'kPresent' is true
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var called = 0;
|
||||
var testResult = false;
|
||||
var firstCalled = 0;
|
||||
@ -43,6 +40,6 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
|
||||
return testResult && firstCalled === 1 && secondCalled === 1;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert.sameValue(firstCalled, 1, 'firstCalled');
|
||||
assert.sameValue(secondCalled, 1, 'secondCalled');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-ii-1
|
||||
description: >
|
||||
Array.prototype.reduceRight - added properties in step 2 are
|
||||
visible here
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var obj = {};
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) { }
|
||||
@ -23,6 +20,4 @@ function testcase() {
|
||||
configurable: true
|
||||
});
|
||||
|
||||
return Array.prototype.reduceRight.call(obj, callbackfn) === "accumulator";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn), "accumulator", 'Array.prototype.reduceRight.call(obj, callbackfn)');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-1
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own data
|
||||
property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 0) {
|
||||
@ -21,6 +18,5 @@ function testcase() {
|
||||
var obj = { 0: 0, 1: 1, length: 2 };
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-10
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 2) {
|
||||
@ -27,6 +25,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property that overrides an inherited data property on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -35,6 +32,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property that overrides an inherited accessor property on
|
||||
an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -42,6 +39,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-15
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is inherited
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -34,6 +31,5 @@ function testcase() {
|
||||
child.length = 3;
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-17
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property without a get function on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -26,6 +23,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-18
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property without a get function on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -26,7 +23,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-2
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own data
|
||||
property on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -21,6 +18,5 @@ function testcase() {
|
||||
var arr = [0, 1, 2];
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-21
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is inherited
|
||||
accessor property without a get function on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -32,7 +29,5 @@ function testcase() {
|
||||
child.length = 3;
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - This object is the Arguments object
|
||||
which implements its own property get method (number of arguments
|
||||
is less than number of parameters)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 0) {
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
};
|
||||
|
||||
func(0, 1);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - This object is the Arguments object
|
||||
which implements its own property get method (number of arguments
|
||||
equals number of parameters)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
};
|
||||
|
||||
func(0, 1, 2);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - This object is the Arguments object
|
||||
which implements its own property get method (number of arguments
|
||||
is greater than number of parameters)
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 2) {
|
||||
@ -24,6 +21,5 @@ function testcase() {
|
||||
};
|
||||
|
||||
func(0, 1, 2, 3);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-28
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to String object, which
|
||||
implements its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -21,7 +18,5 @@ function testcase() {
|
||||
var str = new String("012");
|
||||
|
||||
Array.prototype.reduceRight.call(str, callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-29
|
||||
description: >
|
||||
Array.prototype.reduceRight applied to Function object which
|
||||
implements its own property get method
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -27,7 +24,5 @@ function testcase() {
|
||||
obj[2] = 2;
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own data
|
||||
property that overrides an inherited data property on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -29,7 +26,5 @@ function testcase() {
|
||||
child.length = 3;
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-30
|
||||
description: >
|
||||
Array.prototype.reduceRight - element changed by getter on current
|
||||
iteration is observed in subsequent iterations on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -40,6 +38,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-31
|
||||
description: >
|
||||
Array.prototype.reduceRight - element changed by getter on current
|
||||
iteration is observed subsequetly on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -40,6 +38,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own data
|
||||
property that overrides an inherited accessor property on an
|
||||
Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -41,6 +38,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-7
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is inherited
|
||||
data property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -25,6 +22,5 @@ function testcase() {
|
||||
var child = new Con();
|
||||
|
||||
Array.prototype.reduceRight.call(child, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-8-b-iii-1-9
|
||||
description: >
|
||||
Array.prototype.reduceRight - element to be retrieved is own
|
||||
accessor property on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
if (idx === 1) {
|
||||
@ -27,7 +24,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -8,10 +8,8 @@ description: >
|
||||
index is larger than array original length added to array after it
|
||||
is called, consider new elements which index is smaller than array
|
||||
length
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
arr[5] = 6;
|
||||
arr[2] = 3;
|
||||
@ -19,6 +17,5 @@ function testcase() {
|
||||
}
|
||||
|
||||
var arr = ['1', 2, , 4, '5'];
|
||||
return arr.reduceRight(callbackfn) === "54321";
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.reduceRight(callbackfn), "54321", 'arr.reduceRight(callbackfn)');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-2
|
||||
description: >
|
||||
Array.prototype.reduceRight considers new value of elements in
|
||||
array after it is called
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
arr[3] = -2;
|
||||
@ -19,8 +16,5 @@ function testcase() {
|
||||
}
|
||||
|
||||
var arr = [1,2,3,4,5];
|
||||
if(arr.reduceRight(callbackfn) === 13)
|
||||
return true;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.reduceRight(callbackfn), 13, 'arr.reduceRight(callbackfn)');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-4
|
||||
description: >
|
||||
Array.prototype.reduceRight doesn't consider unvisited deleted
|
||||
elements when Array.length is decreased
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
arr.length = 2;
|
||||
@ -18,8 +15,5 @@ function testcase() {
|
||||
}
|
||||
|
||||
var arr = [1,2,3,4,5];
|
||||
if(arr.reduceRight(callbackfn) === 12 )
|
||||
return true;
|
||||
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(arr.reduceRight(callbackfn), 12, 'arr.reduceRight(callbackfn)');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-5
|
||||
description: >
|
||||
Array.prototype.reduceRight - callbackfn not called for array with
|
||||
one element
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var callCnt = 0;
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
@ -19,7 +16,6 @@ function testcase() {
|
||||
}
|
||||
|
||||
var arr = [1];
|
||||
if(arr.reduceRight(callbackfn) === 1 && callCnt === 0 )
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.reduceRight(callbackfn), 1, 'arr.reduceRight(callbackfn)');
|
||||
assert.sameValue(callCnt, 0, 'callCnt');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-9-7
|
||||
description: >
|
||||
Array.prototype.reduceRight not affect call when the array is
|
||||
deleted during the call
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
delete o.arr;
|
||||
return prevVal + curVal;
|
||||
@ -17,6 +15,6 @@ function testcase() {
|
||||
|
||||
var o = new Object();
|
||||
o.arr = ['1', 2, 3, 4, 5];
|
||||
return o.arr.reduceRight(callbackfn) === "141" && !o.hasOwnProperty("arr");
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(o.arr.reduceRight(callbackfn), "141", 'o.arr.reduceRight(callbackfn)');
|
||||
assert.sameValue(o.hasOwnProperty("arr"), false, 'o.hasOwnProperty("arr")');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-8
|
||||
description: >
|
||||
Array.prototype.reduceRight - no observable effects occur if 'len'
|
||||
is 0
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
function callbackfn() {
|
||||
accessed = true;
|
||||
@ -27,6 +24,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, function () { }, "initialValue");
|
||||
return !accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(accessed, false, 'accessed');
|
||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.22-9-9
|
||||
description: >
|
||||
Array.prototype.reduceRight - modifications to length will change
|
||||
number of iterations
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
var called = 0;
|
||||
function callbackfn(preVal, val, idx, obj) {
|
||||
called++;
|
||||
@ -25,6 +23,4 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn, "initialValue");
|
||||
|
||||
return called === 3;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert.sameValue(called, 3, 'called');
|
||||
|
@ -6,18 +6,13 @@ es5id: 15.4.4.22-9-b-1
|
||||
description: >
|
||||
Array.prototype.reduceRight returns initialvalue when Array is
|
||||
empty and initialValue is not present
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj)
|
||||
{
|
||||
}
|
||||
|
||||
var arr = new Array(10);
|
||||
|
||||
if(arr.reduceRight(callbackfn,5) === 5)
|
||||
return true;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert.sameValue(arr.reduceRight(callbackfn,5), 5, 'arr.reduceRight(callbackfn,5)');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-14
|
||||
description: >
|
||||
Array.prototype.reduceRight - decreasing length of array in step 8
|
||||
causes deleted index property not to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
@ -33,6 +30,5 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
|
||||
return testResult && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - decreasing length of array in step 8
|
||||
does not delete non-configurable properties
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -39,6 +36,4 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-17
|
||||
description: >
|
||||
Array.prototype.reduceRight - properties added into own object are
|
||||
visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -35,6 +32,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, "initialValue");
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-18
|
||||
description: >
|
||||
Array.prototype.reduceRight - properties added into own object are
|
||||
visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -35,6 +32,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn, "initialValue");
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-2
|
||||
description: >
|
||||
Array.prototype.reduceRight - added properties in step 2 are
|
||||
visible here
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -31,6 +28,4 @@ function testcase() {
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, "initialValue");
|
||||
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-21
|
||||
description: >
|
||||
Array.prototype.reduceRight - deleting own property causes deleted
|
||||
index property not to be visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
@ -39,6 +36,6 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, "initialValue");
|
||||
return testResult && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-22
|
||||
description: >
|
||||
Array.prototype.reduceRight - deleting own property causes deleted
|
||||
index property not to be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
@ -39,6 +36,6 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn, "initialValue");
|
||||
return testResult && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-27
|
||||
description: >
|
||||
Array.prototype.reduceRight - decreasing length of array causes
|
||||
deleted index property not to be visited
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
@ -33,6 +30,5 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn, "initialValue");
|
||||
|
||||
return testResult && accessed;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
assert(accessed, 'accessed !== true');
|
||||
|
@ -7,11 +7,8 @@ description: >
|
||||
Array.prototype.reduceRight - decreasing length of array does not
|
||||
delete non-configurable properties
|
||||
flags: [noStrict]
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
@ -39,6 +36,4 @@ function testcase() {
|
||||
|
||||
arr.reduceRight(callbackfn, "initialValue");
|
||||
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-3
|
||||
description: >
|
||||
Array.prototype.reduceRight - deleted properties in step 2 are
|
||||
visible here
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var accessed = false;
|
||||
var testResult = true;
|
||||
|
||||
@ -33,6 +30,5 @@ function testcase() {
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn, "initialValue");
|
||||
|
||||
return accessed && testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
assert(accessed, 'accessed !== true');
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-4
|
||||
description: >
|
||||
Array.prototype.reduceRight - properties added into own object in
|
||||
step 8 can be visited on an Array-like object
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(preVal, curVal, idx, obj) {
|
||||
@ -35,6 +32,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
Array.prototype.reduceRight.call(obj, callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.22-9-b-5
|
||||
description: >
|
||||
Array.prototype.reduceRight - properties added into own object in
|
||||
step 8 can be visited on an Array
|
||||
includes: [runTestCase.js]
|
||||
---*/
|
||||
|
||||
function testcase() {
|
||||
|
||||
var testResult = false;
|
||||
|
||||
function callbackfn(preVal, curVal, idx, obj) {
|
||||
@ -35,6 +32,5 @@ function testcase() {
|
||||
});
|
||||
|
||||
arr.reduceRight(callbackfn);
|
||||
return testResult;
|
||||
}
|
||||
runTestCase(testcase);
|
||||
|
||||
assert(testResult, 'testResult !== true');
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user