Refactor compound assignment tests for parsers

The tests for the parsing of compound assignment expressions were
expressed using eval. This made the tests more complex than necessary
and also prevented the tests from providing value to ECMAScript parsers.

Remove the use of eval and instead express the expectations with
literal source text.
This commit is contained in:
Mike Pennisi 2018-10-07 17:31:24 -04:00 committed by Rick Waldron
parent a3a5bedee4
commit 36f5d9527f
33 changed files with 396 additions and 638 deletions

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(+=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments += 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments += 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(+=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval += 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval += 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x += y
var x;
//CHECK#1
x = -1;
if ((eval("x\u0009+=\u0009-1")) !== -2) {
$ERROR('#1: x = -1; (x\\u0009+=\\u0009-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+0009 (expression)');
assert.sameValue(x, -2, 'U+0009 (side effect)');
//CHECK#2
x = -1;
if ((eval("x\u000B+=\u000B-1")) !== -2) {
$ERROR('#2: x = -1; (x\\u000B+=\\u000B-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+000B (expression)');
assert.sameValue(x, -2, 'U+000B (side effect)');
//CHECK#3
x = -1;
if ((eval("x\u000C+=\u000C-1")) !== -2) {
$ERROR('#3: x = -1; (x\\u000C+=\\u000C-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+000C (expression)');
assert.sameValue(x, -2, 'U+000C (side effect)');
//CHECK#4
x = -1;
if ((eval("x\u0020+=\u0020-1")) !== -2) {
$ERROR('#4: x = -1; (x\\u0020+=\\u0020-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+0020 (expression)');
assert.sameValue(x, -2, 'U+0020 (side effect)');
//CHECK#5
x = -1;
if ((eval("x\u00A0+=\u00A0-1")) !== -2) {
$ERROR('#5: x = -1; (x\\u00A0+=\\u00A0-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+00A0 (expression)');
assert.sameValue(x, -2, 'U+00A0 (side effect)');
//CHECK#6
x = -1;
if ((eval("x\u000A+=\u000A-1")) !== -2) {
$ERROR('#6: x = -1; (x\\u000A+=\\u000A-1) === -2');
}
assert.sameValue(x
+=
-1, -2, 'U+000A (expression)');
assert.sameValue(x, -2, 'U+000A (side effect)');
//CHECK#7
x = -1;
if ((eval("x\u000D+=\u000D-1")) !== -2) {
$ERROR('#7: x = -1; (x\\u000D+=\\u000D-1) === -2');
}
assert.sameValue(x += -1, -2, 'U+000D (expression)');
assert.sameValue(x, -2, 'U+000D (side effect)');
//CHECK#8
x = -1;
if ((eval("x\u2028+=\u2028-1")) !== -2) {
$ERROR('#8: x = -1; (x\\u2028+=\\u2028-1) === -2');
}
assert.sameValue(x+=-1, -2, 'U+2028 (expression)');
assert.sameValue(x, -2, 'U+2028 (side effect)');
//CHECK#9
x = -1;
if ((eval("x\u2029+=\u2029-1")) !== -2) {
$ERROR('#9: x = -1; (x\\u2029+=\\u2029-1) === -2');
}
assert.sameValue(x+=-1, -2, 'U+2029 (expression)');
assert.sameValue(x, -2, 'U+2029 (side effect)');
//CHECK#10
x = -1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029+=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-1")) !== -2) {
$ERROR('#10: x = -1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029+=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-1) === -2');
}
assert.sameValue(x  
+=  
-1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(&=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments &= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments &= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(&=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval &= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval &= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x &= y
var x;
//CHECK#1
x = 1;
if ((eval("x\u0009&=\u00091")) !== 1) {
$ERROR('#1: x = 1; (x\\u0009&=\\u00091) === 1');
}
assert.sameValue(x &= 1, 1, 'U+0009 (expression)');
assert.sameValue(x, 1, 'U+0009 (side effect)');
//CHECK#2
x = 1;
if ((eval("x\u000B&=\u000B1")) !== 1) {
$ERROR('#2: x = 1; (x\\u000B&=\\u000B1) === 1');
}
assert.sameValue(x &= 1, 1, 'U+000B (expression)');
assert.sameValue(x, 1, 'U+000B (side effect)');
//CHECK#3
x = 1;
if ((eval("x\u000C&=\u000C1")) !== 1) {
$ERROR('#3: x = 1; (x\\u000C&=\\u000C1) === 1');
}
assert.sameValue(x &= 1, 1, 'U+000C (expression)');
assert.sameValue(x, 1, 'U+000C (side effect)');
//CHECK#4
x = 1;
if ((eval("x\u0020&=\u00201")) !== 1) {
$ERROR('#4: x = 1; (x\\u0020&=\\u00201) === 1');
}
assert.sameValue(x &= 1, 1, 'U+0020 (expression)');
assert.sameValue(x, 1, 'U+0020 (side effect)');
//CHECK#5
x = 1;
if ((eval("x\u00A0&=\u00A01")) !== 1) {
$ERROR('#5: x = 1; (x\\u00A0&=\\u00A01) === 1');
}
assert.sameValue(x &= 1, 1, 'U+00A0 (expression)');
assert.sameValue(x, 1, 'U+00A0 (side effect)');
//CHECK#6
x = 1;
if ((eval("x\u000A&=\u000A1")) !== 1) {
$ERROR('#6: x = 1; (x\\u000A&=\\u000A1) === 1');
}
assert.sameValue(x
&=
1, 1, 'U+000A (expression)');
assert.sameValue(x, 1, 'U+000A (side effect)');
//CHECK#7
x = 1;
if ((eval("x\u000D&=\u000D1")) !== 1) {
$ERROR('#7: x = 1; (x\\u000D&=\\u000D1) === 1');
}
assert.sameValue(x &= 1, 1, 'U+000D (expression)');
assert.sameValue(x, 1, 'U+000D (side effect)');
//CHECK#8
x = 1;
if ((eval("x\u2028&=\u20281")) !== 1) {
$ERROR('#8: x = 1; (x\\u2028&=\\u20281) === 1');
}
assert.sameValue(x&=1, 1, 'U+2028 (expression)');
assert.sameValue(x, 1, 'U+2028 (side effect)');
//CHECK#9
x = 1;
if ((eval("x\u2029&=\u20291")) !== 1) {
$ERROR('#9: x = 1; (x\\u2029&=\\u20291) === 1');
}
assert.sameValue(x&=1, 1, 'U+2029 (expression)');
assert.sameValue(x, 1, 'U+2029 (side effect)');
//CHECK#10
x = 1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) {
$ERROR('#10: x = 1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1');
}
assert.sameValue(x  
&=  
1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(/=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments /= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments /= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(/=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval /= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval /= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x /= y
var x;
//CHECK#1
x = -1;
if ((eval("x\u0009/=\u0009-1")) !== 1) {
$ERROR('#1: x = -1; (x\\u0009/=\\u0009-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+0009 (expression)');
assert.sameValue(x, 1, 'U+0009 (side effect)');
//CHECK#2
x = -1;
if ((eval("x\u000B/=\u000B-1")) !== 1) {
$ERROR('#2: x = -1; (x\\u000B/=\\u000B-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+000B (expression)');
assert.sameValue(x, 1, 'U+000B (side effect)');
//CHECK#3
x = -1;
if ((eval("x\u000C/=\u000C-1")) !== 1) {
$ERROR('#3: x = -1; (x\\u000C/=\\u000C-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+000C (expression)');
assert.sameValue(x, 1, 'U+000C (side effect)');
//CHECK#4
x = -1;
if ((eval("x\u0020/=\u0020-1")) !== 1) {
$ERROR('#4: x = -1; (x\\u0020/=\\u0020-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+0020 (expression)');
assert.sameValue(x, 1, 'U+0020 (side effect)');
//CHECK#5
x = -1;
if ((eval("x\u00A0/=\u00A0-1")) !== 1) {
$ERROR('#5: x = -1; (x\\u00A0/=\\u00A0-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+00A0 (expression)');
assert.sameValue(x, 1, 'U+00A0 (side effect)');
//CHECK#6
x = -1;
if ((eval("x\u000A/=\u000A-1")) !== 1) {
$ERROR('#6: x = -1; (x\\u000A/=\\u000A-1) === 1');
}
assert.sameValue(x
/=
-1, 1, 'U+000A (expression)');
assert.sameValue(x, 1, 'U+000A (side effect)');
//CHECK#7
x = -1;
if ((eval("x\u000D/=\u000D-1")) !== 1) {
$ERROR('#7: x = -1; (x\\u000D/=\\u000D-1) === 1');
}
assert.sameValue(x /= -1, 1, 'U+000D (expression)');
assert.sameValue(x, 1, 'U+000D (side effect)');
//CHECK#8
x = -1;
if ((eval("x\u2028/=\u2028-1")) !== 1) {
$ERROR('#8: x = -1; (x\\u2028/=\\u2028-1) === 1');
}
assert.sameValue(x/=-1, 1, 'U+2028 (expression)');
assert.sameValue(x, 1, 'U+2028 (side effect)');
//CHECK#9
x = -1;
if ((eval("x\u2029/=\u2029-1")) !== 1) {
$ERROR('#9: x = -1; (x\\u2029/=\\u2029-1) === 1');
}
assert.sameValue(x/=-1, 1, 'U+2029 (expression)');
assert.sameValue(x, 1, 'U+2029 (side effect)');
//CHECK#10
x = -1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029/=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-1")) !== 1) {
$ERROR('#10: x = -1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029/=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-1) === 1');
}
assert.sameValue(x  
/=  
-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(<<=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments <<= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments <<= 20;

View File

@ -9,10 +9,11 @@ description: >
as the LeftHandSideExpression of a Compound Assignment
operator(<<=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval <<= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval <<= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x <<= y
var x;
//CHECK#1
x = 1;
if ((eval("x\u0009<<=\u00091")) !== 2) {
$ERROR('#1: x = 1; (x\\u0009<<=\\u00091) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+0009 (expression)');
assert.sameValue(x, 2, 'U+0009 (side effect)');
//CHECK#2
x = 1;
if ((eval("x\u000B<<=\u000B1")) !== 2) {
$ERROR('#2: x = 1; (x\\u000B<<=\\u000B1) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+000B (expression)');
assert.sameValue(x, 2, 'U+000B (side effect)');
//CHECK#3
x = 1;
if ((eval("x\u000C<<=\u000C1")) !== 2) {
$ERROR('#3: x = 1; (x\\u000C<<=\\u000C1) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+000C (expression)');
assert.sameValue(x, 2, 'U+000C (side effect)');
//CHECK#4
x = 1;
if ((eval("x\u0020<<=\u00201")) !== 2) {
$ERROR('#4: x = 1; (x\\u0020<<=\\u00201) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+0020 (expression)');
assert.sameValue(x, 2, 'U+0020 (side effect)');
//CHECK#5
x = 1;
if ((eval("x\u00A0<<=\u00A01")) !== 2) {
$ERROR('#5: x = 1; (x\\u00A0<<=\\u00A01) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+00A0 (expression)');
assert.sameValue(x, 2, 'U+00A0 (side effect)');
//CHECK#6
x = 1;
if ((eval("x\u000A<<=\u000A1")) !== 2) {
$ERROR('#6: x = 1; (x\\u000A<<=\\u000A1) === 2');
}
assert.sameValue(x
<<=
1, 2, 'U+000A (expression)');
assert.sameValue(x, 2, 'U+000A (side effect)');
//CHECK#7
x = 1;
if ((eval("x\u000D<<=\u000D1")) !== 2) {
$ERROR('#7: x = 1; (x\\u000D<<=\\u000D1) === 2');
}
assert.sameValue(x <<= 1, 2, 'U+000D (expression)');
assert.sameValue(x, 2, 'U+000D (side effect)');
//CHECK#8
x = 1;
if ((eval("x\u2028<<=\u20281")) !== 2) {
$ERROR('#8: x = 1; (x\\u2028<<=\\u20281) === 2');
}
assert.sameValue(x<<=1, 2, 'U+2028 (expression)');
assert.sameValue(x, 2, 'U+2028 (side effect)');
//CHECK#9
x = 1;
if ((eval("x\u2029<<=\u20291")) !== 2) {
$ERROR('#9: x = 1; (x\\u2029<<=\\u20291) === 2');
}
assert.sameValue(x<<=1, 2, 'U+2029 (expression)');
assert.sameValue(x, 2, 'U+2029 (side effect)');
//CHECK#10
x = 1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029<<=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 2) {
$ERROR('#10: x = 1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029<<=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 2');
}
assert.sameValue(x  
<<=  
1, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(%=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments %= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments %= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(%=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval %= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval %= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x %= y
var x;
//CHECK#1
x = -1;
if ((eval("x\u0009%=\u0009-1")) !== 0) {
$ERROR('#1: x = -1; (x\\u0009%=\\u0009-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+0009 (expression)');
assert.sameValue(x, -0, 'U+0009 (side effect)');
//CHECK#2
x = -1;
if ((eval("x\u000B%=\u000B-1")) !== 0) {
$ERROR('#2: x = -1; (x\\u000B%=\\u000B-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+000B (expression)');
assert.sameValue(x, -0, 'U+000B (side effect)');
//CHECK#3
x = -1;
if ((eval("x\u000C%=\u000C-1")) !== 0) {
$ERROR('#3: x = -1; (x\\u000C%=\\u000C-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+000C (expression)');
assert.sameValue(x, -0, 'U+000C (side effect)');
//CHECK#4
x = -1;
if ((eval("x\u0020%=\u0020-1")) !== 0) {
$ERROR('#4: x = -1; (x\\u0020%=\\u0020-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+0020 (expression)');
assert.sameValue(x, -0, 'U+0020 (side effect)');
//CHECK#5
x = -1;
if ((eval("x\u00A0%=\u00A0-1")) !== 0) {
$ERROR('#5: x = -1; (x\\u00A0%=\\u00A0-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+00A0 (expression)');
assert.sameValue(x, -0, 'U+00A0 (side effect)');
//CHECK#6
x = -1;
if ((eval("x\u000A%=\u000A-1")) !== 0) {
$ERROR('#6: x = -1; (x\\u000A%=\\u000A-1) === 0');
}
assert.sameValue(x
%=
-1, -0, 'U+000A (expression)');
assert.sameValue(x, -0, 'U+000A (side effect)');
//CHECK#7
x = -1;
if ((eval("x\u000D%=\u000D-1")) !== 0) {
$ERROR('#7: x = -1; (x\\u000D%=\\u000D-1) === 0');
}
assert.sameValue(x %= -1, -0, 'U+000D (expression)');
assert.sameValue(x, -0, 'U+000D (side effect)');
//CHECK#8
x = -1;
if ((eval("x\u2028%=\u2028-1")) !== 0) {
$ERROR('#8: x = -1; (x\\u2028%=\\u2028-1) === 0');
}
assert.sameValue(x%=-1, -0, 'U+2028 (expression)');
assert.sameValue(x, -0, 'U+2028 (side effect)');
//CHECK#9
x = -1;
if ((eval("x\u2029%=\u2029-1")) !== 0) {
$ERROR('#9: x = -1; (x\\u2029%=\\u2029-1) === 0');
}
assert.sameValue(x%=-1, -0, 'U+2029 (expression)');
assert.sameValue(x, -0, 'U+2029 (side effect)');
//CHECK#10
x = -1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029%=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-1")) !== 0) {
$ERROR('#10: x = -1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029%=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-1) === 0');
}
assert.sameValue(x  
%=  
-1, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(*=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments *= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments *= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(*=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval *= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval *= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x *= y
var x;
//CHECK#1
x = -1;
if ((eval("x\u0009*=\u0009-1")) !== 1) {
$ERROR('#1: x = -1; (x\\u0009*=\\u0009-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+0009 (expression)');
assert.sameValue(x, 1, 'U+0009 (side effect)');
//CHECK#2
x = -1;
if ((eval("x\u000B*=\u000B-1")) !== 1) {
$ERROR('#2: x = -1; (x\\u000B*=\\u000B-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+000B (expression)');
assert.sameValue(x, 1, 'U+000B (side effect)');
//CHECK#3
x = -1;
if ((eval("x\u000C*=\u000C-1")) !== 1) {
$ERROR('#3: x = -1; (x\\u000C*=\\u000C-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+000C (expression)');
assert.sameValue(x, 1, 'U+000C (side effect)');
//CHECK#4
x = -1;
if ((eval("x\u0020*=\u0020-1")) !== 1) {
$ERROR('#4: x = -1; (x\\u0020*=\\u0020-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+0020 (expression)');
assert.sameValue(x, 1, 'U+0020 (side effect)');
//CHECK#5
x = -1;
if ((eval("x\u00A0*=\u00A0-1")) !== 1) {
$ERROR('#5: x = -1; (x\\u00A0*=\\u00A0-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+00A0 (expression)');
assert.sameValue(x, 1, 'U+00A0 (side effect)');
//CHECK#6
x = -1;
if ((eval("x\u000A*=\u000A-1")) !== 1) {
$ERROR('#6: x = -1; (x\\u000A*=\\u000A-1) === 1');
}
assert.sameValue(x
*=
-1, 1, 'U+000A (expression)');
assert.sameValue(x, 1, 'U+000A (side effect)');
//CHECK#7
x = -1;
if ((eval("x\u000D*=\u000D-1")) !== 1) {
$ERROR('#7: x = -1; (x\\u000D*=\\u000D-1) === 1');
}
assert.sameValue(x *= -1, 1, 'U+000D (expression)');
assert.sameValue(x, 1, 'U+000D (side effect)');
//CHECK#8
x = -1;
if ((eval("x\u2028*=\u2028-1")) !== 1) {
$ERROR('#8: x = -1; (x\\u2028*=\\u2028-1) === 1');
}
assert.sameValue(x*=-1, 1, 'U+2028 (expression)');
assert.sameValue(x, 1, 'U+2028 (side effect)');
//CHECK#9
x = -1;
if ((eval("x\u2029*=\u2029-1")) !== 1) {
$ERROR('#9: x = -1; (x\\u2029*=\\u2029-1) === 1');
}
assert.sameValue(x*=-1, 1, 'U+2029 (expression)');
assert.sameValue(x, 1, 'U+2029 (side effect)');
//CHECK#10
x = -1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029*=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-1")) !== 1) {
$ERROR('#10: x = -1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029*=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-1) === 1');
}
assert.sameValue(x  
*=  
-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(|=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments |= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments |= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(|=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval |= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval |= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x |= y
var x;
//CHECK#1
x = 0;
if ((eval("x\u0009|=\u00091")) !== 1) {
$ERROR('#1: x = 0; (x\\u0009|=\\u00091) === 1');
}
assert.sameValue(x |= 1, 1, 'U+0009 (expression)');
assert.sameValue(x, 1, 'U+0009 (side effect)');
//CHECK#2
x = 0;
if ((eval("x\u000B|=\u000B1")) !== 1) {
$ERROR('#2: x = 0; (x\\u000B|=\\u000B1) === 1');
}
assert.sameValue(x |= 1, 1, 'U+000B (expression)');
assert.sameValue(x, 1, 'U+000B (side effect)');
//CHECK#3
x = 0;
if ((eval("x\u000C|=\u000C1")) !== 1) {
$ERROR('#3: x = 0; (x\\u000C|=\\u000C1) === 1');
}
assert.sameValue(x |= 1, 1, 'U+000C (expression)');
assert.sameValue(x, 1, 'U+000C (side effect)');
//CHECK#4
x = 0;
if ((eval("x\u0020|=\u00201")) !== 1) {
$ERROR('#4: x = 0; (x\\u0020|=\\u00201) === 1');
}
assert.sameValue(x |= 1, 1, 'U+0020 (expression)');
assert.sameValue(x, 1, 'U+0020 (side effect)');
//CHECK#5
x = 0;
if ((eval("x\u00A0|=\u00A01")) !== 1) {
$ERROR('#5: x = 0; (x\\u00A0|=\\u00A01) === 1');
}
assert.sameValue(x |= 1, 1, 'U+00A0 (expression)');
assert.sameValue(x, 1, 'U+00A0 (side effect)');
//CHECK#6
x = 0;
if ((eval("x\u000A|=\u000A1")) !== 1) {
$ERROR('#6: x = 0; (x\\u000A|=\\u000A1) === 1');
}
assert.sameValue(x
|=
1, 1, 'U+000A (expression)');
assert.sameValue(x, 1, 'U+000A (side effect)');
//CHECK#7
x = 0;
if ((eval("x\u000D|=\u000D1")) !== 1) {
$ERROR('#7: x = 0; (x\\u000D|=\\u000D1) === 1');
}
assert.sameValue(x |= 1, 1, 'U+000D (expression)');
assert.sameValue(x, 1, 'U+000D (side effect)');
//CHECK#8
x = 0;
if ((eval("x\u2028|=\u20281")) !== 1) {
$ERROR('#8: x = 0; (x\\u2028|=\\u20281) === 1');
}
assert.sameValue(x|=1, 1, 'U+2028 (expression)');
assert.sameValue(x, 1, 'U+2028 (side effect)');
//CHECK#9
x = 0;
if ((eval("x\u2029|=\u20291")) !== 1) {
$ERROR('#9: x = 0; (x\\u2029|=\\u20291) === 1');
}
assert.sameValue(x|=1, 1, 'U+2029 (expression)');
assert.sameValue(x, 1, 'U+2029 (side effect)');
//CHECK#10
x = 0;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029|=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) {
$ERROR('#10: x = 0; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029|=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1');
}
assert.sameValue(x  
|=  
1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(>>=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments >>= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments >>= 20;

View File

@ -9,10 +9,11 @@ description: >
as the LeftHandSideExpression of a Compound Assignment
operator(>>=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval >>= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval >>= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x >>= y
var x;
//CHECK#1
x = 1;
if ((eval("x\u0009>>=\u00091")) !== 0) {
$ERROR('#1: x = 1; (x\\u0009>>=\\u00091) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+0009 (expression)');
assert.sameValue(x, 0, 'U+0009 (side effect)');
//CHECK#2
x = 1;
if ((eval("x\u000B>>=\u000B1")) !== 0) {
$ERROR('#2: x = 1; (x\\u000B>>=\\u000B1) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+000B (expression)');
assert.sameValue(x, 0, 'U+000B (side effect)');
//CHECK#3
x = 1;
if ((eval("x\u000C>>=\u000C1")) !== 0) {
$ERROR('#3: x = 1; (x\\u000C>>=\\u000C1) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+000C (expression)');
assert.sameValue(x, 0, 'U+000C (side effect)');
//CHECK#4
x = 1;
if ((eval("x\u0020>>=\u00201")) !== 0) {
$ERROR('#4: x = 1; (x\\u0020>>=\\u00201) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+0020 (expression)');
assert.sameValue(x, 0, 'U+0020 (side effect)');
//CHECK#5
x = 1;
if ((eval("x\u00A0>>=\u00A01")) !== 0) {
$ERROR('#5: x = 1; (x\\u00A0>>=\\u00A01) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+00A0 (expression)');
assert.sameValue(x, 0, 'U+00A0 (side effect)');
//CHECK#6
x = 1;
if ((eval("x\u000A>>=\u000A1")) !== 0) {
$ERROR('#6: x = 1; (x\\u000A>>=\\u000A1) === 0');
}
assert.sameValue(x
>>=
1, 0, 'U+000A (expression)');
assert.sameValue(x, 0, 'U+000A (side effect)');
//CHECK#7
x = 1;
if ((eval("x\u000D>>=\u000D1")) !== 0) {
$ERROR('#7: x = 1; (x\\u000D>>=\\u000D1) === 0');
}
assert.sameValue(x >>= 1, 0, 'U+000D (expression)');
assert.sameValue(x, 0, 'U+000D (side effect)');
//CHECK#8
x = 1;
if ((eval("x\u2028>>=\u20281")) !== 0) {
$ERROR('#8: x = 1; (x\\u2028>>=\\u20281) === 0');
}
assert.sameValue(x>>=1, 0, 'U+2028 (expression)');
assert.sameValue(x, 0, 'U+2028 (side effect)');
//CHECK#9
x = 1;
if ((eval("x\u2029>>=\u20291")) !== 0) {
$ERROR('#9: x = 1; (x\\u2029>>=\\u20291) === 0');
}
assert.sameValue(x>>=1, 0, 'U+2029 (expression)');
assert.sameValue(x, 0, 'U+2029 (side effect)');
//CHECK#10
x = 1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>>=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 0) {
$ERROR('#10: x = 1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>>=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 0');
}
assert.sameValue(x  
>>=  
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(-=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments -= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments -= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(-=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval -= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval -= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x -= y
var x;
//CHECK#1
x = -1;
if ((eval("x\u0009-=\u00091")) !== -2) {
$ERROR('#1: x = -1; (x\\u0009-=\\u00091) === -2');
}
assert.sameValue(x -= 1, -2, 'U+0009 (expression)');
assert.sameValue(x, -2, 'U+0009 (side effect)');
//CHECK#2
x = -1;
if ((eval("x\u000B-=\u000B1")) !== -2) {
$ERROR('#2: x = -1; (x\\u000B-=\\u000B1) === -2');
}
assert.sameValue(x -= 1, -2, 'U+000B (expression)');
assert.sameValue(x, -2, 'U+000B (side effect)');
//CHECK#3
x = -1;
if ((eval("x\u000C-=\u000C1")) !== -2) {
$ERROR('#3: x = -1; (x\\u000C-=\\u000C1) === -2');
}
assert.sameValue(x -= 1, -2, 'U+000C (expression)');
assert.sameValue(x, -2, 'U+000C (side effect)');
//CHECK#4
x = -1;
if ((eval("x\u0020-=\u00201")) !== -2) {
$ERROR('#4: x = -1; (x\\u0020-=\\u00201) === -2');
}
assert.sameValue(x -= 1, -2, 'U+0020 (expression)');
assert.sameValue(x, -2, 'U+0020 (side effect)');
//CHECK#5
x = -1;
if ((eval("x\u00A0-=\u00A01")) !== -2) {
$ERROR('#5: x = -1; (x\\u00A0-=\\u00A01) === -2');
}
assert.sameValue(x -= 1, -2, 'U+00A0 (expression)');
assert.sameValue(x, -2, 'U+00A0 (side effect)');
//CHECK#6
x = -1;
if ((eval("x\u000A-=\u000A1")) !== -2) {
$ERROR('#6: x = -1; (x\\u000A-=\\u000A1) === -2');
}
assert.sameValue(x
-=
1, -2, 'U+000A (expression)');
assert.sameValue(x, -2, 'U+000A (side effect)');
//CHECK#7
x = -1;
if ((eval("x\u000D-=\u000D1")) !== -2) {
$ERROR('#7: x = -1; (x\\u000D-=\\u000D1) === -2');
}
assert.sameValue(x -= 1, -2, 'U+000D (expression)');
assert.sameValue(x, -2, 'U+000D (side effect)');
//CHECK#8
x = -1;
if ((eval("x\u2028-=\u20281")) !== -2) {
$ERROR('#8: x = -1; (x\\u2028-=\\u20281) === -2');
}
assert.sameValue(x-=1, -2, 'U+2028 (expression)');
assert.sameValue(x, -2, 'U+2028 (side effect)');
//CHECK#9
x = -1;
if ((eval("x\u2029-=\u20291")) !== -2) {
$ERROR('#9: x = -1; (x\\u2029-=\\u20291) === -2');
}
assert.sameValue(x-=1, -2, 'U+2029 (expression)');
assert.sameValue(x, -2, 'U+2029 (side effect)');
//CHECK#10
x = -1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== -2) {
$ERROR('#10: x = -1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === -2');
}
assert.sameValue(x  
-=  
1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(>>>=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments >>>= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments >>>= 20;

View File

@ -9,10 +9,11 @@ description: >
as the LeftHandSideExpression of a Compound Assignment
operator(>>>=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval >>>= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval >>>= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x >>>= y
var x;
//CHECK#1
x = 1;
if ((eval("x\u0009>>>=\u00091")) !== 0) {
$ERROR('#1: x = 1; (x\\u0009>>>=\\u00091) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+0009 (expression)');
assert.sameValue(x, 0, 'U+0009 (side effect)');
//CHECK#2
x = 1;
if ((eval("x\u000B>>>=\u000B1")) !== 0) {
$ERROR('#2: x = 1; (x\\u000B>>>=\\u000B1) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+000B (expression)');
assert.sameValue(x, 0, 'U+000B (side effect)');
//CHECK#3
x = 1;
if ((eval("x\u000C>>>=\u000C1")) !== 0) {
$ERROR('#3: x = 1; (x\\u000C>>>=\\u000C1) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+000C (expression)');
assert.sameValue(x, 0, 'U+000C (side effect)');
//CHECK#4
x = 1;
if ((eval("x\u0020>>>=\u00201")) !== 0) {
$ERROR('#4: x = 1; (x\\u0020>>>=\\u00201) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+0020 (expression)');
assert.sameValue(x, 0, 'U+0020 (side effect)');
//CHECK#5
x = 1;
if ((eval("x\u00A0>>>=\u00A01")) !== 0) {
$ERROR('#5: x = 1; (x\\u00A0>>>=\\u00A01) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+00A0 (expression)');
assert.sameValue(x, 0, 'U+00A0 (side effect)');
//CHECK#6
x = 1;
if ((eval("x\u000A>>>=\u000A1")) !== 0) {
$ERROR('#6: x = 1; (x\\u000A>>>=\\u000A1) === 0');
}
assert.sameValue(x
>>>=
1, 0, 'U+000A (expression)');
assert.sameValue(x, 0, 'U+000A (side effect)');
//CHECK#7
x = 1;
if ((eval("x\u000D>>>=\u000D1")) !== 0) {
$ERROR('#7: x = 1; (x\\u000D>>>=\\u000D1) === 0');
}
assert.sameValue(x >>>= 1, 0, 'U+000D (expression)');
assert.sameValue(x, 0, 'U+000D (side effect)');
//CHECK#8
x = 1;
if ((eval("x\u2028>>>=\u20281")) !== 0) {
$ERROR('#8: x = 1; (x\\u2028>>>=\\u20281) === 0');
}
assert.sameValue(x>>>=1, 0, 'U+2028 (expression)');
assert.sameValue(x, 0, 'U+2028 (side effect)');
//CHECK#9
x = 1;
if ((eval("x\u2029>>>=\u20291")) !== 0) {
$ERROR('#9: x = 1; (x\\u2029>>>=\\u20291) === 0');
}
assert.sameValue(x>>>=1, 0, 'U+2029 (expression)');
assert.sameValue(x, 0, 'U+2029 (side effect)');
//CHECK#10
x = 1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>>>=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 0) {
$ERROR('#10: x = 1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>>>=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 0');
}
assert.sameValue(x  
>>>=  
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');

View File

@ -9,17 +9,11 @@ description: >
appear as the LeftHandSideExpression of a Compound Assignment
operator(^=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("arguments ^= 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
throw "Test262: This statement should not be evaluated.";
arguments ^= 20;

View File

@ -8,10 +8,11 @@ description: >
Strict Mode - SyntaxError is thrown if the identifier eval appear
as the LeftHandSideExpression of a Compound Assignment operator(^=)
flags: [onlyStrict]
negative:
phase: parse
type: SyntaxError
---*/
var blah = eval;
assert.throws(SyntaxError, function() {
eval("eval ^= 20;");
});
assert.sameValue(blah, eval, 'blah');
throw "Test262: This statement should not be evaluated.";
eval ^= 20;

View File

@ -12,63 +12,46 @@ description: Checking by using eval, check operator is x ^= y
var x;
//CHECK#1
x = 1;
if ((eval("x\u0009^=\u00091")) !== 0) {
$ERROR('#1: x = 1; (x\\u0009^=\\u00091) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+0009 (expression)');
assert.sameValue(x, 0, 'U+0009 (side effect)');
//CHECK#2
x = 1;
if ((eval("x\u000B^=\u000B1")) !== 0) {
$ERROR('#2: x = 1; (x\\u000B^=\\u000B1) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+000B (expression)');
assert.sameValue(x, 0, 'U+000B (side effect)');
//CHECK#3
x = 1;
if ((eval("x\u000C^=\u000C1")) !== 0) {
$ERROR('#3: x = 1; (x\\u000C^=\\u000C1) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+000C (expression)');
assert.sameValue(x, 0, 'U+000C (side effect)');
//CHECK#4
x = 1;
if ((eval("x\u0020^=\u00201")) !== 0) {
$ERROR('#4: x = 1; (x\\u0020^=\\u00201) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+0020 (expression)');
assert.sameValue(x, 0, 'U+0020 (side effect)');
//CHECK#5
x = 1;
if ((eval("x\u00A0^=\u00A01")) !== 0) {
$ERROR('#5: x = 1; (x\\u00A0^=\\u00A01) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+00A0 (expression)');
assert.sameValue(x, 0, 'U+00A0 (side effect)');
//CHECK#6
x = 1;
if ((eval("x\u000A^=\u000A1")) !== 0) {
$ERROR('#6: x = 1; (x\\u000A^=\\u000A1) === 0');
}
assert.sameValue(x
^=
1, 0, 'U+000A (expression)');
assert.sameValue(x, 0, 'U+000A (side effect)');
//CHECK#7
x = 1;
if ((eval("x\u000D^=\u000D1")) !== 0) {
$ERROR('#7: x = 1; (x\\u000D^=\\u000D1) === 0');
}
assert.sameValue(x ^= 1, 0, 'U+000D (expression)');
assert.sameValue(x, 0, 'U+000D (side effect)');
//CHECK#8
x = 1;
if ((eval("x\u2028^=\u20281")) !== 0) {
$ERROR('#8: x = 1; (x\\u2028^=\\u20281) === 0');
}
assert.sameValue(x^=1, 0, 'U+2028 (expression)');
assert.sameValue(x, 0, 'U+2028 (side effect)');
//CHECK#9
x = 1;
if ((eval("x\u2029^=\u20291")) !== 0) {
$ERROR('#9: x = 1; (x\\u2029^=\\u20291) === 0');
}
assert.sameValue(x^=1, 0, 'U+2029 (expression)');
assert.sameValue(x, 0, 'U+2029 (side effect)');
//CHECK#10
x = 1;
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029^=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 0) {
$ERROR('#10: x = 1; (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029^=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 0');
}
assert.sameValue(x  
^=  
1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)');
assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)');