Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Unified Diff: test/mjsunit/regress/redeclaration-error-types.js

Issue 2064793002: Revert of change most cases of variable redeclaration from TypeError to SyntaxError (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/es6/block-eval-var-over-let.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/redeclaration-error-types.js
diff --git a/test/mjsunit/regress/redeclaration-error-types.js b/test/mjsunit/regress/redeclaration-error-types.js
deleted file mode 100644
index 72e097db5707c06c5f9eea9f5a4cc1c227c66515..0000000000000000000000000000000000000000
--- a/test/mjsunit/regress/redeclaration-error-types.js
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-function doTest(scripts, expectedError) {
- var realm = Realm.create();
-
- for (var i = 0; i < scripts.length - 1; i++) {
- Realm.eval(realm, scripts[i]);
- }
- assertThrows(function() {
- Realm.eval(realm, scripts[scripts.length - 1]);
- }, Realm.eval(realm, expectedError));
-
- Realm.dispose(realm);
-}
-
-var tests = [
- {
- // ES#sec-globaldeclarationinstantiation 5.a:
- // If envRec.HasVarDeclaration(name) is true, throw a SyntaxError
- // exception.
- scripts: [
- "var a;",
- "let a;",
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-globaldeclarationinstantiation 6.a:
- // If envRec.HasLexicalDeclaration(name) is true, throw a SyntaxError
- // exception.
- scripts: [
- "let a;",
- "var a;",
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-globaldeclarationinstantiation 5.b:
- // If envRec.HasLexicalDeclaration(name) is true, throw a SyntaxError
- // exception.
- scripts: [
- "let a;",
- "let a;",
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 5.a.i.1:
- // If varEnvRec.HasLexicalDeclaration(name) is true, throw a SyntaxError
- // exception.
- scripts: [
- 'let a; eval("var a;");',
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 5.a.i.1:
- // If varEnvRec.HasLexicalDeclaration(name) is true, throw a SyntaxError
- // exception.
- scripts: [
- 'let a; eval("function a() {}");',
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 5.d.ii.2.a.i:
- // Throw a SyntaxError exception.
- scripts: [
- '(function() { let a; eval("var a;"); })();',
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 5.d.ii.2.a.i:
- // Throw a SyntaxError exception.
- scripts: [
- '(function() { let a; eval("function a() {}"); })();',
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-globaldeclarationinstantiation 5.d:
- // If hasRestrictedGlobal is true, throw a SyntaxError exception.
- scripts: [
- 'let NaN;',
- ],
- expectedError: "SyntaxError",
- },
- {
- // ES#sec-globaldeclarationinstantiation 5.d:
- // If hasRestrictedGlobal is true, throw a SyntaxError exception.
- scripts: [
- 'function NaN() {}',
- ],
- expectedError: "SyntaxError",
- },
-
- {
- // ES#sec-evaldeclarationinstantiation 8.a.iv.1.b:
- // If fnDefinable is false, throw a TypeError exception.
- scripts: [
- 'eval("function NaN() {}");',
- ],
- expectedError: "TypeError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 8.a.iv.1.b:
- // If fnDefinable is false, throw a TypeError exception.
- scripts: [
- `
- let a;
- try {
- eval("function a() {}");
- } catch (e) {}
- eval("function NaN() {}");
- `,
- ],
- expectedError: "TypeError",
- },
- {
- // ES#sec-evaldeclarationinstantiation 8.a.iv.1.b:
- // If fnDefinable is false, throw a TypeError exception.
- scripts: [
- `
- eval("
- function f() {
- function b() {
- (0, eval)('function NaN() {}');
- }
- b();
- }
- f();
- ");
- `.replace(/"/g, '`'),
- ],
- expectedError: "TypeError",
- },
-];
-
-tests.forEach(function(test) {
- doTest(test.scripts, test.expectedError);
-});
« no previous file with comments | « test/mjsunit/es6/block-eval-var-over-let.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698