mirror of
https://github.com/tc39/test262.git
synced 2025-05-29 19:20:30 +02:00
Replace runTestCase with assert.throws [test/built-ins]
This commit is contained in:
parent
edc902aff5
commit
589b638ab5
@ -6,17 +6,9 @@ es5id: 15.9.5.40_1
|
|||||||
description: >
|
description: >
|
||||||
Date.prototype.setFullYear - Date.prototype is itself not an
|
Date.prototype.setFullYear - Date.prototype is itself not an
|
||||||
instance of Date
|
instance of Date
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Date.prototype.setFullYear(2012);
|
Date.prototype.setFullYear(2012);
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,9 @@ es5id: 15.9.5.43-0-14
|
|||||||
description: >
|
description: >
|
||||||
Date.prototype.toISOString - when value of year is -Infinity
|
Date.prototype.toISOString - when value of year is -Infinity
|
||||||
Date.prototype.toISOString throw the RangeError
|
Date.prototype.toISOString throw the RangeError
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var date = new Date(-Infinity, 1, 70, 0, 0, 0);
|
var date = new Date(-Infinity, 1, 70, 0, 0, 0);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
date.toISOString();
|
date.toISOString();
|
||||||
} catch (ex) {
|
});
|
||||||
return ex instanceof RangeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,9 @@ es5id: 15.9.5.43-0-15
|
|||||||
description: >
|
description: >
|
||||||
Date.prototype.toISOString - value of year is Infinity
|
Date.prototype.toISOString - value of year is Infinity
|
||||||
Date.prototype.toISOString throw the RangeError
|
Date.prototype.toISOString throw the RangeError
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var date = new Date(Infinity, 1, 70, 0, 0, 0);
|
var date = new Date(Infinity, 1, 70, 0, 0, 0);
|
||||||
|
assert.throws(RangeError, function() {
|
||||||
try {
|
|
||||||
date.toISOString();
|
date.toISOString();
|
||||||
} catch (ex) {
|
});
|
||||||
return ex instanceof RangeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,17 +7,9 @@ description: >
|
|||||||
Date.prototype.toISOString - when this is a String object that
|
Date.prototype.toISOString - when this is a String object that
|
||||||
value format is 'YYYY-MM-DDTHH:mm:ss.sssZ'
|
value format is 'YYYY-MM-DDTHH:mm:ss.sssZ'
|
||||||
Date.prototype.toISOString throw the TypeError
|
Date.prototype.toISOString throw the TypeError
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var date = new String("1970-01-00000:00:00.000Z");
|
var date = new String("1970-01-00000:00:00.000Z");
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
Date.prototype.toISOString.call(date);
|
Date.prototype.toISOString.call(date);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,9 @@ es5id: 15.9.5.43-0-6
|
|||||||
description: >
|
description: >
|
||||||
Date.prototype.toISOString - TypeError is thrown when this is any
|
Date.prototype.toISOString - TypeError is thrown when this is any
|
||||||
other objects instead of Date object
|
other objects instead of Date object
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Date.prototype.toISOString.call([]);
|
Date.prototype.toISOString.call([]);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,16 +6,9 @@ es5id: 15.9.5.43-0-7
|
|||||||
description: >
|
description: >
|
||||||
Date.prototype.toISOString - TypeError is thrown when this is any
|
Date.prototype.toISOString - TypeError is thrown when this is any
|
||||||
primitive values
|
primitive values
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Date.prototype.toISOString.call(15);
|
Date.prototype.toISOString.call(15);
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return ex instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,13 +7,11 @@ description: >
|
|||||||
Date.prototype.toISOString - RangeError is thrown when value of
|
Date.prototype.toISOString - RangeError is thrown when value of
|
||||||
date is Date(1970, 0, -99999999, 0, 0, 0, -1), the time zone is
|
date is Date(1970, 0, -99999999, 0, 0, 0, -1), the time zone is
|
||||||
UTC(0)
|
UTC(0)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var timeZoneMinutes = new Date().getTimezoneOffset() * (-1);
|
var timeZoneMinutes = new Date().getTimezoneOffset() * (-1);
|
||||||
var date, dateStr;
|
var date, dateStr;
|
||||||
try {
|
assert.throws(RangeError, function() {
|
||||||
if (timeZoneMinutes > 0) {
|
if (timeZoneMinutes > 0) {
|
||||||
date = new Date(1970, 0, -99999999, 0, 0, 0, -1);
|
date = new Date(1970, 0, -99999999, 0, 0, 0, -1);
|
||||||
} else {
|
} else {
|
||||||
@ -21,10 +19,4 @@ function testcase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dateStr = date.toISOString();
|
dateStr = date.toISOString();
|
||||||
|
});
|
||||||
return false;
|
|
||||||
} catch (e) {
|
|
||||||
return e instanceof RangeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,17 +7,9 @@ description: >
|
|||||||
Duplicate seperate parameter name in Function constructor throws
|
Duplicate seperate parameter name in Function constructor throws
|
||||||
SyntaxError in strict mode
|
SyntaxError in strict mode
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(SyntaxError, function() {
|
||||||
Function('a','a','"use strict";');
|
Function('a','a','"use strict";');
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return (e instanceof SyntaxError);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,18 +7,9 @@ description: >
|
|||||||
Function constructor having a formal parameter named 'eval' throws
|
Function constructor having a formal parameter named 'eval' throws
|
||||||
SyntaxError if function body is strict mode
|
SyntaxError if function body is strict mode
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
assert.throws(SyntaxError, function() {
|
||||||
Function('eval', '"use strict";');
|
Function('eval', '"use strict";');
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return (e instanceof SyntaxError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,18 +7,9 @@ description: >
|
|||||||
Duplicate combined parameter name in Function constructor throws
|
Duplicate combined parameter name in Function constructor throws
|
||||||
SyntaxError in strict mode
|
SyntaxError in strict mode
|
||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase()
|
|
||||||
{
|
assert.throws(SyntaxError, function() {
|
||||||
try
|
|
||||||
{
|
|
||||||
Function('a,a','"use strict";');
|
Function('a,a','"use strict";');
|
||||||
return false;
|
});
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
return(e instanceof SyntaxError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -9,22 +9,12 @@ es5id: 15.3.4.5-2-1
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind throws TypeError if the Target is not
|
Function.prototype.bind throws TypeError if the Target is not
|
||||||
callable (but an instance of Function)
|
callable (but an instance of Function)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
foo.prototype = Function.prototype;
|
foo.prototype = Function.prototype;
|
||||||
// dummy function
|
// dummy function
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
f.bind();
|
f.bind();
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-2-10
|
es5id: 15.3.4.5-2-10
|
||||||
description: Function.prototype.bind throws TypeError if 'Target' is undefined
|
description: Function.prototype.bind throws TypeError if 'Target' is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call(undefined);
|
Function.prototype.bind.call(undefined);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-2-11
|
es5id: 15.3.4.5-2-11
|
||||||
description: Function.prototype.bind throws TypeError if 'Target' is NULL
|
description: Function.prototype.bind throws TypeError if 'Target' is NULL
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call(null);
|
Function.prototype.bind.call(null);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-2-12
|
es5id: 15.3.4.5-2-12
|
||||||
description: Function.prototype.bind throws TypeError if 'Target' is a boolean
|
description: Function.prototype.bind throws TypeError if 'Target' is a boolean
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call(true);
|
Function.prototype.bind.call(true);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-2-13
|
es5id: 15.3.4.5-2-13
|
||||||
description: Function.prototype.bind throws TypeError if 'Target' is a number
|
description: Function.prototype.bind throws TypeError if 'Target' is a number
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call(5);
|
Function.prototype.bind.call(5);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,15 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.3.4.5-2-14
|
es5id: 15.3.4.5-2-14
|
||||||
description: Function.prototype.bind throws TypeError if 'Target' is a string
|
description: Function.prototype.bind throws TypeError if 'Target' is a string
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call("abc");
|
Function.prototype.bind.call("abc");
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,15 +6,9 @@ es5id: 15.3.4.5-2-15
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind throws TypeError if 'Target' is Object
|
Function.prototype.bind throws TypeError if 'Target' is Object
|
||||||
without Call internal method
|
without Call internal method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
Function.prototype.bind.call({});
|
Function.prototype.bind.call({});
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return (e instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -9,22 +9,12 @@ es5id: 15.3.4.5-2-2
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind throws TypeError if the Target is not
|
Function.prototype.bind throws TypeError if the Target is not
|
||||||
callable (bind attached to object)
|
callable (bind attached to object)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
// dummy function
|
// dummy function
|
||||||
function foo() {}
|
function foo() {}
|
||||||
var f = new foo();
|
var f = new foo();
|
||||||
f.bind = Function.prototype.bind;
|
f.bind = Function.prototype.bind;
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
f.bind();
|
f.bind();
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -9,17 +9,9 @@ es5id: 15.3.4.5-2-7
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind throws TypeError if the Target is not
|
Function.prototype.bind throws TypeError if the Target is not
|
||||||
callable (JSON)
|
callable (JSON)
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
JSON.bind();
|
JSON.bind();
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,18 +6,10 @@ es5id: 15.3.4.5-20-3
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - [[Set]] attribute of 'caller' property
|
Function.prototype.bind - [[Set]] attribute of 'caller' property
|
||||||
in 'F' is thrower
|
in 'F' is thrower
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function foo() { }
|
function foo() { }
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
obj.caller = 12;
|
obj.caller = 12;
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return (ex instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -6,18 +6,10 @@ es5id: 15.3.4.5-21-3
|
|||||||
description: >
|
description: >
|
||||||
Function.prototype.bind - [[Set]] attribute of 'arguments'
|
Function.prototype.bind - [[Set]] attribute of 'arguments'
|
||||||
property in 'F' is thrower
|
property in 'F' is thrower
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
|
|
||||||
function foo() { }
|
function foo() { }
|
||||||
var obj = foo.bind({});
|
var obj = foo.bind({});
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
obj.arguments = 12;
|
obj.arguments = 12;
|
||||||
return false;
|
});
|
||||||
} catch (ex) {
|
|
||||||
return (ex instanceof TypeError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -8,19 +8,9 @@ info: >
|
|||||||
step 4 in 11.2.2 should throw a TypeError exception.
|
step 4 in 11.2.2 should throw a TypeError exception.
|
||||||
es5id: 15.12-0-2
|
es5id: 15.12-0-2
|
||||||
description: JSON must not support the [[Construct]] method
|
description: JSON must not support the [[Construct]] method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = JSON;
|
var o = JSON;
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
var j = new JSON();
|
var j = new JSON();
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -8,19 +8,9 @@ info: >
|
|||||||
step 5 in 11.2.3 should throw a TypeError exception.
|
step 5 in 11.2.3 should throw a TypeError exception.
|
||||||
es5id: 15.12-0-3
|
es5id: 15.12-0-3
|
||||||
description: JSON must not support the [[Call]] method
|
description: JSON must not support the [[Call]] method
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var o = JSON;
|
var o = JSON;
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
try {
|
|
||||||
var j = JSON();
|
var j = JSON();
|
||||||
}
|
});
|
||||||
catch (e) {
|
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.10.7.2-1
|
es5id: 15.10.7.2-1
|
||||||
description: RegExp.prototype.global is a non-generic accessor property
|
description: RegExp.prototype.global is a non-generic accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
RegExp.prototype.global;
|
RegExp.prototype.global;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.10.7.3-1
|
es5id: 15.10.7.3-1
|
||||||
description: RegExp.prototype.ignoreCase is a non-generic accessor property
|
description: RegExp.prototype.ignoreCase is a non-generic accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
RegExp.prototype.ignoreCase;
|
RegExp.prototype.ignoreCase;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.10.7.4-1
|
es5id: 15.10.7.4-1
|
||||||
description: RegExp.prototype.multiline is a non-generic accessor property
|
description: RegExp.prototype.multiline is a non-generic accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
RegExp.prototype.multiline;
|
RegExp.prototype.multiline;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,17 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.10.7.1-1
|
es5id: 15.10.7.1-1
|
||||||
description: RegExp.prototype.source is a non-generic accessor property
|
description: RegExp.prototype.source is a non-generic accessor property
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
RegExp.prototype.source;
|
RegExp.prototype.source;
|
||||||
} catch (e) {
|
});
|
||||||
if (e instanceof TypeError) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,18 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.5.4.20-1-1
|
es5id: 15.5.4.20-1-1
|
||||||
description: String.prototype.trim throws TypeError when string is undefined
|
description: String.prototype.trim throws TypeError when string is undefined
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try
|
assert.throws(TypeError, function() {
|
||||||
{
|
String.prototype.trim.call(undefined);
|
||||||
String.prototype.trim.call(undefined);
|
});
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -4,18 +4,9 @@
|
|||||||
/*---
|
/*---
|
||||||
es5id: 15.5.4.20-1-2
|
es5id: 15.5.4.20-1-2
|
||||||
description: String.prototype.trim throws TypeError when string is null
|
description: String.prototype.trim throws TypeError when string is null
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try
|
assert.throws(TypeError, function() {
|
||||||
{
|
String.prototype.trim.call(null);
|
||||||
String.prototype.trim.call(null);
|
});
|
||||||
return false;
|
|
||||||
}
|
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,10 +7,8 @@ description: >
|
|||||||
String.prototype.trim - TypeError exception was thrown when
|
String.prototype.trim - TypeError exception was thrown when
|
||||||
'this' is an object that both toString and valueOf wouldn't return
|
'this' is an object that both toString and valueOf wouldn't return
|
||||||
primitive value.
|
primitive value.
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
var toStringAccessed = false;
|
var toStringAccessed = false;
|
||||||
var valueOfAccessed = false;
|
var valueOfAccessed = false;
|
||||||
var obj = {
|
var obj = {
|
||||||
@ -23,11 +21,8 @@ function testcase() {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
String.prototype.trim.call(obj);
|
String.prototype.trim.call(obj);
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
assert(valueOfAccessed, 'valueOfAccessed !== true');
|
||||||
return valueOfAccessed && toStringAccessed && (e instanceof TypeError);
|
assert(toStringAccessed, 'toStringAccessed !== true');
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,15 +7,9 @@ description: >
|
|||||||
Strict Mode - TypeError is thrown when changing the value of a
|
Strict Mode - TypeError is thrown when changing the value of a
|
||||||
Value Property of the Global Object under strict mode (NaN)
|
Value Property of the Global Object under strict mode (NaN)
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
NaN = 12;
|
NaN = 12;
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
@ -7,15 +7,9 @@ description: >
|
|||||||
Strict Mode - TypeError is thrown when changing the value of a
|
Strict Mode - TypeError is thrown when changing the value of a
|
||||||
Value Property of the Global Object under strict mode (undefined)
|
Value Property of the Global Object under strict mode (undefined)
|
||||||
flags: [onlyStrict]
|
flags: [onlyStrict]
|
||||||
includes: [runTestCase.js]
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function testcase() {
|
|
||||||
try {
|
assert.throws(TypeError, function() {
|
||||||
undefined = 12;
|
undefined = 12;
|
||||||
return false;
|
});
|
||||||
} catch (e) {
|
|
||||||
return e instanceof TypeError;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
runTestCase(testcase);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user