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

This commit is contained in:
André Bargull 2015-08-13 17:34:17 +02:00
parent ee8a222125
commit 73d5292b77
41 changed files with 177 additions and 270 deletions

View File

@ -8,24 +8,17 @@ description: >
simple assignment creates property on the global object if simple assignment creates property on the global object if
LeftHandSide is an unresolvable reference LeftHandSide is an unresolvable reference
flags: [noStrict] flags: [noStrict]
includes: includes: [fnGlobalObject.js]
- runTestCase.js
- fnGlobalObject.js
---*/ ---*/
function testcase() {
function foo() { function foo() {
__ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42; __ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42;
} }
foo(); foo();
var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), '__ES3_1_test_suite_test_11_13_1_unique_id_3__'); var desc = Object.getOwnPropertyDescriptor(fnGlobalObject(), '__ES3_1_test_suite_test_11_13_1_unique_id_3__');
if (desc.value === 42 &&
desc.writable === true && assert.sameValue(desc.value, 42, 'desc.value');
desc.enumerable === true && assert.sameValue(desc.writable, true, 'desc.writable');
desc.configurable === true) { assert.sameValue(desc.enumerable, true, 'desc.enumerable');
delete __ES3_1_test_suite_test_11_13_1_unique_id_3__; assert.sameValue(desc.configurable, true, 'desc.configurable');
return true;
}
}
runTestCase(testcase);

View File

