Replace runTestCase with assert helpers [test/language/expressions/]

This commit is contained in:
André Bargull 2015-08-06 18:32:15 +02:00
parent c7e160084c
commit efabdf8474
22 changed files with 45 additions and 112 deletions

View File

@ -6,13 +6,8 @@ es5id: 11.1.4-0
description: > description: >
elements elided at the end of an array do not contribute to its elements elided at the end of an array do not contribute to its
length length
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var a = [,]; var a = [,];
if (a.length === 1) {
return true; assert.sameValue(a.length, 1, 'a.length');
}
}
runTestCase(testcase);

View File

@ -5,15 +5,13 @@
es5id: 8.14.4-8-b_1 es5id: 8.14.4-8-b_1
description: Non-writable property on a prototype written to. description: Non-writable property on a prototype written to.
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo() {}; function foo() {};
Object.defineProperty(foo.prototype, "bar", {value: "unwritable"}); Object.defineProperty(foo.prototype, "bar", {value: "unwritable"});
var o = new foo(); var o = new foo();
o.bar = "overridden"; o.bar = "overridden";
return o.hasOwnProperty("bar")===false && o.bar==="unwritable";
} assert.sameValue(o.hasOwnProperty("bar"), false, 'o.hasOwnProperty("bar")');
runTestCase(testcase); assert.sameValue(o.bar, "unwritable", 'o.bar');

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-12-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(*=) evaluates to a resolvable reference Assignment operator(*=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_12 = 5 var _11_13_2_12 = 5
_11_13_2_12 *= 2; _11_13_2_12 *= 2;
return _11_13_2_12 === 10;
} assert.sameValue(_11_13_2_12, 10, '_11_13_2_12');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-13-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(/=) evaluates to a resolvable reference Assignment operator(/=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_13 = 6 var _11_13_2_13 = 6
_11_13_2_13 /= 2; _11_13_2_13 /= 2;
return _11_13_2_13 === 3;
} assert.sameValue(_11_13_2_13, 3, '_11_13_2_13');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-14-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(%=) evaluates to a resolvable reference Assignment operator(%=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_14 = 5 var _11_13_2_14 = 5
_11_13_2_14 %= 2; _11_13_2_14 %= 2;
return _11_13_2_14 === 1;
} assert.sameValue(_11_13_2_14, 1, '_11_13_2_14');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-15-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(>>>=) evaluates to a resolvable reference Assignment operator(>>>=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_15 = 8 var _11_13_2_15 = 8
_11_13_2_15 >>>= 2; _11_13_2_15 >>>= 2;
return _11_13_2_15 === 2;
} assert.sameValue(_11_13_2_15, 2, '_11_13_2_15');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-16-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(-=) evaluates to a resolvable reference Assignment operator(-=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_16 = 5 var _11_13_2_16 = 5
_11_13_2_16 -= 2; _11_13_2_16 -= 2;
return _11_13_2_16 === 3;
} assert.sameValue(_11_13_2_16, 3, '_11_13_2_16');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-17-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(<<=) evaluates to a resolvable reference Assignment operator(<<=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_17 = 1; var _11_13_2_17 = 1;
_11_13_2_17 <<= 2; _11_13_2_17 <<= 2;
return _11_13_2_17 === 4;
} assert.sameValue(_11_13_2_17, 4, '_11_13_2_17');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-18-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(>>=) evaluates to a resolvable reference Assignment operator(>>=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_18 = 4 var _11_13_2_18 = 4
_11_13_2_18 >>= 2; _11_13_2_18 >>= 2;
return _11_13_2_18 === 1;
} assert.sameValue(_11_13_2_18, 1, '_11_13_2_18');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-19-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(+=) evaluates to a resolvable reference Assignment operator(+=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_19 = -1 var _11_13_2_19 = -1
_11_13_2_19 += 10; _11_13_2_19 += 10;
return _11_13_2_19 === 9;
} assert.sameValue(_11_13_2_19, 9, '_11_13_2_19');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-20-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(&=) evaluates to a resolvable reference Assignment operator(&=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_20 = 5 var _11_13_2_20 = 5
_11_13_2_20 &= 3; _11_13_2_20 &= 3;
return _11_13_2_20 === 1;
} assert.sameValue(_11_13_2_20, 1, '_11_13_2_20');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-21-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(^=) evaluates to a resolvable reference Assignment operator(^=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_21 = 5 var _11_13_2_21 = 5
_11_13_2_21 ^= 3; _11_13_2_21 ^= 3;
return _11_13_2_21 === 6;
} assert.sameValue(_11_13_2_21, 6, '_11_13_2_21');
runTestCase(testcase);

