Replace runTestCase with assert.throws [test/built-ins/Array]

This commit is contained in:
André Bargull 2015-08-11 17:44:08 +02:00
parent f3e919209c
commit edc902aff5
162 changed files with 480 additions and 1846 deletions

View File

@ -6,14 +6,9 @@ es5id: 15.4.5.1-3.d-1
description: >
Throw RangeError if attempt to set array length property to
4294967296 (2**32)
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(RangeError, function() {
[].length = 4294967296 ;
} catch (e) {
if (e instanceof RangeError) return true;
}
}
runTestCase(testcase);
});

View File

@ -6,14 +6,9 @@ es5id: 15.4.5.1-3.d-2
description: >
Throw RangeError if attempt to set array length property to
4294967297 (1+2**32)
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(RangeError, function() {
[].length = 4294967297 ;
} catch (e) {
if (e instanceof RangeError) return true;
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.16-1-1
description: Array.prototype.every applied to undefined throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(undefined); // TypeError is thrown if value is undefined
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.16-1-2
description: Array.prototype.every applied to null throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(null); // TypeError is thrown if value is null
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.every throws TypeError exception when 'length' is
an object with toString and valueOf methods that don<EFBFBD>t return
primitive values
includes: [runTestCase.js]
---*/
function testcase() {
var callbackfnAccessed = false;
var toStringAccessed = false;
var valueOfAccessed = false;
@ -36,12 +33,9 @@ function testcase() {
}
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof TypeError) && toStringAccessed && valueOfAccessed && !callbackfnAccessed;
}
}
runTestCase(testcase);
});
assert(toStringAccessed, 'toStringAccessed !== true');
assert(valueOfAccessed, 'valueOfAccessed !== true');
assert.sameValue(callbackfnAccessed, false, 'callbackfnAccessed');

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.16-4-1
description: Array.prototype.every throws TypeError if callbackfn is undefined
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every();
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.16-4-15
description: >
Array.prototype.every - calling with no callbackfn is the same as
passing undefined for callbackfn
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 10: 10 };
var lengthAccessed = false;
var loopAccessed = false;
@ -29,12 +27,8 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(obj);
return false;
} catch (ex) {
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
}
}
runTestCase(testcase);
});
assert(lengthAccessed, 'lengthAccessed !== true');
assert.sameValue(loopAccessed, false, 'loopAccessed');

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.16-4-3
description: Array.prototype.every throws TypeError if callbackfn is null
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every(null);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.16-4-4
description: Array.prototype.every throws TypeError if callbackfn is boolean
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every(true);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.16-4-5
description: Array.prototype.every throws TypeError if callbackfn is number
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every(5);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.16-4-6
description: Array.prototype.every throws TypeError if callbackfn is string
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every("abc");
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.16-4-7
description: >
Array.prototype.every throws TypeError if callbackfn is Object
without a Call internal method
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.every( {} );
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-4-8
description: >
Array.prototype.every - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -22,12 +19,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-4-9
description: >
Array.prototype.every - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.every.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-30
description: >
Array.prototype.every - unnhandled exceptions happened in getter
terminate iteration on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
if (idx > 1) {
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
Array.prototype.every.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-31
description: >
Array.prototype.every - unhandled exceptions happened in getter
terminate iteration on an Array
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
if (idx > 1) {
@ -29,12 +26,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
arr.every(callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.20-1-1
description: Array.prototype.filter applied to undefined throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(undefined); // TypeError is thrown if value is undefined
return false;
} catch (ex) {
return ex instanceof TypeError;
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.20-1-2
description: Array.prototype.filter applied to null throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(null);
return false;
} catch (ex) {
return ex instanceof TypeError;
}
}
runTestCase(testcase);
});

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.filter throws TypeError exception when 'length' is
an object with toString and valueOf methods that don<EFBFBD>t return
primitive values
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var firstStepOccured = false;
var secondStepOccured = false;
@ -36,12 +33,9 @@ function testcase() {
}
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof TypeError) && !accessed && firstStepOccured && secondStepOccured;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');
assert(firstStepOccured, 'firstStepOccured !== true');
assert(secondStepOccured, 'secondStepOccured !== true');

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.20-4-1
description: Array.prototype.filter throws TypeError if callbackfn is undefined
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter();
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.20-4-15
description: >
Array.prototype.filter - calling with no callbackfn is the same as
passing undefined for callbackfn
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 10: 10 };
var lengthAccessed = false;
var loopAccessed = false;
@ -27,12 +25,8 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(obj);
return false;
} catch (ex) {
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
}
}
runTestCase(testcase);
});
assert(lengthAccessed, 'lengthAccessed !== true');
assert.sameValue(loopAccessed, false, 'loopAccessed');

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.20-4-2
description: >
Array.prototype.filter throws ReferenceError if callbackfn is
unreferenced
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(ReferenceError, function() {
arr.filter(foo);
}
catch(e) {
if(e instanceof ReferenceError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.20-4-3
description: Array.prototype.filter throws TypeError if callbackfn is null
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter(null);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.20-4-4
description: Array.prototype.filter throws TypeError if callbackfn is boolean
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter(true);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.20-4-5
description: Array.prototype.filter throws TypeError if callbackfn is number
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter(5);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.20-4-6
description: Array.prototype.filter throws TypeError if callbackfn is string
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter("abc");
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.20-4-7
description: >
Array.prototype.filter throws TypeError if callbackfn is Object
without [[Call]] internal method
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.filter(new Object());
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-4-8
description: >
Array.prototype.filter - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -22,12 +19,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-4-9
description: >
Array.prototype.filter - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.filter.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-i-30
description: >
Array.prototype.filter - unnhandled exceptions happened in getter
terminate iteration on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
if (idx > 1) {
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
Array.prototype.filter.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-i-31
description: >
Array.prototype.filter - unnhandled exceptions happened in getter
terminate iteration on an Array
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
if (idx > 1) {
@ -29,12 +26,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
arr.filter(callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-ii-7
description: >
Array.prototype.filter - unhandled exceptions happened in
callbackfn terminate iteration
includes: [runTestCase.js]
---*/
function testcase() {
var called = 0;
function callbackfn(val, idx, obj) {
@ -22,12 +19,7 @@ function testcase() {
}
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
try {
assert.throws(Error, function() {
Array.prototype.filter.call(obj, callbackfn);
return false;
} catch (ex) {
return 1 === called && ex instanceof Error;
}
}
runTestCase(testcase);
});
assert.sameValue(called, 1, 'called');

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.18-1-1
description: Array.prototype.forEach applied to undefined
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(undefined); // TypeError is thrown if value is undefined
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.18-1-2
description: Array.prototype.forEach applied to null
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(null); // TypeError is thrown if value is null
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.forEach throws TypeError exception when 'length'
is an object with toString and valueOf methods that don<EFBFBD>t return
primitive values
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var firstStepOccured = false;
var secondStepOccured = false;
@ -35,12 +32,7 @@ function testcase() {
}
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(obj, callbackfn);
return false;
} catch (ex) {
return ex instanceof TypeError && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.18-4-1
description: Array.prototype.forEach throws TypeError if callbackfn is undefined
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach();
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-15
description: >
Array.prototype.forEach - calling with no callbackfn is the same
as passing undefined for callbackfn
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 10: 10 };
var lengthAccessed = false;
var loopAccessed = false;
@ -30,12 +27,8 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(obj);
return false;
} catch (ex) {
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
}
}
runTestCase(testcase);
});
assert(lengthAccessed, 'lengthAccessed !== true');
assert.sameValue(loopAccessed, false, 'loopAccessed');

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.18-4-2
description: >
Array.prototype.forEach throws ReferenceError if callbackfn is
unreferenced
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(ReferenceError, function() {
arr.forEach(foo);
}
catch(e) {
if(e instanceof ReferenceError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.18-4-3
description: Array.prototype.forEach throws TypeError if callbackfn is null
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach(null);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.18-4-4
description: Array.prototype.forEach throws TypeError if callbackfn is boolean
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach(true);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.18-4-5
description: Array.prototype.forEach throws TypeError if callbackfn is number
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach(5);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.18-4-6
description: Array.prototype.forEach throws TypeError if callbackfn is string
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach("abc");
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.18-4-7
description: >
Array.prototype.forEach throws TypeError if callbackfn is Object
without Call internal method
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.forEach(new Object());
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-8
description: >
Array.prototype.forEach - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -22,12 +19,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-9
description: >
Array.prototype.forEach - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.forEach.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-30
description: >
Array.prototype.forEach - unnhandled exceptions happened in getter
terminate iteration on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
var accessed = false;
@ -34,12 +31,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
Array.prototype.forEach.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-31
description: >
Array.prototype.forEach - unnhandled exceptions happened in getter
terminate iteration on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
@ -37,12 +34,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
arr.forEach(callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-ii-7
description: >
Array.prototype.forEach - unhandled exceptions happened in
callbackfn terminate iteration
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
@ -23,12 +20,7 @@ function testcase() {
}
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
try {
assert.throws(Error, function() {
Array.prototype.forEach.call(obj, callbackfn);
return false;
} catch (ex) {
return ex instanceof Error && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,16 +4,9 @@
/*---
es5id: 15.4.4.14-1-1
description: Array.prototype.indexOf applied to undefined throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.indexOf.call(undefined);
return false;
}
catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);
});

View File

@ -4,16 +4,9 @@
/*---
es5id: 15.4.4.14-1-2
description: Array.prototype.indexOf applied to null throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.indexOf.call(null);
return false;
}
catch (e) {
return e instanceof TypeError;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-28
description: >
Array.prototype.indexOf - side effects produced by step 1 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var fromIndex = {
valueOf: function () {
@ -18,12 +15,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.indexOf.call(undefined, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof TypeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-29
description: >
Array.prototype.indexOf - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var obj = {};
@ -27,12 +24,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(RangeError, function() {
Array.prototype.indexOf.call(obj, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof RangeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-30
description: >
Array.prototype.indexOf - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var obj = {};
@ -31,12 +28,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.indexOf.call(obj, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof TypeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-30
description: >
Array.prototype.indexOf - terminates iteration on unhandled
exception on an Array
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var arr = [];
@ -28,12 +25,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
arr.indexOf(true);
return false;
} catch (e) {
return (e instanceof TypeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-31
description: >
Array.prototype.indexOf - terminates iteration on unhandled
exception on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var obj = { length: 2 };
@ -28,13 +25,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.indexOf.call(obj, true);
return false;
} catch (e) {
return (e instanceof TypeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,18 +4,9 @@
/*---
es5id: 15.4.4.15-1-1
description: Array.prototype.lastIndexOf applied to undefined throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(undefined);
return false;
} catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -4,18 +4,9 @@
/*---
es5id: 15.4.4.15-1-2
description: Array.prototype.lastIndexOf applied to null throws a TypeError
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(null);
return false;
} catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-28
description: >
Array.prototype.lastIndexOf - side effects produced by step 1 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var fromIndex = {
valueOf: function () {
@ -18,12 +15,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(undefined, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof TypeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-29
description: >
Array.prototype.lastIndexOf - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var obj = {};
@ -27,12 +24,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(RangeError, function() {
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof RangeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-30
description: >
Array.prototype.lastIndexOf - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var stepFiveOccurs = false;
var obj = {};
@ -31,12 +28,7 @@ function testcase() {
return 0;
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
return false;
} catch (e) {
return (e instanceof TypeError) && !stepFiveOccurs;
}
}
runTestCase(testcase);
});
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-30
description: >
Array.prototype.lastIndexOf terminates iteration on unhandled
exception on an Array
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var arr = [];
@ -28,13 +25,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
arr.lastIndexOf(true);
return false;
} catch (e) {
return (e instanceof TypeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-31
description: >
Array.prototype.lastIndexOf terminates iteration on unhandled
exception on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var obj = { length: 3 };
@ -28,13 +25,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.lastIndexOf.call(obj, true);
return false;
} catch (e) {
return (e instanceof TypeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.19-1-1
description: Array.prototype.map - applied to undefined
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(undefined); // TypeError is thrown if value is undefined
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.19-1-2
description: Array.prototype.map - applied to null
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(null); // TypeError is thrown if value is null
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -4,22 +4,13 @@
/*---
es5id: 15.4.4.19-3-14
description: Array.prototype.map - 'length' is a string containing Infinity
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return val < 10;
}
var obj = { 0: 9, length: "Infinity" };
try {
assert.throws(RangeError, function() {
Array.prototype.map.call(obj, callbackfn);
} catch (e) {
if (e instanceof RangeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.map throws TypeError exception when 'length' is an
object with toString and valueOf methods that don<EFBFBD>t return
primitive values
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return val > 10;
}
@ -29,12 +26,6 @@ function testcase() {
}
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(obj, callbackfn);
return false;
} catch (ex) {
return ex instanceof TypeError;
}
}
runTestCase(testcase);
});

View File

@ -4,11 +4,8 @@
/*---
es5id: 15.4.4.19-3-28
description: Array.prototype.map - value of 'length' is boundary value (2^32)
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return val > 10;
}
@ -17,13 +14,6 @@ function testcase() {
0: 12,
length: 4294967296
};
try {
assert.throws(RangeError, function() {
var newArr = Array.prototype.map.call(obj, callbackfn);
} catch (e) {
if (e instanceof RangeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-3-29
description: >
Array.prototype.map - value of 'length' is boundary value (2^32 +
1)
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return val > 10;
}
@ -20,13 +17,6 @@ function testcase() {
1: 9,
length: 4294967297
};
try {
assert.throws(RangeError, function() {
var newArr = Array.prototype.map.call(obj, callbackfn);
} catch (e) {
if (e instanceof RangeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -6,22 +6,13 @@ es5id: 15.4.4.19-3-8
description: >
Array.prototype.map - value of 'length' is a number (value is
Infinity)
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(val, idx, obj) {
return val < 10;
}
var obj = { 0: 9, length: Infinity };
try {
assert.throws(RangeError, function() {
Array.prototype.map.call(obj, callbackfn);
} catch (e) {
if (e instanceof RangeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.19-4-1
description: Array.prototype.map throws TypeError if callbackfn is undefined
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map();
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-15
description: >
Array.prototype.map - calling with no callbackfn is the same as
passing undefined for callbackfn
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 10: 10 };
var lengthAccessed = false;
var loopAccessed = false;
@ -29,12 +26,8 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(obj);
return false;
} catch (e) {
return e instanceof TypeError && lengthAccessed && !loopAccessed;
}
}
runTestCase(testcase);
});
assert(lengthAccessed, 'lengthAccessed !== true');
assert.sameValue(loopAccessed, false, 'loopAccessed');

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.19-4-2
description: >
Array.prototype.map throws ReferenceError if callbackfn is
unreferenced
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(ReferenceError, function() {
arr.map(foo);
}
catch(e) {
if(e instanceof ReferenceError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.19-4-3
description: Array.prototype.map throws TypeError if callbackfn is null
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map(null);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.19-4-4
description: Array.prototype.map throws TypeError if callbackfn is boolean
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map(true);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.19-4-5
description: Array.prototype.map throws TypeError if callbackfn is number
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map(5);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.19-4-6
description: Array.prototype.map throws TypeError if callbackfn is string
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map("abc");
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.19-4-7
description: >
Array.prototype.map throws TypeError if callbackfn is Object
without Call internal method
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.map(new Object());
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-8
description: >
Array.prototype.map - Side effects produced by step 2 are visible
when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -22,12 +19,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-9
description: >
Array.prototype.map - Side effects produced by step 3 are visible
when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.map.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-i-30
description: >
Array.prototype.map - unhandled exceptions happened in getter
terminate iteration on an Array-like object
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
var accessed = false;
@ -34,12 +31,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
Array.prototype.map.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-i-31
description: >
Array.prototype.map - unhandled exceptions happened in getter
terminate iteration on an Array
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
@ -37,12 +34,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(RangeError, function() {
arr.map(callbackfn);
return false;
} catch (ex) {
return (ex instanceof RangeError) && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-ii-7
description: >
Array.prototype.map - unhandled exceptions happened in callbackfn
terminate iteration
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
function callbackfn(val, idx, obj) {
@ -23,12 +20,7 @@ function testcase() {
}
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
try {
assert.throws(Error, function() {
Array.prototype.map.call(obj, callbackfn);
return false;
} catch (ex) {
return ex instanceof Error && !accessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.21-1-1
description: Array.prototype.reduce applied to undefined
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(undefined);
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -4,15 +4,9 @@
/*---
es5id: 15.4.4.21-1-2
description: Array.prototype.reduce applied to null
includes: [runTestCase.js]
---*/
function testcase() {
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(null);
return false;
} catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);
});

View File

@ -7,11 +7,8 @@ description: >
Array.prototype.reduce throws TypeError exception - 'length' is an
object with toString and valueOf methods that don<EFBFBD>t return
primitive values
includes: [runTestCase.js]
---*/
function testcase() {
var accessed = false;
var valueOfAccessed = false;
var toStringAccessed = false;
@ -36,12 +33,9 @@ function testcase() {
}
}
};
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj, callbackfn, 1);
return false;
} catch (ex) {
return (ex instanceof TypeError) && !accessed && toStringAccessed && valueOfAccessed;
}
}
runTestCase(testcase);
});
assert.sameValue(accessed, false, 'accessed');
assert(toStringAccessed, 'toStringAccessed !== true');
assert(valueOfAccessed, 'valueOfAccessed !== true');

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.21-4-1
description: Array.prototype.reduce throws TypeError if callbackfn is undefined
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce();
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,10 +6,8 @@ es5id: 15.4.4.21-4-15
description: >
Array.prototype.reduce - calling with no callbackfn is the same as
passing undefined for callbackfn
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 10: 10 };
var lengthAccessed = false;
var loopAccessed = false;
@ -29,12 +27,8 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj);
return false;
} catch (ex) {
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
}
}
runTestCase(testcase);
});
assert(lengthAccessed, 'lengthAccessed !== true');
assert.sameValue(loopAccessed, false, 'loopAccessed');

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.21-4-2
description: >
Array.prototype.reduce throws ReferenceError if callbackfn is
unreferenced
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(ReferenceError, function() {
arr.reduce(foo);
}
catch(e) {
if(e instanceof ReferenceError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.21-4-3
description: Array.prototype.reduce throws TypeError if callbackfn is null
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce(null);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.21-4-4
description: Array.prototype.reduce throws TypeError if callbackfn is boolean
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce(true);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.21-4-5
description: Array.prototype.reduce throws TypeError if callbackfn is number
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce(5);
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -4,19 +4,9 @@
/*---
es5id: 15.4.4.21-4-6
description: Array.prototype.reduce throws TypeError if callbackfn is string
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce("abc");
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.21-4-7
description: >
Array.prototype.reduce throws TypeError if callbackfn is Object
without [[Call]] internal method
includes: [runTestCase.js]
---*/
function testcase() {
var arr = new Array(10);
try {
assert.throws(TypeError, function() {
arr.reduce(new Object());
}
catch(e) {
if(e instanceof TypeError)
return true;
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-4-8
description: >
Array.prototype.reduce - side effects produced by step 2 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -22,12 +19,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-4-9
description: >
Array.prototype.reduce - side effects produced by step 3 are
visible when an exception occurs
includes: [runTestCase.js]
---*/
function testcase() {
var obj = { 0: 11, 1: 12 };
var accessed = false;
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj, null);
return false;
} catch (ex) {
return ex instanceof TypeError && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,19 +6,9 @@ es5id: 15.4.4.21-5-1
description: >
Array.prototype.reduce throws TypeError if 'length' is 0 (empty
array), no initVal
includes: [runTestCase.js]
---*/
function testcase() {
function cb(){}
try {
assert.throws(TypeError, function() {
[].reduce(cb);
}
catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-10
description: >
Array.prototype.reduce - if exception occurs, it occurs after any
side-effects that might be produced by step 2
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(prevVal, curVal, idx, obj) {
return (curVal > 10);
}
@ -26,12 +23,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof TypeError) && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-11
description: >
Array.prototype.reduce - if the exception occurs, it occurs after
any side-effects that might be produced by step 3
includes: [runTestCase.js]
---*/
function testcase() {
function callbackfn(prevVal, curVal, idx, obj) {
return (curVal > 10);
}
@ -30,12 +27,7 @@ function testcase() {
},
configurable: true
});
try {
assert.throws(TypeError, function() {
Array.prototype.reduce.call(obj, callbackfn);
return false;
} catch (ex) {
return (ex instanceof TypeError) && accessed;
}
}
runTestCase(testcase);
});
assert(accessed, 'accessed !== true');

View File

@ -7,23 +7,14 @@ description: >
Array.prototype.reduce throws TypeError if 'length' is 0
(subclassed Array, length overridden to null (type conversion)),
no initVal
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = null;
function cb(){}
try {
assert.throws(TypeError, function() {
f.reduce(cb);
}
catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);
});

View File

@ -7,23 +7,14 @@ description: >
Array.prototype.reduce throws TypeError if 'length' is 0
(subclassed Array, length overridden to false (type conversion)),
no initVal
includes: [runTestCase.js]
---*/
function testcase() {
foo.prototype = new Array(1, 2, 3);
function foo() {}
var f = new foo();
f.length = false;
function cb(){}
try {
assert.throws(TypeError, function() {
f.reduce(cb);
}
catch (e) {
if (e instanceof TypeError) {
return true;
}
}
}
runTestCase(testcase);
});

Some files were not shown because too many files have changed in this diff Show More