@ -6,20 +6,10 @@ es5id: 11.13.1-4-27-s
description: > description: >
simple assignment throws TypeError if LeftHandSide is a readonly simple assignment throws TypeError if LeftHandSide is a readonly
property in strict mode (Global.undefined) property in strict mode (Global.undefined)
includes: flags: [onlyStrict]
- runTestCase.js includes: [fnGlobalObject.js]
- fnGlobalObject.js
---*/ ---*/
function testcase() { assert.throws(TypeError, function() {
'use strict';
try {
fnGlobalObject().undefined = 42; fnGlobalObject().undefined = 42;
return false; });
}
catch (e) {
return (e instanceof TypeError);
}
}
runTestCase(testcase);

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression of simple assignment(=) appears as the LeftHandSideExpression of simple assignment(=)
under strict mode under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = eval; var blah = eval;
try { try {
eval("var eval = 20;"); eval("var eval = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === eval; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, eval, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression of simple assignment(=) appears as the LeftHandSideExpression of simple assignment(=)
under strict mode under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("var arguments = 20;"); eval("var arguments = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -8,16 +8,17 @@ description: >
appears as the LeftHandSideExpression (PrimaryExpression) of appears as the LeftHandSideExpression (PrimaryExpression) of
simple assignment(=) under strict mode simple assignment(=) under strict mode
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("(arguments) = 20;"); eval("(arguments) = 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
} }
runTestCase(testcase); testcase();

View File

@ -6,15 +6,11 @@ es5id: 8.12.5-3-b_1
description: > description: >
Changing the value of a data property should not affect it's Changing the value of a data property should not affect it's
non-value property descriptor attributes. non-value property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var origReduce = Array.prototype.reduce;
var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
var newDesc; var newDesc;
try {
Array.prototype.reduce = function () {;}; Array.prototype.reduce = function () {;};
newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
@ -22,19 +18,10 @@ function testcase() {
for (var j in descArray) { //Ensure no attributes are magically added to newDesc for (var j in descArray) { //Ensure no attributes are magically added to newDesc
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (i==="value") { if (i==="value") {
if (origDesc[i]===newDesc[i]) { assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
}
} }
else if (origDesc[i]!==newDesc[i]) { else {
return false; assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
} }
} }
} }
return true;
} finally {
Array.prototype.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -6,19 +6,15 @@ es5id: 8.12.5-3-b_2
description: > description: >
Changing the value of a data property should not affect it's Changing the value of a data property should not affect it's
non-value property descriptor attributes. non-value property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var tempObj = {}; var tempObj = {};
Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true}); Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true});
var origReduce = tempObj.reduce;
var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var newDesc; var newDesc;
try {
tempObj.reduce = 123; tempObj.reduce = 123;
newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
@ -26,19 +22,10 @@ function testcase() {
for (var j in descArray) { for (var j in descArray) {
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (i==="value") { if (i==="value") {
if (origDesc[i]===newDesc[i]) { assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
}
} }
else if (origDesc[i]!==newDesc[i]) { else {
return false; assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
} }
} }
} }
return true;
} finally {
tempObj.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -6,34 +6,23 @@ es5id: 8.12.5-5-b_1
description: > description: >
Changing the value of an accessor property should not affect it's Changing the value of an accessor property should not affect it's
property descriptor attributes. property descriptor attributes.
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var tempObj = {}; var tempObj = {};
Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}}); Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}});
var origReduce = tempObj.reduce;
var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var newDesc; var newDesc;
try {
tempObj.reduce = 123; tempObj.reduce = 123;
newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
var descArray = [origDesc, newDesc]; var descArray = [origDesc, newDesc];
for (var j in descArray) { for (var j in descArray) {
for (var i in descArray[j]) { for (var i in descArray[j]) {
if (origDesc[i]!==newDesc[i]) { assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]');
return false;
}
} }
} }
return tempObj.reduce===456;
assert.sameValue(tempObj.reduce, 456, 'tempObj.reduce');
} finally {
tempObj.reduce = origReduce;
}
}
runTestCase(testcase);

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(*=) operator(*=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments *= 20;"); eval("arguments *= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(/=) operator(/=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments /= 20;"); eval("arguments /= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(%=) operator(%=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments %= 20;"); eval("arguments %= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(+=) operator(+=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments += 20;"); eval("arguments += 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(-=) operator(-=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments -= 20;"); eval("arguments -= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(<<=) operator(<<=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments <<= 20;"); eval("arguments <<= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(>>=) operator(>>=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments >>= 20;"); eval("arguments >>= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(>>>=) operator(>>>=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments >>>= 20;"); eval("arguments >>>= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(&=) operator(&=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments &= 20;"); eval("arguments &= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(^=) operator(^=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments ^= 20;"); eval("arguments ^= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,16 +8,17 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment appear as the LeftHandSideExpression of a Compound Assignment
operator(|=) operator(|=)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var err = null;
var blah = arguments; var blah = arguments;
try { try {
eval("arguments |= 20;"); eval("arguments |= 20;");
return false;
} catch (e) { } catch (e) {
return e instanceof SyntaxError && blah === arguments; err = e;
} }
} assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
runTestCase(testcase); assert.sameValue(blah, arguments, 'blah');
}
testcase();

View File

@ -8,18 +8,14 @@ info: >
es5id: 11.4.1-0-1 es5id: 11.4.1-0-1
description: delete operator as UnaryExpression description: delete operator as UnaryExpression
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var x = 1; var x = 1;
var y = 2; var y = 2;
var z = 3; var z = 3;
if( (!delete x || delete y) && assert((!delete x || delete y), '(!delete x || delete y)');
delete delete z) assert(delete delete z, 'delete delete z');
{
return true;
}
} }
runTestCase(testcase); testcase();

View File

@ -4,13 +4,8 @@
/*--- /*---
es5id: 11.4.1-2-1 es5id: 11.4.1-2-1
description: delete operator returns true when deleting a non-reference (number) description: delete operator returns true when deleting a non-reference (number)
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var d = delete 42; var d = delete 42;
if (d === true) {
return true; assert.sameValue(d, true, 'd');
}
}
runTestCase(testcase);

View File

@ -10,7 +10,6 @@ description: >
delete operator returns true on deleting arguments delete operator returns true on deleting arguments
propterties(arguments.callee) propterties(arguments.callee)
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -19,7 +18,8 @@ function testcase() {
return (delete arguments.callee); return (delete arguments.callee);
} }
var d = delete arguments.callee; var d = delete arguments.callee;
if(d === true && arguments.callee === undefined)
return true; assert.sameValue(d, true, 'd');
assert.sameValue(arguments.callee, undefined, 'arguments.callee');
} }
runTestCase(testcase); testcase();

View File

@ -8,7 +8,6 @@ info: >
es5id: 11.4.1-4.a-13 es5id: 11.4.1-4.a-13
description: delete operator returns false when deleting Array object description: delete operator returns false when deleting Array object
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -18,7 +17,7 @@ function testcase() {
var d = delete a var d = delete a
if(d === false && Array.isArray(a) === true) assert.sameValue(d, false, 'd');
return true; assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)');
} }
runTestCase(testcase); testcase();

View File

@ -8,12 +8,10 @@ info: >
es5id: 11.4.1-4.a-16 es5id: 11.4.1-4.a-16
description: delete operator returns false on deleting arguments object description: delete operator returns false on deleting arguments object
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
assert.sameValue(delete arguments, false, 'delete arguments');
if(delete arguments === false && arguments !== undefined) assert.notSameValue(arguments, undefined, 'arguments');
return true;
} }
runTestCase(testcase); testcase();

View File

@ -7,17 +7,12 @@ info: >
language provides no way to directly exercise [[Delete]], the tests are placed here. language provides no way to directly exercise [[Delete]], the tests are placed here.
es5id: 11.4.1-4.a-17 es5id: 11.4.1-4.a-17
description: delete operator returns true on deleting a arguments element description: delete operator returns true on deleting a arguments element
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
function foo(a,b) function foo(a,b)
{ {
var d = delete arguments[0]; var d = delete arguments[0];
return (d === true && arguments[0] === undefined); return (d === true && arguments[0] === undefined);
} }
if(foo(1,2) === true) assert.sameValue(foo(1,2), true, 'foo(1,2)');
return true;
}
runTestCase(testcase);

View File

@ -10,7 +10,6 @@ description: >
delete operator returns false when deleting the declaration of the environment object delete operator returns false when deleting the declaration of the environment object
inside 'with' inside 'with'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -21,9 +20,9 @@ function testcase() {
{ {
d = delete o; d = delete o;
} }
if (d === false && typeof(o) === 'object' && o.x === 1) {
return true; assert.sameValue(d, false, 'd');
} assert.sameValue(typeof(o), 'object', 'typeof(o)');
return false; assert.sameValue(o.x, 1, 'o.x');
} }
runTestCase(testcase); testcase();

View File

@ -8,15 +8,13 @@ info: >
es5id: 11.4.1-4.a-7 es5id: 11.4.1-4.a-7
description: delete operator inside 'eval' description: delete operator inside 'eval'
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var x = 1; var x = 1;
var d = eval("delete x"); var d = eval("delete x");
if (d === false && x === 1) {
return true; assert.sameValue(d, false, 'd');
} assert.sameValue(x, 1, 'x');
return false;
} }
runTestCase(testcase); testcase();

View File

@ -7,7 +7,6 @@ description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a var a var
flags: [noStrict] flags: [noStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
@ -15,7 +14,8 @@ function testcase() {
// Now, deleting 'x' directly should fail; // Now, deleting 'x' directly should fail;
var d = delete x; var d = delete x;
if(d === false && x === 1)
return true; assert.sameValue(d, false, 'd');
assert.sameValue(x, 1, 'x');
} }
runTestCase(testcase); testcase();

View File

@ -7,8 +7,6 @@ description: >
delete operator returns false when deleting a direct reference to delete operator returns false when deleting a direct reference to
a function name a function name
flags: [noStrict] flags: [noStrict]
includes:
- runTestCase.js
---*/ ---*/
function testcase() { function testcase() {
@ -16,7 +14,8 @@ function testcase() {
// Now, deleting 'foo' directly should fail; // Now, deleting 'foo' directly should fail;
var d = delete foo; var d = delete foo;
if(d === false && typeof foo === 'function')
return true; assert.sameValue(d, false, 'd');
assert.sameValue(typeof foo, 'function', 'typeof foo');
} }
runTestCase(testcase); testcase();

View File

@ -7,20 +7,16 @@ info: >
probably be replaced by some more targeted tests. AllenWB probably be replaced by some more targeted tests. AllenWB
es5id: 11.1.5-0-1 es5id: 11.1.5-0-1
description: Object literal - get set property description: Object literal - get set property
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var s1 = "In getter"; var s1 = "In getter";
var s2 = "In setter"; var s2 = "In setter";
var s3 = "Modified by setter"; var s3 = "Modified by setter";
var o; var o;
eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};"); eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};");
if(o.foo !== s1)
return false; assert.sameValue(o.foo, s1, 'o.foo');
o.foo=10; o.foo=10;
if(s2 !== s3)
return false; assert.sameValue(s2, s3, 's2');
return true;
}
runTestCase(testcase);

View File

@ -7,25 +7,21 @@ info: >
probably be replaced by some more targeted tests. AllenWB probably be replaced by some more targeted tests. AllenWB
es5id: 11.1.5-0-2 es5id: 11.1.5-0-2
description: Object literal - multiple get set properties description: Object literal - multiple get set properties
includes: [runTestCase.js]
---*/ ---*/
function testcase() {
var s1 = "First getter"; var s1 = "First getter";
var s2 = "First setter"; var s2 = "First setter";
var s3 = "Second getter"; var s3 = "Second getter";
var o; var o;
eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};"); eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};");
if(o.foo !== s1)
return false; assert.sameValue(o.foo, s1, 'o.foo');
o.foo = 10; o.foo = 10;
if(s2 !== s3)
return false; assert.sameValue(s2, s3, 's2');
if(o.bar !== s3) assert.sameValue(o.bar, s3, 'o.bar');
return false;
o.bar = "Second setter"; o.bar = "Second setter";
if(o.bar !== "Second setter")
return false; assert.sameValue(o.bar, "Second setter", 'o.bar');
return true;
}
runTestCase(testcase);

View File

@ -7,16 +7,13 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier 'arguments' Strict Mode - SyntaxError is thrown if the identifier 'arguments'
appear as a PostfixExpression(arguments--) appear as a PostfixExpression(arguments--)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var blah = arguments; var blah = arguments;
try { assert.throws(SyntaxError, function() {
eval("arguments--;"); eval("arguments--;");
return false; });
} catch (e) { assert.sameValue(blah, arguments, 'blah');
return e instanceof SyntaxError && blah === arguments;
}
} }
runTestCase(testcase); testcase();