View File

@ -6,12 +6,9 @@ es5id: 11.13.2-22-s
description: > description: >
ReferenceError isn't thrown if the LeftHandSideExpression of a Compound ReferenceError isn't thrown if the LeftHandSideExpression of a Compound
Assignment operator(|=) evaluates to a resolvable reference Assignment operator(|=) evaluates to a resolvable reference
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var _11_13_2_22 = 5 var _11_13_2_22 = 5
_11_13_2_22 |= 2; _11_13_2_22 |= 2;
return _11_13_2_22 === 7;
} assert.sameValue(_11_13_2_22, 7, '_11_13_2_22');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.2-1
description: > description: >
11.8.2 Greater-than Operator - Partial left to right order 11.8.2 Greater-than Operator - Partial left to right order
enforced when using Greater-than operator: valueOf > valueOf enforced when using Greater-than operator: valueOf > valueOf
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
valueOf: function () { valueOf: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return !(obj1 > obj2);
} assert(!(obj1 > obj2), '!(obj1 > obj2) !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.2-2
description: > description: >
11.8.2 Greater-than Operator - Partial left to right order 11.8.2 Greater-than Operator - Partial left to right order
enforced when using Greater-than operator: valueOf > toString enforced when using Greater-than operator: valueOf > toString
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
valueOf: function () { valueOf: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return !(obj1 > obj2);
} assert(!(obj1 > obj2), '!(obj1 > obj2) !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.2-3
description: > description: >
11.8.2 Greater-than Operator - Partial left to right order 11.8.2 Greater-than Operator - Partial left to right order
enforced when using Greater-than operator: toString > valueOf enforced when using Greater-than operator: toString > valueOf
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
toString: function () { toString: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return !(obj1 > obj2);
} assert(!(obj1 > obj2), '!(obj1 > obj2) !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.2-4
description: > description: >
11.8.2 Greater-than Operator - Partial left to right order 11.8.2 Greater-than Operator - Partial left to right order
enforced when using Greater-than operator: toString > toString enforced when using Greater-than operator: toString > toString
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
toString: function () { toString: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return !(obj1 > obj2);
} assert(!(obj1 > obj2), '!(obj1 > obj2) !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.3-1
description: > description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order 11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: valueOf <= valueOf enforced when using Less-than-or-equal operator: valueOf <= valueOf
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
valueOf: function () { valueOf: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return (obj1 <= obj2);
} assert((obj1 <= obj2), '(obj1 <= obj2) !== true');
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order 11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: valueOf <= enforced when using Less-than-or-equal operator: valueOf <=
toString toString
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
valueOf: function () { valueOf: function () {
@ -27,6 +25,5 @@ function testcase() {
} }
} }
}; };
return (obj1 <= obj2);
} assert((obj1 <= obj2), '(obj1 <= obj2) !== true');
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order 11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: toString <= enforced when using Less-than-or-equal operator: toString <=
valueOf valueOf
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
toString: function () { toString: function () {
@ -27,6 +25,5 @@ function testcase() {
} }
} }
}; };
return (obj1 <= obj2);
} assert((obj1 <= obj2), '(obj1 <= obj2) !== true');
runTestCase(testcase);

View File

@ -7,10 +7,8 @@ description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order 11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: toString <= enforced when using Less-than-or-equal operator: toString <=
toString toString
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
toString: function () { toString: function () {
@ -27,6 +25,5 @@ function testcase() {
} }
} }
}; };
return (obj1 <= obj2);
} assert((obj1 <= obj2), '(obj1 <= obj2) !== true');
runTestCase(testcase);

View File

@ -6,10 +6,8 @@ es5id: 11.8.3-5
description: > description: >
11.8.3 Less-than-or-equal Operator - Partial left to right order 11.8.3 Less-than-or-equal Operator - Partial left to right order
enforced when using Less-than-or-equal operator: valueOf <= valueOf enforced when using Less-than-or-equal operator: valueOf <= valueOf
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var accessed = false; var accessed = false;
var obj1 = { var obj1 = {
valueOf: function () { valueOf: function () {
@ -26,6 +24,5 @@ function testcase() {
} }
} }
}; };
return (obj1 <= obj2);
} assert((obj1 <= obj2), '(obj1 <= obj2) !== true');
runTestCase(testcase);