Skip to content
Snippets Groups Projects
Unverified Commit 642d8837 authored by Rick Waldron's avatar Rick Waldron Committed by GitHub
Browse files

Merge pull request #1375 from jugglinmike/refactor-for-parsers-assignment

Refactor AssignmentExpression tests for parsers
parents dc2596e8 025b44f3
No related branches found
No related tags found
No related merge requests found
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.13.1-4-29-s
description: >
Strict Mode - SyntaxError is thrown if the identifier 'arguments'
appears as the LeftHandSideExpression of simple assignment(=)
under strict mode
flags: [onlyStrict]
---*/
function testcase() {
var err = null;
var blah = arguments;
try {
eval("var arguments = 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, arguments, 'blah');
}
testcase();
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.13.1-4-31-s
description: >
Strict Mode - SyntaxError is thrown if the identifier 'arguments'
appears as the LeftHandSideExpression (PrimaryExpression) of
simple assignment(=) under strict mode
flags: [onlyStrict]
---*/
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();
// Copyright (c) 2012 Ecma International. All rights reserved. // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es5id: 11.13.1-4-30-s es5id: 11.13.1-4-30-s
description: > description: >
Strict Mode - SyntaxError is thrown if the identifier 'eval' Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears as
appears as the LeftHandSideExpression (PrimaryExpression) of the LeftHandSideExpression (PrimaryExpression) of simple assignment(=).
simple assignment(=) under strict mode negative:
phase: early
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
var blah = eval; throw "Test262: This statement should not be evaluated.";
assert.throws(SyntaxError, function() {
eval("(eval) = 20;"); (arguments) = 20;
});
assert.sameValue(blah, eval, 'blah');
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.13.1-4-30-s
description: >
Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the
LeftHandSideExpression (PrimaryExpression) of simple assignment(=).
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
throw "Test262: This statement should not be evaluated.";
(eval) = 20;
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: >
White Space between LeftHandSideExpression and "=" or between "=" and
AssignmentExpression is allowed
es5id: 11.13.1_A1
---*/
var x;
x
=
true;
if (x !== true) {
$ERROR('#6: (x\\u000A=\\u000Atrue) === true');
}
// Copyright 2009 the Sputnik authors. All rights reserved. // Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
info: > description: >
White Space and Line Terminator between LeftHandSideExpression and "=" or White Space between LeftHandSideExpression and "=" or between "=" and
between "=" and AssignmentExpression are allowed AssignmentExpression is allowed
es5id: 11.13.1_A1 es5id: 11.13.1_A1
description: Checking by using eval
flags: [noStrict]
---*/ ---*/
//CHECK#1 var x;
if ((eval("x\u0009=\u0009true")) !== true) {
x = 'U+0009';
if (x !== 'U+0009') {
$ERROR('#1: (x\\u0009=\\u0009true) === true'); $ERROR('#1: (x\\u0009=\\u0009true) === true');
} }
//CHECK#2 x = 'U+000B';
if ((eval("x\u000B=\u000Btrue")) !== true) { if (x !== 'U+000B') {
$ERROR('#2: (x\\u000B=\\u000Btrue) === true'); $ERROR('#2: (x\\u000B=\\u000Btrue) === true');
} }
//CHECK#3 x = 'U+000C';
if ((eval("x\u000C=\u000Ctrue")) !== true) { if (x !== 'U+000C') {
$ERROR('#3: (x\\u000C=\\u000Ctrue) === true'); $ERROR('#3: (x\\u000C=\\u000Ctrue) === true');
} }
//CHECK#4 x = 'U+0020';
if ((eval("x\u0020=\u0020true")) !== true) { if (x !== 'U+0020') {
$ERROR('#4: (x\\u0020=\\u0020true) === true'); $ERROR('#4: (x\\u0020=\\u0020true) === true');
} }
//CHECK#5 x = 'U+00A0';
if ((eval("x\u00A0=\u00A0true")) !== true) { if (x !== 'U+00A0') {
$ERROR('#5: (x\\u00A0=\\u00A0true) === true'); $ERROR('#5: (x\\u00A0=\\u00A0true) === true');
} }
//CHECK#6 x='U+000D';
if ((eval("x\u000A=\u000Atrue")) !== true) { if (x !== 'U+000D') {
$ERROR('#6: (x\\u000A=\\u000Atrue) === true');
}
//CHECK#7
if ((eval("x\u000D=\u000Dtrue")) !== true) {
$ERROR('#7: (x\\u000D=\\u000Dtrue) === true'); $ERROR('#7: (x\\u000D=\\u000Dtrue) === true');
} }
//CHECK#8 x='U+2028';
if ((eval("x\u2028=\u2028true")) !== true) { if (x !== 'U+2028') {
$ERROR('#8: (x\\u2028=\\u2028true) === true'); $ERROR('#8: (x\\u2028=\\u2028true) === true');
} }
//CHECK#9 x='U+2029';
if ((eval("x\u2029=\u2029true")) !== true) { if (x !== 'U+2029') {
$ERROR('#9: (x\\u2029=\\u2029true) === true'); $ERROR('#9: (x\\u2029=\\u2029true) === true');
} }
x 

= 

'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029';
//CHECK#10 if (x !== 'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029') {
if ((eval("x\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { $ERROR('#10: (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029true) === true');
$ERROR('#10: (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true');
} }
......
// Copyright (c) 2012 Ecma International. All rights reserved. // Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
es5id: 11.13.1-4-28-s es5id: 11.13.1-4-28-s
description: > description: >
Strict Mode - SyntaxError is thrown if the identifier 'eval' Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears
appears as the LeftHandSideExpression of simple assignment(=) as the LeftHandSideExpression of simple assignment(=) under strict mode
under strict mode negative:
phase: early
type: SyntaxError
flags: [onlyStrict] flags: [onlyStrict]
---*/ ---*/
function testcase() { throw "Test262: This statement should not be evaluated.";
var err = null;
var blah = eval; var arguments;
try {
eval("var eval = 20;");
} catch (e) {
err = e;
}
assert(err instanceof SyntaxError, 'err instanceof SyntaxError');
assert.sameValue(blah, eval, 'blah');
}
testcase();
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es5id: 11.13.1-4-28-s
description: >
Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the
LeftHandSideExpression of simple assignment(=) under strict mode
negative:
phase: early
type: SyntaxError
flags: [onlyStrict]
---*/
throw "Test262: This statement should not be evaluated.";
var eval;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment