diff --git a/test/language/expressions/compound-assignment/add-arguments-strict.js b/test/language/expressions/compound-assignment/add-arguments-strict.js index e3b13283cb..1ebf1f0184 100644 --- a/test/language/expressions/compound-assignment/add-arguments-strict.js +++ b/test/language/expressions/compound-assignment/add-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/add-eval-strict.js b/test/language/expressions/compound-assignment/add-eval-strict.js index 8112a1cfb0..28e8a7ae59 100644 --- a/test/language/expressions/compound-assignment/add-eval-strict.js +++ b/test/language/expressions/compound-assignment/add-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/add-whitespace.js b/test/language/expressions/compound-assignment/add-whitespace.js index 45932d97ea..2aa3cd991a 100644 --- a/test/language/expressions/compound-assignment/add-whitespace.js +++ b/test/language/expressions/compound-assignment/add-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/and-arguments-strict.js b/test/language/expressions/compound-assignment/and-arguments-strict.js index 7393e00f85..52b4c12661 100644 --- a/test/language/expressions/compound-assignment/and-arguments-strict.js +++ b/test/language/expressions/compound-assignment/and-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/and-eval-strict.js b/test/language/expressions/compound-assignment/and-eval-strict.js index 05a33d5d52..99727c6e76 100644 --- a/test/language/expressions/compound-assignment/and-eval-strict.js +++ b/test/language/expressions/compound-assignment/and-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/and-whitespace.js b/test/language/expressions/compound-assignment/and-whitespace.js index c56f6c2c58..b54c0b185c 100644 --- a/test/language/expressions/compound-assignment/and-whitespace.js +++ b/test/language/expressions/compound-assignment/and-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/div-arguments-strict.js b/test/language/expressions/compound-assignment/div-arguments-strict.js index 3589c8096c..55634e45de 100644 --- a/test/language/expressions/compound-assignment/div-arguments-strict.js +++ b/test/language/expressions/compound-assignment/div-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/div-eval-strict.js b/test/language/expressions/compound-assignment/div-eval-strict.js index ca4eebfeaa..0f9cbbb1c6 100644 --- a/test/language/expressions/compound-assignment/div-eval-strict.js +++ b/test/language/expressions/compound-assignment/div-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/div-whitespace.js b/test/language/expressions/compound-assignment/div-whitespace.js index ea79f598d8..d565da5cea 100644 --- a/test/language/expressions/compound-assignment/div-whitespace.js +++ b/test/language/expressions/compound-assignment/div-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/lshift-arguments-strict.js b/test/language/expressions/compound-assignment/lshift-arguments-strict.js index fc2b89db42..71521fc1bc 100644 --- a/test/language/expressions/compound-assignment/lshift-arguments-strict.js +++ b/test/language/expressions/compound-assignment/lshift-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/lshift-eval-strict.js b/test/language/expressions/compound-assignment/lshift-eval-strict.js index 00e5553bee..f1c8ae3fd8 100644 --- a/test/language/expressions/compound-assignment/lshift-eval-strict.js +++ b/test/language/expressions/compound-assignment/lshift-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/lshift-whitespace.js b/test/language/expressions/compound-assignment/lshift-whitespace.js index 717d6f4031..895e1d9c0b 100644 --- a/test/language/expressions/compound-assignment/lshift-whitespace.js +++ b/test/language/expressions/compound-assignment/lshift-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/mod-arguments-strict.js b/test/language/expressions/compound-assignment/mod-arguments-strict.js index 8431a57b94..818c13caaa 100644 --- a/test/language/expressions/compound-assignment/mod-arguments-strict.js +++ b/test/language/expressions/compound-assignment/mod-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/mod-eval-strict.js b/test/language/expressions/compound-assignment/mod-eval-strict.js index 81ab6d6ec2..251b9a8175 100644 --- a/test/language/expressions/compound-assignment/mod-eval-strict.js +++ b/test/language/expressions/compound-assignment/mod-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/mod-whitespace.js b/test/language/expressions/compound-assignment/mod-whitespace.js index 9dcf963f38..2a6058174d 100644 --- a/test/language/expressions/compound-assignment/mod-whitespace.js +++ b/test/language/expressions/compound-assignment/mod-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/mult-arguments-strict.js b/test/language/expressions/compound-assignment/mult-arguments-strict.js index c18ad8c111..84610c68fe 100644 --- a/test/language/expressions/compound-assignment/mult-arguments-strict.js +++ b/test/language/expressions/compound-assignment/mult-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/mult-eval-strict.js b/test/language/expressions/compound-assignment/mult-eval-strict.js index 0735095eee..fc4fa396f9 100644 --- a/test/language/expressions/compound-assignment/mult-eval-strict.js +++ b/test/language/expressions/compound-assignment/mult-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/mult-whitespace.js b/test/language/expressions/compound-assignment/mult-whitespace.js index 02dca5a4d6..736c3f300c 100644 --- a/test/language/expressions/compound-assignment/mult-whitespace.js +++ b/test/language/expressions/compound-assignment/mult-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/or-arguments-strict.js b/test/language/expressions/compound-assignment/or-arguments-strict.js index a9c7f53603..94fce92edf 100644 --- a/test/language/expressions/compound-assignment/or-arguments-strict.js +++ b/test/language/expressions/compound-assignment/or-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/or-eval-strict.js b/test/language/expressions/compound-assignment/or-eval-strict.js index 2af00e037f..049ba00fbc 100644 --- a/test/language/expressions/compound-assignment/or-eval-strict.js +++ b/test/language/expressions/compound-assignment/or-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/or-whitespace.js b/test/language/expressions/compound-assignment/or-whitespace.js index 45d6e457aa..3ac191c281 100644 --- a/test/language/expressions/compound-assignment/or-whitespace.js +++ b/test/language/expressions/compound-assignment/or-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/srshift-arguments-strict.js b/test/language/expressions/compound-assignment/srshift-arguments-strict.js index c4036bb8e8..b2225f7b3d 100644 --- a/test/language/expressions/compound-assignment/srshift-arguments-strict.js +++ b/test/language/expressions/compound-assignment/srshift-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/srshift-eval-strict.js b/test/language/expressions/compound-assignment/srshift-eval-strict.js index 4a05589764..2e716827f8 100644 --- a/test/language/expressions/compound-assignment/srshift-eval-strict.js +++ b/test/language/expressions/compound-assignment/srshift-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/srshift-whitespace.js b/test/language/expressions/compound-assignment/srshift-whitespace.js index 6e0cfaa34c..972ad8a502 100644 --- a/test/language/expressions/compound-assignment/srshift-whitespace.js +++ b/test/language/expressions/compound-assignment/srshift-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/sub-arguments-strict.js b/test/language/expressions/compound-assignment/sub-arguments-strict.js index ea511ece18..ea51207691 100644 --- a/test/language/expressions/compound-assignment/sub-arguments-strict.js +++ b/test/language/expressions/compound-assignment/sub-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/sub-eval-strict.js b/test/language/expressions/compound-assignment/sub-eval-strict.js index 137babb15d..d473bd2435 100644 --- a/test/language/expressions/compound-assignment/sub-eval-strict.js +++ b/test/language/expressions/compound-assignment/sub-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/sub-whitespace.js b/test/language/expressions/compound-assignment/sub-whitespace.js index 1957077c37..2e7cee8972 100644 --- a/test/language/expressions/compound-assignment/sub-whitespace.js +++ b/test/language/expressions/compound-assignment/sub-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/urshift-arguments-strict.js b/test/language/expressions/compound-assignment/urshift-arguments-strict.js index 29e35931a3..1446712dec 100644 --- a/test/language/expressions/compound-assignment/urshift-arguments-strict.js +++ b/test/language/expressions/compound-assignment/urshift-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/urshift-eval-strict.js b/test/language/expressions/compound-assignment/urshift-eval-strict.js index 6e0e44ad76..1fe46c025b 100644 --- a/test/language/expressions/compound-assignment/urshift-eval-strict.js +++ b/test/language/expressions/compound-assignment/urshift-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/urshift-whitespace.js b/test/language/expressions/compound-assignment/urshift-whitespace.js index 510126bd5c..efc070d1c2 100644 --- a/test/language/expressions/compound-assignment/urshift-whitespace.js +++ b/test/language/expressions/compound-assignment/urshift-whitespace.js @@ -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)'); diff --git a/test/language/expressions/compound-assignment/xor-arguments-strict.js b/test/language/expressions/compound-assignment/xor-arguments-strict.js index 12c06cb94d..8d57c684f3 100644 --- a/test/language/expressions/compound-assignment/xor-arguments-strict.js +++ b/test/language/expressions/compound-assignment/xor-arguments-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/xor-eval-strict.js b/test/language/expressions/compound-assignment/xor-eval-strict.js index 50a241543e..8c3a8c1ce4 100644 --- a/test/language/expressions/compound-assignment/xor-eval-strict.js +++ b/test/language/expressions/compound-assignment/xor-eval-strict.js @@ -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; diff --git a/test/language/expressions/compound-assignment/xor-whitespace.js b/test/language/expressions/compound-assignment/xor-whitespace.js index 13741c6bca..be1d9d3124 100644 --- a/test/language/expressions/compound-assignment/xor-whitespace.js +++ b/test/language/expressions/compound-assignment/xor-whitespace.js @@ -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)');