mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Merge pull request #2118 from jugglinmike/refactor-for-parsers-with
Refactor `with` statement tests for parsers
This commit is contained in:
commit
93f2bae981
@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-1-s
|
||||
description: with statement in strict mode throws SyntaxError (strict function)
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
// wrapping it in eval since this needs to be a syntax error. The
|
||||
// exception thrown must be a SyntaxError exception.
|
||||
eval("\
|
||||
function f() {\
|
||||
\'use strict\';\
|
||||
var o = {}; \
|
||||
with (o) {};\
|
||||
}\
|
||||
");
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-15-s
|
||||
description: >
|
||||
Strict Mode - SyntaxError is thrown when the RHS of a dot property
|
||||
assignment utilizes WithStatement
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("var obj = {}; obj.get = function (a) { with(a){} }; ");
|
||||
});
|
@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-16-s
|
||||
description: >
|
||||
Strict Mode - SyntaxError is thrown when the RHS of an object
|
||||
indexer assignment utilizes WithStatement
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("var obj = {}; obj['get'] = function (a) { with(a){} }; ");
|
||||
});
|
@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-2-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (nested function
|
||||
where container is strict)
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
// wrapping it in eval since this needs to be a syntax error. The
|
||||
// exception thrown must be a SyntaxError exception.
|
||||
eval("\
|
||||
function foo() {\
|
||||
\'use strict\'; \
|
||||
function f() {\
|
||||
var o = {}; \
|
||||
with (o) {};\
|
||||
}\
|
||||
}\
|
||||
");
|
||||
});
|
@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-3-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (nested strict
|
||||
function)
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
// wrapping it in eval since this needs to be a syntax error. The
|
||||
// exception thrown must be a SyntaxError exception.
|
||||
eval("\
|
||||
function foo() {\
|
||||
function f() {\
|
||||
\'use strict\'; \
|
||||
var o = {}; \
|
||||
with (o) {};\
|
||||
}\
|
||||
}\
|
||||
");
|
||||
});
|
@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-7-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (function
|
||||
expression, where the container function is directly evaled from
|
||||
strict code)
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("var f = function () {\
|
||||
var o = {}; \
|
||||
with (o) {}; \
|
||||
}\
|
||||
");
|
||||
});
|
@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-9-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (strict function
|
||||
expression)
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("\
|
||||
var f = function () {\
|
||||
\'use strict\';\
|
||||
var o = {}; \
|
||||
with (o) {}; \
|
||||
}\
|
||||
");
|
||||
});
|
@ -4,12 +4,14 @@
|
||||
/*---
|
||||
es5id: 12.10.1-11-s
|
||||
description: >
|
||||
Strict Mode - SyntaxError is thrown when using WithStatement in
|
||||
strict mode code
|
||||
Strict Mode - SyntaxError is thrown when using WithStatement in strict mode
|
||||
code
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("with ({}) { throw new Error();}");
|
||||
});
|
||||
with ({}) {}
|
23
test/language/statements/with/strict-fn-decl-nested-1.js
Normal file
23
test/language/statements/with/strict-fn-decl-nested-1.js
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-2-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (nested function where
|
||||
container is strict)
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
function foo() {
|
||||
'use strict';
|
||||
function f() {
|
||||
var o = {};
|
||||
with (o) {};
|
||||
}
|
||||
}
|
22
test/language/statements/with/strict-fn-decl-nested-2.js
Normal file
22
test/language/statements/with/strict-fn-decl-nested-2.js
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-3-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (nested strict function)
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
function foo() {
|
||||
function f() {
|
||||
'use strict';
|
||||
var o = {};
|
||||
with (o) {};
|
||||
}
|
||||
}
|
19
test/language/statements/with/strict-fn-decl.js
Normal file
19
test/language/statements/with/strict-fn-decl.js
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-1-s
|
||||
description: with statement in strict mode throws SyntaxError (strict function)
|
||||
flags: [noStrict]
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
function f() {
|
||||
'use strict';
|
||||
var o = {};
|
||||
with (o) {};
|
||||
}
|
19
test/language/statements/with/strict-fn-expr.js
Normal file
19
test/language/statements/with/strict-fn-expr.js
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
es5id: 12.10.1-7-s
|
||||
description: >
|
||||
with statement in strict mode throws SyntaxError (function expression)
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var f = function () {
|
||||
var o = {};
|
||||
with (o) {};
|
||||
};
|
@ -4,12 +4,14 @@
|
||||
/*---
|
||||
es5id: 12.10.1-14-s
|
||||
description: >
|
||||
Strict Mode - SyntaxError is thrown when the getter of a literal
|
||||
object utilizes WithStatement
|
||||
Strict Mode - SyntaxError is thrown when the getter of a literal object
|
||||
utilizes WithStatement
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
assert.throws(SyntaxError, function() {
|
||||
eval("var obj = { get(a) { with(a){} } }; ");
|
||||
});
|
||||
var obj = { get(a) { with(a){} } };
|
Loading…
x
Reference in New Issue
Block a user