diff options
Diffstat (limited to 'test/built-ins/Array/prototype/reduceRight')
250 files changed, 3001 insertions, 3444 deletions
diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-1.js index 5a64f1472..7650b6531 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-1.js @@ -9,5 +9,5 @@ description: Array.prototype.reduceRight applied to undefined throws a TypeError assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(undefined); + Array.prototype.reduceRight.call(undefined); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-10.js index fb0a1f9f8..341dac729 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-10.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-10 description: Array.prototype.reduceRight applied to the Math object ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return '[object Math]' === Object.prototype.toString.call(obj); -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return '[object Math]' === Object.prototype.toString.call(obj); + } -Math.length = 1; -Math[0] = 1; + Math.length = 1; + Math[0] = 1; assert(Array.prototype.reduceRight.call(Math, callbackfn, 1), 'Array.prototype.reduceRight.call(Math, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-11.js index 610b41291..447771e6e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-11.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-11 description: Array.prototype.reduceRight applied to Date object ---*/ -var obj = new Date(); -obj.length = 1; -obj[0] = 1; -var accessed = false; + var obj = new Date(); + obj.length = 1; + obj[0] = 1; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj instanceof Date; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj instanceof Date; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-12.js index efc9fa2e3..06834d39e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-12.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-12 description: Array.prototype.reduceRight applied to RegExp object ---*/ -var obj = new RegExp(); -obj.length = 1; -obj[0] = 1; -var accessed = false; + var obj = new RegExp(); + obj.length = 1; + obj[0] = 1; + var accessed = false; -function callbackfn(prevVal, curVal, idx, o) { - accessed = true; - return o instanceof RegExp; -} + function callbackfn(prevVal, curVal, idx, o) { + accessed = true; + return o instanceof RegExp; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-13.js index 822d57425..9d6b8f83c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-13.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-13 description: Array.prototype.reduceRight applied to the JSON object ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return ('[object JSON]' === Object.prototype.toString.call(obj)); -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return ('[object JSON]' === Object.prototype.toString.call(obj)); + } -JSON.length = 1; -JSON[0] = 1; + JSON.length = 1; + JSON[0] = 1; assert(Array.prototype.reduceRight.call(JSON, callbackfn, 1), 'Array.prototype.reduceRight.call(JSON, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-14.js index 4d8557c59..6b7e76ea4 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-14.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-14 description: Array.prototype.reduceRight applied to Error object ---*/ -var obj = new Error(); -obj.length = 1; -obj[0] = 1; -var accessed = false; + var obj = new Error(); + obj.length = 1; + obj[0] = 1; + var accessed = false; -function callbackfn(prevVal, curVal, idx, o) { - accessed = true; - return o instanceof Error; -} + function callbackfn(prevVal, curVal, idx, o) { + accessed = true; + return o instanceof Error; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 1), 'Array.prototype.reduceRight.call(obj, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-15.js index a2bb8a9ff..8e739dfab 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-15.js @@ -7,16 +7,16 @@ es5id: 15.4.4.22-1-15 description: Array.prototype.reduceRight applied to the Arguments object ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return '[object Arguments]' === Object.prototype.toString.call(obj); -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return '[object Arguments]' === Object.prototype.toString.call(obj); + } -var obj = (function() { - return arguments; -}("a", "b")); + var obj = (function () { + return arguments; + }("a", "b")); assert(Array.prototype.reduceRight.call(obj, callbackfn, "a"), 'Array.prototype.reduceRight.call(obj, callbackfn, "a") !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-2.js index cf08c68a5..602cef5da 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-2.js @@ -9,5 +9,5 @@ description: Array.prototype.reduceRight applied to null throws a TypeError assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(null); + Array.prototype.reduceRight.call(null); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-3.js index 6fca6c304..54f2c207a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-3.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-3 description: Array.prototype.reduceRight applied to boolean primitive ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj instanceof Boolean; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj instanceof Boolean; + } -Boolean.prototype[0] = 1; -Boolean.prototype.length = 1; + Boolean.prototype[0] = 1; + Boolean.prototype.length = 1; assert(Array.prototype.reduceRight.call(false, callbackfn, 1), 'Array.prototype.reduceRight.call(false, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-4.js index d78244685..77427f29c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-4.js @@ -7,16 +7,16 @@ es5id: 15.4.4.22-1-4 description: Array.prototype.reduceRight applied to Boolean object ---*/ -var obj = new Boolean(true); -obj.length = 2; -obj[0] = 11; -obj[1] = 12; -var accessed = false; + var obj = new Boolean(true); + obj.length = 2; + obj[0] = 11; + obj[1] = 12; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj instanceof Boolean; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj instanceof Boolean; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-5.js index c83b156f0..59244bbe9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-5.js @@ -7,15 +7,15 @@ es5id: 15.4.4.22-1-5 description: Array.prototype.reduceRight applied to number primitive ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj instanceof Number; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj instanceof Number; + } -Number.prototype[0] = 1; -Number.prototype.length = 1; + Number.prototype[0] = 1; + Number.prototype.length = 1; assert(Array.prototype.reduceRight.call(2.5, callbackfn, 1), 'Array.prototype.reduceRight.call(2.5, callbackfn, 1) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-6.js index 9d1c2792a..a0c2df0e8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-6.js @@ -7,16 +7,16 @@ es5id: 15.4.4.22-1-6 description: Array.prototype.reduceRight applied to Number object ---*/ -var obj = new Number(-128); -obj.length = 2; -obj[0] = 11; -obj[1] = 12; -var accessed = false; + var obj = new Number(-128); + obj.length = 2; + obj[0] = 11; + obj[1] = 12; + var accessed = false; -function callbackfn(prevVal, curVal, idx, o) { - accessed = true; - return o instanceof Number; -} + function callbackfn(prevVal, curVal, idx, o) { + accessed = true; + return o instanceof Number; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-7.js index 7c3dabefe..6e368cfff 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-7.js @@ -7,12 +7,12 @@ es5id: 15.4.4.22-1-7 description: Array.prototype.reduceRight applied to string primitive ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj instanceof String; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj instanceof String; + } assert(Array.prototype.reduceRight.call("hello\nworld\\!", callbackfn, "h"), 'Array.prototype.reduceRight.call("hello\nworld\\!", callbackfn, "h") !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-8.js index 9f6ee35db..d034b48b3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-8.js @@ -7,13 +7,13 @@ es5id: 15.4.4.22-1-8 description: Array.prototype.reduceRight applied to String object ---*/ -var obj = new String("hello\nworld\\!"); -var accessed = false; + var obj = new String("hello\nworld\\!"); + var accessed = false; -function callbackfn(prevVal, curVal, idx, o) { - accessed = true; - return o instanceof String; -} + function callbackfn(prevVal, curVal, idx, o) { + accessed = true; + return o instanceof String; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, "h"), 'Array.prototype.reduceRight.call(obj, callbackfn, "h") !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-9.js index 42e6c8ca6..1820f546c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-1-9.js @@ -7,17 +7,17 @@ es5id: 15.4.4.22-1-9 description: Array.prototype.reduceRight applied to Function object ---*/ -var obj = function(a, b) { - return a + b; -}; -obj[0] = 11; -obj[1] = 9; -var accessed = false; + var obj = function (a, b) { + return a + b; + }; + obj[0] = 11; + obj[1] = 9; + var accessed = false; -function callbackfn(prevVal, curVal, idx, o) { - accessed = true; - return o instanceof Function; -} + function callbackfn(prevVal, curVal, idx, o) { + accessed = true; + return o instanceof Function; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-1.js index eaaca4897..d9b0c874d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-1.js @@ -9,12 +9,12 @@ description: > is called on ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - return 1; -} -var srcArr = [1, 2, 3, 4, 5]; -srcArr.reduceRight(callbackfn); + function callbackfn(prevVal, curVal, idx, obj) + { + return 1; + } + var srcArr = [1,2,3,4,5]; + srcArr.reduceRight(callbackfn); assert.sameValue(srcArr[0], 1, 'srcArr[0]'); assert.sameValue(srcArr[1], 2, 'srcArr[1]'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-2.js index cffd5e08e..1b34162cf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-2.js @@ -9,10 +9,10 @@ description: > indices ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - return prevVal + curVal; -} -var srcArr = ['1', '2', '3', '4', '5']; + function callbackfn(prevVal, curVal, idx, obj) + { + return prevVal + curVal; + } + var srcArr = ['1','2','3','4','5']; assert.sameValue(srcArr.reduceRight(callbackfn), '54321', 'srcArr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-3.js index de4a59b0c..6e47fd871 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-3.js @@ -7,11 +7,10 @@ es5id: 15.4.4.22-10-3 description: Array.prototype.reduceRight - subclassed array with length 1 ---*/ -foo.prototype = [1]; + foo.prototype = [1]; + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); - -function cb() {} + function cb(){} assert.sameValue(f.reduceRight(cb), 1, 'f.reduceRight(cb)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-4.js index 7726d9fde..76afe6029 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-4.js @@ -9,13 +9,10 @@ description: > than 1 ---*/ -foo.prototype = new Array(0, 1, 2, 3); + foo.prototype = new Array(0, 1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); - -function cb(prevVal, curVal, idx, obj) { - return prevVal + curVal; -} + function cb(prevVal, curVal, idx, obj){return prevVal + curVal;} assert.sameValue(f.reduceRight(cb), 6, 'f.reduceRight(cb)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-5.js index c5c29eb02..78e6d744f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-5.js @@ -9,10 +9,10 @@ description: > indices(initialvalue present) ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - return prevVal + curVal; -} -var srcArr = ['1', '2', '3', '4', '5']; + function callbackfn(prevVal, curVal, idx, obj) + { + return prevVal + curVal; + } + var srcArr = ['1','2','3','4','5']; -assert.sameValue(srcArr.reduceRight(callbackfn, '6'), '654321', 'srcArr.reduceRight(callbackfn,"6")'); +assert.sameValue(srcArr.reduceRight(callbackfn,'6'), '654321', 'srcArr.reduceRight(callbackfn,"6")'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-6.js index 37cb4705e..1ce24519c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-6.js @@ -9,13 +9,10 @@ description: > provided ---*/ -foo.prototype = new Array(0, 1, 2, 3); + foo.prototype = new Array(0, 1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + function cb(prevVal, curVal, idx, obj){return prevVal + curVal;} -function cb(prevVal, curVal, idx, obj) { - return prevVal + curVal; -} - -assert.sameValue(f.reduceRight(cb, "4"), "43210", 'f.reduceRight(cb,"4")'); +assert.sameValue(f.reduceRight(cb,"4"), "43210", 'f.reduceRight(cb,"4")'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-7.js index 813179ec7..27be976b4 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-7.js @@ -9,13 +9,10 @@ description: > and initialvalue provided ---*/ -foo.prototype = [1]; + foo.prototype = [1]; + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + function cb(prevVal, curVal, idx, obj){return prevVal + curVal;} -function cb(prevVal, curVal, idx, obj) { - return prevVal + curVal; -} - -assert.sameValue(f.reduceRight(cb, "4"), "41", 'f.reduceRight(cb,"4")'); +assert.sameValue(f.reduceRight(cb,"4"), "41", 'f.reduceRight(cb,"4")'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-8.js index a9aa69740..8a9eb8165 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-10-8.js @@ -7,16 +7,15 @@ es5id: 15.4.4.22-10-8 description: Array.prototype.reduceRight doesn't visit expandos ---*/ -var callCnt = 0; + var callCnt = 0; + function callbackfn(prevVal, curVal, idx, obj) + { + callCnt++; + } + var srcArr = ['1','2','3','4','5']; + srcArr["i"] = 10; + srcArr[true] = 11; -function callbackfn(prevVal, curVal, idx, obj) -{ - callCnt++; -} -var srcArr = ['1', '2', '3', '4', '5']; -srcArr["i"] = 10; -srcArr[true] = 11; - -srcArr.reduceRight(callbackfn); + srcArr.reduceRight(callbackfn); assert.sameValue(callCnt, 4, 'callCnt'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-1.js index 5a7a0af52..5da45ad9d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-1.js @@ -9,18 +9,18 @@ description: > is an own data property ---*/ -var accessed = false; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: 2 -}; + var accessed = false; + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: 2 + }; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-10.js index 035cc1c82..ad204a77b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-10.js @@ -9,30 +9,30 @@ description: > is an inherited accessor property ---*/ -var accessed = false; -var Con = function() {}; + var accessed = false; + var Con = function () { }; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var proto = {}; + var proto = {}; -Object.defineProperty(proto, "length", { - get: function() { - return 2; - }, - configurable: true -}); + Object.defineProperty(proto, "length", { + get: function () { + return 2; + }, + configurable: true + }); -Con.prototype = proto; + Con.prototype = proto; -var child = new Con(); -child[0] = 12; -child[1] = 11; -child[2] = 9; + var child = new Con(); + child[0] = 12; + child[1] = 11; + child[2] = 9; assert(Array.prototype.reduceRight.call(child, callbackfn, 11), 'Array.prototype.reduceRight.call(child, callbackfn, 11) !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-11.js index ffd66953e..dc8d017bd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-11.js @@ -9,21 +9,21 @@ description: > is an own accessor property without a get function ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return typeof obj.length === "undefined"; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return typeof obj.length === "undefined"; + } -var obj = { - 0: 11, - 1: 12 -}; -Object.defineProperty(obj, "length", { - set: function() {}, - configurable: true -}); + var obj = { + 0: 11, + 1: 12 + }; + Object.defineProperty(obj, "length", { + set: function () { }, + configurable: true + }); assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(obj, callbackfn, 111)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-12.js index b685810f9..c162760d0 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-12.js @@ -10,28 +10,25 @@ description: > property ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return typeof obj.length === "undefined"; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return typeof obj.length === "undefined"; + } -Object.defineProperty(Object.prototype, "length", { - get: function() { - return 2; - }, - configurable: true -}); + Object.defineProperty(Object.prototype, "length", { + get: function () { + return 2; + }, + configurable: true + }); -var obj = { - 0: 12, - 1: 13 -}; -Object.defineProperty(obj, "length", { - set: function() {}, - configurable: true -}); + var obj = { 0: 12, 1: 13 }; + Object.defineProperty(obj, "length", { + set: function () { }, + configurable: true + }); assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 11), 11, 'Array.prototype.reduceRight.call(obj, callbackfn, 11)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-13.js index 7cdaf568c..56f37873f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-13.js @@ -9,25 +9,25 @@ description: > 'length' is inherited accessor property without a get function ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return curVal > 10; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return curVal > 10; + } -var proto = {}; -Object.defineProperty(proto, "length", { - set: function() {}, - configurable: true -}); + var proto = {}; + Object.defineProperty(proto, "length", { + set: function () { }, + configurable: true + }); -var Con = function() {}; -Con.prototype = proto; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); -child[0] = 11; -child[1] = 12; + var child = new Con(); + child[0] = 11; + child[1] = 12; assert.sameValue(Array.prototype.reduceRight.call(child, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(child, callbackfn, 111)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-14.js index 75d312923..26f6a9d37 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-14.js @@ -9,16 +9,13 @@ description: > 'length' property doesn't exist ---*/ -var obj = { - 0: 11, - 1: 12 -}; -var accessed = false; + var obj = { 0: 11, 1: 12 }; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return curVal > 10; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return curVal > 10; + } assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 111), 111, 'Array.prototype.reduceRight.call(obj, callbackfn, 111)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-17.js index b888b562e..41f7352af 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-17.js @@ -9,18 +9,18 @@ description: > implements its own property get method ---*/ -var arg; -var accessed = false; + var arg; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var func = function(a, b) { - arg = arguments; - return Array.prototype.reduceRight.call(arguments, callbackfn, 11); -}; + var func = function (a, b) { + arg = arguments; + return Array.prototype.reduceRight.call(arguments, callbackfn, 11); + }; assert(func(12, 11), 'func(12, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-18.js index bc036bf48..89f7a89fa 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-18.js @@ -9,15 +9,15 @@ description: > implements its own property get method ---*/ -var accessed = false; -var str = new String("432"); + var accessed = false; + var str = new String("432"); -function callbackfn(preVal, curVal, idx, obj) { - accessed = true; - return obj.length === 3; -} + function callbackfn(preVal, curVal, idx, obj) { + accessed = true; + return obj.length === 3; + } -String.prototype[3] = "1"; + String.prototype[3] = "1"; assert(Array.prototype.reduceRight.call(str, callbackfn, 111), 'Array.prototype.reduceRight.call(str, callbackfn, 111) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-19.js index f76fdf223..08bdd46df 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-19.js @@ -9,18 +9,18 @@ description: > implements its own property get method ---*/ -var accessed = false; -var fun = function(a, b) { - return a + b; -}; -fun[0] = 12; -fun[1] = 11; -fun[2] = 9; + var accessed = false; + var fun = function (a, b) { + return a + b; + }; + fun[0] = 12; + fun[1] = 11; + fun[2] = 9; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } assert(Array.prototype.reduceRight.call(fun, callbackfn, 11), 'Array.prototype.reduceRight.call(fun, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-2.js index b2b8335e1..c56d545b4 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-2.js @@ -9,12 +9,12 @@ description: > Array ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } assert([12, 11].reduceRight(callbackfn, 11), '[12, 11].reduceRight(callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-3.js index ef1d83a5d..feff6998d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-3.js @@ -9,25 +9,23 @@ description: > is an own data property that overrides an inherited data property ---*/ -var accessed = true; + var accessed = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var proto = { - length: 3 -}; + var proto = { length: 3 }; -var Con = function() {}; -Con.prototype = proto; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); -child.length = 2; -child[0] = 12; -child[1] = 11; -child[2] = 9; + var child = new Con(); + child.length = 2; + child[0] = 12; + child[1] = 11; + child[2] = 9; assert(Array.prototype.reduceRight.call(child, callbackfn), 'Array.prototype.reduceRight.call(child, callbackfn) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-4.js index 4335394fa..0a1b81254 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-4.js @@ -9,16 +9,15 @@ description: > overrides an inherited data property on an Array ---*/ -var accessed = false; -var arrProtoLen; + var accessed = false; + var arrProtoLen; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} - -arrProtoLen = Array.prototype.length; -Array.prototype.length = 0; + arrProtoLen = Array.prototype.length; + Array.prototype.length = 0; assert([12, 11].reduceRight(callbackfn, 11), '[12, 11].reduceRight(callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-5.js index 50e35c3b4..3fcf425de 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-5.js @@ -10,32 +10,32 @@ description: > property ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var proto = {}; -Object.defineProperty(proto, "length", { - get: function() { - return 3; - }, - configurable: true -}); + var proto = {}; + Object.defineProperty(proto, "length", { + get: function () { + return 3; + }, + configurable: true + }); -var Con = function() {}; -Con.prototype = proto; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); -Object.defineProperty(child, "length", { - value: 2, - configurable: true -}); -child[0] = 12; -child[1] = 11; -child[2] = 9; + var child = new Con(); + Object.defineProperty(child, "length", { + value: 2, + configurable: true + }); + child[0] = 12; + child[1] = 11; + child[2] = 9; assert(Array.prototype.reduceRight.call(child, callbackfn), 'Array.prototype.reduceRight.call(child, callbackfn) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-6.js index d41b9630a..b31b796cb 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-6.js @@ -9,22 +9,20 @@ description: > is an inherited data property ---*/ -var accessed = false; -var proto = { - length: 2 -}; -var Con = function() {}; -Con.prototype = proto; + var accessed = false; + var proto = { length: 2 }; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); -child[0] = 12; -child[1] = 11; -child[2] = 9; + var child = new Con(); + child[0] = 12; + child[1] = 11; + child[2] = 9; -function callbackfn1(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn1(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } assert(Array.prototype.reduceRight.call(child, callbackfn1, 11), 'Array.prototype.reduceRight.call(child, callbackfn1, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-7.js index 836ed95e1..1400c9e8e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-7.js @@ -9,23 +9,23 @@ description: > is an own accessor property ---*/ -var accessed = true; -var obj = {}; -obj[0] = 12; -obj[1] = 11; -obj[2] = 9; + var accessed = true; + var obj = {}; + obj[0] = 12; + obj[1] = 11; + obj[2] = 9; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -Object.defineProperty(obj, "length", { - get: function() { - return 2; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return 2; + }, + configurable: true + }); assert(Array.prototype.reduceRight.call(obj, callbackfn, 11), 'Array.prototype.reduceRight.call(obj, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-8.js index f867632c0..85912235a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-8.js @@ -10,32 +10,30 @@ description: > property ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var proto = { - length: 3 -}; + var proto = { length: 3 }; -var Con = function() {}; -Con.prototype = proto; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); + var child = new Con(); -Object.defineProperty(child, "length", { - get: function() { - return 2; - }, - configurable: true -}); + Object.defineProperty(child, "length", { + get: function () { + return 2; + }, + configurable: true + }); -child[0] = 12; -child[1] = 11; -child[2] = 9; + child[0] = 12; + child[1] = 11; + child[2] = 9; assert(Array.prototype.reduceRight.call(child, callbackfn, 11), 'Array.prototype.reduceRight.call(child, callbackfn, 11) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-9.js index d47f6150f..139b4d175 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-2-9.js @@ -10,34 +10,34 @@ description: > property ---*/ -var accessed = false; + var accessed = false; -function callbackfn1(prevVal, curVal, idx, obj) { - accessed = true; - return obj.length === 2; -} + function callbackfn1(prevVal, curVal, idx, obj) { + accessed = true; + return obj.length === 2; + } -var proto = {}; -Object.defineProperty(proto, "length", { - get: function() { - return 3; - }, - configurable: true -}); + var proto = {}; + Object.defineProperty(proto, "length", { + get: function () { + return 3; + }, + configurable: true + }); -var Con = function() {}; -Con.prototype = proto; + var Con = function () { }; + Con.prototype = proto; -var child = new Con(); -Object.defineProperty(child, "length", { - get: function() { - return 2; - }, - configurable: true -}); -child[0] = 12; -child[1] = 11; -child[2] = 9; + var child = new Con(); + Object.defineProperty(child, "length", { + get: function () { + return 2; + }, + configurable: true + }); + child[0] = 12; + child[1] = 11; + child[2] = 9; assert(Array.prototype.reduceRight.call(child, callbackfn1, 111), 'Array.prototype.reduceRight.call(child, callbackfn1, 111) !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-1.js index 7ce837aeb..d309b78ac 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-1.js @@ -7,16 +7,13 @@ es5id: 15.4.4.22-3-1 description: Array.prototype.reduceRight - value of 'length' is undefined ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: undefined -}; + var obj = { 0: 9, length: undefined }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-10.js index 938371d98..be485e4db 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-10.js @@ -9,16 +9,13 @@ description: > is NaN) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: NaN -}; + var obj = { 0: 9, length: NaN }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-11.js index 63f6e5712..c5d9cb5ab 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-11.js @@ -9,28 +9,22 @@ description: > containing a positive number ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: "2" }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: "2" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-12.js index 3a209ff40..f81ce7b4c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-12.js @@ -9,28 +9,22 @@ description: > containing a negative number ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 11, 1: 12, 2: 9, length: "-4294967294" }; -var obj = { - 0: 11, - 1: 12, - 2: 9, - length: "-4294967294" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert.sameValue(testResult2, false, 'testResult2'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-13.js index 6fb47ffde..054d4cf94 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-13.js @@ -9,28 +9,22 @@ description: > containing a decimal number ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: "2.5" }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: "2.5" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-14.js index 8fc2ef112..8f7aeeb38 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-14.js @@ -9,16 +9,13 @@ description: > containing -Infinity ---*/ -var accessed2 = false; + var accessed2 = false; -function callbackfn2(prevVal, curVal, idx, obj) { - accessed2 = true; -} + function callbackfn2(prevVal, curVal, idx, obj) { + accessed2 = true; + } -var obj2 = { - 0: 9, - length: "-Infinity" -}; + var obj2 = { 0: 9, length: "-Infinity" }; assert.sameValue(Array.prototype.reduceRight.call(obj2, callbackfn2, 2), 2, 'Array.prototype.reduceRight.call(obj2, callbackfn2, 2)'); assert.sameValue(accessed2, false, 'accessed2'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-15.js index dc7937f77..a77e817bd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-15.js @@ -9,28 +9,22 @@ description: > containing an exponential number ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: "2E0" }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: "2E0" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-16.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-16.js index ac8deb3c9..6d75ccf2e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-16.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-16.js @@ -9,28 +9,22 @@ description: > containing a hex number ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: "0x0002" }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: "0x0002" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-17.js index 5da8f8d4f..ace356165 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-17.js @@ -9,28 +9,22 @@ description: > containing a number with leading zeros ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: "0002.00" }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: "0002.00" -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-18.js index bd2586f98..1ae0c97f9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-18.js @@ -9,17 +9,13 @@ description: > can't convert to a number ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - 1: 8, - length: "two" -}; + var obj = { 0: 9, 1: 8, length: "two" }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 11), 11, 'Array.prototype.reduceRight.call(obj, callbackfn, 11)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-19.js index 1e2f2e395..4f314ad51 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-19.js @@ -9,40 +9,39 @@ description: > has an own toString method ---*/ -var testResult1 = true; -var testResult2 = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } - - if (idx === 1) { - testResult2 = true; - } - return false; -} - -var toStringAccessed = false; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: { - toString: function() { - toStringAccessed = true; - return '2'; - } - } -}; - -// objects inherit the default valueOf() method from Object -// that simply returns itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } + + if (idx === 1) { + testResult2 = true; + } + return false; + } + + var toStringAccessed = false; + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: { + toString: function () { + toStringAccessed = true; + return '2'; + } + } + }; + + // objects inherit the default valueOf() method from Object + // that simply returns itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. + + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-2.js index 77c0abd1b..80ddaeaa9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-2.js @@ -9,16 +9,13 @@ description: > 'length' is 0 (length overridden to false(type conversion)) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(preVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(preVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: false -}; + var obj = { 0: 9, length: false }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-20.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-20.js index 5b8cf1cbd..f277c7fa8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-20.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-20.js @@ -9,35 +9,34 @@ description: > has an own valueOf method ---*/ -var testResult1 = true; -var testResult2 = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } - - if (idx === 1) { - testResult2 = true; - } - return false; -} - -var valueOfAccessed = false; - -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: { - valueOf: function() { - valueOfAccessed = true; - return 2; - } - } -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } + + if (idx === 1) { + testResult2 = true; + } + return false; + } + + var valueOfAccessed = false; + + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: { + valueOf: function () { + valueOfAccessed = true; + return 2; + } + } + }; + + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-21.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-21.js index 31024633a..1f7f478cd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-21.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-21.js @@ -10,40 +10,39 @@ description: > returns a string ---*/ -var testResult1 = true; -var testResult2 = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } - - if (idx === 1) { - testResult2 = true; - } - return false; -} - -var toStringAccessed = false; -var valueOfAccessed = false; - -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: { - valueOf: function() { - valueOfAccessed = true; - return {}; - }, - toString: function() { - toStringAccessed = true; - return '2'; - } - } -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } + + if (idx === 1) { + testResult2 = true; + } + return false; + } + + var toStringAccessed = false; + var valueOfAccessed = false; + + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: { + valueOf: function () { + valueOfAccessed = true; + return {}; + }, + toString: function () { + toStringAccessed = true; + return '2'; + } + } + }; + + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-22.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-22.js index 488f1808f..717f2c2db 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-22.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-22.js @@ -10,31 +10,31 @@ description: > return primitive values ---*/ -var accessed = false; -var toStringAccessed = false; -var valueOfAccessed = false; + var accessed = false; + var toStringAccessed = false; + var valueOfAccessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 11, - 1: 12, + var obj = { + 0: 11, + 1: 12, - length: { - valueOf: function() { - valueOfAccessed = true; - return {}; - }, - toString: function() { - toStringAccessed = true; - return {}; - } - } -}; + length: { + valueOf: function () { + valueOfAccessed = true; + return {}; + }, + toString: function () { + toStringAccessed = true; + return {}; + } + } + }; assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); }); assert(toStringAccessed, 'toStringAccessed !== true'); assert(valueOfAccessed, 'valueOfAccessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-23.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-23.js index f9f5fa105..4a3951bcf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-23.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-23.js @@ -10,45 +10,45 @@ description: > methods ---*/ -var testResult1 = true; -var testResult2 = false; -var valueOfAccessed = false; -var toStringAccessed = false; - -var proto = { - valueOf: function() { - valueOfAccessed = true; - return 2; - } -}; -var Con = function() {}; -Con.prototype = proto; -var child = new Con(); - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } - - if (idx === 1) { - testResult2 = true; - } - return false; -} - -child.toString = function() { - toStringAccessed = true; - return '1'; -}; - -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: child -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + var testResult1 = true; + var testResult2 = false; + var valueOfAccessed = false; + var toStringAccessed = false; + + var proto = { + valueOf: function () { + valueOfAccessed = true; + return 2; + } + }; + var Con = function () { }; + Con.prototype = proto; + var child = new Con(); + + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } + + if (idx === 1) { + testResult2 = true; + } + return false; + } + + child.toString = function () { + toStringAccessed = true; + return '1'; + }; + + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: child + }; + + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-24.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-24.js index db317c993..33ffe0951 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-24.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-24.js @@ -9,28 +9,22 @@ description: > non-integer, ensure truncation occurs in the proper direction ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 0: 12, 1: 11, 2: 9, length: 2.685 }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: 2.685 -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-25.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-25.js index eb311aa6f..4895baa71 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-25.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-25.js @@ -9,28 +9,27 @@ description: > non-integer ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { + 0: 12, + 1: 11, + 2: 9, + length: -4294967294.5 + }; -var obj = { - 0: 12, - 1: 11, - 2: 9, - length: -4294967294.5 -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert.sameValue(testResult2, false, 'testResult2'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-3.js index b651dc45e..5eb751221 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-3.js @@ -9,16 +9,13 @@ description: > is 0) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: 0 -}; + var obj = { 0: 9, length: 0 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-4.js index 9b7f07bd4..8317bd611 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-4.js @@ -9,16 +9,13 @@ description: > is +0) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: +0 -}; + var obj = { 0: 9, length: +0 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-5.js index 9a8919e54..d41f2f0db 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-5.js @@ -9,16 +9,13 @@ description: > is -0) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(preVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(preVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: -0 -}; + var obj = { 0: 9, length: -0 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-6.js index 69ed877c2..4caab36e8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-6.js @@ -9,27 +9,22 @@ description: > is positive) ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 1: 11, 2: 9, length: 2 }; -var obj = { - 1: 11, - 2: 9, - length: 2 -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert(testResult2, 'testResult2 !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-7.js index a8da6c075..53556d6bd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-7.js @@ -9,27 +9,22 @@ description: > is negative) ---*/ -var testResult1 = true; -var testResult2 = false; + var testResult1 = true; + var testResult2 = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx > 1) { + testResult1 = false; + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx > 1) { - testResult1 = false; - } + if (idx === 1) { + testResult2 = true; + } + return false; + } - if (idx === 1) { - testResult2 = true; - } - return false; -} + var obj = { 1: 11, 2: 9, length: -4294967294 }; -var obj = { - 1: 11, - 2: 9, - length: -4294967294 -}; - -Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); assert(testResult1, 'testResult1 !== true'); assert.sameValue(testResult2, false, 'testResult2'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-9.js index 7ecc600aa..b9a895999 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-3-9.js @@ -9,16 +9,13 @@ description: > is -Infinity) ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + } -var obj = { - 0: 9, - length: -Infinity -}; + var obj = { 0: 9, length: -Infinity }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), 1, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-1.js index 04017e990..dc3e16591 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-1.js @@ -9,7 +9,7 @@ description: > undefined ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(); + arr.reduceRight(); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js index b6a599910..78a88e9b8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-10.js @@ -9,18 +9,15 @@ description: > exception was thrown by step 2 ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -Object.defineProperty(obj, "length", { - get: function() { - throw new Test262Error(); - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + throw new Test262Error(); + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, undefined); + Array.prototype.reduceRight.call(obj, undefined); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js index 34885bde3..cfb99f9c3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-11.js @@ -9,22 +9,19 @@ description: > exception was thrown by step 3 ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - throw new Test262Error(); - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + throw new Test262Error(); + } + }; + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, undefined); + Array.prototype.reduceRight.call(obj, undefined); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-12.js index f4e76497f..8f8339475 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-12.js @@ -7,11 +7,10 @@ es5id: 15.4.4.22-4-12 description: Array.prototype.reduceRight - 'callbackfn' is a function ---*/ -var initialValue = 0; - -function callbackfn(accum, val, idx, obj) { - accum += val; - return accum; -} + var initialValue = 0; + function callbackfn(accum, val, idx, obj) { + accum += val; + return accum; + } assert.sameValue([11, 9].reduceRight(callbackfn, initialValue), 20, '[11, 9].reduceRight(callbackfn, initialValue)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-15.js index cdef077c6..38d8e3f06 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-15.js @@ -9,28 +9,26 @@ description: > same as passing undefined for callbackfn ---*/ -var obj = { - 10: 10 -}; -var lengthAccessed = false; -var loopAccessed = false; + var obj = { 10: 10 }; + var lengthAccessed = false; + var loopAccessed = false; -Object.defineProperty(obj, "length", { - get: function() { - lengthAccessed = true; - return 20; - }, - configurable: true -}); -Object.defineProperty(obj, "0", { - get: function() { - loopAccessed = true; - return 10; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + lengthAccessed = true; + return 20; + }, + configurable: true + }); + Object.defineProperty(obj, "0", { + get: function () { + loopAccessed = true; + return 10; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, undefined); + Array.prototype.reduceRight.call(obj, undefined); }); assert(lengthAccessed, 'lengthAccessed !== true'); assert.sameValue(loopAccessed, false, 'loopAccessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-2.js index 40ea5d53c..51c148dce 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-2.js @@ -9,7 +9,7 @@ description: > unreferenced ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(ReferenceError, function() { - arr.reduceRight(foo); + arr.reduceRight(foo); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-3.js index 76b084c2b..129cfc44c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-3.js @@ -7,7 +7,7 @@ es5id: 15.4.4.22-4-3 description: Array.prototype.reduceRight throws TypeError if callbackfn is null ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(null); + arr.reduceRight(null); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-4.js index 9f0043f12..d4dc6d1f2 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-4.js @@ -9,7 +9,7 @@ description: > boolean ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(true); + arr.reduceRight(true); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-5.js index e22ed2183..a20e6ccb3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-5.js @@ -9,7 +9,7 @@ description: > number ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(5); + arr.reduceRight(5); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-6.js index e6437a1b3..f32324399 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-6.js @@ -9,7 +9,7 @@ description: > string ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight("abc"); + arr.reduceRight("abc"); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-7.js index c6104250d..86a86b8c9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-7.js @@ -9,7 +9,7 @@ description: > Object without [[Call]] internal method ---*/ -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(new Object()); + arr.reduceRight(new Object()); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-8.js index d76239982..2b7468f54 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-8.js @@ -9,21 +9,18 @@ description: > visible when an exception occurs ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - accessed = true; - return 2; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + accessed = true; + return 2; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, null); + Array.prototype.reduceRight.call(obj, null); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-9.js index 0da73eb44..dac9e41fa 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-4-9.js @@ -9,25 +9,22 @@ description: > visible when an exception occurs ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - accessed = true; - return "2"; - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + accessed = true; + return "2"; + } + }; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, null); + Array.prototype.reduceRight.call(obj, null); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-1.js index 562903de4..7aca86981 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-1.js @@ -9,7 +9,7 @@ description: > (empty array), no initVal ---*/ -function cb() {} + function cb(){} assert.throws(TypeError, function() { - [].reduceRight(cb); + [].reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-10.js index f70a3062d..ede41e29f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-10.js @@ -9,21 +9,18 @@ description: > an exception occurs ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - accessed = true; - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + accessed = true; + return 0; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-11.js index a0d148aac..627bebe30 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-11.js @@ -9,25 +9,22 @@ description: > an exception occurs ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - accessed = true; - return "0"; - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + accessed = true; + return "0"; + } + }; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js index 5a8f49096..7115439f2 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-12.js @@ -9,18 +9,15 @@ description: > exception was thrown by step 2 ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -Object.defineProperty(obj, "length", { - get: function() { - throw new Test262Error(); - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + throw new Test262Error(); + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js index f3a658dbd..8ff17da58 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-13.js @@ -9,22 +9,19 @@ description: > exception was thrown by step 3 ---*/ -var obj = { - 0: 11, - 1: 12 -}; + var obj = { 0: 11, 1: 12 }; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - throw new Test262Error(); - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + throw new Test262Error(); + } + }; + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-2.js index e2ea6c0a1..4f74f4fb5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-2.js @@ -10,13 +10,12 @@ description: > no initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = null; -function foo() {} -var f = new foo(); -f.length = null; - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-3.js index 1256ed668..a19e73e2b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-3.js @@ -10,13 +10,12 @@ description: > no initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = false; -function foo() {} -var f = new foo(); -f.length = false; - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-4.js index ec024658f..31a202f5e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-4.js @@ -10,13 +10,12 @@ description: > initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = 0; -function foo() {} -var f = new foo(); -f.length = 0; - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-5.js index ddf90e92e..db633c214 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-5.js @@ -10,13 +10,12 @@ description: > initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = '0'; -function foo() {} -var f = new foo(); -f.length = '0'; - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-6.js index 76d34aed0..cea6793e0 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-6.js @@ -10,19 +10,14 @@ description: > initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + var o = { valueOf: function () { return 0;}}; + f.length = o; -var o = { - valueOf: function() { - return 0; - } -}; -f.length = o; - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-7.js index bd392b800..6fac3bfd8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-7.js @@ -10,25 +10,20 @@ description: > (toString)), no initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + var o = { toString: function () { return '0';}}; + f.length = o; -var o = { - toString: function() { - return '0'; - } -}; -f.length = o; + // objects inherit the default valueOf method of the Object object; + // that simply returns the itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. -// objects inherit the default valueOf method of the Object object; -// that simply returns the itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-8.js index 93ce902f0..10631cf82 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-8.js @@ -9,28 +9,27 @@ description: > (subclassed Array, length overridden with []), no initVal ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + f.length = []; -f.length = []; + // objects inherit the default valueOf method of the Object object; + // that simply returns the itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. + // + // The toString( ) method on Array converts the array elements to strings, + // then returns the result of concatenating these strings, with commas in + // between. An array with no elements converts to the empty string, which + // converts to the number 0. If an array has a single element that is a + // number n, the array converts to a string representation of n, which is + // then converted back to n itself. If an array contains more than one element, + // or if its one element is not a number, the array converts to NaN. -// objects inherit the default valueOf method of the Object object; -// that simply returns the itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. -// -// The toString( ) method on Array converts the array elements to strings, -// then returns the result of concatenating these strings, with commas in -// between. An array with no elements converts to the empty string, which -// converts to the number 0. If an array has a single element that is a -// number n, the array converts to a string representation of n, which is -// then converted back to n itself. If an array contains more than one element, -// or if its one element is not a number, the array converts to NaN. - -function cb() {} + function cb(){} assert.throws(TypeError, function() { - f.reduceRight(cb); + f.reduceRight(cb); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-9.js index 8c9053cdb..ce3fe6844 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-5-9.js @@ -9,6 +9,6 @@ description: > is 0 and 'initialValue' is present ---*/ -var initialValue = 10; + var initialValue = 10; -assert.sameValue([].reduceRight(function() {}, initialValue), initialValue, '[].reduceRight(function () { }, initialValue)'); +assert.sameValue([].reduceRight(function () { }, initialValue), initialValue, '[].reduceRight(function () { }, initialValue)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-1.js index 76cec3316..cd191ee0e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-1.js @@ -9,5 +9,5 @@ description: > and initialValue is present (empty array) ---*/ -function cb() {} -assert.sameValue([].reduceRight(cb, 1), 1, '[].reduceRight(cb,1)'); + function cb(){} +assert.sameValue([].reduceRight(cb,1), 1, '[].reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-10.js index c50c734da..ca80beabf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-10.js @@ -7,6 +7,6 @@ es5id: 15.4.4.22-7-10 description: Array.prototype.reduceRight - 'initialValue' is present ---*/ -var str = "initialValue is present"; + var str = "initialValue is present"; -assert.sameValue([].reduceRight(function() {}, str), str, '[].reduceRight(function () { }, str)'); +assert.sameValue([].reduceRight(function () { }, str), str, '[].reduceRight(function () { }, str)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-11.js index 466105ad6..c7c2a92a6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-11.js @@ -7,6 +7,6 @@ es5id: 15.4.4.22-7-11 description: Array.prototype.reduceRight - 'initialValue' is not present ---*/ -var str = "initialValue is not present"; + var str = "initialValue is not present"; -assert.sameValue([str].reduceRight(function() {}), str, '[str].reduceRight(function () { })'); +assert.sameValue([str].reduceRight(function () { }), str, '[str].reduceRight(function () { })'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-2.js index 226fe2e53..d6bbe8e4d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-2.js @@ -10,11 +10,10 @@ description: > to null (type conversion)) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = null; -function foo() {} -var f = new foo(); -f.length = null; - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-3.js index 07b39a3cc..f06d61ae5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-3.js @@ -10,11 +10,10 @@ description: > to false (type conversion)) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = false; -function foo() {} -var f = new foo(); -f.length = false; - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-4.js index 6006a08c3..5cc4058fe 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-4.js @@ -10,11 +10,10 @@ description: > to 0 (type conversion)) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = 0; -function foo() {} -var f = new foo(); -f.length = 0; - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-5.js index e91ba1627..1a7b538fd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-5.js @@ -10,11 +10,10 @@ description: > to '0' (type conversion)) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); + f.length = '0'; -function foo() {} -var f = new foo(); -f.length = '0'; - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-6.js index 5fda99875..7d7f0356d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-6.js @@ -10,17 +10,12 @@ description: > with obj with valueOf) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + var o = { valueOf: function () { return 0;}}; + f.length = o; -var o = { - valueOf: function() { - return 0; - } -}; -f.length = o; - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-7.js index 80819a2b4..a2fdb76eb 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-7.js @@ -10,23 +10,18 @@ description: > with obj w/o valueOf (toString)) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + var o = { toString: function () { return '0';}}; + f.length = o; -var o = { - toString: function() { - return '0'; - } -}; -f.length = o; + // objects inherit the default valueOf method of the Object object; + // that simply returns the itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. -// objects inherit the default valueOf method of the Object object; -// that simply returns the itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-8.js index d2db08ed9..88fd551cf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-8.js @@ -10,26 +10,25 @@ description: > with []) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + f.length = []; -f.length = []; + // objects inherit the default valueOf method of the Object object; + // that simply returns the itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. + // + // The toString( ) method on Array converts the array elements to strings, + // then returns the result of concatenating these strings, with commas in + // between. An array with no elements converts to the empty string, which + // converts to the number 0. If an array has a single element that is a + // number n, the array converts to a string representation of n, which is + // then converted back to n itself. If an array contains more than one element, + // or if its one element is not a number, the array converts to NaN. -// objects inherit the default valueOf method of the Object object; -// that simply returns the itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. -// -// The toString( ) method on Array converts the array elements to strings, -// then returns the result of concatenating these strings, with commas in -// between. An array with no elements converts to the empty string, which -// converts to the number 0. If an array has a single element that is a -// number n, the array converts to a string representation of n, which is -// then converted back to n itself. If an array contains more than one element, -// or if its one element is not a number, the array converts to NaN. - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-9.js index 9903f299b..b7d1567e2 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-7-9.js @@ -10,26 +10,25 @@ description: > with [0]) ---*/ -foo.prototype = new Array(1, 2, 3); + foo.prototype = new Array(1, 2, 3); + function foo() {} + var f = new foo(); -function foo() {} -var f = new foo(); + f.length = [0]; -f.length = [0]; + // objects inherit the default valueOf method of the Object object; + // that simply returns the itself. Since the default valueOf() method + // does not return a primitive value, ES next tries to convert the object + // to a number by calling its toString() method and converting the + // resulting string to a number. + // + // The toString( ) method on Array converts the array elements to strings, + // then returns the result of concatenating these strings, with commas in + // between. An array with no elements converts to the empty string, which + // converts to the number 0. If an array has a single element that is a + // number n, the array converts to a string representation of n, which is + // then converted back to n itself. If an array contains more than one element, + // or if its one element is not a number, the array converts to NaN. -// objects inherit the default valueOf method of the Object object; -// that simply returns the itself. Since the default valueOf() method -// does not return a primitive value, ES next tries to convert the object -// to a number by calling its toString() method and converting the -// resulting string to a number. -// -// The toString( ) method on Array converts the array elements to strings, -// then returns the result of concatenating these strings, with commas in -// between. An array with no elements converts to the empty string, which -// converts to the number 0. If an array has a single element that is a -// number n, the array converts to a string representation of n, which is -// then converted back to n itself. If an array contains more than one element, -// or if its one element is not a number, the array converts to NaN. - -function cb() {} -assert.sameValue(f.reduceRight(cb, 1), 1, 'f.reduceRight(cb,1)'); + function cb(){} +assert.sameValue(f.reduceRight(cb,1), 1, 'f.reduceRight(cb,1)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js index de85b84e2..2763dde2e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-1.js @@ -9,22 +9,20 @@ description: > is 0 ---*/ -var accessed = false; + var accessed = false; -var obj = { - length: 0 -}; + var obj = { length: 0 }; -Object.defineProperty(obj, "0", { - get: function() { - accessed = true; - return 10; - }, - configurable: true -}); + Object.defineProperty(obj, "0", { + get: function () { + accessed = true; + return 10; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-2.js index 96e4d9109..c2c0b4e85 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-2.js @@ -9,23 +9,22 @@ description: > number of iterations in step 9 ---*/ -var called = 0; + var called = 0; + function callbackfn(prevVal, curVal, idx, obj) { + called++; + return prevVal + curVal; + } -function callbackfn(prevVal, curVal, idx, obj) { - called++; - return prevVal + curVal; -} + var arr = [0, 1, 2, 3]; + Object.defineProperty(arr, "4", { + get: function () { + arr.length = 2; + return 10; + }, + configurable: true + }); -var arr = [0, 1, 2, 3]; -Object.defineProperty(arr, "4", { - get: function() { - arr.length = 2; - return 10; - }, - configurable: true -}); - -var preVal = arr.reduceRight(callbackfn); + var preVal = arr.reduceRight(callbackfn); assert.sameValue(preVal, 11, 'preVal'); assert.sameValue(called, 2, 'called'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-3.js index 0c9292f97..cfa839663 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-3.js @@ -9,37 +9,37 @@ description: > 'kPresent' is true ---*/ -var called = 0; -var testResult = false; -var firstCalled = 0; -var secondCalled = 0; - -function callbackfn(prevVal, val, idx, obj) { - if (called === 0) { - testResult = (idx === 1); - } - called++; -} - -var arr = [, , , ]; - -Object.defineProperty(arr, "1", { - get: function() { - firstCalled++; - return 9; - }, - configurable: true -}); - -Object.defineProperty(arr, "2", { - get: function() { - secondCalled++; - return 11; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + var called = 0; + var testResult = false; + var firstCalled = 0; + var secondCalled = 0; + + function callbackfn(prevVal, val, idx, obj) { + if (called === 0) { + testResult = (idx === 1); + } + called++; + } + + var arr = [, , , ]; + + Object.defineProperty(arr, "1", { + get: function () { + firstCalled++; + return 9; + }, + configurable: true + }); + + Object.defineProperty(arr, "2", { + get: function () { + secondCalled++; + return 11; + }, + configurable: true + }); + + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); assert.sameValue(firstCalled, 1, 'firstCalled'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-1.js index cbd57020e..41ea823dc 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-1.js @@ -9,16 +9,16 @@ description: > visible here ---*/ -var obj = {}; + var obj = {}; -function callbackfn(prevVal, curVal, idx, obj) {} + function callbackfn(prevVal, curVal, idx, obj) { } -Object.defineProperty(obj, "length", { - get: function() { - obj[2] = "accumulator"; - return 3; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + obj[2] = "accumulator"; + return 3; + }, + configurable: true + }); assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn), "accumulator", 'Array.prototype.reduceRight.call(obj, callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-2.js index 8da273e0c..4afeb3bb7 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-ii-2.js @@ -9,17 +9,14 @@ description: > visible here ---*/ -var obj = { - 2: "accumulator", - 3: "another" -}; + var obj = { 2: "accumulator", 3: "another" }; -Object.defineProperty(obj, "length", { - get: function() { - delete obj[2]; - return 5; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + delete obj[2]; + return 5; + }, + configurable: true + }); -assert.notSameValue(Array.prototype.reduceRight.call(obj, function() {}), "accumulator", 'Array.prototype.reduceRight.call(obj, function () { })'); +assert.notSameValue(Array.prototype.reduceRight.call(obj, function () { }), "accumulator", 'Array.prototype.reduceRight.call(obj, function () { })'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-1.js index 3edc44785..d3421ebb5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-1.js @@ -9,20 +9,15 @@ description: > property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 0) { + testResult = (prevVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 0) { - testResult = (prevVal === 1); - } -} + var obj = { 0: 0, 1: 1, length: 2 }; -var obj = { - 0: 0, - 1: 1, - length: 2 -}; - -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-10.js index d76cbfc02..2f82c1289 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-10.js @@ -9,23 +9,22 @@ description: > accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2) { + testResult = (curVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2) { - testResult = (curVal === 2); - } -} + var arr = [0, 1, , 3]; -var arr = [0, 1, , 3]; + Object.defineProperty(arr, "2", { + get: function () { + return 2; + }, + configurable: true + }); -Object.defineProperty(arr, "2", { - get: function() { - return 2; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-11.js index 98aea64ef..62c9245a9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-11.js @@ -10,33 +10,28 @@ description: > Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} - -var proto = { - 0: 0, - 1: 1, - 2: 2 -}; - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 3; - -Object.defineProperty(child, "2", { - get: function() { - return "20"; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(child, callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } + + var proto = { 0: 0, 1: 1, 2: 2 }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 3; + + Object.defineProperty(child, "2", { + get: function () { + return "20"; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-12.js index d322bc64d..ee042baae 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-12.js @@ -10,24 +10,23 @@ description: > Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} + Array.prototype[2] = 2; + var arr = [0, 1]; -Array.prototype[2] = 2; -var arr = [0, 1]; + Object.defineProperty(arr, "2", { + get: function () { + return "20"; + }, + configurable: true + }); -Object.defineProperty(arr, "2", { - get: function() { - return "20"; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-13.js index f2e27dc4e..0d3c40e0a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-13.js @@ -10,39 +10,35 @@ description: > an Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} - -var proto = { - 0: 0, - 1: 1 -}; - -Object.defineProperty(proto, "2", { - get: function() { - return 2; - }, - configurable: true -}); - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 3; - -Object.defineProperty(child, "2", { - get: function() { - return "20"; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(child, callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } + + var proto = { 0: 0, 1: 1 }; + + Object.defineProperty(proto, "2", { + get: function () { + return 2; + }, + configurable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 3; + + Object.defineProperty(child, "2", { + get: function () { + return "20"; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-14.js index 74613a078..3973a3593 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-14.js @@ -10,30 +10,29 @@ description: > an Array ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} - -Object.defineProperty(Array.prototype, "2", { - get: function() { - return 2; - }, - configurable: true -}); - -var arr = [0, 1, , ]; - -Object.defineProperty(arr, "2", { - get: function() { - return "20"; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } + + Object.defineProperty(Array.prototype, "2", { + get: function () { + return 2; + }, + configurable: true + }); + + var arr = [0, 1, , ]; + + Object.defineProperty(arr, "2", { + get: function () { + return "20"; + }, + configurable: true + }); + + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-15.js index 4a484444e..5ed456fb1 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-15.js @@ -9,32 +9,28 @@ description: > accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var proto = { 0: 0, 1: 1 }; -var proto = { - 0: 0, - 1: 1 -}; + Object.defineProperty(proto, "2", { + get: function () { + return 2; + }, + configurable: true + }); -Object.defineProperty(proto, "2", { - get: function() { - return 2; - }, - configurable: true -}); + var Con = function () { }; + Con.prototype = proto; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child.length = 3; -var child = new Con(); -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn); + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js index 8d473225b..b2cc5cbb2 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-16.js @@ -9,23 +9,22 @@ description: > accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + Object.defineProperty(Array.prototype, "2", { + get: function () { + return 2; + }, + configurable: true + }); -Object.defineProperty(Array.prototype, "2", { - get: function() { - return 2; - }, - configurable: true -}); + var arr = [0, 1, , ]; -var arr = [0, 1, , ]; - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-17.js index 00cb06069..754f25206 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-17.js @@ -9,25 +9,20 @@ description: > accessor property without a get function on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + var obj = { 0: 0, 1: 1, length: 3 }; -var obj = { - 0: 0, - 1: 1, - length: 3 -}; + Object.defineProperty(obj, "2", { + set: function () { }, + configurable: true + }); -Object.defineProperty(obj, "2", { - set: function() {}, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-18.js index 4be07578a..7413e3140 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-18.js @@ -9,21 +9,20 @@ description: > accessor property without a get function on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + var arr = [0, 1]; -var arr = [0, 1]; + Object.defineProperty(arr, "2", { + set: function () { }, + configurable: true + }); -Object.defineProperty(arr, "2", { - set: function() {}, - configurable: true -}); - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-19.js index 65b0ec395..55df142cb 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-19.js @@ -10,26 +10,21 @@ description: > inherited accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + Object.prototype[2] = 2; -Object.prototype[2] = 2; + var obj = { 0: 0, 1: 1, length: 3 }; + Object.defineProperty(obj, "2", { + set: function () { }, + configurable: true + }); -var obj = { - 0: 0, - 1: 1, - length: 3 -}; -Object.defineProperty(obj, "2", { - set: function() {}, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-2.js index 6b68c4259..e7dfce50c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-2.js @@ -9,16 +9,15 @@ description: > property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var arr = [0, 1, 2]; -var arr = [0, 1, 2]; - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-20.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-20.js index f42f77de4..7c0d2b3d5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-20.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-20.js @@ -10,21 +10,20 @@ description: > inherited accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + Array.prototype[2] = 2; + var arr = [0, 1]; + Object.defineProperty(arr, "2", { + set: function () { }, + configurable: true + }); -Array.prototype[2] = 2; -var arr = [0, 1]; -Object.defineProperty(arr, "2", { - set: function() {}, - configurable: true -}); - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-21.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-21.js index 234438eb9..c2586e35a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-21.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-21.js @@ -9,30 +9,26 @@ description: > accessor property without a get function on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + var proto = { 0: 0, 1: 1 }; -var proto = { - 0: 0, - 1: 1 -}; + Object.defineProperty(proto, "2", { + set: function () { }, + configurable: true + }); -Object.defineProperty(proto, "2", { - set: function() {}, - configurable: true -}); + var Con = function () { }; + Con.prototype = proto; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child.length = 3; -var child = new Con(); -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn); + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-22.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-22.js index 801417004..0c3321dce 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-22.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-22.js @@ -9,21 +9,20 @@ description: > accessor property without a get function on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof prevVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof prevVal === "undefined"); - } -} + Object.defineProperty(Array.prototype, "2", { + set: function () { }, + configurable: true + }); -Object.defineProperty(Array.prototype, "2", { - set: function() {}, - configurable: true -}); + var arr = [0, 1, , ]; -var arr = [0, 1, , ]; - -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-25.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-25.js index a00761e4b..ed00735cb 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-25.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-25.js @@ -10,18 +10,17 @@ description: > is less than number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 0) { + testResult = (prevVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 0) { - testResult = (prevVal === 1); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn); -}; - -func(0, 1); + func(0, 1); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-26.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-26.js index 5024b8159..fa3c52c43 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-26.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-26.js @@ -10,18 +10,17 @@ description: > equals number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn); -}; - -func(0, 1, 2); + func(0, 1, 2); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-27.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-27.js index 4b716884f..c6cfe25cd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-27.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-27.js @@ -10,18 +10,17 @@ description: > is greater than number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2) { + testResult = (prevVal === 3); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2) { - testResult = (prevVal === 3); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn); -}; - -func(0, 1, 2, 3); + func(0, 1, 2, 3); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-28.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-28.js index 296ac59cd..892cfdc56 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-28.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-28.js @@ -9,16 +9,15 @@ description: > implements its own property get method ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "2"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "2"); - } -} + var str = new String("012"); -var str = new String("012"); - -Array.prototype.reduceRight.call(str, callbackfn); + Array.prototype.reduceRight.call(str, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-29.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-29.js index e7c88ee8f..acb274e17 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-29.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-29.js @@ -9,22 +9,21 @@ description: > implements its own property get method ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var obj = function (a, b, c) { + return a + b + c; + }; -var obj = function(a, b, c) { - return a + b + c; -}; + obj[0] = 0; + obj[1] = 1; + obj[2] = 2; -obj[0] = 0; -obj[1] = 1; -obj[2] = 2; - -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-3.js index 5dae8cade..062f12ba1 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-3.js @@ -10,28 +10,22 @@ description: > Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} + var proto = { 0: 0, 1: 1, 2: 2, length: 2 }; + var Con = function () { }; + Con.prototype = proto; -var proto = { - 0: 0, - 1: 1, - 2: 2, - length: 2 -}; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child[1] = "10"; + child[2] = "20"; + child.length = 3; -var child = new Con(); -child[1] = "10"; -child[2] = "20"; -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn); + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-30.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-30.js index dd07c30e2..bfebf8515 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-30.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-30.js @@ -9,36 +9,35 @@ description: > iteration is observed in subsequent iterations on an Array ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1 && prevVal === 2); - } -} - -var arr = [0]; -var preIterVisible = false; - -Object.defineProperty(arr, "1", { - get: function() { - if (preIterVisible) { - return 1; - } else { - return "20"; - } - }, - configurable: true -}); - -Object.defineProperty(arr, "2", { - get: function() { - preIterVisible = true; - return 2; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1 && prevVal === 2); + } + } + + var arr = [0]; + var preIterVisible = false; + + Object.defineProperty(arr, "1", { + get: function () { + if (preIterVisible) { + return 1; + } else { + return "20"; + } + }, + configurable: true + }); + + Object.defineProperty(arr, "2", { + get: function () { + preIterVisible = true; + return 2; + }, + configurable: true + }); + + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-31.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-31.js index adc024dca..8d8168a56 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-31.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-31.js @@ -9,39 +9,35 @@ description: > iteration is observed subsequetly on an Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2 && curVal === 1); - } -} - -var obj = { - 0: 0, - length: 3 -}; -var preIterVisible = false; - -Object.defineProperty(obj, "1", { - get: function() { - if (preIterVisible) { - return 1; - } else { - return "20"; - } - }, - configurable: true -}); - -Object.defineProperty(obj, "2", { - get: function() { - preIterVisible = true; - return 2; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2 && curVal === 1); + } + } + + var obj = { 0: 0, length: 3 }; + var preIterVisible = false; + + Object.defineProperty(obj, "1", { + get: function () { + if (preIterVisible) { + return 1; + } else { + return "20"; + } + }, + configurable: true + }); + + Object.defineProperty(obj, "2", { + get: function () { + preIterVisible = true; + return 2; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-32.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-32.js index e4056e11f..49146cd49 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-32.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-32.js @@ -9,26 +9,21 @@ description: > iteration on an Array-like object ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx <= 1) { + accessed = true; + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx <= 1) { - accessed = true; - } -} - -var obj = { - 0: 0, - 1: 1, - length: 3 -}; -Object.defineProperty(obj, "2", { - get: function() { - throw new RangeError("unhandle exception happened in getter"); - }, - configurable: true -}); + var obj = { 0: 0, 1: 1, length: 3 }; + Object.defineProperty(obj, "2", { + get: function () { + throw new RangeError("unhandle exception happened in getter"); + }, + configurable: true + }); assert.throws(RangeError, function() { - Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-33.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-33.js index b770c5ccc..53f974e22 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-33.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-33.js @@ -9,23 +9,22 @@ description: > iteration on an Array ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx <= 1) { + accessed = true; + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx <= 1) { - accessed = true; - } -} + var arr = [0, 1]; -var arr = [0, 1]; - -Object.defineProperty(arr, "2", { - get: function() { - throw new RangeError("unhandle exception happened in getter"); - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + throw new RangeError("unhandle exception happened in getter"); + }, + configurable: true + }); assert.throws(RangeError, function() { - arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-4.js index 9363a9c3b..2bf4cc00d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-4.js @@ -9,15 +9,14 @@ description: > property that overrides an inherited data property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} - -Array.prototype[2] = "11"; -[0, 1, 2].reduceRight(callbackfn); + Array.prototype[2] = "11"; + [0, 1, 2].reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-5.js index 1eda02b46..c08e59248 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-5.js @@ -10,35 +10,34 @@ description: > Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === "20"); - } -} - -var proto = {}; - -Object.defineProperty(proto, "2", { - get: function() { - return 11; - }, - configurable: true -}); - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 3; -child[0] = "0"; -child[1] = "1"; -Object.defineProperty(proto, "2", { - value: "20", - configurable: true -}); - -Array.prototype.reduceRight.call(child, callbackfn); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === "20"); + } + } + + var proto = {}; + + Object.defineProperty(proto, "2", { + get: function () { + return 11; + }, + configurable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 3; + child[0] = "0"; + child[1] = "1"; + Object.defineProperty(proto, "2", { + value: "20", + configurable: true + }); + + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-6.js index 6f8f1eec3..6bd5ab5eb 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-6.js @@ -9,20 +9,19 @@ description: > property that overrides an inherited accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} - -Object.defineProperty(Array.prototype, "2", { - get: function() { - return "2"; - }, - configurable: true -}); -[0, 1, 2].reduceRight(callbackfn); + Object.defineProperty(Array.prototype, "2", { + get: function () { + return "2"; + }, + configurable: true + }); + [0, 1, 2].reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-7.js index 55a3d6dbd..a955557ec 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-7.js @@ -9,25 +9,19 @@ description: > data property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var proto = { 0: 0, 1: 1, 2: 2, length: 3 }; + var Con = function () { }; + Con.prototype = proto; -var proto = { - 0: 0, - 1: 1, - 2: 2, - length: 3 -}; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); -var child = new Con(); - -Array.prototype.reduceRight.call(child, callbackfn); + Array.prototype.reduceRight.call(child, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js index d7174183c..983566a9c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-8.js @@ -9,17 +9,16 @@ description: > data property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} - -Array.prototype[0] = 0; -Array.prototype[1] = 1; -Array.prototype[2] = 2; -[, , , ].reduceRight(callbackfn); + Array.prototype[0] = 0; + Array.prototype[1] = 1; + Array.prototype[2] = 2; + [, , ,].reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-9.js index 648e9485b..e2f7da4b6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-b-iii-1-9.js @@ -9,26 +9,21 @@ description: > accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 2); - } -} + var obj = { 0: 0, 1: 1, length: 3 }; + Object.defineProperty(obj, "2", { + get: function () { + return 2; + }, + configurable: true + }); -var obj = { - 0: 0, - 1: 1, - length: 3 -}; -Object.defineProperty(obj, "2", { - get: function() { - return 2; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-1.js index 8c59328e3..9c1d91d3c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-1.js @@ -9,10 +9,11 @@ description: > and initialValue is not present ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{} + function callbackfn(prevVal, curVal, idx, obj) + { + } -var arr = new Array(10); + var arr = new Array(10); assert.throws(TypeError, function() { - arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-2.js index 3153f84f5..05271d674 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-2.js @@ -10,12 +10,13 @@ description: > initialValue is not present ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{} + function callbackfn(prevVal, curVal, idx, obj) + { + } -var arr = new Array(10); -arr[9] = 1; -arr.length = 5; + var arr = new Array(10); + arr[9] = 1; + arr.length = 5; assert.throws(TypeError, function() { - arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-3.js index 06d5460c7..e47a755d5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-3.js @@ -9,15 +9,16 @@ description: > assigned values are deleted and initialValue is not present ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{} + function callbackfn(prevVal, curVal, idx, obj) + { + } -var arr = [1, 2, 3, 4, 5]; -delete arr[0]; -delete arr[1]; -delete arr[2]; -delete arr[3]; -delete arr[4]; + var arr = [1,2,3,4,5]; + delete arr[0]; + delete arr[1]; + delete arr[2]; + delete arr[3]; + delete arr[4]; assert.throws(TypeError, function() { - arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-4.js index 4dc298096..18296c2bf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-4.js @@ -9,11 +9,11 @@ description: > own properties but prototype contains a single property ---*/ -var arr = [, , , ]; + var arr = [, , , ]; -try { - Array.prototype[1] = "prototype"; - arr.reduceRight(function() {}); -} finally { - delete Array.prototype[1]; -} + try { + Array.prototype[1] = "prototype"; + arr.reduceRight(function () { }); + } finally { + delete Array.prototype[1]; + } diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5.js index 224ff36c3..b5dd24963 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-5.js @@ -9,18 +9,18 @@ description: > visible when an exception occurs ---*/ -var obj = {}; + var obj = { }; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - accessed = true; - return 2; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + accessed = true; + return 2; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-6.js index 3dab92c10..476886a76 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-6.js @@ -9,22 +9,22 @@ description: > visible when an exception occurs ---*/ -var obj = {}; + var obj = {}; -var accessed = false; + var accessed = false; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - accessed = true; - return "2"; - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + accessed = true; + return "2"; + } + }; + }, + configurable: true + }); assert.throws(TypeError, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js index fade921f9..2fabc8fd6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-7.js @@ -9,15 +9,15 @@ description: > exception was thrown by step 2 ---*/ -var obj = {}; + var obj = {}; -Object.defineProperty(obj, "length", { - get: function() { - throw new Test262Error(); - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + throw new Test262Error(); + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js index d0e875976..52c2ed7a6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-8-c-8.js @@ -9,19 +9,19 @@ description: > exception was thrown by step 3 ---*/ -var obj = {}; + var obj = {}; -Object.defineProperty(obj, "length", { - get: function() { - return { - toString: function() { - throw new Test262Error(); - } - }; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + return { + toString: function () { + throw new Test262Error(); + } + }; + }, + configurable: true + }); assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, function() {}); + Array.prototype.reduceRight.call(obj, function () { }); }); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-1.js index ef9f26791..8132b414c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-1.js @@ -11,12 +11,12 @@ description: > length ---*/ -function callbackfn(prevVal, curVal, idx, obj) { - arr[5] = 6; - arr[2] = 3; - return prevVal + curVal; -} + function callbackfn(prevVal, curVal, idx, obj) { + arr[5] = 6; + arr[2] = 3; + return prevVal + curVal; + } -var arr = ['1', 2, , 4, '5']; + var arr = ['1', 2, , 4, '5']; assert.sameValue(arr.reduceRight(callbackfn), "54321", 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-2.js index 4fa783dfe..05fa751f0 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-2.js @@ -9,13 +9,13 @@ description: > array after it is called ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - arr[3] = -2; - arr[0] = -1; - return prevVal + curVal; -} + function callbackfn(prevVal, curVal, idx, obj) + { + arr[3] = -2; + arr[0] = -1; + return prevVal + curVal; + } -var arr = [1, 2, 3, 4, 5]; + var arr = [1,2,3,4,5]; assert.sameValue(arr.reduceRight(callbackfn), 13, 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js index 0455ef32a..eb48426ea 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-3.js @@ -9,14 +9,14 @@ description: > elements in array after the call ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - delete arr[1]; - delete arr[4]; - return prevVal + curVal; -} + function callbackfn(prevVal, curVal, idx, obj) + { + delete arr[1]; + delete arr[4]; + return prevVal + curVal; + } -var arr = ['1', 2, 3, 4, 5]; + var arr = ['1',2,3,4,5]; // two elements deleted assert.sameValue(arr.reduceRight(callbackfn), "121", 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-4.js index d3fa9884c..0c00cf9c9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-4.js @@ -9,12 +9,12 @@ description: > elements when Array.length is decreased ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - arr.length = 2; - return prevVal + curVal; -} + function callbackfn(prevVal, curVal, idx, obj) + { + arr.length = 2; + return prevVal + curVal; + } -var arr = [1, 2, 3, 4, 5]; + var arr = [1,2,3,4,5]; assert.sameValue(arr.reduceRight(callbackfn), 12, 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-5.js index a11242c5d..8cbf9edee 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-5.js @@ -9,15 +9,14 @@ description: > one element ---*/ -var callCnt = 0; + var callCnt = 0; + function callbackfn(prevVal, curVal, idx, obj) + { + callCnt++; + return 2; + } -function callbackfn(prevVal, curVal, idx, obj) -{ - callCnt++; - return 2; -} - -var arr = [1]; + var arr = [1]; assert.sameValue(arr.reduceRight(callbackfn), 1, 'arr.reduceRight(callbackfn)'); assert.sameValue(callCnt, 0, 'callCnt'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js index 24f658690..ca9493b31 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-6.js @@ -9,16 +9,16 @@ description: > the call when same index is also present in prototype ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - delete arr[1]; - delete arr[2]; - return prevVal + curVal; -} -Array.prototype[2] = 6; -var arr = ['1', 2, 3, 4, 5]; -var res = arr.reduceRight(callbackfn); -delete Array.prototype[2]; + function callbackfn(prevVal, curVal, idx, obj) + { + delete arr[1]; + delete arr[2]; + return prevVal + curVal; + } + Array.prototype[2] = 6; + var arr = ['1',2,3,4,5]; + var res = arr.reduceRight(callbackfn); + delete Array.prototype[2]; //one element deleted assert.sameValue(res, "151", 'res'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-7.js index b76b74b65..6adeffef5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-7.js @@ -9,13 +9,13 @@ description: > deleted during the call ---*/ -function callbackfn(prevVal, curVal, idx, obj) { - delete o.arr; - return prevVal + curVal; -} + function callbackfn(prevVal, curVal, idx, obj) { + delete o.arr; + return prevVal + curVal; + } -var o = new Object(); -o.arr = ['1', 2, 3, 4, 5]; + var o = new Object(); + o.arr = ['1', 2, 3, 4, 5]; assert.sameValue(o.arr.reduceRight(callbackfn), "141", 'o.arr.reduceRight(callbackfn)'); assert.sameValue(o.hasOwnProperty("arr"), false, 'o.hasOwnProperty("arr")'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-8.js index a2ef4d7fe..9968f8929 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-8.js @@ -9,24 +9,21 @@ description: > is 0 ---*/ -var accessed = false; + var accessed = false; + function callbackfn() { + accessed = true; + } -function callbackfn() { - accessed = true; -} + var obj = { length: 0 }; -var obj = { - length: 0 -}; + Object.defineProperty(obj, "5", { + get: function () { + accessed = true; + return 10; + }, + configurable: true + }); -Object.defineProperty(obj, "5", { - get: function() { - accessed = true; - return 10; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, function() {}, "initialValue"); + Array.prototype.reduceRight.call(obj, function () { }, "initialValue"); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-9.js index ac47f378a..f5fc22ab3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-9.js @@ -9,20 +9,19 @@ description: > number of iterations ---*/ -var called = 0; + var called = 0; + function callbackfn(preVal, val, idx, obj) { + called++; + } -function callbackfn(preVal, val, idx, obj) { - called++; -} + var arr = [0, 1, 2, 3]; + Object.defineProperty(arr, "4", { + get: function () { + arr.length = 2; + }, + configurable: true + }); -var arr = [0, 1, 2, 3]; -Object.defineProperty(arr, "4", { - get: function() { - arr.length = 2; - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert.sameValue(called, 3, 'called'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-1.js index b7336d05e..9277ef37d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-1.js @@ -9,10 +9,11 @@ description: > empty and initialValue is not present ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{} + function callbackfn(prevVal, curVal, idx, obj) + { + } -var arr = new Array(10); + var arr = new Array(10); -assert.sameValue(arr.reduceRight(callbackfn, 5), 5, 'arr.reduceRight(callbackfn,5)'); +assert.sameValue(arr.reduceRight(callbackfn,5), 5, 'arr.reduceRight(callbackfn,5)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-10.js index 1dd6fb9fe..a92bf8dcc 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-10.js @@ -10,31 +10,28 @@ description: > Array-like Object ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(preVal, val, idx, obj) { - accessed = true; - if (idx === 3) { - testResult = false; - } -} + function callbackfn(preVal, val, idx, obj) { + accessed = true; + if (idx === 3) { + testResult = false; + } + } -var obj = { - 2: 2, - length: 20 -}; + var obj = { 2: 2, length: 20 }; -Object.defineProperty(obj, "5", { - get: function() { - delete Object.prototype[3]; - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "5", { + get: function () { + delete Object.prototype[3]; + return 0; + }, + configurable: true + }); -Object.prototype[3] = 1; -Array.prototype.reduceRight.call(obj, callbackfn); + Object.prototype[3] = 1; + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js index e364fbbb7..bd1bcb4f3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-11.js @@ -9,27 +9,27 @@ description: > step 8 causes deleted index property not to be visited on an Array ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } -var arr = [0, , , ]; -Object.defineProperty(arr, "3", { - get: function() { - delete Array.prototype[1]; - return 0; - }, - configurable: true -}); + var arr = [0, , , ]; + Object.defineProperty(arr, "3", { + get: function () { + delete Array.prototype[1]; + return 0; + }, + configurable: true + }); -Array.prototype[1] = 1; -arr.reduceRight(callbackfn); + Array.prototype[1] = 1; + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-12.js index a6aed7624..9d1eca645 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-12.js @@ -10,29 +10,25 @@ description: > on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } -var obj = { - 0: 0, - 1: 111, - length: 10 -}; + var obj = { 0: 0, 1: 111, length: 10 }; -Object.defineProperty(obj, "4", { - get: function() { - delete obj[1]; - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "4", { + get: function () { + delete obj[1]; + return 0; + }, + configurable: true + }); -Object.prototype[1] = 1; -Array.prototype.reduceRight.call(obj, callbackfn); + Object.prototype[1] = 1; + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-13.js index 470c9420a..fe522f071 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-13.js @@ -10,24 +10,24 @@ description: > on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} -var arr = [0, 111]; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } + var arr = [0, 111]; -Object.defineProperty(arr, "2", { - get: function() { - delete arr[1]; - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + delete arr[1]; + return 0; + }, + configurable: true + }); -Array.prototype[1] = 1; -arr.reduceRight(callbackfn); + Array.prototype[1] = 1; + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-14.js index 8307a9768..16924c99c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-14.js @@ -9,27 +9,27 @@ description: > causes deleted index property not to be visited ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 2) { - testResult = false; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 2) { + testResult = false; + } + } -var arr = [0, 1, 2, 3]; + var arr = [0, 1, 2, 3]; -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-15.js index 97695a950..456fc605b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-15.js @@ -10,30 +10,30 @@ description: > visited ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2 && curVal === "prototype") { - testResult = true; - } -} -var arr = [0, 1, 2, 3]; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2 && curVal === "prototype") { + testResult = true; + } + } + var arr = [0, 1, 2, 3]; -Object.defineProperty(Array.prototype, "2", { - get: function() { - return "prototype"; - }, - configurable: true -}); + Object.defineProperty(Array.prototype, "2", { + get: function () { + return "prototype"; + }, + configurable: true + }); -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 1; - }, - configurable: true -}); + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 1; + }, + configurable: true + }); -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-16.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-16.js index 71def64c7..f23e5ecf0 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-16.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-16.js @@ -10,31 +10,31 @@ description: > flags: [noStrict] ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2 && curVal === "unconfigurable") { - testResult = true; - } -} - -var arr = [0, 1, 2, 3]; - -Object.defineProperty(arr, "2", { - get: function() { - return "unconfigurable"; - }, - configurable: false -}); - -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 1; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + var testResult = false; + + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2 && curVal === "unconfigurable") { + testResult = true; + } + } + + var arr = [0, 1, 2, 3]; + + Object.defineProperty(arr, "2", { + get: function () { + return "unconfigurable"; + }, + configurable: false + }); + + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 1; + }, + configurable: true + }); + + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-17.js index d21d758ac..d74fd82f5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-17.js @@ -9,31 +9,29 @@ description: > visited on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 0 && curVal === 0) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 0 && curVal === 0) { + testResult = true; + } + } -var obj = { - length: 2 -}; + var obj = { length: 2 }; -Object.defineProperty(obj, "1", { - get: function() { - Object.defineProperty(obj, "0", { - get: function() { - return 0; - }, - configurable: true - }); - return 1; - }, - configurable: true -}); + Object.defineProperty(obj, "1", { + get: function () { + Object.defineProperty(obj, "0", { + get: function () { + return 0; + }, + configurable: true + }); + return 1; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-18.js index 89ed61d4e..d6ab2aac6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-18.js @@ -9,29 +9,29 @@ description: > visited on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } -var arr = [0, , 2]; + var arr = [0, , 2]; -Object.defineProperty(arr, "2", { - get: function() { - Object.defineProperty(arr, "1", { - get: function() { - return 1; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + Object.defineProperty(arr, "1", { + get: function () { + return 1; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-19.js index e31e3f370..714b8ecd3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-19.js @@ -9,31 +9,29 @@ description: > visited on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 6.99) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 6.99) { + testResult = true; + } + } -var obj = { - length: 6 -}; + var obj = { length: 6 }; -Object.defineProperty(obj, "2", { - get: function() { - Object.defineProperty(Object.prototype, "1", { - get: function() { - return 6.99; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "2", { + get: function () { + Object.defineProperty(Object.prototype, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-2.js index 11d7140d9..423ae546a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-2.js @@ -9,24 +9,24 @@ description: > visible here ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2 && curVal === "2") { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2 && curVal === "2") { + testResult = true; + } + } -var obj = {}; + var obj = {}; -Object.defineProperty(obj, "length", { - get: function() { - obj[2] = "2"; - return 3; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + obj[2] = "2"; + return 3; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js index 47586d76f..b993b17f5 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-20.js @@ -9,29 +9,29 @@ description: > visited on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 6.99) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 6.99) { + testResult = true; + } + } -var arr = [0, , 2]; + var arr = [0, , 2]; -Object.defineProperty(arr, "2", { - get: function() { - Object.defineProperty(Array.prototype, "1", { - get: function() { - return 6.99; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-21.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-21.js index 13f3eeaa6..0b5b53ccf 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-21.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-21.js @@ -9,37 +9,34 @@ description: > index property not to be visited on an Array-like object ---*/ -var accessed = false; -var testResult = true; - -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} - -var obj = { - 0: 10, - length: 10 -}; - -Object.defineProperty(obj, "1", { - get: function() { - return 6.99; - }, - configurable: true -}); - -Object.defineProperty(obj, "5", { - get: function() { - delete obj[1]; - return 0; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + var accessed = false; + var testResult = true; + + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } + + var obj = { 0: 10, length: 10 }; + + Object.defineProperty(obj, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + + Object.defineProperty(obj, "5", { + get: function () { + delete obj[1]; + return 0; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-22.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-22.js index 8c57a1bd2..d0bffcff6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-22.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-22.js @@ -9,34 +9,34 @@ description: > index property not to be visited on an Array ---*/ -var accessed = false; -var testResult = true; - -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} - -var arr = [1, 2, 4]; - -Object.defineProperty(arr, "1", { - get: function() { - return "6.99"; - }, - configurable: true -}); - -Object.defineProperty(arr, "2", { - get: function() { - delete arr[1]; - return 0; - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + var accessed = false; + var testResult = true; + + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } + + var arr = [1, 2, 4]; + + Object.defineProperty(arr, "1", { + get: function () { + return "6.99"; + }, + configurable: true + }); + + Object.defineProperty(arr, "2", { + get: function () { + delete arr[1]; + return 0; + }, + configurable: true + }); + + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-23.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-23.js index 52046431c..611310635 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-23.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-23.js @@ -10,31 +10,28 @@ description: > Object ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 3) { - testResult = false; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 3) { + testResult = false; + } + } -var obj = { - 2: 2, - length: 20 -}; + var obj = { 2: 2, length: 20 }; -Object.defineProperty(obj, "5", { - get: function() { - delete Object.prototype[3]; - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "5", { + get: function () { + delete Object.prototype[3]; + return 0; + }, + configurable: true + }); -Object.prototype[3] = 1; -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Object.prototype[3] = 1; + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js index 9248519f9..8f2c45520 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-24.js @@ -9,27 +9,27 @@ description: > causes deleted index property not to be visited on an Array ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } -var arr = [0, , , ]; -Object.defineProperty(arr, "3", { - get: function() { - delete Array.prototype[1]; - return 0; - }, - configurable: true -}); + var arr = [0, , , ]; + Object.defineProperty(arr, "3", { + get: function () { + delete Array.prototype[1]; + return 0; + }, + configurable: true + }); -Array.prototype[1] = 1; -arr.reduceRight(callbackfn, "initialValue"); + Array.prototype[1] = 1; + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-25.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-25.js index bbfac7348..78d46ed7b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-25.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-25.js @@ -10,30 +10,25 @@ description: > Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } -var obj = { - 0: 0, - 1: 111, - 4: 10, - length: 10 -}; + var obj = { 0: 0, 1: 111, 4: 10, length: 10 }; -Object.defineProperty(obj, "4", { - get: function() { - delete obj[1]; - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "4", { + get: function () { + delete obj[1]; + return 0; + }, + configurable: true + }); -Object.prototype[1] = 1; -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Object.prototype[1] = 1; + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-26.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-26.js index 6b7362927..7b0e441b3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-26.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-26.js @@ -9,24 +9,24 @@ description: > property causes prototype index property to be visited on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} -var arr = [0, 111]; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } + var arr = [0, 111]; -Object.defineProperty(arr, "2", { - get: function() { - delete arr[1]; - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + delete arr[1]; + return 0; + }, + configurable: true + }); -Array.prototype[1] = 1; -arr.reduceRight(callbackfn, "initialValue"); + Array.prototype[1] = 1; + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-27.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-27.js index 01b7f09b9..45aa57a16 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-27.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-27.js @@ -9,27 +9,27 @@ description: > deleted index property not to be visited ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 2) { - testResult = false; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 2) { + testResult = false; + } + } -var arr = [0, 1, 2, 3]; + var arr = [0, 1, 2, 3]; -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-28.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-28.js index a039a64b7..31ab61068 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-28.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-28.js @@ -9,30 +9,30 @@ description: > prototype property causes prototype index property to be visited ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2 && curVal === "prototype") { - testResult = true; - } -} -var arr = [0, 1, 2, 3]; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2 && curVal === "prototype") { + testResult = true; + } + } + var arr = [0, 1, 2, 3]; -Object.defineProperty(Array.prototype, "2", { - get: function() { - return "prototype"; - }, - configurable: true -}); + Object.defineProperty(Array.prototype, "2", { + get: function () { + return "prototype"; + }, + configurable: true + }); -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 1; - }, - configurable: true -}); + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 1; + }, + configurable: true + }); -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-29.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-29.js index b5cd3bd28..b30c7d0b6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-29.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-29.js @@ -10,31 +10,31 @@ description: > flags: [noStrict] ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2 && curVal === "unconfigurable") { - testResult = true; - } -} - -var arr = [0, 1, 2, 3]; - -Object.defineProperty(arr, "2", { - get: function() { - return "unconfigurable"; - }, - configurable: false -}); - -Object.defineProperty(arr, "3", { - get: function() { - arr.length = 2; - return 1; - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + var testResult = false; + + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2 && curVal === "unconfigurable") { + testResult = true; + } + } + + var arr = [0, 1, 2, 3]; + + Object.defineProperty(arr, "2", { + get: function () { + return "unconfigurable"; + }, + configurable: false + }); + + Object.defineProperty(arr, "3", { + get: function () { + arr.length = 2; + return 1; + }, + configurable: true + }); + + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-3.js index c9bf72fcb..3e26f8b98 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-3.js @@ -9,30 +9,27 @@ description: > visible here ---*/ -var accessed = false; -var testResult = true; + var accessed = false; + var testResult = true; -function callbackfn(preVal, curVal, idx, obj) { - accessed = true; - if (idx === 2) { - testResult = false; - } -} + function callbackfn(preVal, curVal, idx, obj) { + accessed = true; + if (idx === 2) { + testResult = false; + } + } -var obj = { - 2: "2", - 3: 10 -}; + var obj = { 2: "2", 3: 10 }; -Object.defineProperty(obj, "length", { - get: function() { - delete obj[2]; - return 5; - }, - configurable: true -}); + Object.defineProperty(obj, "length", { + get: function () { + delete obj[2]; + return 5; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(accessed, 'accessed !== true'); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-4.js index de1e7e50e..e8038a797 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-4.js @@ -9,31 +9,29 @@ description: > step 8 can be visited on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(preVal, curVal, idx, obj) { - if (idx === 0 && curVal === 0) { - testResult = true; - } -} + function callbackfn(preVal, curVal, idx, obj) { + if (idx === 0 && curVal === 0) { + testResult = true; + } + } -var obj = { - length: 2 -}; + var obj = { length: 2 }; -Object.defineProperty(obj, "1", { - get: function() { - Object.defineProperty(obj, "0", { - get: function() { - return 0; - }, - configurable: true - }); - return 1; - }, - configurable: true -}); + Object.defineProperty(obj, "1", { + get: function () { + Object.defineProperty(obj, "0", { + get: function () { + return 0; + }, + configurable: true + }); + return 1; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-5.js index be881241b..4c0df9703 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-5.js @@ -9,29 +9,29 @@ description: > step 8 can be visited on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(preVal, curVal, idx, obj) { - if (idx === 1 && curVal === 1) { - testResult = true; - } -} + function callbackfn(preVal, curVal, idx, obj) { + if (idx === 1 && curVal === 1) { + testResult = true; + } + } -var arr = [0, , 2]; + var arr = [0, , 2]; -Object.defineProperty(arr, "2", { - get: function() { - Object.defineProperty(arr, "1", { - get: function() { - return 1; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + Object.defineProperty(arr, "1", { + get: function () { + return 1; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-6.js index 4c4616663..7149dad93 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-6.js @@ -9,31 +9,29 @@ description: > step 8 visited on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(preVal, curVal, idx, obj) { - if (idx === 1 && curVal === 6.99) { - testResult = true; - } -} + function callbackfn(preVal, curVal, idx, obj) { + if (idx === 1 && curVal === 6.99) { + testResult = true; + } + } -var obj = { - length: 6 -}; + var obj = { length: 6 }; -Object.defineProperty(obj, "2", { - get: function() { - Object.defineProperty(Object.prototype, "1", { - get: function() { - return 6.99; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(obj, "2", { + get: function () { + Object.defineProperty(Object.prototype, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -Array.prototype.reduceRight.call(obj, callbackfn); + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js index 1eea9497c..b38b4cb50 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-7.js @@ -9,29 +9,29 @@ description: > step 8 visited on an Array ---*/ -var testResult = false; + var testResult = false; -function callbackfn(preVal, curVal, idx, obj) { - if (idx === 1 && curVal === 6.99) { - testResult = true; - } -} + function callbackfn(preVal, curVal, idx, obj) { + if (idx === 1 && curVal === 6.99) { + testResult = true; + } + } -var arr = [0, , 2]; + var arr = [0, , 2]; -Object.defineProperty(arr, "2", { - get: function() { - Object.defineProperty(Array.prototype, "1", { - get: function() { - return 6.99; - }, - configurable: true - }); - return 0; - }, - configurable: true -}); + Object.defineProperty(arr, "2", { + get: function () { + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + return 0; + }, + configurable: true + }); -arr.reduceRight(callbackfn); + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-8.js index f71e3926e..6e5c2a567 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-8.js @@ -10,37 +10,34 @@ description: > object ---*/ -var accessed = false; -var testResult = true; - -function callbackfn(preVal, val, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} - -var obj = { - 0: 10, - length: 10 -}; - -Object.defineProperty(obj, "1", { - get: function() { - return 6.99; - }, - configurable: true -}); - -Object.defineProperty(obj, "5", { - get: function() { - delete obj[1]; - return 0; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn); + var accessed = false; + var testResult = true; + + function callbackfn(preVal, val, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } + + var obj = { 0: 10, length: 10 }; + + Object.defineProperty(obj, "1", { + get: function () { + return 6.99; + }, + configurable: true + }); + + Object.defineProperty(obj, "5", { + get: function () { + delete obj[1]; + return 0; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(obj, callbackfn); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-9.js index 215cab2ef..8cc465606 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-b-9.js @@ -9,34 +9,34 @@ description: > causes deleted index property not to be visited on an Array ---*/ -var accessed = false; -var testResult = true; - -function callbackfn(preVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - testResult = false; - } -} - -var arr = [0]; - -Object.defineProperty(arr, "1", { - get: function() { - return "6.99"; - }, - configurable: true -}); - -Object.defineProperty(arr, "2", { - get: function() { - delete arr[1]; - return 0; - }, - configurable: true -}); - -arr.reduceRight(callbackfn); + var accessed = false; + var testResult = true; + + function callbackfn(preVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + testResult = false; + } + } + + var arr = [0]; + + Object.defineProperty(arr, "1", { + get: function () { + return "6.99"; + }, + configurable: true + }); + + Object.defineProperty(arr, "2", { + get: function () { + delete arr[1]; + return 0; + }, + configurable: true + }); + + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-1.js index 825a40814..fdce8cb0d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-1.js @@ -9,16 +9,15 @@ description: > never been assigned values ---*/ -var callCnt = 0; + var callCnt = 0; + function callbackfn(prevVal, curVal, idx, obj) + { + callCnt++; + return curVal; + } -function callbackfn(prevVal, curVal, idx, obj) -{ - callCnt++; - return curVal; -} - -var arr = new Array(10); -arr[0] = arr[1] = undefined; //explicitly assigning a value + var arr = new Array(10); + arr[0] = arr[1] = undefined; //explicitly assigning a value assert.sameValue(arr.reduceRight(callbackfn), undefined, 'arr.reduceRight(callbackfn)'); assert.sameValue(callCnt, 1, 'callCnt'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-1.js index 351f363ff..da0debdf9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-1.js @@ -9,20 +9,14 @@ description: > property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 0) { + testResult = (curVal === 0); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 0) { - testResult = (curVal === 0); - } -} - -var obj = { - 0: 0, - 1: 1, - 2: 2, - length: 2 -}; -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + var obj = { 0: 0, 1: 1, 2: 2, length: 2 }; + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-10.js index 2c3a2f1e7..d4cf4da37 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-10.js @@ -9,23 +9,22 @@ description: > accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var arr = [0, , 2]; -var arr = [0, , 2]; + Object.defineProperty(arr, "1", { + get: function () { + return 1; + }, + configurable: true + }); -Object.defineProperty(arr, "1", { - get: function() { - return 1; - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-11.js index 8d72dd51d..1cbecd5ed 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-11.js @@ -10,33 +10,28 @@ description: > Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} - -var proto = { - 0: 0, - 1: 11, - 2: 2 -}; - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 3; - -Object.defineProperty(child, "1", { - get: function() { - return "1"; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } + + var proto = { 0: 0, 1: 11, 2: 2 }; + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 3; + + Object.defineProperty(child, "1", { + get: function () { + return "1"; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-12.js index 61fb0309a..e7a9e708f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-12.js @@ -10,24 +10,23 @@ description: > Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} + Array.prototype[1] = 11; + var arr = [0, ,2]; -Array.prototype[1] = 11; -var arr = [0, , 2]; + Object.defineProperty(arr, "1", { + get: function () { + return "1"; + }, + configurable: true + }); -Object.defineProperty(arr, "1", { - get: function() { - return "1"; - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-13.js index f66c4bf60..d9cbbc10b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-13.js @@ -10,39 +10,35 @@ description: > an Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} - -var proto = { - 0: 0, - 2: 2 -}; - -Object.defineProperty(proto, "1", { - get: function() { - return 11; - }, - configurable: true -}); - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 3; - -Object.defineProperty(child, "1", { - get: function() { - return "1"; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } + + var proto = { 0: 0, 2: 2}; + + Object.defineProperty(proto, "1", { + get: function () { + return 11; + }, + configurable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 3; + + Object.defineProperty(child, "1", { + get: function () { + return "1"; + }, + configurable: true + }); + + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-14.js index 25f63b507..e0df7ceb0 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-14.js @@ -10,29 +10,28 @@ description: > an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 11; + }, + configurable: true + }); -Object.defineProperty(Array.prototype, "1", { - get: function() { - return 11; - }, - configurable: true -}); + var arr = [0, ,2]; -var arr = [0, , 2]; - -Object.defineProperty(arr, "1", { - get: function() { - return "1"; - }, - configurable: true -}); -arr.reduceRight(callbackfn, "initialValue"); + Object.defineProperty(arr, "1", { + get: function () { + return "1"; + }, + configurable: true + }); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-15.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-15.js index 270f2ed4b..f8684e9e8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-15.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-15.js @@ -9,32 +9,28 @@ description: > accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var proto = { 0: 0, 2: 2 }; -var proto = { - 0: 0, - 2: 2 -}; + Object.defineProperty(proto, "1", { + get: function () { + return 1; + }, + configurable: true + }); -Object.defineProperty(proto, "1", { - get: function() { - return 1; - }, - configurable: true -}); + var Con = function () { }; + Con.prototype = proto; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child.length = 3; -var child = new Con(); -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js index 78cdc1a28..0f70fe617 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-16.js @@ -9,23 +9,22 @@ description: > accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + Object.defineProperty(Array.prototype, "1", { + get: function () { + return 1; + }, + configurable: true + }); -Object.defineProperty(Array.prototype, "1", { - get: function() { - return 1; - }, - configurable: true -}); + var arr = [0, , 2]; -var arr = [0, , 2]; - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-17.js index 7f9c3c073..04d28b556 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-17.js @@ -9,25 +9,20 @@ description: > accessor property without a get function on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + var obj = { 0: 0, 2: 2, length: 3 }; -var obj = { - 0: 0, - 2: 2, - length: 3 -}; + Object.defineProperty(obj, "1", { + set: function () { }, + configurable: true + }); -Object.defineProperty(obj, "1", { - set: function() {}, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-18.js index 21a4bf39d..ffd33eaac 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-18.js @@ -9,21 +9,20 @@ description: > accessor property without a get function on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + var arr = [0, , 2]; -var arr = [0, , 2]; + Object.defineProperty(arr, "1", { + set: function () { }, + configurable: true + }); -Object.defineProperty(arr, "1", { - set: function() {}, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-19.js index 82ab638bd..ca309ae00 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-19.js @@ -10,26 +10,21 @@ description: > inherited accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + Object.prototype[1] = 1; -Object.prototype[1] = 1; + var obj = { 0: 0, 2: 2, length: 3 }; + Object.defineProperty(obj, "1", { + set: function () { }, + configurable: true + }); -var obj = { - 0: 0, - 2: 2, - length: 3 -}; -Object.defineProperty(obj, "1", { - set: function() {}, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-2.js index c7168a194..f608df609 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-2.js @@ -9,15 +9,14 @@ description: > property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -var arr = [0, 1, 2]; -arr.reduceRight(callbackfn, "initialValue"); + var arr = [0, 1, 2]; + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-20.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-20.js index 0f39cd442..266cafd1a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-20.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-20.js @@ -10,21 +10,20 @@ description: > inherited accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + Array.prototype[1] = 1; + var arr = [0, ,2]; + Object.defineProperty(arr, "1", { + set: function () { }, + configurable: true + }); -Array.prototype[1] = 1; -var arr = [0, , 2]; -Object.defineProperty(arr, "1", { - set: function() {}, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-21.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-21.js index f5dda1c86..1e7b5fd1a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-21.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-21.js @@ -9,30 +9,26 @@ description: > accessor property without a get function on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + var proto = { 0: 0, 2: 2 }; -var proto = { - 0: 0, - 2: 2 -}; + Object.defineProperty(proto, "1", { + set: function () { }, + configurable: true + }); -Object.defineProperty(proto, "1", { - set: function() {}, - configurable: true -}); + var Con = function () { }; + Con.prototype = proto; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child.length = 3; -var child = new Con(); -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-22.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-22.js index 365b543a5..dedd4b643 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-22.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-22.js @@ -9,21 +9,20 @@ description: > accessor property without a get function on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (typeof curVal === "undefined"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (typeof curVal === "undefined"); - } -} + Object.defineProperty(Array.prototype, "1", { + set: function () { }, + configurable: true + }); -Object.defineProperty(Array.prototype, "1", { - set: function() {}, - configurable: true -}); + var arr = [0, , 2]; -var arr = [0, , 2]; - -arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-25.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-25.js index 9c177f936..81d2d0e04 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-25.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-25.js @@ -10,18 +10,17 @@ description: > is less than number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); -}; - -func(0, 1); + func(0, 1); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-26.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-26.js index 79984ddfe..e2518afe3 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-26.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-26.js @@ -10,18 +10,17 @@ description: > equals number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2) { + testResult = (curVal === 2); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2) { - testResult = (curVal === 2); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); -}; - -func(0, 1, 2); + func(0, 1, 2); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-27.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-27.js index 080ad10a2..677bcd3da 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-27.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-27.js @@ -10,18 +10,17 @@ description: > is greater than number of parameters) ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 3) { + testResult = (curVal === 3); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 3) { - testResult = (curVal === 3); - } -} + var func = function (a, b, c) { + Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); + }; -var func = function(a, b, c) { - Array.prototype.reduceRight.call(arguments, callbackfn, "initialValue"); -}; - -func(0, 1, 2, 3); + func(0, 1, 2, 3); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-28.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-28.js index 388685e91..83976643c 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-28.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-28.js @@ -9,15 +9,14 @@ description: > implements its own property get method ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} - -var str = new String("012"); -Array.prototype.reduceRight.call(str, callbackfn, "initialValue"); + var str = new String("012"); + Array.prototype.reduceRight.call(str, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-29.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-29.js index 2cc8148fd..b69e0332b 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-29.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-29.js @@ -9,23 +9,22 @@ description: > implements its own property get method ---*/ -var testResult = false; -var initialValue = 0; + var testResult = false; + var initialValue = 0; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var obj = function (a, b, c) { + return a + b + c; + }; + obj[0] = 0; + obj[1] = 1; + obj[2] = 2; + obj[3] = 3; -var obj = function(a, b, c) { - return a + b + c; -}; -obj[0] = 0; -obj[1] = 1; -obj[2] = 2; -obj[3] = 3; - -Array.prototype.reduceRight.call(obj, callbackfn, initialValue); + Array.prototype.reduceRight.call(obj, callbackfn, initialValue); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-3.js index 98c28ad1e..50fa72704 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-3.js @@ -10,28 +10,22 @@ description: > Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === "1"); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === "1"); - } -} + var proto = { 0: 10, 1: 11, 2: 12, length: 2 }; + var Con = function () { }; + Con.prototype = proto; -var proto = { - 0: 10, - 1: 11, - 2: 12, - length: 2 -}; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child[1] = "1"; + child[2] = "2"; + child.length = 3; -var child = new Con(); -child[1] = "1"; -child[2] = "2"; -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-30.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-30.js index 234bf191a..c3c66cd5f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-30.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-30.js @@ -9,36 +9,35 @@ description: > previous iterations is observed on an Array ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -var arr = [, , ]; -var preIterVisible = false; - -Object.defineProperty(arr, "2", { - get: function() { - preIterVisible = true; - return 0; - }, - configurable: true -}); - -Object.defineProperty(arr, "1", { - get: function() { - if (preIterVisible) { - return 1; - } else { - return "11"; - } - }, - configurable: true -}); - -arr.reduceRight(callbackfn, "initialValue"); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } + + var arr = [, ,]; + var preIterVisible = false; + + Object.defineProperty(arr, "2", { + get: function () { + preIterVisible = true; + return 0; + }, + configurable: true + }); + + Object.defineProperty(arr, "1", { + get: function () { + if (preIterVisible) { + return 1; + } else { + return "11"; + } + }, + configurable: true + }); + + arr.reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-31.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-31.js index c560a641e..a25b15397 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-31.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-31.js @@ -9,38 +9,35 @@ description: > previous iterations is observed on an Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -var obj = { - length: 3 -}; -var preIterVisible = false; - -Object.defineProperty(obj, "2", { - get: function() { - preIterVisible = true; - return 0; - }, - configurable: true -}); - -Object.defineProperty(obj, "1", { - get: function() { - if (preIterVisible) { - return 1; - } else { - return "11"; - } - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } + + var obj = { length: 3 }; + var preIterVisible = false; + + Object.defineProperty(obj, "2", { + get: function () { + preIterVisible = true; + return 0; + }, + configurable: true + }); + + Object.defineProperty(obj, "1", { + get: function () { + if (preIterVisible) { + return 1; + } else { + return "11"; + } + }, + configurable: true + }); + + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-32.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-32.js index 57da7683a..a0225a882 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-32.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-32.js @@ -9,27 +9,22 @@ description: > getter terminate iteration on an Array-like object ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx <= 1) { + accessed = true; + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx <= 1) { - accessed = true; - } -} - -var obj = { - 0: 0, - 2: 2, - length: 3 -}; -Object.defineProperty(obj, "1", { - get: function() { - throw new RangeError("unhandle exception happened in getter"); - }, - configurable: true -}); + var obj = { 0: 0, 2: 2, length: 3 }; + Object.defineProperty(obj, "1", { + get: function () { + throw new RangeError("unhandle exception happened in getter"); + }, + configurable: true + }); assert.throws(RangeError, function() { - Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js index 257325e49..643f4ee4a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-33.js @@ -9,25 +9,24 @@ description: > getter terminate iteration on an Array ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx <= 1) { + accessed = true; + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx <= 1) { - accessed = true; - } -} + var arr = [0, , 2]; -var arr = [0, , 2]; - -Object.defineProperty(arr, "1", { - get: function() { - throw new Test262Error("unhandle exception happened in getter"); - }, - configurable: true -}); + Object.defineProperty(arr, "1", { + get: function () { + throw new Test262Error("unhandle exception happened in getter"); + }, + configurable: true + }); assert.throws(Test262Error, function() { - arr.reduceRight(callbackfn, "initialValue"); + arr.reduceRight(callbackfn, "initialValue"); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-4.js index a5145b80d..a5226d8d8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-4.js @@ -9,15 +9,14 @@ description: > property that overrides an inherited data property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -Array.prototype[1] = "11"; -[0, 1, 2].reduceRight(callbackfn, "initialValue"); + Array.prototype[1] = "11"; + [0, 1, 2].reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-5.js index 6feb43a1b..fe417547f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-5.js @@ -10,34 +10,33 @@ description: > Array-like object ---*/ -var testResult = false; - -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 0) { - testResult = (curVal === "0"); - } -} - -var proto = {}; - -Object.defineProperty(proto, "0", { - get: function() { - return 10; - }, - configurable: true -}); - -var Con = function() {}; -Con.prototype = proto; - -var child = new Con(); -child.length = 2; -Object.defineProperty(child, "0", { - value: "0", - configurable: true -}); -child[1] = "1"; - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 0) { + testResult = (curVal === "0"); + } + } + + var proto = {}; + + Object.defineProperty(proto, "0", { + get: function () { + return 10; + }, + configurable: true + }); + + var Con = function () { }; + Con.prototype = proto; + + var child = new Con(); + child.length = 2; + Object.defineProperty(child, "0", { + value: "0", + configurable: true + }); + child[1] = "1"; + + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-6.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-6.js index 5b47467c3..d3715f273 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-6.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-6.js @@ -9,20 +9,19 @@ description: > property that overrides an inherited accessor property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -Object.defineProperty(Array.prototype, "1", { - get: function() { - return "11"; - }, - configurable: true -}); -[0, 1, 2].reduceRight(callbackfn, "initialValue"); + Object.defineProperty(Array.prototype, "1", { + get: function () { + return "11"; + }, + configurable: true + }); + [0, 1, 2].reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-7.js index e5a8ebfc3..31f37fcee 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-7.js @@ -9,25 +9,20 @@ description: > data property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var proto = { 0: 0, 1: 1, 2: 2 }; + var Con = function () { }; + Con.prototype = proto; -var proto = { - 0: 0, - 1: 1, - 2: 2 -}; -var Con = function() {}; -Con.prototype = proto; + var child = new Con(); + child.length = 3; -var child = new Con(); -child.length = 3; - -Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(child, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js index ad73acacb..754987649 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-8.js @@ -9,17 +9,16 @@ description: > data property on an Array ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} - -Array.prototype[0] = 0; -Array.prototype[1] = 1; -Array.prototype[2] = 2; -[, , , ].reduceRight(callbackfn, "initialValue"); + Array.prototype[0] = 0; + Array.prototype[1] = 1; + Array.prototype[2] = 2; + [, , , ].reduceRight(callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-9.js index d512dd5da..e26ebcc16 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-i-9.js @@ -9,26 +9,21 @@ description: > accessor property on an Array-like object ---*/ -var testResult = false; + var testResult = false; + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (curVal === 1); + } + } -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (curVal === 1); - } -} + var obj = { 0: 0, 2: 2, length: 3 }; + Object.defineProperty(obj, "1", { + get: function () { + return 1; + }, + configurable: true + }); -var obj = { - 0: 0, - 2: 2, - length: 3 -}; -Object.defineProperty(obj, "1", { - get: function() { - return 1; - }, - configurable: true -}); - -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-1.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-1.js index 50b5043be..ef650ba62 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-1.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-1.js @@ -9,14 +9,14 @@ description: > parameters (initialvalue not passed) ---*/ -function callbackfn(prevVal, curVal, idx, obj) -{ - if (idx + 1 < obj.length && obj[idx] === curVal && obj[idx + 1] === prevVal) - return curVal; - else - return false; -} + function callbackfn(prevVal, curVal, idx, obj) + { + if(idx+1 < obj.length && obj[idx] === curVal && obj[idx+1] === prevVal) + return curVal; + else + return false; + } -var arr = [0, 1, true, null, new Object(), "five"]; + var arr = [0,1,true,null,new Object(),"five"]; assert.sameValue(arr.reduceRight(callbackfn), 0, 'arr.reduceRight(callbackfn)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-10.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-10.js index 1953c9a37..ef2c33485 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-10.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-10.js @@ -9,12 +9,12 @@ description: > parameter ---*/ -var called = 0; + var called = 0; -function callbackfn(prevVal) { - called++; - return prevVal; -} + function callbackfn(prevVal) { + called++; + return prevVal; + } assert.sameValue([11, 12].reduceRight(callbackfn, 100), 100, '[11, 12].reduceRight(callbackfn, 100)'); assert.sameValue(called, 2, 'called'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-11.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-11.js index d6e3cfd1d..50fe7d7aa 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-11.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-11.js @@ -9,14 +9,14 @@ description: > parameter ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal) { - if (prevVal === 100) { - testResult = true; - } - return curVal > 10; -} + function callbackfn(prevVal, curVal) { + if (prevVal === 100) { + testResult = true; + } + return curVal > 10; + } assert.sameValue([11].reduceRight(callbackfn, 100), true, '[11].reduceRight(callbackfn, 100)'); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-12.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-12.js index 5d7a7b572..c29286b57 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-12.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-12.js @@ -9,16 +9,16 @@ description: > parameter ---*/ -var testResult = false; -var arr = [11, 12, 13]; -var initVal = 6.99; + var testResult = false; + var arr = [11, 12, 13]; + var initVal = 6.99; -function callbackfn(prevVal, curVal, idx) { - if (idx === 2) { - testResult = (prevVal === initVal); - } - return curVal > 10 && arguments[3][idx] === curVal; -} + function callbackfn(prevVal, curVal, idx) { + if (idx === 2) { + testResult = (prevVal === initVal); + } + return curVal > 10 && arguments[3][idx] === curVal; + } assert.sameValue(arr.reduceRight(callbackfn, initVal), true, 'arr.reduceRight(callbackfn, initVal)'); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-13.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-13.js index 6fc2965d5..39325da4e 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-13.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-13.js @@ -9,16 +9,16 @@ description: > parameter ---*/ -var arr = [11, 12, 13]; -var initVal = 6.99; -var testResult = false; + var arr = [11, 12, 13]; + var initVal = 6.99; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 2) { - testResult = (prevVal === initVal); - } - return curVal > 10 && obj[idx] === curVal; -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 2) { + testResult = (prevVal === initVal); + } + return curVal > 10 && obj[idx] === curVal; + } assert.sameValue(arr.reduceRight(callbackfn, initVal), true, 'arr.reduceRight(callbackfn, initVal)'); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-14.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-14.js index 07437dba5..200649494 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-14.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-14.js @@ -7,8 +7,8 @@ es5id: 15.4.4.22-9-c-ii-14 description: Array.prototype.reduceRight - callbackfn uses arguments ---*/ -function callbackfn() { - return arguments[0] === 100 && arguments[3][arguments[2]] === arguments[1]; -} + function callbackfn() { + return arguments[0] === 100 && arguments[3][arguments[2]] === arguments[1]; + } assert.sameValue([11].reduceRight(callbackfn, 100), true, '[11].reduceRight(callbackfn, 100)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-16.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-16.js index 401a680ec..101a63d5f 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-16.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-16.js @@ -9,20 +9,15 @@ description: > called on an Array-like object ---*/ -var testResult = false; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (prevVal === 8 || curVal === 8) { - testResult = true; - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (prevVal === 8 || curVal === 8) { + testResult = true; + } + } -var obj = { - 0: 11, - 10: 12, - non_index_property: 8, - length: 20 -}; -Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); + var obj = { 0: 11, 10: 12, non_index_property: 8, length: 20 }; + Array.prototype.reduceRight.call(obj, callbackfn, "initialValue"); assert.sameValue(testResult, false, 'testResult'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-17.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-17.js index b2823532e..0b8e5be99 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-17.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-17.js @@ -9,19 +9,19 @@ description: > iteration is the result of previous iteration on an Array ---*/ -var arr = [11, 12, 13]; -var testResult = true; -var initVal = 6.99; -var preResult = initVal; + var arr = [11, 12, 13]; + var testResult = true; + var initVal = 6.99; + var preResult = initVal; -function callbackfn(prevVal, curVal, idx, obj) { - if (prevVal !== preResult) { - testResult = false; - } - preResult = curVal; - return curVal; -} + function callbackfn(prevVal, curVal, idx, obj) { + if (prevVal !== preResult) { + testResult = false; + } + preResult = curVal; + return curVal; + } -arr.reduceRight(callbackfn, initVal); + arr.reduceRight(callbackfn, initVal); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-18.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-18.js index 28d86867b..7e7098d40 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-18.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-18.js @@ -10,17 +10,17 @@ description: > Array ---*/ -var arr = [11, 12]; -var testResult = false; -var initVal = 6.99; + var arr = [11, 12]; + var testResult = false; + var initVal = 6.99; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === initVal); - } - return curVal; -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === initVal); + } + return curVal; + } -arr.reduceRight(callbackfn, initVal); + arr.reduceRight(callbackfn, initVal); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-19.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-19.js index 991b82cf0..194a32917 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-19.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-19.js @@ -10,15 +10,15 @@ description: > undefined when 'initialValue' is not present on an Array ---*/ -var arr = [11, 12, 13]; -var testResult = false; + var arr = [11, 12, 13]; + var testResult = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === 1) { - testResult = (prevVal === 13); - } - return curVal; -} -arr.reduceRight(callbackfn); + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === 1) { + testResult = (prevVal === 13); + } + return curVal; + } + arr.reduceRight(callbackfn); assert(testResult, 'testResult !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-2.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-2.js index 238b1e2a3..7324a06a8 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-2.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-2.js @@ -9,17 +9,17 @@ description: > parameters (initialvalue passed) ---*/ -var bParCorrect = false; -var arr = [0, 1, true, null, new Object(), "five"]; -var initialValue = 5.5; + var bParCorrect = false; + var arr = [0, 1, true, null, new Object(), "five"]; + var initialValue = 5.5; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx === obj.length - 1 && obj[idx] === curVal && prevVal === initialValue) - return curVal; - else if (idx + 1 < obj.length && obj[idx] === curVal && obj[idx + 1] === prevVal) - return curVal; - else - return false; -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx === obj.length - 1 && obj[idx] === curVal && prevVal === initialValue) + return curVal; + else if (idx + 1 < obj.length && obj[idx] === curVal && obj[idx + 1] === prevVal) + return curVal; + else + return false; + } assert.sameValue(arr.reduceRight(callbackfn, initialValue), 0, 'arr.reduceRight(callbackfn, initialValue)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-20.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-20.js index 09cf7e099..f4b5470c6 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-20.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-20.js @@ -7,17 +7,13 @@ es5id: 15.4.4.22-9-c-ii-20 description: Array.prototype.reduceRight - undefined can be used as accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return typeof prevVal === "undefined"; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return typeof prevVal === "undefined"; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, undefined), true, 'Array.prototype.reduceRight.call(obj, callbackfn, undefined)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-21.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-21.js index 83f18c38c..7f10e3b78 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-21.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-21.js @@ -7,17 +7,13 @@ es5id: 15.4.4.22-9-c-ii-21 description: Array.prototype.reduceRight - null can be used as accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === null; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === null; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, null), true, 'Array.prototype.reduceRight.call(obj, callbackfn, null)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-22.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-22.js index e130868f0..10b20d942 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-22.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-22.js @@ -9,17 +9,13 @@ description: > accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === false; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === false; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, false), true, 'Array.prototype.reduceRight.call(obj, callbackfn, false)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-23.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-23.js index dc7dba028..57cb524bd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-23.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-23.js @@ -9,17 +9,13 @@ description: > accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === 12; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === 12; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 12), true, 'Array.prototype.reduceRight.call(obj, callbackfn, 12)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-24.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-24.js index 768eb6a3d..2326939fd 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-24.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-24.js @@ -9,17 +9,13 @@ description: > accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === "hello_"; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === "hello_"; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, "hello_"), true, 'Array.prototype.reduceRight.call(obj, callbackfn, "hello_")'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-25.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-25.js index 7d37c5f2a..4de1b221a 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-25.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-25.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objFunction = function() {}; + var accessed = false; + var objFunction = function () { }; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objFunction; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objFunction; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objFunction), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objFunction)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-26.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-26.js index e95896266..485f17e10 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-26.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-26.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objArray = []; + var accessed = false; + var objArray = []; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objArray; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objArray; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objArray), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objArray)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-27.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-27.js index b5f187df0..3414ccbc9 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-27.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-27.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objString = new String(); + var accessed = false; + var objString = new String(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objString; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objString; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objString), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objString)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-28.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-28.js index e8f4b8bc0..541ff7834 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-28.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-28.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objBoolean = new Boolean(); + var accessed = false; + var objBoolean = new Boolean(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objBoolean; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objBoolean; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objBoolean), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objBoolean)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-29.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-29.js index 7194c1789..852073958 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-29.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-29.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objNumber = new Number(); + var accessed = false; + var objNumber = new Number(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objNumber; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objNumber; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objNumber), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objNumber)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-3.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-3.js index 86a77aa36..7a53ea562 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-3.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-3.js @@ -7,17 +7,16 @@ es5id: 15.4.4.22-9-c-ii-3 description: Array.prototype.reduceRight - callbackfn takes 4 arguments ---*/ -var bCalled = false; + var bCalled = false; + function callbackfn(prevVal, curVal, idx, obj) + { + bCalled = true; + if(prevVal === true && arguments.length === 4) + return true; + else + return false; + } + var arr = [0,1,2,3,4,5,6,7,8,9]; -function callbackfn(prevVal, curVal, idx, obj) -{ - bCalled = true; - if (prevVal === true && arguments.length === 4) - return true; - else - return false; -} -var arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - -assert.sameValue(arr.reduceRight(callbackfn, true), true, 'arr.reduceRight(callbackfn,true)'); +assert.sameValue(arr.reduceRight(callbackfn,true), true, 'arr.reduceRight(callbackfn,true)'); assert.sameValue(bCalled, true, 'bCalled'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-30.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-30.js index 0df779018..c15160423 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-30.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-30.js @@ -9,17 +9,13 @@ description: > accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === Math; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === Math; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, Math), true, 'Array.prototype.reduceRight.call(obj, callbackfn, Math)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-31.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-31.js index 092e60ecf..c58777b28 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-31.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-31.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objDate = new Date(); + var accessed = false; + var objDate = new Date(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objDate; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objDate; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objDate), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objDate)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-32.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-32.js index 921bc654d..08e8e4232 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-32.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-32.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objRegExp = new RegExp(); + var accessed = false; + var objRegExp = new RegExp(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objRegExp; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objRegExp; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objRegExp), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objRegExp)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-33.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-33.js index 37a2bd4a6..97419e156 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-33.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-33.js @@ -7,17 +7,13 @@ es5id: 15.4.4.22-9-c-ii-33 description: Array.prototype.reduceRight - the JSON can be used as accumulator ---*/ -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === JSON; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === JSON; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, JSON), true, 'Array.prototype.reduceRight.call(obj, callbackfn, JSON)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-34.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-34.js index 72fcc0cc5..f384ce910 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-34.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-34.js @@ -9,18 +9,14 @@ description: > accumulator ---*/ -var accessed = false; -var objError = new RangeError(); + var accessed = false; + var objError = new RangeError(); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === objError; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === objError; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, objError), true, 'Array.prototype.reduceRight.call(obj, callbackfn, objError)'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-35.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-35.js index db05c37e0..11d7428b7 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-35.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-35.js @@ -9,22 +9,19 @@ description: > accumulator ---*/ -var accessed = false; -var arg; + var accessed = false; + var arg; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === arg; -} + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === arg; + } -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; -(function fun() { - arg = arguments; -}(10, 11, 12, 13)); + (function fun() { + arg = arguments; + }(10, 11, 12, 13)); assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, arg), true, 'Array.prototype.reduceRight.call(obj, callbackfn, arg)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-37.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-37.js index 23314a32b..e8b37ab73 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-37.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-37.js @@ -10,17 +10,13 @@ description: > ---*/ var global = this; -var accessed = false; + var accessed = false; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + return prevVal === global; + } -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - return prevVal === global; -} - -var obj = { - 0: 11, - length: 1 -}; + var obj = { 0: 11, length: 1 }; assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, this), true, 'Array.prototype.reduceRight.call(obj, callbackfn, this)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4-s.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4-s.js index 35efbafc9..599387257 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4-s.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4-s.js @@ -10,14 +10,13 @@ description: > flags: [noStrict] ---*/ -var innerThisCorrect = false; - -function callbackfn(prevVal, curVal, idx, obj) -{ - "use strict"; - innerThisCorrect = this === undefined; - return true; -} -[0].reduceRight(callbackfn, true); + var innerThisCorrect = false; + function callbackfn(prevVal, curVal, idx, obj) + { + "use strict"; + innerThisCorrect = this===undefined; + return true; + } + [0].reduceRight(callbackfn,true); assert(innerThisCorrect, 'innerThisCorrect !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4.js index 7dd1ce5ed..2fc5083b7 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-4.js @@ -9,20 +9,20 @@ description: > numeric order ---*/ -var arr = [0, 1, 2, 3, 4, 5]; -var lastIdx = arr.length - 1; -var accessed = false; -var result = true; + var arr = [0, 1, 2, 3, 4, 5]; + var lastIdx = arr.length - 1; + var accessed = false; + var result = true; -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (lastIdx !== idx) { - result = false; - } else { - lastIdx--; - } -} -arr.reduceRight(callbackfn, 1); + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (lastIdx !== idx) { + result = false; + } else { + lastIdx--; + } + } + arr.reduceRight(callbackfn, 1); assert(result, 'result !== true'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js index ccb63b811..8d3811a03 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-5.js @@ -9,27 +9,27 @@ description: > iteration and not prior to starting the loop on an Array ---*/ -var arr = [11, 12, 13, 14]; -var kIndex = []; -var result = true; -var called = 0; + var arr = [11, 12, 13, 14]; + var kIndex = []; + var result = true; + var called = 0; -//By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time. -function callbackfn(preVal, curVal, idx, o) { - //Each position should be visited one time, which means k is accessed one time during iterations. - called++; - if (typeof kIndex[idx] === "undefined") { - //when current position is visited, its next index should has been visited. - if (idx !== arr.length - 1 && typeof kIndex[idx + 1] === "undefined") { - result = false; - } - kIndex[idx] = 1; - } else { - result = false; - } -} + //By below way, we could verify that k would be setted as 0, 1, ..., length - 1 in order, and each value will be setted one time. + function callbackfn(preVal, curVal, idx, o) { + //Each position should be visited one time, which means k is accessed one time during iterations. + called++; + if (typeof kIndex[idx] === "undefined") { + //when current position is visited, its next index should has been visited. + if (idx !== arr.length - 1 && typeof kIndex[idx + 1] === "undefined") { + result = false; + } + kIndex[idx] = 1; + } else { + result = false; + } + } -arr.reduceRight(callbackfn, 1); + arr.reduceRight(callbackfn, 1); assert(result, 'result !== true'); assert.sameValue(called, 4, 'called'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js index f6f26025d..2c4f53601 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-7.js @@ -9,26 +9,21 @@ description: > callbackfn terminate iteration ---*/ -var accessed = false; + var accessed = false; -function callbackfn(prevVal, curVal, idx, obj) { - if (idx < 10) { - accessed = true; - } - if (idx === 10) { - throw new Test262Error("Exception occurred in callbackfn"); - } -} + function callbackfn(prevVal, curVal, idx, obj) { + if (idx < 10) { + accessed = true; + } + if (idx === 10) { + throw new Test262Error("Exception occurred in callbackfn"); + } + } -var obj = { - 0: 11, - 4: 10, - 10: 8, - length: 20 -}; + var obj = { 0: 11, 4: 10, 10: 8, length: 20 }; assert.throws(Test262Error, function() { - Array.prototype.reduceRight.call(obj, callbackfn, 1); + Array.prototype.reduceRight.call(obj, callbackfn, 1); }); assert.sameValue(accessed, false, 'accessed'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-8.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-8.js index 439445c5b..3625e8a4d 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-8.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-8.js @@ -9,20 +9,15 @@ description: > previous iterations is observed ---*/ -var accessed = false; -var obj = { - 0: 11, - 1: 12, - length: 2 -}; - -function callbackfn(prevVal, curVal, idx, obj) { - accessed = true; - if (idx === 1) { - obj[idx - 1] = 8; - } - return curVal > 10; -} + var accessed = false; + var obj = { 0: 11, 1: 12, length: 2 }; + function callbackfn(prevVal, curVal, idx, obj) { + accessed = true; + if (idx === 1) { + obj[idx - 1] = 8; + } + return curVal > 10; + } assert.sameValue(Array.prototype.reduceRight.call(obj, callbackfn, 1), false, 'Array.prototype.reduceRight.call(obj, callbackfn, 1)'); assert(accessed, 'accessed !== true'); diff --git a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-9.js b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-9.js index c1dfba328..170d9d328 100644 --- a/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-9.js +++ b/test/built-ins/Array/prototype/reduceRight/15.4.4.22-9-c-ii-9.js @@ -9,12 +9,12 @@ description: > parameter ---*/ -var called = 0; + var called = 0; -function callbackfn() { - called++; - return true; -} + function callbackfn() { + called++; + return true; + } assert.sameValue([11, 12].reduceRight(callbackfn, 11), true, '[11, 12].reduceRight(callbackfn, 11)'); assert.sameValue(called, 2, 'called'); |