From a1a4e2b1b85efb912fe97965553ec5af8f98e7ab Mon Sep 17 00:00:00 2001 From: Rick Waldron <waldron.rick@gmail.com> Date: Wed, 18 Apr 2018 16:54:30 -0400 Subject: [PATCH] Corrections to sec-web-compat-evaldeclarationinstantiation and sec-web-compat-functiondeclarationinstantiation tests. Fixes gh-1364 (#1509) --- ...ck-decl-eval-source-is-strict-nostrict.js} | 11 ++++-- ...k-decl-eval-source-is-strict-onlystrict.js | 28 +++++++++++++ .../eval-code/direct/block-decl-nostrict.js | 27 +++++++++++++ ...ict-caller.js => block-decl-onlystrict.js} | 12 +++--- ...se-decl-eval-source-is-strict-nostrict.js} | 12 +++--- ...e-decl-eval-source-is-strict-onlystrict.js | 33 ++++++++++++++++ .../direct/switch-case-decl-nostrict.js | 32 +++++++++++++++ ...ller.js => switch-case-decl-onlystrict.js} | 13 ++++--- ...lt-decl-eval-source-is-strict-nostrict.js} | 12 +++--- ...t-decl-eval-source-is-strict-onlystrict.js | 33 ++++++++++++++++ .../direct/switch-dflt-decl-nostrict.js | 32 +++++++++++++++ ...ller.js => switch-dflt-decl-onlystrict.js} | 13 ++++--- .../function-code/block-decl-nostrict.js | 38 ++++++++++++++++++ ...ecl-strict.js => block-decl-onlystrict.js} | 12 +++--- .../switch-case-decl-nostrict.js | 39 +++++++++++++++++++ ...rict.js => switch-case-decl-onlystrict.js} | 13 ++++--- .../switch-dflt-decl-nostrict.js | 39 +++++++++++++++++++ ...rict.js => switch-dflt-decl-onlystrict.js} | 13 ++++--- 18 files changed, 364 insertions(+), 48 deletions(-) rename test/language/eval-code/direct/{block-decl-strict-source.js => block-decl-eval-source-is-strict-nostrict.js} (65%) create mode 100644 test/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict.js create mode 100644 test/language/eval-code/direct/block-decl-nostrict.js rename test/language/eval-code/direct/{block-decl-strict-caller.js => block-decl-onlystrict.js} (68%) rename test/language/eval-code/direct/{switch-case-decl-strict-source.js => switch-case-decl-eval-source-is-strict-nostrict.js} (66%) create mode 100644 test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict.js create mode 100644 test/language/eval-code/direct/switch-case-decl-nostrict.js rename test/language/eval-code/direct/{switch-case-decl-strict-caller.js => switch-case-decl-onlystrict.js} (68%) rename test/language/eval-code/direct/{switch-dflt-decl-strict-source.js => switch-dflt-decl-eval-source-is-strict-nostrict.js} (66%) create mode 100644 test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict.js create mode 100644 test/language/eval-code/direct/switch-dflt-decl-nostrict.js rename test/language/eval-code/direct/{switch-dflt-decl-strict-caller.js => switch-dflt-decl-onlystrict.js} (68%) create mode 100644 test/language/function-code/block-decl-nostrict.js rename test/language/function-code/{block-decl-strict.js => block-decl-onlystrict.js} (74%) create mode 100644 test/language/function-code/switch-case-decl-nostrict.js rename test/language/function-code/{switch-case-decl-strict.js => switch-case-decl-onlystrict.js} (73%) create mode 100644 test/language/function-code/switch-dflt-decl-nostrict.js rename test/language/function-code/{switch-dflt-decl-strict.js => switch-dflt-decl-onlystrict.js} (73%) diff --git a/test/language/eval-code/direct/block-decl-strict-source.js b/test/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js similarity index 65% rename from test/language/eval-code/direct/block-decl-strict-source.js rename to test/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js index dad6f7563b..12deaa67fa 100644 --- a/test/language/eval-code/direct/block-decl-strict-source.js +++ b/test/language/eval-code/direct/block-decl-eval-source-is-strict-nostrict.js @@ -1,14 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.2 +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration info: | - Block statement in eval code containing a function declaration - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [noStrict] ---*/ var err; diff --git a/test/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict.js b/test/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict.js new file mode 100644 index 0000000000..0ee638614a --- /dev/null +++ b/test/language/eval-code/direct/block-decl-eval-source-is-strict-onlystrict.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('"use strict";{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); + diff --git a/test/language/eval-code/direct/block-decl-nostrict.js b/test/language/eval-code/direct/block-decl-nostrict.js new file mode 100644 index 0000000000..97e159c119 --- /dev/null +++ b/test/language/eval-code/direct/block-decl-nostrict.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('{ function f() {} }'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err, undefined); diff --git a/test/language/eval-code/direct/block-decl-strict-caller.js b/test/language/eval-code/direct/block-decl-onlystrict.js similarity index 68% rename from test/language/eval-code/direct/block-decl-strict-caller.js rename to test/language/eval-code/direct/block-decl-onlystrict.js index 43a29e0b2b..2a61cb4467 100644 --- a/test/language/eval-code/direct/block-decl-strict-caller.js +++ b/test/language/eval-code/direct/block-decl-onlystrict.js @@ -1,15 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.2 -flags: [onlyStrict] +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in eval code containing a function declaration info: | - Block statement in eval code containing a function declaration - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err; diff --git a/test/language/eval-code/direct/switch-case-decl-strict-source.js b/test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js similarity index 66% rename from test/language/eval-code/direct/switch-case-decl-strict-source.js rename to test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js index 6c5835de0b..e58338702d 100644 --- a/test/language/eval-code/direct/switch-case-decl-strict-source.js +++ b/test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-nostrict.js @@ -1,15 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.3 +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code info: | - Function declaration in the `case` clause of a `switch` statement in eval - code - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [noStrict] ---*/ var err; diff --git a/test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict.js b/test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict.js new file mode 100644 index 0000000000..0368049c07 --- /dev/null +++ b/test/language/eval-code/direct/switch-case-decl-eval-source-is-strict-onlystrict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); diff --git a/test/language/eval-code/direct/switch-case-decl-nostrict.js b/test/language/eval-code/direct/switch-case-decl-nostrict.js new file mode 100644 index 0000000000..808debf607 --- /dev/null +++ b/test/language/eval-code/direct/switch-case-decl-nostrict.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('\ + switch (1) {\ + case 1:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err, undefined); diff --git a/test/language/eval-code/direct/switch-case-decl-strict-caller.js b/test/language/eval-code/direct/switch-case-decl-onlystrict.js similarity index 68% rename from test/language/eval-code/direct/switch-case-decl-strict-caller.js rename to test/language/eval-code/direct/switch-case-decl-onlystrict.js index 604da83499..3c9277fa04 100644 --- a/test/language/eval-code/direct/switch-case-decl-strict-caller.js +++ b/test/language/eval-code/direct/switch-case-decl-onlystrict.js @@ -1,16 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.3 -flags: [onlyStrict] +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in eval code info: | - Function declaration in the `case` clause of a `switch` statement in eval - code - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err; diff --git a/test/language/eval-code/direct/switch-dflt-decl-strict-source.js b/test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js similarity index 66% rename from test/language/eval-code/direct/switch-dflt-decl-strict-source.js rename to test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js index f601fd23c5..4370569bc3 100644 --- a/test/language/eval-code/direct/switch-dflt-decl-strict-source.js +++ b/test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-nostrict.js @@ -1,15 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.3 +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in eval code info: | - Function declaration in the `default` clause of a `switch` statement in - eval code - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [noStrict] ---*/ var err; diff --git a/test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict.js b/test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict.js new file mode 100644 index 0000000000..fd16e8d146 --- /dev/null +++ b/test/language/eval-code/direct/switch-dflt-decl-eval-source-is-strict-onlystrict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [onlyStrict] +---*/ + +var err; + +eval('\ + "use strict";\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err.constructor, ReferenceError); diff --git a/test/language/eval-code/direct/switch-dflt-decl-nostrict.js b/test/language/eval-code/direct/switch-dflt-decl-nostrict.js new file mode 100644 index 0000000000..623e518457 --- /dev/null +++ b/test/language/eval-code/direct/switch-dflt-decl-nostrict.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in eval code +info: | + B.3.3.3 Changes to EvalDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err; + +eval('\ + switch (1) {\ + default:\ + function f() { }\ + }\ +'); + +try { + f; +} catch (exception) { + err = exception; +} + +assert.sameValue(err, undefined); diff --git a/test/language/eval-code/direct/switch-dflt-decl-strict-caller.js b/test/language/eval-code/direct/switch-dflt-decl-onlystrict.js similarity index 68% rename from test/language/eval-code/direct/switch-dflt-decl-strict-caller.js rename to test/language/eval-code/direct/switch-dflt-decl-onlystrict.js index fcf5e87190..067ea894eb 100644 --- a/test/language/eval-code/direct/switch-dflt-decl-strict-caller.js +++ b/test/language/eval-code/direct/switch-dflt-decl-onlystrict.js @@ -1,16 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.3 -flags: [onlyStrict] +esid: sec-web-compat-evaldeclarationinstantiation +description: > + AnnexB extension not honored in strict mode: Function declaration + in the `default` clause of a `switch` statement in eval code info: | - Function declaration in the `default` clause of a `switch` statement in - eval code - B.3.3.3 Changes to EvalDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err; diff --git a/test/language/function-code/block-decl-nostrict.js b/test/language/function-code/block-decl-nostrict.js new file mode 100644 index 0000000000..9ac8aad823 --- /dev/null +++ b/test/language/function-code/block-decl-nostrict.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in function code containing a function declaration +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err1, err2; + +(function() { + try { + f; + } catch (exception) { + err1 = exception; + } + + { + function f() { } + } + + try { + f; + } catch (exception) { + err2 = exception; + } +}()); + +assert.sameValue(err1, undefined); +assert.sameValue(err2, undefined); diff --git a/test/language/function-code/block-decl-strict.js b/test/language/function-code/block-decl-onlystrict.js similarity index 74% rename from test/language/function-code/block-decl-strict.js rename to test/language/function-code/block-decl-onlystrict.js index 573176b80d..39342a4d19 100644 --- a/test/language/function-code/block-decl-strict.js +++ b/test/language/function-code/block-decl-onlystrict.js @@ -1,15 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.1 -flags: [onlyStrict] +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Block statement + in function code containing a function declaration info: | - Block statement in function code containing a function declaration - B.3.3.1 Changes to FunctionDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err1, err2; diff --git a/test/language/function-code/switch-case-decl-nostrict.js b/test/language/function-code/switch-case-decl-nostrict.js new file mode 100644 index 0000000000..6be9587e09 --- /dev/null +++ b/test/language/function-code/switch-case-decl-nostrict.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in function code +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err1, err2; + +(function() { + try { + f; + } catch (exception) { + err1 = exception; + } + + switch (1) { + case 1: + function f() { } + } + + try { + f; + } catch (exception) { + err2 = exception; + } +}()); + +assert.sameValue(err1, undefined); +assert.sameValue(err2, undefined); diff --git a/test/language/function-code/switch-case-decl-strict.js b/test/language/function-code/switch-case-decl-onlystrict.js similarity index 73% rename from test/language/function-code/switch-case-decl-strict.js rename to test/language/function-code/switch-case-decl-onlystrict.js index 783da6cceb..045605f8b6 100644 --- a/test/language/function-code/switch-case-decl-strict.js +++ b/test/language/function-code/switch-case-decl-onlystrict.js @@ -1,16 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.1 -flags: [onlyStrict] +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `case` clause of a `switch` statement in function code info: | - Function declaration in the `case` clause of a `switch` statement in - function code - B.3.3.1 Changes to FunctionDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err1, err2; diff --git a/test/language/function-code/switch-dflt-decl-nostrict.js b/test/language/function-code/switch-dflt-decl-nostrict.js new file mode 100644 index 0000000000..9b66c97a8f --- /dev/null +++ b/test/language/function-code/switch-dflt-decl-nostrict.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in function code +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + 1. If strict is false, then + ... + +flags: [noStrict] +---*/ + +var err1, err2; + +(function() { + try { + f; + } catch (exception) { + err1 = exception; + } + + switch (1) { + default: + function f() { } + } + + try { + f; + } catch (exception) { + err2 = exception; + } +}()); + +assert.sameValue(err1, undefined); +assert.sameValue(err2, undefined); diff --git a/test/language/function-code/switch-dflt-decl-strict.js b/test/language/function-code/switch-dflt-decl-onlystrict.js similarity index 73% rename from test/language/function-code/switch-dflt-decl-strict.js rename to test/language/function-code/switch-dflt-decl-onlystrict.js index 0b5369db24..9b58961655 100644 --- a/test/language/function-code/switch-dflt-decl-strict.js +++ b/test/language/function-code/switch-dflt-decl-onlystrict.js @@ -1,16 +1,17 @@ // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- -description: AnnexB extension not honored in strict mode -es6id: B.3.3.1 -flags: [onlyStrict] +esid: sec-web-compat-functiondeclarationinstantiation +description: > + AnnexB extension not honored in strict mode, Function declaration + in the `default` clause of a `switch` statement in function code info: | - Function declaration in the `default` clause of a `switch` statement in - function code - B.3.3.1 Changes to FunctionDeclarationInstantiation 1. If strict is false, then + ... + +flags: [onlyStrict] ---*/ var err1, err2; -- GitLab