View File

@ -6,12 +6,11 @@ es5id: 11.3.2-2-3-s
description: > description: >
SyntaxError is not thrown if the identifier 'arguments[...]' appears as a SyntaxError is not thrown if the identifier 'arguments[...]' appears as a
PostfixExpression(arguments--) PostfixExpression(arguments--)
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
arguments[1] = 7; arguments[1] = 7;
arguments[1]--; arguments[1]--;
return arguments[1]===6; assert.sameValue(arguments[1], 6, 'arguments[1]');
} }
runTestCase(testcase); testcase();

View File

@ -7,16 +7,13 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier 'arguments' Strict Mode - SyntaxError is thrown if the identifier 'arguments'
appear as a PostfixExpression(arguments++) appear as a PostfixExpression(arguments++)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var blah = arguments; var blah = arguments;
try { assert.throws(SyntaxError, function() {
eval("arguments++;"); eval("arguments++;");
return false; });
} catch (e) { assert.sameValue(blah, arguments, 'blah');
return e instanceof SyntaxError && blah === arguments;
}
} }
runTestCase(testcase); testcase();

View File

@ -7,12 +7,11 @@ description: >
Strict Mode - SyntaxError is not thrown if the identifier Strict Mode - SyntaxError is not thrown if the identifier
'arguments[...]' appears as a PostfixExpression(arguments++) 'arguments[...]' appears as a PostfixExpression(arguments++)
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
arguments[1] = 7; arguments[1] = 7;
arguments[1]++; arguments[1]++;
return arguments[1]===8; assert.sameValue(arguments[1], 8, 'arguments[1]');
} }
runTestCase(testcase); testcase();

