mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 15:04:43 +02:00
Replace runTestCase with assert.throws [test/built-ins/Array]
This commit is contained in:
parent
f3e919209c
commit
edc902aff5
@ -6,14 +6,9 @@ es5id: 15.4.5.1-3.d-1
|
|||||||
description: >
|
description: >
|
||||||
Throw RangeError if attempt to set array length property to
|
Throw RangeError if attempt to set array length property to
|
||||||
4294967296 (2**32)
|
4294967296 (2**32)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(RangeError, function() {
|
||||||
[].length = 4294967296 ;
|
[].length = 4294967296 ;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,14 +6,9 @@ es5id: 15.4.5.1-3.d-2
|
|||||||
description: >
|
description: >
|
||||||
Throw RangeError if attempt to set array length property to
|
Throw RangeError if attempt to set array length property to
|
||||||
4294967297 (1+2**32)
|
4294967297 (1+2**32)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(RangeError, function() {
|
||||||
[].length = 4294967297 ;
|
[].length = 4294967297 ;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-1-1
|
es5id: 15.4.4.16-1-1
|
||||||
description: Array.prototype.every applied to undefined throws a TypeError
|
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
|
Array.prototype.every.call(undefined); // TypeError is thrown if value is undefined
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-1-2
|
es5id: 15.4.4.16-1-2
|
||||||
description: Array.prototype.every applied to null throws a TypeError
|
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
|
Array.prototype.every.call(null); // TypeError is thrown if value is null
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.every throws TypeError exception when 'length' is
|
Array.prototype.every throws TypeError exception when 'length' is
|
||||||
an object with toString and valueOf methods that don<EFBFBD>t return
|
an object with toString and valueOf methods that don<EFBFBD>t return
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var callbackfnAccessed = false;
|
var callbackfnAccessed = false;
|
||||||
var toStringAccessed = false;
|
var toStringAccessed = false;
|
||||||
var valueOfAccessed = false;
|
var valueOfAccessed = false;
|
||||||
@ -36,12 +33,9 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.every.call(obj, callbackfn);
|
Array.prototype.every.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||||
return (ex instanceof TypeError) && toStringAccessed && valueOfAccessed && !callbackfnAccessed;
|
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||||
}
|
assert.sameValue(callbackfnAccessed, false, 'callbackfnAccessed');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-4-1
|
es5id: 15.4.4.16-4-1
|
||||||
description: Array.prototype.every throws TypeError if callbackfn is undefined
|
description: Array.prototype.every throws TypeError if callbackfn is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every();
|
arr.every();
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.16-4-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every - calling with no callbackfn is the same as
|
Array.prototype.every - calling with no callbackfn is the same as
|
||||||
passing undefined for callbackfn
|
passing undefined for callbackfn
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = { 10: 10 };
|
var obj = { 10: 10 };
|
||||||
var lengthAccessed = false;
|
var lengthAccessed = false;
|
||||||
var loopAccessed = false;
|
var loopAccessed = false;
|
||||||
@ -29,12 +27,8 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.every.call(obj);
|
Array.prototype.every.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(lengthAccessed, 'lengthAccessed !== true');
|
||||||
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
|
assert.sameValue(loopAccessed, false, 'loopAccessed');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-4-3
|
es5id: 15.4.4.16-4-3
|
||||||
description: Array.prototype.every throws TypeError if callbackfn is null
|
description: Array.prototype.every throws TypeError if callbackfn is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every(null);
|
arr.every(null);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-4-4
|
es5id: 15.4.4.16-4-4
|
||||||
description: Array.prototype.every throws TypeError if callbackfn is boolean
|
description: Array.prototype.every throws TypeError if callbackfn is boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every(true);
|
arr.every(true);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-4-5
|
es5id: 15.4.4.16-4-5
|
||||||
description: Array.prototype.every throws TypeError if callbackfn is number
|
description: Array.prototype.every throws TypeError if callbackfn is number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every(5);
|
arr.every(5);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.16-4-6
|
es5id: 15.4.4.16-4-6
|
||||||
description: Array.prototype.every throws TypeError if callbackfn is string
|
description: Array.prototype.every throws TypeError if callbackfn is string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every("abc");
|
arr.every("abc");
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.16-4-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every throws TypeError if callbackfn is Object
|
Array.prototype.every throws TypeError if callbackfn is Object
|
||||||
without a Call internal method
|
without a Call internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.every( {} );
|
arr.every( {} );
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-4-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every - side effects produced by step 2 are
|
Array.prototype.every - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.every.call(obj, null);
|
Array.prototype.every.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-4-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every - side effects produced by step 3 are
|
Array.prototype.every - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.every.call(obj, null);
|
Array.prototype.every.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every - unnhandled exceptions happened in getter
|
Array.prototype.every - unnhandled exceptions happened in getter
|
||||||
terminate iteration on an Array-like object
|
terminate iteration on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
if (idx > 1) {
|
if (idx > 1) {
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.every.call(obj, callbackfn);
|
Array.prototype.every.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.16-7-c-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.every - unhandled exceptions happened in getter
|
Array.prototype.every - unhandled exceptions happened in getter
|
||||||
terminate iteration on an Array
|
terminate iteration on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
if (idx > 1) {
|
if (idx > 1) {
|
||||||
@ -29,12 +26,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
arr.every(callbackfn);
|
arr.every(callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-1-1
|
es5id: 15.4.4.20-1-1
|
||||||
description: Array.prototype.filter applied to undefined throws a TypeError
|
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
|
Array.prototype.filter.call(undefined); // TypeError is thrown if value is undefined
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-1-2
|
es5id: 15.4.4.20-1-2
|
||||||
description: Array.prototype.filter applied to null throws a TypeError
|
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);
|
Array.prototype.filter.call(null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.filter throws TypeError exception when 'length' is
|
Array.prototype.filter throws TypeError exception when 'length' is
|
||||||
an object with toString and valueOf methods that don<EFBFBD>t return
|
an object with toString and valueOf methods that don<EFBFBD>t return
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var firstStepOccured = false;
|
var firstStepOccured = false;
|
||||||
var secondStepOccured = false;
|
var secondStepOccured = false;
|
||||||
@ -36,12 +33,9 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj, callbackfn);
|
Array.prototype.filter.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof TypeError) && !accessed && firstStepOccured && secondStepOccured;
|
assert(firstStepOccured, 'firstStepOccured !== true');
|
||||||
}
|
assert(secondStepOccured, 'secondStepOccured !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-4-1
|
es5id: 15.4.4.20-4-1
|
||||||
description: Array.prototype.filter throws TypeError if callbackfn is undefined
|
description: Array.prototype.filter throws TypeError if callbackfn is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter();
|
arr.filter();
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.20-4-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - calling with no callbackfn is the same as
|
Array.prototype.filter - calling with no callbackfn is the same as
|
||||||
passing undefined for callbackfn
|
passing undefined for callbackfn
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = { 10: 10 };
|
var obj = { 10: 10 };
|
||||||
var lengthAccessed = false;
|
var lengthAccessed = false;
|
||||||
var loopAccessed = false;
|
var loopAccessed = false;
|
||||||
@ -27,12 +25,8 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj);
|
Array.prototype.filter.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(lengthAccessed, 'lengthAccessed !== true');
|
||||||
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
|
assert.sameValue(loopAccessed, false, 'loopAccessed');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.20-4-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter throws ReferenceError if callbackfn is
|
Array.prototype.filter throws ReferenceError if callbackfn is
|
||||||
unreferenced
|
unreferenced
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(ReferenceError, function() {
|
||||||
arr.filter(foo);
|
arr.filter(foo);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof ReferenceError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-4-3
|
es5id: 15.4.4.20-4-3
|
||||||
description: Array.prototype.filter throws TypeError if callbackfn is null
|
description: Array.prototype.filter throws TypeError if callbackfn is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter(null);
|
arr.filter(null);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-4-4
|
es5id: 15.4.4.20-4-4
|
||||||
description: Array.prototype.filter throws TypeError if callbackfn is boolean
|
description: Array.prototype.filter throws TypeError if callbackfn is boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter(true);
|
arr.filter(true);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-4-5
|
es5id: 15.4.4.20-4-5
|
||||||
description: Array.prototype.filter throws TypeError if callbackfn is number
|
description: Array.prototype.filter throws TypeError if callbackfn is number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter(5);
|
arr.filter(5);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.20-4-6
|
es5id: 15.4.4.20-4-6
|
||||||
description: Array.prototype.filter throws TypeError if callbackfn is string
|
description: Array.prototype.filter throws TypeError if callbackfn is string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter("abc");
|
arr.filter("abc");
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.20-4-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter throws TypeError if callbackfn is Object
|
Array.prototype.filter throws TypeError if callbackfn is Object
|
||||||
without [[Call]] internal method
|
without [[Call]] internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.filter(new Object());
|
arr.filter(new Object());
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-4-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - side effects produced by step 2 are
|
Array.prototype.filter - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj, null);
|
Array.prototype.filter.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-4-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - side effects produced by step 3 are
|
Array.prototype.filter - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj, null);
|
Array.prototype.filter.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - unnhandled exceptions happened in getter
|
Array.prototype.filter - unnhandled exceptions happened in getter
|
||||||
terminate iteration on an Array-like object
|
terminate iteration on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
if (idx > 1) {
|
if (idx > 1) {
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj, callbackfn);
|
Array.prototype.filter.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - unnhandled exceptions happened in getter
|
Array.prototype.filter - unnhandled exceptions happened in getter
|
||||||
terminate iteration on an Array
|
terminate iteration on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
if (idx > 1) {
|
if (idx > 1) {
|
||||||
@ -29,12 +26,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
arr.filter(callbackfn);
|
arr.filter(callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.20-9-c-ii-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.filter - unhandled exceptions happened in
|
Array.prototype.filter - unhandled exceptions happened in
|
||||||
callbackfn terminate iteration
|
callbackfn terminate iteration
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var called = 0;
|
var called = 0;
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
||||||
|
assert.throws(Error, function() {
|
||||||
try {
|
|
||||||
Array.prototype.filter.call(obj, callbackfn);
|
Array.prototype.filter.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(called, 1, 'called');
|
||||||
return 1 === called && ex instanceof Error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-1-1
|
es5id: 15.4.4.18-1-1
|
||||||
description: Array.prototype.forEach applied to undefined
|
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
|
Array.prototype.forEach.call(undefined); // TypeError is thrown if value is undefined
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-1-2
|
es5id: 15.4.4.18-1-2
|
||||||
description: Array.prototype.forEach applied to null
|
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
|
Array.prototype.forEach.call(null); // TypeError is thrown if value is null
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.forEach throws TypeError exception when 'length'
|
Array.prototype.forEach throws TypeError exception when 'length'
|
||||||
is an object with toString and valueOf methods that don<EFBFBD>t return
|
is an object with toString and valueOf methods that don<EFBFBD>t return
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var firstStepOccured = false;
|
var firstStepOccured = false;
|
||||||
var secondStepOccured = false;
|
var secondStepOccured = false;
|
||||||
@ -35,12 +32,7 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj, callbackfn);
|
Array.prototype.forEach.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return ex instanceof TypeError && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-4-1
|
es5id: 15.4.4.18-4-1
|
||||||
description: Array.prototype.forEach throws TypeError if callbackfn is undefined
|
description: Array.prototype.forEach throws TypeError if callbackfn is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach();
|
arr.forEach();
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - calling with no callbackfn is the same
|
Array.prototype.forEach - calling with no callbackfn is the same
|
||||||
as passing undefined for callbackfn
|
as passing undefined for callbackfn
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 10: 10 };
|
var obj = { 10: 10 };
|
||||||
var lengthAccessed = false;
|
var lengthAccessed = false;
|
||||||
var loopAccessed = false;
|
var loopAccessed = false;
|
||||||
@ -30,12 +27,8 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj);
|
Array.prototype.forEach.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(lengthAccessed, 'lengthAccessed !== true');
|
||||||
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
|
assert.sameValue(loopAccessed, false, 'loopAccessed');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.18-4-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach throws ReferenceError if callbackfn is
|
Array.prototype.forEach throws ReferenceError if callbackfn is
|
||||||
unreferenced
|
unreferenced
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(ReferenceError, function() {
|
||||||
arr.forEach(foo);
|
arr.forEach(foo);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof ReferenceError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-4-3
|
es5id: 15.4.4.18-4-3
|
||||||
description: Array.prototype.forEach throws TypeError if callbackfn is null
|
description: Array.prototype.forEach throws TypeError if callbackfn is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach(null);
|
arr.forEach(null);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-4-4
|
es5id: 15.4.4.18-4-4
|
||||||
description: Array.prototype.forEach throws TypeError if callbackfn is boolean
|
description: Array.prototype.forEach throws TypeError if callbackfn is boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach(true);
|
arr.forEach(true);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-4-5
|
es5id: 15.4.4.18-4-5
|
||||||
description: Array.prototype.forEach throws TypeError if callbackfn is number
|
description: Array.prototype.forEach throws TypeError if callbackfn is number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach(5);
|
arr.forEach(5);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.18-4-6
|
es5id: 15.4.4.18-4-6
|
||||||
description: Array.prototype.forEach throws TypeError if callbackfn is string
|
description: Array.prototype.forEach throws TypeError if callbackfn is string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach("abc");
|
arr.forEach("abc");
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.18-4-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach throws TypeError if callbackfn is Object
|
Array.prototype.forEach throws TypeError if callbackfn is Object
|
||||||
without Call internal method
|
without Call internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.forEach(new Object());
|
arr.forEach(new Object());
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - side effects produced by step 2 are
|
Array.prototype.forEach - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj, null);
|
Array.prototype.forEach.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-4-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - side effects produced by step 3 are
|
Array.prototype.forEach - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj, null);
|
Array.prototype.forEach.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - unnhandled exceptions happened in getter
|
Array.prototype.forEach - unnhandled exceptions happened in getter
|
||||||
terminate iteration on an Array-like object
|
terminate iteration on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
|
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
@ -34,12 +31,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj, callbackfn);
|
Array.prototype.forEach.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - unnhandled exceptions happened in getter
|
Array.prototype.forEach - unnhandled exceptions happened in getter
|
||||||
terminate iteration on an Array-like object
|
terminate iteration on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
@ -37,12 +34,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
arr.forEach(callbackfn);
|
arr.forEach(callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.18-7-c-ii-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.forEach - unhandled exceptions happened in
|
Array.prototype.forEach - unhandled exceptions happened in
|
||||||
callbackfn terminate iteration
|
callbackfn terminate iteration
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
@ -23,12 +20,7 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
||||||
|
assert.throws(Error, function() {
|
||||||
try {
|
|
||||||
Array.prototype.forEach.call(obj, callbackfn);
|
Array.prototype.forEach.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return ex instanceof Error && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,16 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.14-1-1
|
es5id: 15.4.4.14-1-1
|
||||||
description: Array.prototype.indexOf applied to undefined throws a TypeError
|
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);
|
Array.prototype.indexOf.call(undefined);
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,16 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.14-1-2
|
es5id: 15.4.4.14-1-2
|
||||||
description: Array.prototype.indexOf applied to null throws a TypeError
|
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);
|
Array.prototype.indexOf.call(null);
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-28
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.indexOf - side effects produced by step 1 are
|
Array.prototype.indexOf - side effects produced by step 1 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
var fromIndex = {
|
var fromIndex = {
|
||||||
valueOf: function () {
|
valueOf: function () {
|
||||||
@ -18,12 +15,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.indexOf.call(undefined, undefined, fromIndex);
|
Array.prototype.indexOf.call(undefined, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof TypeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-29
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.indexOf - side effects produced by step 2 are
|
Array.prototype.indexOf - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
@ -27,12 +24,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.indexOf.call(obj, undefined, fromIndex);
|
Array.prototype.indexOf.call(obj, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof RangeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-5-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.indexOf - side effects produced by step 3 are
|
Array.prototype.indexOf - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
@ -31,12 +28,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.indexOf.call(obj, undefined, fromIndex);
|
Array.prototype.indexOf.call(obj, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof TypeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.indexOf - terminates iteration on unhandled
|
Array.prototype.indexOf - terminates iteration on unhandled
|
||||||
exception on an Array
|
exception on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var arr = [];
|
var arr = [];
|
||||||
|
|
||||||
@ -28,12 +25,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
arr.indexOf(true);
|
arr.indexOf(true);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (e instanceof TypeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.14-9-b-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.indexOf - terminates iteration on unhandled
|
Array.prototype.indexOf - terminates iteration on unhandled
|
||||||
exception on an Array-like object
|
exception on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var obj = { length: 2 };
|
var obj = { length: 2 };
|
||||||
|
|
||||||
@ -28,13 +25,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.indexOf.call(obj, true);
|
Array.prototype.indexOf.call(obj, true);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (e instanceof TypeError) && !accessed;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,18 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.15-1-1
|
es5id: 15.4.4.15-1-1
|
||||||
description: Array.prototype.lastIndexOf applied to undefined throws a TypeError
|
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);
|
Array.prototype.lastIndexOf.call(undefined);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,18 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.15-1-2
|
es5id: 15.4.4.15-1-2
|
||||||
description: Array.prototype.lastIndexOf applied to null throws a TypeError
|
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);
|
Array.prototype.lastIndexOf.call(null);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-28
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.lastIndexOf - side effects produced by step 1 are
|
Array.prototype.lastIndexOf - side effects produced by step 1 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
var fromIndex = {
|
var fromIndex = {
|
||||||
valueOf: function () {
|
valueOf: function () {
|
||||||
@ -18,12 +15,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.lastIndexOf.call(undefined, undefined, fromIndex);
|
Array.prototype.lastIndexOf.call(undefined, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof TypeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-29
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.lastIndexOf - side effects produced by step 2 are
|
Array.prototype.lastIndexOf - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
@ -27,12 +24,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
|
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof RangeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.15-5-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.lastIndexOf - side effects produced by step 3 are
|
Array.prototype.lastIndexOf - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var stepFiveOccurs = false;
|
var stepFiveOccurs = false;
|
||||||
|
|
||||||
var obj = {};
|
var obj = {};
|
||||||
@ -31,12 +28,7 @@ function testcase() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
|
Array.prototype.lastIndexOf.call(obj, undefined, fromIndex);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(stepFiveOccurs, false, 'stepFiveOccurs');
|
||||||
return (e instanceof TypeError) && !stepFiveOccurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.lastIndexOf terminates iteration on unhandled
|
Array.prototype.lastIndexOf terminates iteration on unhandled
|
||||||
exception on an Array
|
exception on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var arr = [];
|
var arr = [];
|
||||||
|
|
||||||
@ -28,13 +25,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
arr.lastIndexOf(true);
|
arr.lastIndexOf(true);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (e instanceof TypeError) && !accessed;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.15-8-b-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.lastIndexOf terminates iteration on unhandled
|
Array.prototype.lastIndexOf terminates iteration on unhandled
|
||||||
exception on an Array-like object
|
exception on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var obj = { length: 3 };
|
var obj = { length: 3 };
|
||||||
|
|
||||||
@ -28,13 +25,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.lastIndexOf.call(obj, true);
|
Array.prototype.lastIndexOf.call(obj, true);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (e instanceof TypeError) && !accessed;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-1-1
|
es5id: 15.4.4.19-1-1
|
||||||
description: Array.prototype.map - applied to undefined
|
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
|
Array.prototype.map.call(undefined); // TypeError is thrown if value is undefined
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-1-2
|
es5id: 15.4.4.19-1-2
|
||||||
description: Array.prototype.map - applied to null
|
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
|
Array.prototype.map.call(null); // TypeError is thrown if value is null
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,22 +4,13 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-3-14
|
es5id: 15.4.4.19-3-14
|
||||||
description: Array.prototype.map - 'length' is a string containing Infinity
|
description: Array.prototype.map - 'length' is a string containing Infinity
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
return val < 10;
|
return val < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 9, length: "Infinity" };
|
var obj = { 0: 9, length: "Infinity" };
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, callbackfn);
|
Array.prototype.map.call(obj, callbackfn);
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.map throws TypeError exception when 'length' is an
|
Array.prototype.map throws TypeError exception when 'length' is an
|
||||||
object with toString and valueOf methods that don<EFBFBD>t return
|
object with toString and valueOf methods that don<EFBFBD>t return
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
return val > 10;
|
return val > 10;
|
||||||
}
|
}
|
||||||
@ -29,12 +26,6 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, callbackfn);
|
Array.prototype.map.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,11 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-3-28
|
es5id: 15.4.4.19-3-28
|
||||||
description: Array.prototype.map - value of 'length' is boundary value (2^32)
|
description: Array.prototype.map - value of 'length' is boundary value (2^32)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
return val > 10;
|
return val > 10;
|
||||||
}
|
}
|
||||||
@ -17,13 +14,6 @@ function testcase() {
|
|||||||
0: 12,
|
0: 12,
|
||||||
length: 4294967296
|
length: 4294967296
|
||||||
};
|
};
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
var newArr = Array.prototype.map.call(obj, callbackfn);
|
var newArr = Array.prototype.map.call(obj, callbackfn);
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-3-29
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - value of 'length' is boundary value (2^32 +
|
Array.prototype.map - value of 'length' is boundary value (2^32 +
|
||||||
1)
|
1)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
return val > 10;
|
return val > 10;
|
||||||
}
|
}
|
||||||
@ -20,13 +17,6 @@ function testcase() {
|
|||||||
1: 9,
|
1: 9,
|
||||||
length: 4294967297
|
length: 4294967297
|
||||||
};
|
};
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
var newArr = Array.prototype.map.call(obj, callbackfn);
|
var newArr = Array.prototype.map.call(obj, callbackfn);
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,22 +6,13 @@ es5id: 15.4.4.19-3-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - value of 'length' is a number (value is
|
Array.prototype.map - value of 'length' is a number (value is
|
||||||
Infinity)
|
Infinity)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
return val < 10;
|
return val < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 9, length: Infinity };
|
var obj = { 0: 9, length: Infinity };
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, callbackfn);
|
Array.prototype.map.call(obj, callbackfn);
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof RangeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-4-1
|
es5id: 15.4.4.19-4-1
|
||||||
description: Array.prototype.map throws TypeError if callbackfn is undefined
|
description: Array.prototype.map throws TypeError if callbackfn is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map();
|
arr.map();
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - calling with no callbackfn is the same as
|
Array.prototype.map - calling with no callbackfn is the same as
|
||||||
passing undefined for callbackfn
|
passing undefined for callbackfn
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 10: 10 };
|
var obj = { 10: 10 };
|
||||||
var lengthAccessed = false;
|
var lengthAccessed = false;
|
||||||
var loopAccessed = false;
|
var loopAccessed = false;
|
||||||
@ -29,12 +26,8 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj);
|
Array.prototype.map.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert(lengthAccessed, 'lengthAccessed !== true');
|
||||||
return e instanceof TypeError && lengthAccessed && !loopAccessed;
|
assert.sameValue(loopAccessed, false, 'loopAccessed');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.19-4-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map throws ReferenceError if callbackfn is
|
Array.prototype.map throws ReferenceError if callbackfn is
|
||||||
unreferenced
|
unreferenced
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(ReferenceError, function() {
|
||||||
arr.map(foo);
|
arr.map(foo);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof ReferenceError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-4-3
|
es5id: 15.4.4.19-4-3
|
||||||
description: Array.prototype.map throws TypeError if callbackfn is null
|
description: Array.prototype.map throws TypeError if callbackfn is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map(null);
|
arr.map(null);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-4-4
|
es5id: 15.4.4.19-4-4
|
||||||
description: Array.prototype.map throws TypeError if callbackfn is boolean
|
description: Array.prototype.map throws TypeError if callbackfn is boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map(true);
|
arr.map(true);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-4-5
|
es5id: 15.4.4.19-4-5
|
||||||
description: Array.prototype.map throws TypeError if callbackfn is number
|
description: Array.prototype.map throws TypeError if callbackfn is number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map(5);
|
arr.map(5);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.19-4-6
|
es5id: 15.4.4.19-4-6
|
||||||
description: Array.prototype.map throws TypeError if callbackfn is string
|
description: Array.prototype.map throws TypeError if callbackfn is string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map("abc");
|
arr.map("abc");
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.19-4-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map throws TypeError if callbackfn is Object
|
Array.prototype.map throws TypeError if callbackfn is Object
|
||||||
without Call internal method
|
without Call internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.map(new Object());
|
arr.map(new Object());
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - Side effects produced by step 2 are visible
|
Array.prototype.map - Side effects produced by step 2 are visible
|
||||||
when an exception occurs
|
when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, null);
|
Array.prototype.map.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-4-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - Side effects produced by step 3 are visible
|
Array.prototype.map - Side effects produced by step 3 are visible
|
||||||
when an exception occurs
|
when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, null);
|
Array.prototype.map.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-i-30
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - unhandled exceptions happened in getter
|
Array.prototype.map - unhandled exceptions happened in getter
|
||||||
terminate iteration on an Array-like object
|
terminate iteration on an Array-like object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
|
var obj = { 0: 11, 5: 10, 10: 8, length: 20 };
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
@ -34,12 +31,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, callbackfn);
|
Array.prototype.map.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-i-31
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - unhandled exceptions happened in getter
|
Array.prototype.map - unhandled exceptions happened in getter
|
||||||
terminate iteration on an Array
|
terminate iteration on an Array
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
@ -37,12 +34,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
arr.map(callbackfn);
|
arr.map(callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof RangeError) && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.19-8-c-ii-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.map - unhandled exceptions happened in callbackfn
|
Array.prototype.map - unhandled exceptions happened in callbackfn
|
||||||
terminate iteration
|
terminate iteration
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
|
|
||||||
function callbackfn(val, idx, obj) {
|
function callbackfn(val, idx, obj) {
|
||||||
@ -23,12 +20,7 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
var obj = { 0: 11, 4: 10, 10: 8, length: 20 };
|
||||||
|
assert.throws(Error, function() {
|
||||||
try {
|
|
||||||
Array.prototype.map.call(obj, callbackfn);
|
Array.prototype.map.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return ex instanceof Error && !accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-1
|
es5id: 15.4.4.21-1-1
|
||||||
description: Array.prototype.reduce applied to undefined
|
description: Array.prototype.reduce applied to undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Array.prototype.reduce.call(undefined);
|
Array.prototype.reduce.call(undefined);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-1-2
|
es5id: 15.4.4.21-1-2
|
||||||
description: Array.prototype.reduce applied to null
|
description: Array.prototype.reduce applied to null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Array.prototype.reduce.call(null);
|
Array.prototype.reduce.call(null);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,11 +7,8 @@ description: >
|
|||||||
Array.prototype.reduce throws TypeError exception - 'length' is an
|
Array.prototype.reduce throws TypeError exception - 'length' is an
|
||||||
object with toString and valueOf methods that don<EFBFBD>t return
|
object with toString and valueOf methods that don<EFBFBD>t return
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
var valueOfAccessed = false;
|
var valueOfAccessed = false;
|
||||||
var toStringAccessed = false;
|
var toStringAccessed = false;
|
||||||
@ -36,12 +33,9 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn, 1);
|
Array.prototype.reduce.call(obj, callbackfn, 1);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert.sameValue(accessed, false, 'accessed');
|
||||||
return (ex instanceof TypeError) && !accessed && toStringAccessed && valueOfAccessed;
|
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||||
}
|
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-1
|
es5id: 15.4.4.21-4-1
|
||||||
description: Array.prototype.reduce throws TypeError if callbackfn is undefined
|
description: Array.prototype.reduce throws TypeError if callbackfn is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce();
|
arr.reduce();
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,10 +6,8 @@ es5id: 15.4.4.21-4-15
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - calling with no callbackfn is the same as
|
Array.prototype.reduce - calling with no callbackfn is the same as
|
||||||
passing undefined for callbackfn
|
passing undefined for callbackfn
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var obj = { 10: 10 };
|
var obj = { 10: 10 };
|
||||||
var lengthAccessed = false;
|
var lengthAccessed = false;
|
||||||
var loopAccessed = false;
|
var loopAccessed = false;
|
||||||
@ -29,12 +27,8 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj);
|
Array.prototype.reduce.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(lengthAccessed, 'lengthAccessed !== true');
|
||||||
return (ex instanceof TypeError) && lengthAccessed && !loopAccessed;
|
assert.sameValue(loopAccessed, false, 'loopAccessed');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.21-4-2
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce throws ReferenceError if callbackfn is
|
Array.prototype.reduce throws ReferenceError if callbackfn is
|
||||||
unreferenced
|
unreferenced
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(ReferenceError, function() {
|
||||||
arr.reduce(foo);
|
arr.reduce(foo);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof ReferenceError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-3
|
es5id: 15.4.4.21-4-3
|
||||||
description: Array.prototype.reduce throws TypeError if callbackfn is null
|
description: Array.prototype.reduce throws TypeError if callbackfn is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce(null);
|
arr.reduce(null);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-4
|
es5id: 15.4.4.21-4-4
|
||||||
description: Array.prototype.reduce throws TypeError if callbackfn is boolean
|
description: Array.prototype.reduce throws TypeError if callbackfn is boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce(true);
|
arr.reduce(true);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-5
|
es5id: 15.4.4.21-4-5
|
||||||
description: Array.prototype.reduce throws TypeError if callbackfn is number
|
description: Array.prototype.reduce throws TypeError if callbackfn is number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce(5);
|
arr.reduce(5);
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,19 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.4.4.21-4-6
|
es5id: 15.4.4.21-4-6
|
||||||
description: Array.prototype.reduce throws TypeError if callbackfn is string
|
description: Array.prototype.reduce throws TypeError if callbackfn is string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce("abc");
|
arr.reduce("abc");
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.21-4-7
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce throws TypeError if callbackfn is Object
|
Array.prototype.reduce throws TypeError if callbackfn is Object
|
||||||
without [[Call]] internal method
|
without [[Call]] internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var arr = new Array(10);
|
var arr = new Array(10);
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
arr.reduce(new Object());
|
arr.reduce(new Object());
|
||||||
}
|
});
|
||||||
catch(e) {
|
|
||||||
if(e instanceof TypeError)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-4-8
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - side effects produced by step 2 are
|
Array.prototype.reduce - side effects produced by step 2 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -22,12 +19,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj, null);
|
Array.prototype.reduce.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-4-9
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - side effects produced by step 3 are
|
Array.prototype.reduce - side effects produced by step 3 are
|
||||||
visible when an exception occurs
|
visible when an exception occurs
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
var obj = { 0: 11, 1: 12 };
|
var obj = { 0: 11, 1: 12 };
|
||||||
|
|
||||||
var accessed = false;
|
var accessed = false;
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj, null);
|
Array.prototype.reduce.call(obj, null);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return ex instanceof TypeError && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,19 +6,9 @@ es5id: 15.4.4.21-5-1
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce throws TypeError if 'length' is 0 (empty
|
Array.prototype.reduce throws TypeError if 'length' is 0 (empty
|
||||||
array), no initVal
|
array), no initVal
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
function cb(){}
|
function cb(){}
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
[].reduce(cb);
|
[].reduce(cb);
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-10
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - if exception occurs, it occurs after any
|
Array.prototype.reduce - if exception occurs, it occurs after any
|
||||||
side-effects that might be produced by step 2
|
side-effects that might be produced by step 2
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal > 10);
|
return (curVal > 10);
|
||||||
}
|
}
|
||||||
@ -26,12 +23,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return (ex instanceof TypeError) && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,11 +6,8 @@ es5id: 15.4.4.21-5-11
|
|||||||
description: >
|
description: >
|
||||||
Array.prototype.reduce - if the exception occurs, it occurs after
|
Array.prototype.reduce - if the exception occurs, it occurs after
|
||||||
any side-effects that might be produced by step 3
|
any side-effects that might be produced by step 3
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function callbackfn(prevVal, curVal, idx, obj) {
|
function callbackfn(prevVal, curVal, idx, obj) {
|
||||||
return (curVal > 10);
|
return (curVal > 10);
|
||||||
}
|
}
|
||||||
@ -30,12 +27,7 @@ function testcase() {
|
|||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Array.prototype.reduce.call(obj, callbackfn);
|
Array.prototype.reduce.call(obj, callbackfn);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
assert(accessed, 'accessed !== true');
|
||||||
return (ex instanceof TypeError) && accessed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,23 +7,14 @@ description: >
|
|||||||
Array.prototype.reduce throws TypeError if 'length' is 0
|
Array.prototype.reduce throws TypeError if 'length' is 0
|
||||||
(subclassed Array, length overridden to null (type conversion)),
|
(subclassed Array, length overridden to null (type conversion)),
|
||||||
no initVal
|
no initVal
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = new Array(1, 2, 3);
|
foo.prototype = new Array(1, 2, 3);
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
f.length = null;
|
f.length = null;
|
||||||
|
|
||||||
function cb(){}
|
function cb(){}
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
f.reduce(cb);
|
f.reduce(cb);
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,23 +7,14 @@ description: >
|
|||||||
Array.prototype.reduce throws TypeError if 'length' is 0
|
Array.prototype.reduce throws TypeError if 'length' is 0
|
||||||
(subclassed Array, length overridden to false (type conversion)),
|
(subclassed Array, length overridden to false (type conversion)),
|
||||||
no initVal
|
no initVal
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = new Array(1, 2, 3);
|
foo.prototype = new Array(1, 2, 3);
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
f.length = false;
|
f.length = false;
|
||||||
|
|
||||||
function cb(){}
|
function cb(){}
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
f.reduce(cb);
|
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
Loading…
x
Reference in New Issue
Block a user