diff options
author | Leonardo Balter <leonardo.balter@gmail.com> | 2017-03-14 16:24:26 -0400 |
---|---|---|
committer | Leonardo Balter <leonardo.balter@gmail.com> | 2017-03-14 16:27:56 -0400 |
commit | 41370bcb994d564b9b3ea35734ed1a6939e1bc9a (patch) | |
tree | 099313c36baa808030cc2fbe2fd6c15048d373ba /src/arguments | |
parent | aa2c69960df33b96634d4b4f44a7c2b0f2038815 (diff) | |
download | qtdeclarative-testsuites-41370bcb994d564b9b3ea35734ed1a6939e1bc9a.tar.gz |
Create tests for trailing comma on arguments list
Diffstat (limited to 'src/arguments')
18 files changed, 473 insertions, 0 deletions
diff --git a/src/arguments/default/cls-decl-gen-meth-static.template b/src/arguments/default/cls-decl-gen-meth-static.template new file mode 100644 index 000000000..e57381376 --- /dev/null +++ b/src/arguments/default/cls-decl-gen-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-decl-gen-meth-static- +name: class declaration generator method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +class C { + static *method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-gen-meth.template b/src/arguments/default/cls-decl-gen-meth.template new file mode 100644 index 000000000..d24c31401 --- /dev/null +++ b/src/arguments/default/cls-decl-gen-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-decl-gen-meth- +name: class declaration generator method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +class C { + *method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-meth-static.template b/src/arguments/default/cls-decl-meth-static.template new file mode 100644 index 000000000..ea045e283 --- /dev/null +++ b/src/arguments/default/cls-decl-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-decl-meth-static- +name: static class declaration method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +class C { + static method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-decl-meth.template b/src/arguments/default/cls-decl-meth.template new file mode 100644 index 000000000..b7f09f8dd --- /dev/null +++ b/src/arguments/default/cls-decl-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-decl-meth- +name: class declaration method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +class C { + method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-gen-meth-static.template b/src/arguments/default/cls-expr-gen-meth-static.template new file mode 100644 index 000000000..1fefb34ee --- /dev/null +++ b/src/arguments/default/cls-expr-gen-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-expr-gen-meth-static- +name: static class expression generator method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var C = class { + static *method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-gen-meth.template b/src/arguments/default/cls-expr-gen-meth.template new file mode 100644 index 000000000..0781417d6 --- /dev/null +++ b/src/arguments/default/cls-expr-gen-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-expr-gen-meth- +name: class expression generator method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var C = class { + *method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-meth-static.template b/src/arguments/default/cls-expr-meth-static.template new file mode 100644 index 000000000..57dfc2293 --- /dev/null +++ b/src/arguments/default/cls-expr-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-expr-meth-static- +name: static class expression method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var C = class { + static method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/cls-expr-meth.template b/src/arguments/default/cls-expr-meth.template new file mode 100644 index 000000000..99d5c5687 --- /dev/null +++ b/src/arguments/default/cls-expr-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/cls-expr-meth- +name: class expression method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var C = class { + method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/default/func-decl.template b/src/arguments/default/func-decl.template new file mode 100644 index 000000000..271dac007 --- /dev/null +++ b/src/arguments/default/func-decl.template @@ -0,0 +1,25 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/func-decl- +name: function declaration +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function ref(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} + +ref(/*{ args }*/); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/arguments/default/func-expr.template b/src/arguments/default/func-expr.template new file mode 100644 index 000000000..58fc72285 --- /dev/null +++ b/src/arguments/default/func-expr.template @@ -0,0 +1,26 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/func-expr- +name: function expression +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +ref(/*{ args }*/); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/arguments/default/gen-func-decl.template b/src/arguments/default/gen-func-decl.template new file mode 100644 index 000000000..b9e7fdcc9 --- /dev/null +++ b/src/arguments/default/gen-func-decl.template @@ -0,0 +1,25 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/gen-func-decl- +name: generator function declaration +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} + +ref(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/arguments/default/gen-func-expr.template b/src/arguments/default/gen-func-expr.template new file mode 100644 index 000000000..70baf6f7a --- /dev/null +++ b/src/arguments/default/gen-func-expr.template @@ -0,0 +1,26 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/gen-func-expr- +name: generator function expression +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +ref(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/arguments/default/gen-meth.template b/src/arguments/default/gen-meth.template new file mode 100644 index 000000000..a459aecf6 --- /dev/null +++ b/src/arguments/default/gen-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/gen-meth- +name: generator method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var obj = { + *method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/src/arguments/default/meth.template b/src/arguments/default/meth.template new file mode 100644 index 000000000..5cbe57184 --- /dev/null +++ b/src/arguments/default/meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/arguments-object/meth- +name: method +esid: sec-arguments-exotic-objects +info: | + 9.4.4 Arguments Exotic Objects + + Most ECMAScript functions make an arguments object available to their code. Depending upon the + characteristics of the function definition, its arguments object is either an ordinary object + or an arguments exotic object. +---*/ + +var callCount = 0; +var obj = { + method(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/arguments/trailing-comma-multiple-args.case b/src/arguments/trailing-comma-multiple-args.case new file mode 100644 index 000000000..6fec35a0c --- /dev/null +++ b/src/arguments/trailing-comma-multiple-args.case @@ -0,0 +1,21 @@ +// Copyright (C) 2016 Jeff Morrison. All rights reserved. +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: A trailing comma should not increase the arguments.length, using multiple args +template: default +esid: prod-Arguments +info: | + Trailing comma in the arguments list + + 12.3 Left-Hand-Side Expressions + + Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) +---*/ + +//- args +42, 'TC39', +//- body +assert.sameValue(arguments.length, 2); +assert.sameValue(arguments[0], 42); +assert.sameValue(arguments[1], 'TC39'); diff --git a/src/arguments/trailing-comma-null.case b/src/arguments/trailing-comma-null.case new file mode 100644 index 000000000..1eb48aa0f --- /dev/null +++ b/src/arguments/trailing-comma-null.case @@ -0,0 +1,20 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: A trailing comma after null should not increase the arguments.length +template: default +esid: prod-Arguments +info: | + Trailing comma in the arguments list + + 12.3 Left-Hand-Side Expressions + + Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) +---*/ + +//- args +42, null, +//- body +assert.sameValue(arguments.length, 2); +assert.sameValue(arguments[0], 42); +assert.sameValue(arguments[1], null); diff --git a/src/arguments/trailing-comma-single-args.case b/src/arguments/trailing-comma-single-args.case new file mode 100644 index 000000000..33eceeb58 --- /dev/null +++ b/src/arguments/trailing-comma-single-args.case @@ -0,0 +1,20 @@ +// Copyright (C) 2016 Jeff Morrison. All rights reserved. +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: A trailing comma should not increase the arguments.length, using a single arg +template: default +esid: prod-Arguments +info: | + Trailing comma in the arguments list + + 12.3 Left-Hand-Side Expressions + + Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) +---*/ + +//- args +42, +//- body +assert.sameValue(arguments.length, 1); +assert.sameValue(arguments[0], 42); diff --git a/src/arguments/trailing-comma-undefined.case b/src/arguments/trailing-comma-undefined.case new file mode 100644 index 000000000..c8cd3ec3b --- /dev/null +++ b/src/arguments/trailing-comma-undefined.case @@ -0,0 +1,20 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: A trailing comma after undefined should not increase the arguments.length +template: default +esid: prod-Arguments +info: | + Trailing comma in the arguments list + + 12.3 Left-Hand-Side Expressions + + Arguments[Yield, Await] : ( ArgumentList[?Yield, ?Await] , ) +---*/ + +//- args +42, undefined, +//- body +assert.sameValue(arguments.length, 2); +assert.sameValue(arguments[0], 42); +assert.sameValue(arguments[1], undefined); |