View File

@ -5,16 +5,13 @@
es5id: 11.4.5-2-2-s es5id: 11.4.5-2-2-s
description: Strict Mode - SyntaxError is thrown for --arguments description: Strict Mode - SyntaxError is thrown for --arguments
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var blah = arguments; var blah = arguments;
try { assert.throws(SyntaxError, function() {
eval("--arguments;"); eval("--arguments;");
return false; });
} catch (e) { assert.sameValue(blah, arguments, 'blah');
return e instanceof SyntaxError && blah === arguments;
}
} }
runTestCase(testcase); testcase();

View File

@ -4,12 +4,11 @@
/*--- /*---
es5id: 11.4.5-2-3-s es5id: 11.4.5-2-3-s
description: SyntaxError is not thrown for --arguments[...] description: SyntaxError is not thrown for --arguments[...]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
arguments[1] = 7; arguments[1] = 7;
--arguments[1]; --arguments[1];
return arguments[1]===6; assert.sameValue(arguments[1], 6, 'arguments[1]');
} }
runTestCase(testcase); testcase();

View File

@ -5,16 +5,13 @@
es5id: 11.4.4-2-2-s es5id: 11.4.4-2-2-s
description: Strict Mode - SyntaxError is thrown for ++arguments description: Strict Mode - SyntaxError is thrown for ++arguments
flags: [onlyStrict] flags: [onlyStrict]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
var blah = arguments; var blah = arguments;
try { assert.throws(SyntaxError, function() {
eval("++arguments;"); eval("++arguments;");
return false; });
} catch (e) { assert.sameValue(blah, arguments, 'blah');
return e instanceof SyntaxError && blah === arguments;
}
} }
runTestCase(testcase); testcase();

View File

@ -4,12 +4,11 @@
/*--- /*---
es5id: 11.4.4-2-3-s es5id: 11.4.4-2-3-s
description: SyntaxError is not thrown for ++arguments[...] description: SyntaxError is not thrown for ++arguments[...]
includes: [runTestCase.js]
---*/ ---*/
function testcase() { function testcase() {
arguments[1] = 7; arguments[1] = 7;
++arguments[1]; ++arguments[1];
return arguments[1]===8; assert.sameValue(arguments[1], 8, 'arguments[1]');
} }
runTestCase(testcase); testcase();

View File

@ -4,10 +4,6 @@
/*--- /*---
es5id: 11.4.7-4-1 es5id: 11.4.7-4-1
description: -"" should be zero description: -"" should be zero
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(-"", -0, '-""');
return -"" === 0;
}
runTestCase(testcase);

View File

@ -4,10 +4,6 @@
/*--- /*---
es5id: 11.4.6-2-1 es5id: 11.4.6-2-1
description: +"" should be zero description: +"" should be zero
includes: [runTestCase.js]
---*/ ---*/
function testcase() { assert.sameValue(+"", 0, '+""');
return +"" === 0;
}
runTestCase(testcase);