Merge pull request #321 from bocoup/swallowed-assertions

Fix tautological pattern in tests
This commit is contained in:
Brian Terlson 2015-06-16 13:19:32 -04:00
commit 15ad3c9cad
15 changed files with 47 additions and 120 deletions

View File

@ -7,15 +7,8 @@ info: >
[[Construct]] property
es5id: 15.3.4_A5
description: Checking if creating "new Function.prototype object" fails
includes:
- $PRINT.js
---*/
//CHECK#
try {
var obj = new Function.prototype;
$ERROR('#1: The Function prototype object is itself a Function object without [[Construct]] property: '+e);
} catch (e) {
$PRINT("#1.1: The Function prototype object is itself a Function object without [[Construct]] property "+e);
}
assert.throws(TypeError, function() {
new Function.prototype;
});

View File

@ -5,15 +5,10 @@
info: Function.prototype.toString can't be used as constructor
es5id: 15.3.4.2_A7
description: Checking if creating "new Function.prototype.toString" fails
includes:
- $PRINT.js
---*/
var FACTORY = Function.prototype.toString;
try {
var instance = new FACTORY;
$ERROR('#1: Function.prototype.toString can\'t be used as constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -7,14 +7,8 @@ info: >
method
es5id: 15.2.4_A3
description: Checking if calling Object prototype as a function fails
includes:
- $PRINT.js
---*/
//CHECK#1
try {
assert.throws(TypeError, function() {
Object.prototype();
$ERROR('#1: Since Object prototype object is not function it has not [[call]] method');
} catch (e) {
$PRINT(e);
}
});

View File

@ -7,14 +7,8 @@ info: >
[[create]] method
es5id: 15.2.4_A4
description: Checking if creating "new Object.prototype" fails
includes:
- $PRINT.js
---*/
//CHECK#1
try {
var instance = new Object.prototype;
$ERROR('#1: Since Object prototype object is not function it has not [[create]] method');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new Object.prototype;
});

View File

@ -11,10 +11,6 @@ includes:
var FACTORY = Object.prototype.hasOwnProperty;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.hasOwnProperty can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -5,16 +5,10 @@
info: Object.prototype.isPrototypeOf can't be used as a constructor
es5id: 15.2.4.6_A7
description: Checking if creating new "Object.prototype.isPrototypeOf" fails
includes:
- $PRINT.js
---*/
var FACTORY = Object.prototype.isPrototypeOf;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.isPrototypeOf can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -7,16 +7,10 @@ es5id: 15.2.4.7_A7
description: >
Checking if creating "new Object.prototype.propertyIsEnumerable"
fails
includes:
- $PRINT.js
---*/
var FACTORY = Object.prototype.propertyIsEnumerable;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.propertyIsEnumerable can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -5,16 +5,10 @@
info: Object.prototype.toLocaleString can't be used as a constructor
es5id: 15.2.4.3_A7
description: Checking if creating "new Object.prototype.toLocaleString" fails
includes:
- $PRINT.js
---*/
var FACTORY = Object.prototype.toLocaleString;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.toLocaleString can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -5,15 +5,10 @@
info: Object.prototype.toString can't be used as a constructor
es5id: 15.2.4.2_A7
description: Checking if creating "new Object.prototype.toString" fails
includes:
- $PRINT.js
---*/
var FACTORY = Object.prototype.toString;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.toString can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -11,10 +11,6 @@ includes:
var FACTORY = Object.prototype.valueOf;
try {
var instance = new FACTORY;
$ERROR('#1: Object.prototype.valueOf can\'t be used as a constructor');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -5,15 +5,10 @@
info: String.prototype.lastIndexOf can't be used as constructor
es5id: 15.5.4.8_A7
description: Checking if creating the String.prototype.lastIndexOf object fails
includes:
- $PRINT.js
---*/
var __FACTORY = String.prototype.lastIndexOf;
var FACTORY = String.prototype.lastIndexOf;
try {
var __instance = new __FACTORY;
$ERROR('#1: __FACTORY = String.prototype.lastIndexOf; __instance = new __FACTORY lead to throwing exception');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -5,15 +5,10 @@
info: String.prototype.slice can't be used as constructor
es5id: 15.5.4.13_A7
description: Checking if creating the String.prototype.slice object fails
includes:
- $PRINT.js
---*/
var __FACTORY = String.prototype.slice;
var FACTORY = String.prototype.slice;
try {
var __instance = new __FACTORY;
$ERROR('#1: __FACTORY = String.prototype.slice; "__instance = new __FACTORY" lead to throwing exception');
} catch (e) {
$PRINT(e);
}
assert.throws(TypeError, function() {
new FACTORY;
});

View File

@ -13,12 +13,12 @@ includes: [$PRINT.js]
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try {
x();
$ERROR('#1: "x()" lead to throwing exception');
} catch (e) {
$PRINT(e.message);
}
assert.throws(ReferenceError, function() {
{
x();
}
});
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -8,7 +8,6 @@ info: >
VariableStatement is executed, not when the variable is created
es5id: 12.2_A1
description: Creating variables after entering the execution scope
includes: [$PRINT.js]
---*/
//////////////////////////////////////////////////////////////////////////////
@ -25,12 +24,9 @@ try {
//////////////////////////////////////////////////////////////////////////////
//CHECK#2
try{
assert.throws(ReferenceError, function() {
__something__undefined = __something__undefined;
$ERROR('#2: "__something__undefined = __something__undefined" lead to throwing exception');
} catch(e){
$PRINT(e.message);
}
});
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -7,18 +7,14 @@ info: >
reaches the eval statement
es5id: 12.2_A5
description: Executing eval("var x")
includes: [$PRINT.js]
flags: [noStrict]
---*/
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try{
assert.throws(ReferenceError, function() {
x=x;
$ERROR('#1: "x=x" lead to throwing exception');
}catch(e){
$PRINT(e.message);
};
});
//
//////////////////////////////////////////////////////////////////////////////