From 874ce565ed695ad9878b6adec12d5d30b844014a Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Mon, 6 Mar 2017 16:03:59 -0500 Subject: [PATCH] Generate tests --- .../block-decl-func-skip-dft-param.js | 31 +++++++++++++++ ...if-decl-else-decl-a-func-skip-dft-param.js | 38 +++++++++++++++++++ ...if-decl-else-decl-b-func-skip-dft-param.js | 38 +++++++++++++++++++ .../if-decl-else-stmt-func-skip-dft-param.js | 38 +++++++++++++++++++ .../if-decl-no-else-func-skip-dft-param.js | 38 +++++++++++++++++++ .../if-stmt-else-decl-func-skip-dft-param.js | 38 +++++++++++++++++++ .../switch-case-func-skip-dft-param.js | 32 ++++++++++++++++ .../switch-dflt-func-skip-dft-param.js | 32 ++++++++++++++++ 8 files changed, 285 insertions(+) create mode 100644 test/annexB/language/function-code/block-decl-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-a-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/if-decl-else-decl-b-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/if-decl-else-stmt-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/if-decl-no-else-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/if-stmt-else-decl-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/switch-case-func-skip-dft-param.js create mode 100644 test/annexB/language/function-code/switch-dflt-func-skip-dft-param.js diff --git a/test/annexB/language/function-code/block-decl-func-skip-dft-param.js b/test/annexB/language/function-code/block-decl-func-skip-dft-param.js new file mode 100644 index 0000000000..66a0277f8d --- /dev/null +++ b/test/annexB/language/function-code/block-decl-func-skip-dft-param.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/block.template +/*--- +description: Extension not observed when there is a default parameter with the same name (Block statement in function scope containing a function declaration) +esid: sec-web-compat-functiondeclarationinstantiation +es6id: B.3.3.1 +flags: [generated, noStrict] +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + { + function f() { } + } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-dft-param.js b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-dft-param.js new file mode 100644 index 0000000000..433480599a --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-a-func-skip-dft-param.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/if-decl-else-decl-a.template +/*--- +description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in both statement positions in function scope) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.4 +flags: [generated, noStrict] +info: | + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + if (true) function f() { } else function _f() {} + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-dft-param.js b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-dft-param.js new file mode 100644 index 0000000000..2219770e56 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-decl-b-func-skip-dft-param.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/if-decl-else-decl-b.template +/*--- +description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in both statement positions in function scope) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.4 +flags: [generated, noStrict] +info: | + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + if (false) function _f() {} else function f() { } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/if-decl-else-stmt-func-skip-dft-param.js b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-dft-param.js new file mode 100644 index 0000000000..d0557e8c96 --- /dev/null +++ b/test/annexB/language/function-code/if-decl-else-stmt-func-skip-dft-param.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/if-decl-else-stmt.template +/*--- +description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in the first statement position in function scope) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.4 +flags: [generated, noStrict] +info: | + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + if (true) function f() { } else ; + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/if-decl-no-else-func-skip-dft-param.js b/test/annexB/language/function-code/if-decl-no-else-func-skip-dft-param.js new file mode 100644 index 0000000000..9778293eac --- /dev/null +++ b/test/annexB/language/function-code/if-decl-no-else-func-skip-dft-param.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/if-decl-no-else.template +/*--- +description: Extension not observed when there is a default parameter with the same name (IfStatement without an else clause in function scope) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.4 +flags: [generated, noStrict] +info: | + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + if (true) function f() { } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/if-stmt-else-decl-func-skip-dft-param.js b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-dft-param.js new file mode 100644 index 0000000000..869b5d08b9 --- /dev/null +++ b/test/annexB/language/function-code/if-stmt-else-decl-func-skip-dft-param.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/if-stmt-else-decl.template +/*--- +description: Extension not observed when there is a default parameter with the same name (IfStatement with a declaration in the second statement position in function scope) +esid: sec-functiondeclarations-in-ifstatement-statement-clauses +es6id: B.3.4 +flags: [generated, noStrict] +info: | + The following rules for IfStatement augment those in 13.6: + + IfStatement[Yield, Return]: + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else Statement[?Yield, ?Return] + if ( Expression[In, ?Yield] ) Statement[?Yield, ?Return] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] else FunctionDeclaration[?Yield] + if ( Expression[In, ?Yield] ) FunctionDeclaration[?Yield] + + + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + if (false) ; else function f() { } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/switch-case-func-skip-dft-param.js b/test/annexB/language/function-code/switch-case-func-skip-dft-param.js new file mode 100644 index 0000000000..8ad5fa9765 --- /dev/null +++ b/test/annexB/language/function-code/switch-case-func-skip-dft-param.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/switch-case.template +/*--- +description: Extension not observed when there is a default parameter with the same name (Function declaration in the `case` clause of a `switch` statement in function scope) +esid: sec-web-compat-functiondeclarationinstantiation +es6id: B.3.3.1 +flags: [generated, noStrict] +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + switch (1) { + case 1: + function f() { } + } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation'); diff --git a/test/annexB/language/function-code/switch-dflt-func-skip-dft-param.js b/test/annexB/language/function-code/switch-dflt-func-skip-dft-param.js new file mode 100644 index 0000000000..d9100fefd4 --- /dev/null +++ b/test/annexB/language/function-code/switch-dflt-func-skip-dft-param.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/annex-b-fns/func-skip-dft-param.case +// - src/annex-b-fns/func/switch-dflt.template +/*--- +description: Extension not observed when there is a default parameter with the same name (Funtion declaration in the `default` clause of a `switch` statement in function scope) +esid: sec-web-compat-functiondeclarationinstantiation +es6id: B.3.3.1 +flags: [generated, noStrict] +info: | + B.3.3.1 Changes to FunctionDeclarationInstantiation + + [...] + ii. If replacing the FunctionDeclaration f with a VariableStatement that + has F as a BindingIdentifier would not produce any Early Errors for + func and F is not an element of BoundNames of argumentsList, then + [...] +---*/ +var init, after; + +(function(f = 123) { + init = f; + + switch (1) { + default: + function f() { } + } + + after = f; +}()); + +assert.sameValue(init, 123, 'binding is not initialized to `undefined`'); +assert.sameValue(after, 123, 'value is not updated following evaluation');