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: >
elements elided at the end of an array do not contribute to its
length
includes: [runTestCase.js]
---*/
function testcase() {
var a = [,];
if (a.length === 1) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(a.length, 1, 'a.length');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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