diff options
Diffstat (limited to 'js/src/tests/test262/language/function-code')
219 files changed, 4365 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-1-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-1-s.js new file mode 100644 index 0000000000..7ff0b13d9f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-1-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-1-s +description: this is not coerced to an object in strict mode (Number) +flags: [noStrict] +---*/ + +function foo() +{ + 'use strict'; + return typeof(this); +} + +function bar() +{ + return typeof(this); +} + +assert.sameValue(foo.call(1), 'number', 'foo.call(1)'); +assert.sameValue(bar.call(1), 'object', 'bar.call(1)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-10-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-10-s.js new file mode 100644 index 0000000000..1791707301 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-10-s.js @@ -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: 10.4.3-1-10-s +description: > + Strict Mode - checking 'this' (FunctionExpression includes strict + directive prologue) +flags: [noStrict] +---*/ + +var f = function () { + "use strict"; + return typeof this; +} + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-100-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-100-s.js new file mode 100644 index 0000000000..c3e6aa145a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-100-s.js @@ -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: 10.4.3-1-100-s +description: > + Strict Mode - checking 'this' (strict function passed as arg to + String.prototype.replace) +---*/ + +var x = 3; + +function f() { + "use strict"; + x = this; + return "a"; +} + +assert.sameValue("ab".replace("b", f), "aa", '"ab".replace("b", f)'); +assert.sameValue(x, undefined, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-100gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-100gs.js new file mode 100644 index 0000000000..acb3b0f743 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-100gs.js @@ -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: 10.4.3-1-100gs +description: > + Strict Mode - checking 'this' (strict function passed as arg to + String.prototype.replace) +---*/ + +var x = 3; + +function f() { + "use strict"; + x = this; + return "a"; +} +if (("ab".replace("b", f)!=="aa") || (x!==undefined)) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-101-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-101-s.js new file mode 100644 index 0000000000..2c334e9e63 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-101-s.js @@ -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: 10.4.3-1-101-s +description: > + Strict Mode - checking 'this' (non-strict function passed as arg + to String.prototype.replace from strict context) +flags: [noStrict] +---*/ + +var x = 3; + +function f() { + x = this; + return "a"; +} + +assert.sameValue(function() {"use strict"; return "ab".replace("b", f);}(), "aa"); +assert.sameValue(x, this, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-101gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-101gs.js new file mode 100644 index 0000000000..f468140ab4 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-101gs.js @@ -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: 10.4.3-1-101gs +description: > + Strict Mode - checking 'this' (non-strict function passed as arg + to String.prototype.replace from strict context) +flags: [noStrict] +---*/ + +var x = 3; + +function f() { + x = this; + return "a"; +} + +if ( (!(function() {"use strict"; return "ab".replace("b", f)==="aa";}())) || (x!==this)) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-102-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-102-s.js new file mode 100644 index 0000000000..cc8531636e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-102-s.js @@ -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: 10.4.3-1-102-s +description: > + Strict Mode - checking 'this' (strict anonymous function passed as + arg to String.prototype.replace) +---*/ + +var x = 3; + +assert.sameValue("ab".replace("b", (function () { + "use strict"; + return function () { + x = this; + return "a"; + } +})()), "aa"); +assert.sameValue(x, undefined, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-102gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-102gs.js new file mode 100644 index 0000000000..35a2c0c5b6 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-102gs.js @@ -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: 10.4.3-1-102gs +description: > + Strict Mode - checking 'this' (strict anonymous function passed as + arg to String.prototype.replace) +---*/ + +var x = 3; +if ( ("ab".replace("b", (function () { + "use strict"; + return function () { + x = this; + return "a"; + } +})())!=="aa") || (x!==undefined)) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-103.js b/js/src/tests/test262/language/function-code/10.4.3-1-103.js new file mode 100644 index 0000000000..1dcdabbd3a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-103.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-103 +description: > + Non strict mode should ToObject thisArg if not an object. + Abstract equality operator should succeed. +---*/ + +Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); + +assert.sameValue((5).x == 0, false, '(5).x == 0'); +assert((5).x == 5, '(5).x == 5'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-104-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-104-strict.js new file mode 100644 index 0000000000..11525977a5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-104-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-104 +description: > + Strict mode should not ToObject thisArg if not an object. Strict + equality operator should succeed. +flags: [onlyStrict] +---*/ + +Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); + +assert((5).x === 5, '(5).x === 5'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-105.js b/js/src/tests/test262/language/function-code/10.4.3-1-105.js new file mode 100644 index 0000000000..2130b58dea --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-105.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Created based on feedback in + https://bugs.ecmascript.org/show_bug.cgi?id=333 +es5id: 10.4.3-1-105 +description: > + Non strict mode should ToObject thisArg if not an object. Return + type should be object and strict equality should fail. +flags: [noStrict] +---*/ + +Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); + +assert.sameValue((5).x === 5, false, '(5).x === 5'); +assert.sameValue(typeof (5).x, "object", 'typeof (5).x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-106-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-106-strict.js new file mode 100644 index 0000000000..1f8a5f7b7e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-106-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Created based on feedback in + https://bugs.ecmascript.org/show_bug.cgi?id=333 +es5id: 10.4.3-1-106 +description: > + Strict mode should not ToObject thisArg if not an object. Return + type should be 'number'. +flags: [onlyStrict] +---*/ + +Object.defineProperty(Object.prototype, "x", { get: function () { return this; } }); + +assert.sameValue(typeof (5).x, "number", 'typeof (5).x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-10gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-10gs.js new file mode 100644 index 0000000000..a11b1e1259 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-10gs.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-10gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = function () { + "use strict"; + return typeof this; +} +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-11-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-11-s-strict.js new file mode 100644 index 0000000000..172e550bd0 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-11-s-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-11-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within strict mode) +flags: [onlyStrict] +---*/ + +assert.sameValue((function () { + return typeof this; +})(), "undefined"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-11gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-11gs-strict.js new file mode 100644 index 0000000000..5a03c900bd --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-11gs-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-11gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within strict mode) +flags: [onlyStrict] +---*/ + +if ((function () { + return typeof this; +})() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-12-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-12-s.js new file mode 100644 index 0000000000..8d3ca30626 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-12-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-12-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + includes strict directive prologue) +flags: [noStrict] +---*/ + +assert.sameValue((function () { + "use strict"; + return typeof this; +})(), "undefined"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-12gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-12gs.js new file mode 100644 index 0000000000..b5cf68c407 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-12gs.js @@ -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: 10.4.3-1-12gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression includes strict directive prologue) +flags: [noStrict] +---*/ + +if ((function () { + "use strict"; + return typeof this; +})() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-13-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-13-s-strict.js new file mode 100644 index 0000000000..9914fcc7f4 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-13-s-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-13-s +description: > + Strict Mode - checking 'this' (Function constructor defined within + strict mode) +flags: [onlyStrict] +---*/ + +var f = Function("return typeof this;"); + +assert.notSameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-13gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-13gs-strict.js new file mode 100644 index 0000000000..63b37560ed --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-13gs-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-13gs +description: > + Strict - checking 'this' from a global scope (Function constructor + defined within strict mode) +flags: [onlyStrict] +---*/ + +var f = Function("return typeof this;"); +if (f() === "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-14-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-14-s.js new file mode 100644 index 0000000000..a9164ddfd9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-14-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-14-s +description: > + Strict Mode - checking 'this' (Function constructor includes + strict directive prologue) +flags: [noStrict] +---*/ + +var f = Function("\"use strict\";\nreturn typeof this;"); + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-14gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-14gs.js new file mode 100644 index 0000000000..3fc5fee50b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-14gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-14gs +description: > + Strict - checking 'this' from a global scope (Function constructor + includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = Function("\"use strict\";\nreturn typeof this;"); +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-15-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-15-s-strict.js new file mode 100644 index 0000000000..c2dbf97d87 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-15-s-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-15-s +description: > + Strict Mode - checking 'this' (New'ed Function constructor defined + within strict mode) +flags: [onlyStrict] +---*/ + +var f = new Function("return typeof this;"); + +assert.notSameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-15gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-15gs-strict.js new file mode 100644 index 0000000000..d31d968e09 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-15gs-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-15gs +description: > + Strict - checking 'this' from a global scope (New'ed Function + constructor defined within strict mode) +flags: [onlyStrict] +---*/ + +var f = new Function("return typeof this;"); +if (f() === "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-16-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-16-s.js new file mode 100644 index 0000000000..291624ec37 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-16-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-16-s +description: > + Strict Mode - checking 'this' (New'ed Function constructor + includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = new Function("\"use strict\";\nreturn typeof this;"); + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-16gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-16gs.js new file mode 100644 index 0000000000..2a0510317d --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-16gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-16gs +description: > + Strict - checking 'this' from a global scope (New'ed Function + constructor includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = new Function("\"use strict\";\nreturn typeof this;"); +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-17-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-17-s-strict.js new file mode 100644 index 0000000000..a91606bbde --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-17-s-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-17-s +description: Strict Mode - checking 'this' (eval used within strict mode) +flags: [onlyStrict] +---*/ + +var global = this; + +function testcase() { + assert.sameValue(eval("typeof this"), "undefined", 'eval("typeof this")'); + assert.notSameValue(eval("this"), global, 'eval("this")'); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-17gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-17gs-strict.js new file mode 100644 index 0000000000..984d6e9ddf --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-17gs-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-17gs +description: > + Strict - checking 'this' from a global scope (eval used within + strict mode) +flags: [onlyStrict] +---*/ + +if (eval("this") !== this) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-18gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-18gs.js new file mode 100644 index 0000000000..9d8bfcfedc --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-18gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-18gs +description: > + Strict - checking 'this' from a global scope (eval includes strict + directive prologue) +flags: [noStrict] +---*/ + +if (eval("\"use strict\";\nthis") !== this) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-19-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-19-s-strict.js new file mode 100644 index 0000000000..93ece2f7d4 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-19-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-19-s +description: > + Strict Mode - checking 'this' (indirect eval used within strict + mode) +flags: [onlyStrict] +---*/ + +var global = this; + +function testcase() { +var my_eval = eval; +assert.sameValue(my_eval("this"), global, 'my_eval("this")'); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-19gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-19gs-strict.js new file mode 100644 index 0000000000..21352c0dee --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-19gs-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-19gs +description: > + Strict - checking 'this' from a global scope (indirect eval used + within strict mode) +flags: [onlyStrict] +---*/ + +var my_eval = eval; +if (my_eval("this") !== this) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-2-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-2-s.js new file mode 100644 index 0000000000..926abb8b18 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-2-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-2-s +description: this is not coerced to an object in strict mode (string) +flags: [noStrict] +---*/ + +function foo() +{ + 'use strict'; + return typeof(this); +} + +function bar() +{ + return typeof(this); +} + +assert.sameValue(foo.call('1'), 'string', 'foo.call("1")'); +assert.sameValue(bar.call('1'), 'object', 'bar.call("1")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-20-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-20-s.js new file mode 100644 index 0000000000..85cf68cc1e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-20-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-20-s +description: > + Strict Mode - checking 'this' (indirect eval includes strict + directive prologue) +flags: [noStrict] +---*/ + +var global = this; + +function testcase() { +var my_eval = eval; +assert.sameValue(my_eval("\"use strict\";\nthis"), this); +} +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-20gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-20gs.js new file mode 100644 index 0000000000..c970d6d7da --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-20gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-20gs +description: > + Strict - checking 'this' from a global scope (indirect eval + includes strict directive prologue) +flags: [noStrict] +---*/ + +var my_eval = eval; +if (my_eval("\"use strict\";\nthis") !== this ) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-21-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-21-s-strict.js new file mode 100644 index 0000000000..c5c8e3de4a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-21-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-21-s +description: > + Strict Mode - checking 'this' (New'ed object from + FunctionDeclaration defined within strict mode) +flags: [onlyStrict] +---*/ + +function f() { + return this; +} + +assert.notSameValue((new f()), this, '(new f())'); +assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-21gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-21gs-strict.js new file mode 100644 index 0000000000..e3dd74db43 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-21gs-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-21gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + FunctionDeclaration defined within strict mode) +flags: [onlyStrict] +---*/ + +function f() { + return this; +} +if (((new f()) === this) || (typeof (new f()) === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-22-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-22-s.js new file mode 100644 index 0000000000..4085358da5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-22-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-22-s +description: > + Strict Mode - checking 'this' (New'ed object from + FunctionDeclaration includes strict directive prologue) +flags: [noStrict] +---*/ + +function f() { + "use strict"; + return this; +} + +assert.notSameValue((new f()), this, '(new f())'); +assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-22gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-22gs.js new file mode 100644 index 0000000000..fa793b68a2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-22gs.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-22gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + FunctionDeclaration includes strict directive prologue) +flags: [noStrict] +---*/ + +function f() { + "use strict"; + return this; +} +if (((new f()) === this) || (typeof (new f()) === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-23-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-23-s-strict.js new file mode 100644 index 0000000000..05c4c508b1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-23-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-23-s +description: > + Strict Mode - checking 'this' (New'ed object from + FunctionExpression defined within strict mode) +flags: [onlyStrict] +---*/ + +var f = function () { + return this; +} + +assert.notSameValue((new f()), this, '(new f())'); +assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-23gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-23gs-strict.js new file mode 100644 index 0000000000..370a4e079d --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-23gs-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-23gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + FunctionExpression defined within strict mode) +flags: [onlyStrict] +---*/ + +var f = function () { + return this; +} +if (((new f()) === this) || (typeof (new f()) === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-24-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-24-s.js new file mode 100644 index 0000000000..08c293c9b2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-24-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-24-s +description: > + Strict Mode - checking 'this' (New'ed object from + FunctionExpression includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = function () { + "use strict"; + return this; +} + +assert.notSameValue((new f()), this, '(new f())'); +assert.notSameValue(typeof (new f()), "undefined", 'typeof (new f())'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-24gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-24gs.js new file mode 100644 index 0000000000..6751c29e23 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-24gs.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-24gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + FunctionExpression includes strict directive prologue) +flags: [noStrict] +---*/ + +var f = function () { + "use strict"; + return this; +} +if (((new f()) === this) || (typeof (new f()) === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-25-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-25-s-strict.js new file mode 100644 index 0000000000..3881673182 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-25-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-25-s +description: > + Strict Mode - checking 'this' (New'ed object from Anonymous + FunctionExpression defined within strict mode) +flags: [onlyStrict] +---*/ + +var obj = new (function () { + return this; +}); + +assert.notSameValue(obj, this, 'obj'); +assert.notSameValue((typeof obj), "undefined", '(typeof obj)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-25gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-25gs-strict.js new file mode 100644 index 0000000000..d74607d745 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-25gs-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-25gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + Anonymous FunctionExpression defined within strict mode) +flags: [onlyStrict] +---*/ + +var obj = new (function () { + return this; +}); +if ((obj === this) || (typeof obj === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-26-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-26-s.js new file mode 100644 index 0000000000..5866feb488 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-26-s.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-26-s +description: > + Strict Mode - checking 'this' (New'ed object from Anonymous + FunctionExpression includes strict directive prologue) +flags: [noStrict] +---*/ + +var obj = new (function () { + "use strict"; + return this; +}); + +assert.notSameValue(obj, this, 'obj'); +assert.notSameValue((typeof obj), "undefined", '(typeof obj)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-26gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-26gs.js new file mode 100644 index 0000000000..0161d49004 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-26gs.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-26gs +description: > + Strict - checking 'this' from a global scope (New'ed object from + Anonymous FunctionExpression includes strict directive prologue) +flags: [noStrict] +---*/ + +var obj = new (function () { + "use strict"; + return this; +}); +if ((obj === this) || (typeof obj === "undefined")) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-27-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-27-s-strict.js new file mode 100644 index 0000000000..4d742f9597 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-27-s-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-27-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + a FunctionDeclaration inside strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-27gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-27gs-strict.js new file mode 100644 index 0000000000..21f8c53aeb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-27gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-27gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within a FunctionDeclaration inside strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-28-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-28-s-strict.js new file mode 100644 index 0000000000..f26d1faa37 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-28-s-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-28-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within a + FunctionDeclaration inside strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-28gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-28gs-strict.js new file mode 100644 index 0000000000..4e59fb8e43 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-28gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-28gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within a FunctionDeclaration inside strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-29-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-29-s-strict.js new file mode 100644 index 0000000000..f13d076b93 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-29-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-29-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within a FunctionDeclaration inside strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-29gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-29gs-strict.js new file mode 100644 index 0000000000..16d13d4bb3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-29gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-29gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within a FunctionDeclaration inside + strict mode) +flags: [onlyStrict] +---*/ + +function f1() { + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-3-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-3-s.js new file mode 100644 index 0000000000..8ca7bba0ab --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-3-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-3-s +description: this is not coerced to an object in strict mode (undefined) +flags: [noStrict] +---*/ + +function foo() +{ + 'use strict'; + return typeof(this); +} + +function bar() +{ + return typeof(this); +} + +assert.sameValue(foo.call(undefined), 'undefined', 'foo.call(undefined)'); +assert.sameValue(bar.call(), 'object', 'bar.call()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-30-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-30-s-strict.js new file mode 100644 index 0000000000..43ba3a2cb5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-30-s-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-30-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + a FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-30gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-30gs-strict.js new file mode 100644 index 0000000000..7ab0cd2fc9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-30gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-30gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within a FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-31-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-31-s-strict.js new file mode 100644 index 0000000000..d6158e0edd --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-31-s-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-31-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within a + FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-31gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-31gs-strict.js new file mode 100644 index 0000000000..be3c582a56 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-31gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-31gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within a FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-32-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-32-s-strict.js new file mode 100644 index 0000000000..e8e98db593 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-32-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-32-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within a FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-32gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-32gs-strict.js new file mode 100644 index 0000000000..6127b27a16 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-32gs-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-32gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within a FunctionExpression inside + strict mode) +flags: [onlyStrict] +---*/ + +var f1 = function () { + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-33-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-33-s-strict.js new file mode 100644 index 0000000000..8baf937673 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-33-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-33-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + an Anonymous FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +(function () { + function f() { + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-33gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-33gs-strict.js new file mode 100644 index 0000000000..76f6d820bd --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-33gs-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-33gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within an Anonymous FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +if (! ((function () { + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-34-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-34-s-strict.js new file mode 100644 index 0000000000..f86944d472 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-34-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-34-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within + an Anonymous FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +(function () { + var f = function () { + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-34gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-34gs-strict.js new file mode 100644 index 0000000000..ae8ef8c0d9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-34gs-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-34gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within an Anonymous FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +if (! ((function () { + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-35-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-35-s-strict.js new file mode 100644 index 0000000000..c9797e1c6e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-35-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-35-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within an Anonymous FunctionExpression inside strict mode) +flags: [onlyStrict] +---*/ + +(function () { + assert.sameValue((function () { + return typeof this; + })(), "undefined"); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-35gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-35gs-strict.js new file mode 100644 index 0000000000..5b9f9ea1fd --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-35gs-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-35gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within an Anonymous FunctionExpression + inside strict mode) +flags: [onlyStrict] +---*/ + +if (! ((function () { + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-36-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-36-s.js new file mode 100644 index 0000000000..9f56c7e942 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-36-s.js @@ -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: 10.4.3-1-36-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + a FunctionDeclaration with a strict directive prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-36gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-36gs.js new file mode 100644 index 0000000000..81231dd2bb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-36gs.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-36gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within a FunctionDeclaration with a strict directive + prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-37-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-37-s.js new file mode 100644 index 0000000000..88f46fd9d5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-37-s.js @@ -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: 10.4.3-1-37-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within a + FunctionDeclaration with a strict directive prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-37gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-37gs.js new file mode 100644 index 0000000000..dbfad246af --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-37gs.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-37gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within a FunctionDeclaration with a strict directive + prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-38-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-38-s.js new file mode 100644 index 0000000000..c84b4ad660 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-38-s.js @@ -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: 10.4.3-1-38-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within a FunctionDeclaration with a strict directive + prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-38gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-38gs.js new file mode 100644 index 0000000000..908d01a529 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-38gs.js @@ -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: 10.4.3-1-38gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within a FunctionDeclaration with a + strict directive prologue) +flags: [noStrict] +---*/ + +function f1() { + "use strict"; + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-39-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-39-s.js new file mode 100644 index 0000000000..5d358bc451 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-39-s.js @@ -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: 10.4.3-1-39-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + a FunctionExpression with a strict directive prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-39gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-39gs.js new file mode 100644 index 0000000000..2ec3a219a2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-39gs.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-39gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within a FunctionExpression with a strict directive + prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-4-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-4-s.js new file mode 100644 index 0000000000..bb82b9e11a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-4-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-4-s +description: this is not coerced to an object in strict mode (boolean) +flags: [noStrict] +---*/ + +function foo() +{ + 'use strict'; + return typeof(this); +} + +function bar() +{ + return typeof(this); +} + +assert.sameValue(foo.call(true), 'boolean', 'foo.call(true)'); +assert.sameValue(bar.call(true), 'object', 'bar.call(true)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-40-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-40-s.js new file mode 100644 index 0000000000..6ee8a54433 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-40-s.js @@ -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: 10.4.3-1-40-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within a + FunctionExpression with a strict directive prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-40gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-40gs.js new file mode 100644 index 0000000000..65c92679b3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-40gs.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-40gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within a FunctionExpression with a strict directive + prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-41-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-41-s.js new file mode 100644 index 0000000000..ab32d842e3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-41-s.js @@ -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: 10.4.3-1-41-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within a FunctionExpression with a strict directive + prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-41gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-41gs.js new file mode 100644 index 0000000000..e1d1076485 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-41gs.js @@ -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: 10.4.3-1-41gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within a FunctionExpression with a + strict directive prologue) +flags: [noStrict] +---*/ + +var f1 = function () { + "use strict"; + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-42-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-42-s.js new file mode 100644 index 0000000000..9b0deabef5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-42-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-42-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + an Anonymous FunctionExpression with a strict directive prologue) +flags: [noStrict] +---*/ + +(function () { + "use strict"; + function f() { + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-42gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-42gs.js new file mode 100644 index 0000000000..bfe3f3c671 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-42gs.js @@ -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: 10.4.3-1-42gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within an Anonymous FunctionExpression with a strict + directive prologue) +flags: [noStrict] +---*/ + +if (! ((function () { + "use strict"; + function f() { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-43-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-43-s.js new file mode 100644 index 0000000000..0e4d90a11c --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-43-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-43-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within + an Anonymous FunctionExpression with a strict directive prologue) +flags: [noStrict] +---*/ + +(function () { + "use strict"; + var f = function () { + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-43gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-43gs.js new file mode 100644 index 0000000000..fc6da8a6a7 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-43gs.js @@ -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: 10.4.3-1-43gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within an Anonymous FunctionExpression with a strict + directive prologue) +flags: [noStrict] +---*/ + +if (! ((function () { + "use strict"; + var f = function () { + return typeof this; + } + return (f()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-44-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-44-s.js new file mode 100644 index 0000000000..46c61ba084 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-44-s.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-44-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression + defined within an Anonymous FunctionExpression with a strict + directive prologue) +flags: [noStrict] +---*/ + +(function () { + "use strict"; + assert.sameValue((function () { + return typeof this; + })(), "undefined"); + assert.sameValue(typeof this, "undefined", 'typeof this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-44gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-44gs.js new file mode 100644 index 0000000000..86590fbc16 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-44gs.js @@ -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: 10.4.3-1-44gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression defined within an Anonymous FunctionExpression + with a strict directive prologue) +flags: [noStrict] +---*/ + +if (! ((function () { + "use strict"; + return ((function () { + return typeof this; + })()==="undefined") && ((typeof this)==="undefined"); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-45-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-45-s.js new file mode 100644 index 0000000000..2f6a3f178b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-45-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-45-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration with a strict + directive prologue defined within a FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + function f() { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-45gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-45gs.js new file mode 100644 index 0000000000..608b0e264f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-45gs.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-45gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + with a strict directive prologue defined within a + FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + function f() { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-46-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-46-s.js new file mode 100644 index 0000000000..94f909ef92 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-46-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-46-s +description: > + Strict Mode - checking 'this' (FunctionExpression with a strict + directive prologue defined within a FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + var f = function () { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-46gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-46gs.js new file mode 100644 index 0000000000..6e413db790 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-46gs.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-46gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + with a strict directive prologue defined within a + FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + var f = function () { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-47-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-47-s.js new file mode 100644 index 0000000000..391702e09d --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-47-s.js @@ -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: 10.4.3-1-47-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression with a + strict directive prologue defined within a FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + return ((function () { + "use strict"; + return typeof this; + })()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-47gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-47gs.js new file mode 100644 index 0000000000..26d3744ea8 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-47gs.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-47gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression with a strict directive prologue defined within + a FunctionDeclaration) +flags: [noStrict] +---*/ + +var global = this; + +function f1() { + return ((function () { + "use strict"; + return typeof this; + })()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-48-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-48-s.js new file mode 100644 index 0000000000..9d65e1d8ba --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-48-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-48-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration with a strict + directive prologue defined within a FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + function f() { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-48gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-48gs.js new file mode 100644 index 0000000000..1ea02a4273 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-48gs.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-48gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + with a strict directive prologue defined within a + FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + function f() { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-49-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-49-s.js new file mode 100644 index 0000000000..d84117be7b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-49-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-49-s +description: > + Strict Mode - checking 'this' (FunctionExpression with a strict + directive prologue defined within a FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + var f = function () { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-49gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-49gs.js new file mode 100644 index 0000000000..38ebdba2ea --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-49gs.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-49gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + with a strict directive prologue defined within a + FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + var f = function () { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-5-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-5-s.js new file mode 100644 index 0000000000..a9884bd65b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-5-s.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-5-s +description: this is not coerced to an object (function) +---*/ + +function foo() +{ + 'use strict'; + return typeof(this); +} + +function bar() +{ + return typeof(this); +} + +function foobar() +{ +} + +assert.sameValue(foo.call(foobar), 'function', 'foo.call(foobar)'); +assert.sameValue(bar.call(foobar), 'function', 'bar.call(foobar)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-50-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-50-s.js new file mode 100644 index 0000000000..e3fc96168e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-50-s.js @@ -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: 10.4.3-1-50-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression with a + strict directive prologue defined within a FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + return ((function () { + "use strict"; + return typeof this; + })()==="undefined") && (this===global); +} + +assert(f1(), 'f1() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-50gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-50gs.js new file mode 100644 index 0000000000..25e0d75d44 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-50gs.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-50gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression with a strict directive prologue defined within + a FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +var f1 = function () { + return ((function () { + "use strict"; + return typeof this; + })()==="undefined") && (this===global); +} +if (! f1()) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-51-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-51-s.js new file mode 100644 index 0000000000..d7167a937b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-51-s.js @@ -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: 10.4.3-1-51-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration with a strict + directive prologue defined within an Anonymous FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +(function () { + function f() { + "use strict"; + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(this, global, 'this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-51gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-51gs.js new file mode 100644 index 0000000000..de055c835c --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-51gs.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-51gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + with a strict directive prologue defined within an Anonymous + FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +if (! ((function () { + function f() { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-52-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-52-s.js new file mode 100644 index 0000000000..63ac62fdd9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-52-s.js @@ -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: 10.4.3-1-52-s +description: > + Strict Mode - checking 'this' (FunctionExpression with a strict + directive prologue defined within an Anonymous FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +(function () { + var f = function () { + "use strict"; + return typeof this; + } + assert.sameValue(f(), "undefined", 'f()'); + assert.sameValue(this, global, 'this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-52gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-52gs.js new file mode 100644 index 0000000000..3b5d217ca0 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-52gs.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-52gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + with a strict directive prologue defined within an Anonymous + FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +if (! ((function () { + var f = function () { + "use strict"; + return typeof this; + } + return (f()==="undefined") && (this===global); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-53-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-53-s.js new file mode 100644 index 0000000000..22f5bd2656 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-53-s.js @@ -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: 10.4.3-1-53-s +description: > + Strict Mode - checking 'this' (Anonymous FunctionExpression with a + strict directive prologue defined within an Anonymous + FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +(function () { + assert.sameValue((function () { + "use strict"; + return typeof this; + })(), "undefined"); + assert.sameValue(this, global, 'this'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-53gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-53gs.js new file mode 100644 index 0000000000..c1d70fc844 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-53gs.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-53gs +description: > + Strict - checking 'this' from a global scope (Anonymous + FunctionExpression with a strict directive prologue defined within + an Anonymous FunctionExpression) +flags: [noStrict] +---*/ + +var global = this; + +if (! ((function () { + return ((function () { + "use strict"; + return typeof this; + })()==="undefined") && (this===global); +})())) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-54-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-54-s.js new file mode 100644 index 0000000000..b9cac1d492 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-54-s.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-54-s +description: > + checking 'this' (Literal getter) +---*/ + +var o = { get foo() { return this; } } + +assert.sameValue(o.foo, o, 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-54gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-54gs.js new file mode 100644 index 0000000000..0166ab8537 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-54gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-54gs +description: > + Strict - checking 'this' from a global scope (Literal getter + defined within strict mode) +flags: [noStrict] +---*/ + +"use strict"; +var o = { get foo() { return this; } } +if (o.foo!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-55-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-55-s.js new file mode 100644 index 0000000000..3e04b19f51 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-55-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-55-s +description: > + Strict Mode - checking 'this' (Literal getter includes strict + directive prologue) +---*/ + +var o = { get foo() { "use strict"; return this; } } + +assert.sameValue(o.foo, o, 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-55gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-55gs.js new file mode 100644 index 0000000000..340014719e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-55gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-55gs +description: > + Strict - checking 'this' from a global scope (Literal getter + includes strict directive prologue) +---*/ + +var o = { get foo() { "use strict"; return this; } } +if (o.foo!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-56-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-56-s.js new file mode 100644 index 0000000000..bde92f42a1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-56-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-56-s +description: > + checking 'this' (Literal setter) +---*/ + +var x = 2; +var o = { set foo(stuff) { x=this; } } +o.foo = 3; + +assert.sameValue(x, o, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-56gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-56gs.js new file mode 100644 index 0000000000..22a5d912ae --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-56gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-56gs +description: > + checking 'this' from a global scope (Literal setter) +---*/ + +var x = 2; +var o = { set foo(stuff) { x=this; } } +o.foo = 3; +if (x!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-57-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-57-s.js new file mode 100644 index 0000000000..51faf1a87c --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-57-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-57-s +description: > + checking 'this' (Literal setter includes strict directive prologue) +---*/ + +var x = 2; +var o = { set foo(stuff) { "use strict"; x=this; } } +o.foo = 3; + +assert.sameValue(x, o, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-57gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-57gs.js new file mode 100644 index 0000000000..d405f42428 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-57gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-57gs +description: > + Checking 'this' from a global scope (Literal setter + includes strict directive prologue) +---*/ + +var x = 2; +var o = { set foo(stuff) { "use strict"; x=this; } } +o.foo = 3; +if (x!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-58-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-58-s.js new file mode 100644 index 0000000000..eea62b4be5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-58-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-58-s +description: > + checking 'this' (Injected getter) +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { get: function() { return this; } }); + +assert.sameValue(o.foo, o, 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-58gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-58gs.js new file mode 100644 index 0000000000..e1d47ce206 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-58gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-58gs +description: > + checking 'this' from a global scope (Injected getter defined) +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { get : function() { return this; } }); +if (o.foo!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-59-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-59-s.js new file mode 100644 index 0000000000..48b801974b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-59-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-59-s +description: > + checking 'this' (Injected getter includes strict directive prologue) +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { get: function() { "use strict"; return this; } }); + +assert.sameValue(o.foo, o, 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-59gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-59gs.js new file mode 100644 index 0000000000..87086f1f29 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-59gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-59gs +description: > + checking 'this' from a global scope (Injected getter includes strict + directive prologue) +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { get: function() { "use strict"; return this; } }); +if (o.foo!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-60-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-60-s.js new file mode 100644 index 0000000000..1e7e7dfb58 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-60-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-60-s +description: > + checking 'this' (Injected setter) +---*/ + +var o = {}; +var x = 2; +Object.defineProperty(o, "foo", { set: function(stuff) { x=this; } }); +o.foo = 3; + +assert.sameValue(x, o, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-60gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-60gs.js new file mode 100644 index 0000000000..0f69a700c9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-60gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-60gs +description: > + checking 'this' from a global scope (Injected setter) +---*/ + +var o = {}; +var x = 2; +Object.defineProperty(o, "foo", { set: function(stuff) { x=this; } }); +o.foo = 3; +if (x!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-61-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-61-s.js new file mode 100644 index 0000000000..cdc8e54813 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-61-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-61-s +description: > + checking 'this' (Injected setter includes strict directive prologue) +---*/ + +var o = {}; +var x = 2; +Object.defineProperty(o, "foo", { set: function(stuff) { "use strict"; x=this; } }); +o.foo = 3; + +assert.sameValue(x, o, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-61gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-61gs.js new file mode 100644 index 0000000000..239610af0f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-61gs.js @@ -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: 10.4.3-1-61gs +description: > + checking 'this' from a global scope (Injected setter includes strict + directive prologue) +---*/ + +var o = {}; +var x = 2; +Object.defineProperty(o, "foo", { set: function(stuff) { "use strict"; x=this; } }); +o.foo = 3; +if (x!==o) { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-62-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-62-s.js new file mode 100644 index 0000000000..b83568e8f6 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-62-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-62-s +description: > + checking 'this' (strict function declaration called by non-strict function + declaration) +---*/ + +function f() { "use strict"; return this;}; +function foo() { return f();} + +assert.sameValue(foo(), undefined, 'foo()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-62gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-62gs.js new file mode 100644 index 0000000000..e28ae58a1d --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-62gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-62gs +description: > + checking 'this' from a global scope (strict function declaration called by + non-strict function declaration) +---*/ + +function f() { "use strict"; return this;}; +function foo() { return f();} +if (foo()!==undefined){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-63-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-63-s.js new file mode 100644 index 0000000000..f9bdd27b15 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-63-s.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-63-s +description: > + checking 'this' (strict function declaration called by non-strict eval) +---*/ + +function f() { "use strict"; return this===undefined;}; +assert(eval("f();")); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-63gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-63gs.js new file mode 100644 index 0000000000..c1e1ce50d2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-63gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-63gs +description: > + checking 'this' from a global scope (strict function declaration called by + non-strict eval) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! eval("f();")){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-64-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-64-s.js new file mode 100644 index 0000000000..f85b51b38b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-64-s.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-64-s +description: > + checking 'this' (strict function declaration called by non-strict Function + constructor) +---*/ + +this.f = function() { "use strict"; return this===undefined;}; +assert(Function("return f();")()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-64gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-64gs.js new file mode 100644 index 0000000000..e9afc59ad5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-64gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-64gs +description: > + checking 'this' from a global scope (strict function declaration called by + non-strict Function constructor) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! (Function("return f();")())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-65-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-65-s.js new file mode 100644 index 0000000000..6da5705cd9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-65-s.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-65-s +description: > + checking 'this' (strict function declaration called by non-strict new'ed + Function constructor) +---*/ + +this.f = function() { "use strict"; return this===undefined;}; +assert((new Function("return f();"))()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-65gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-65gs.js new file mode 100644 index 0000000000..6996024f04 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-65gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-65gs +description: > + checking 'this' from a global scope (strict function declaration called by + non-strict new'ed Function constructor) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! ( (new Function("return f();")) () )){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-66-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-66-s.js new file mode 100644 index 0000000000..74334bf8f0 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-66-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-66-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.apply()) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.apply(), 'f.apply() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-66gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-66gs.js new file mode 100644 index 0000000000..badc73f2b3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-66gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-66gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.apply()) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! f.apply()){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-67-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-67-s.js new file mode 100644 index 0000000000..292f01b742 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-67-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-67-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.apply(null)) +---*/ + +function f() { "use strict"; return this===null;}; + +assert(f.apply(null), 'f.apply(null) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-67gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-67gs.js new file mode 100644 index 0000000000..379bb1a4f1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-67gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-67gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.apply(null)) +---*/ + +function f() { "use strict"; return this===null;}; +if (! f.apply(null)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-68-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-68-s.js new file mode 100644 index 0000000000..afe50505fb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-68-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-68-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.apply(undefined)) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.apply(undefined), 'f.apply(undefined) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-68gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-68gs.js new file mode 100644 index 0000000000..075593f52c --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-68gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-68gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.apply(undefined)) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! f.apply(undefined)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-69-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-69-s.js new file mode 100644 index 0000000000..504e7f8e0a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-69-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-69-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.apply(someObject)) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; + +assert(f.apply(o), 'f.apply(o) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-69gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-69gs.js new file mode 100644 index 0000000000..9a01db604f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-69gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-69gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.apply(someObject)) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; +if (! f.apply(o)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-7-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-7-s-strict.js new file mode 100644 index 0000000000..cc0a322788 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-7-s-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-7-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration defined within + strict mode) +flags: [onlyStrict] +---*/ + +function f() { + return typeof this; +} + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-70-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-70-s.js new file mode 100644 index 0000000000..26b8c0d57e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-70-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-70-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.apply(globalObject)) +---*/ + +function f() { "use strict"; return this;}; + +assert.sameValue(f.apply(this), this, 'f.apply(this)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-70gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-70gs.js new file mode 100644 index 0000000000..e0ce9eaef3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-70gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-70gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.apply(globalObject)) +---*/ + +function f() { "use strict"; return this;}; +if (f.apply(this) !== this){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-71-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-71-s.js new file mode 100644 index 0000000000..1d0074049b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-71-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-71-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.call()) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.call(), 'f.call() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-71gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-71gs.js new file mode 100644 index 0000000000..109c2e6551 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-71gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-71gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.call()) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! f.call()){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-72-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-72-s.js new file mode 100644 index 0000000000..dde92aacd9 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-72-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-72-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.call(null)) +---*/ + +function f() { "use strict"; return this===null;}; + +assert(f.call(null), 'f.call(null) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-72gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-72gs.js new file mode 100644 index 0000000000..2e0824a8e1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-72gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-72gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.call(null)) +---*/ + +function f() { "use strict"; return this===null;}; +if (! f.call(null)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-73-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-73-s.js new file mode 100644 index 0000000000..2f06b8c8c0 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-73-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-73-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.call(undefined)) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.call(undefined), 'f.call(undefined) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-73gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-73gs.js new file mode 100644 index 0000000000..7432080fcb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-73gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-73gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.call(undefined)) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! f.call(undefined)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-74-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-74-s.js new file mode 100644 index 0000000000..3e2d014483 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-74-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-74-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.call(someObject)) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; + +assert(f.call(o), 'f.call(o) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-74gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-74gs.js new file mode 100644 index 0000000000..bf939410aa --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-74gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-74gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.call(someObject)) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; +if (! f.call(o)){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-75-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-75-s.js new file mode 100644 index 0000000000..77a3d33a26 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-75-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-75-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.call(globalObject)) +---*/ + +function f() { "use strict"; return this;}; + +assert.sameValue(f.call(this), this, 'f.call(this)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-75gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-75gs.js new file mode 100644 index 0000000000..e13f91d6db --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-75gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-75gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.call(globalObject)) +---*/ + +function f() { "use strict"; return this;}; +if (f.call(this) !== this){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-76-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-76-s.js new file mode 100644 index 0000000000..87465ee634 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-76-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-76-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.bind()()) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.bind()(), 'f.bind()() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-76gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-76gs.js new file mode 100644 index 0000000000..04ac878f5b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-76gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-76gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.bind()()) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! (f.bind()())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-77-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-77-s.js new file mode 100644 index 0000000000..d4f8def337 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-77-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-77-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.bind(null)()) +---*/ + +function f() { "use strict"; return this===null;}; + +assert(f.bind(null)(), 'f.bind(null)() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-77gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-77gs.js new file mode 100644 index 0000000000..47c9081ce5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-77gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-77gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.bind(null)()) +---*/ + +function f() { "use strict"; return this===null;}; +if (! (f.bind(null)())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-78-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-78-s.js new file mode 100644 index 0000000000..4cefa6ac4a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-78-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-78-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.bind(undefined)()) +---*/ + +function f() { "use strict"; return this===undefined;}; + +assert(f.bind(undefined)(), 'f.bind(undefined)() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-78gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-78gs.js new file mode 100644 index 0000000000..c4a940c2fa --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-78gs.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-78gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.bind(undefined)()) +---*/ + +function f() { "use strict"; return this===undefined;}; +if (! (f.bind(undefined)())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-79-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-79-s.js new file mode 100644 index 0000000000..e0e0c5e7df --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-79-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-79-s +description: > + checking 'this' (strict function declaration called by + Function.prototype.bind(someObject)()) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; + +assert(f.bind(o)(), 'f.bind(o)() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-79gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-79gs.js new file mode 100644 index 0000000000..a07e1b5434 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-79gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-79gs +description: > + checking 'this' from a global scope (strict function declaration called by + Function.prototype.bind(someObject)()) +---*/ + +var o = {}; +function f() { "use strict"; return this===o;}; +if (! (f.bind(o)())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-7gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-7gs-strict.js new file mode 100644 index 0000000000..d5c8251874 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-7gs-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-7gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + defined within strict mode) +flags: [onlyStrict] +---*/ + +function f() { + return typeof this; +} +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-8-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-8-s.js new file mode 100644 index 0000000000..44c37a1a20 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-8-s.js @@ -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: 10.4.3-1-8-s +description: > + Strict Mode - checking 'this' (FunctionDeclaration includes strict + directive prologue) +flags: [noStrict] +---*/ + +function f() { + "use strict"; + return typeof this; +} + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-80-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-80-s.js new file mode 100644 index 0000000000..f0c6406c05 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-80-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-80-s +description: > + Strict Mode - checking 'this' (strict function declaration called + by Function.prototype.bind(globalObject)()) +flags: [noStrict] +---*/ + +function f() { "use strict"; return this;}; + +assert.sameValue(f.bind(this)(), this, 'f.bind(this)()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-80gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-80gs.js new file mode 100644 index 0000000000..2c65ecd6f7 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-80gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-80gs +description: > + Strict - checking 'this' from a global scope (strict function + declaration called by Function.prototype.bind(globalObject)()) +flags: [noStrict] +---*/ + +function f() { "use strict"; return this;}; +if (f.bind(this)() !== this){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-81-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-81-s.js new file mode 100644 index 0000000000..0f68c51d19 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-81-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-81-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict function declaration) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +function foo() { "use strict"; return f();} + +assert(foo(), 'foo() !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-81gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-81gs.js new file mode 100644 index 0000000000..ce3128710a --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-81gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-81gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict function declaration) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +function foo() { "use strict"; return f();} +if (! foo()){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-82-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-82-s.js new file mode 100644 index 0000000000..1b85c33feb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-82-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-82-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict eval) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +assert((function () {"use strict"; return eval("f();");})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-82gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-82gs.js new file mode 100644 index 0000000000..9a9831381b --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-82gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-82gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict eval) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +if (! ((function () {"use strict"; return eval("f();");})()) ){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-83-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-83-s.js new file mode 100644 index 0000000000..85ee36f9ed --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-83-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-83-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function constructor) +flags: [noStrict] +---*/ + +this.f = function() {return this!==undefined;}; +assert((function () {return Function("\"use strict\";return f();")();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-83gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-83gs.js new file mode 100644 index 0000000000..022fa0e761 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-83gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-83gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function constructor) +flags: [noStrict] +---*/ + +function f() {return this!==undefined;}; +if (! ((function () {return Function("\"use strict\";return f();")();})()) ){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-84-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-84-s.js new file mode 100644 index 0000000000..3eb5c7dfbf --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-84-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-84-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict new'ed Function constructor) +flags: [noStrict] +---*/ + +this.f = function() { return this!==undefined;}; +assert((function () {return new Function("\"use strict\";return f();")();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-84gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-84gs.js new file mode 100644 index 0000000000..439e6172f0 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-84gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-84gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict new'ed Function constructor) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +if (! ((function () {return new Function("\"use strict\";return f();")();})()) ){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-85-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-85-s.js new file mode 100644 index 0000000000..65cb21ba9e --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-85-s.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-85-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.apply()) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +assert((function () {"use strict"; return f.apply();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-85gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-85gs.js new file mode 100644 index 0000000000..4d0c6c20f1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-85gs.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-85gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.apply()) +flags: [noStrict] +---*/ + +function f() { return this!==undefined;}; +if (! ((function () {"use strict"; return f.apply();})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-86-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-86-s.js new file mode 100644 index 0000000000..edcd712f41 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-86-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-86-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.apply(null)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.apply(null);})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-86gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-86gs.js new file mode 100644 index 0000000000..e617f616c1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-86gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-86gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.apply(null)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.apply(null);})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-87-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-87-s.js new file mode 100644 index 0000000000..81d5df5645 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-87-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-87-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.apply(undefined)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global}; +assert((function () {"use strict"; return f.apply(undefined);})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-87gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-87gs.js new file mode 100644 index 0000000000..6cb8633aa6 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-87gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-87gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.apply(undefined)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.apply(undefined);})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-88-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-88-s.js new file mode 100644 index 0000000000..bddfad8534 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-88-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-88-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.apply(someObject)) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +assert((function () {"use strict"; return f.apply(o);})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-88gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-88gs.js new file mode 100644 index 0000000000..c1bab2e1af --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-88gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-88gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.apply(someObject)) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +if (! ((function () {"use strict"; return f.apply(o);})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-89-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-89-s.js new file mode 100644 index 0000000000..c9761002e1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-89-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-89-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.apply(globalObject)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this;}; +assert.sameValue((function () {"use strict"; return f.apply(global); })(), global); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-89gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-89gs.js new file mode 100644 index 0000000000..ce21d8fc07 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-89gs.js @@ -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: 10.4.3-1-89gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict + Function.prototype.apply(globalObject)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this;}; +if ((function () {"use strict"; return f.apply(global);})() !== global){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-8gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-8gs.js new file mode 100644 index 0000000000..6a74dbd170 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-8gs.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-8gs +description: > + Strict - checking 'this' from a global scope (FunctionDeclaration + includes strict directive prologue) +flags: [noStrict] +---*/ + +function f() { + "use strict"; + return typeof this; +} +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-9-s-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-9-s-strict.js new file mode 100644 index 0000000000..5eb146e934 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-9-s-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-9-s +description: > + Strict Mode - checking 'this' (FunctionExpression defined within + strict mode) +flags: [onlyStrict] +---*/ + +var f = function () { + return typeof this; +} + +assert.sameValue(f(), "undefined", 'f()'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-90-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-90-s.js new file mode 100644 index 0000000000..8baf52d158 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-90-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-90-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.call()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.call(); })()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-90gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-90gs.js new file mode 100644 index 0000000000..ae48297f34 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-90gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-90gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.call()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.call();})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-91-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-91-s.js new file mode 100644 index 0000000000..a91691ff65 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-91-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-91-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.call(null)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.call(null); })()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-91gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-91gs.js new file mode 100644 index 0000000000..6ac702d078 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-91gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-91gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.call(null)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.call(null); })())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-92-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-92-s.js new file mode 100644 index 0000000000..1ff50a45ac --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-92-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-92-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.call(undefined)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.call(undefined);})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-92gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-92gs.js new file mode 100644 index 0000000000..21a4c41a34 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-92gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-92gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.call(undefined)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.call(undefined);})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-93-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-93-s.js new file mode 100644 index 0000000000..29f857a640 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-93-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-93-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.call(someObject)) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +assert((function () {"use strict"; return f.call(o); })()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-93gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-93gs.js new file mode 100644 index 0000000000..8e852580da --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-93gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-93gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.call(someObject)) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +if (! ((function () {"use strict"; return f.call(o); })())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-94-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-94-s.js new file mode 100644 index 0000000000..ebbff31652 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-94-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-94-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.call(globalObject)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.call(global);})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-94gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-94gs.js new file mode 100644 index 0000000000..733fd7d7bf --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-94gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-94gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.call(globalObject)) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.call(global);})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-95-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-95-s.js new file mode 100644 index 0000000000..fedb6470b1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-95-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-95-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.bind()()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.bind()(); })()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-95gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-95gs.js new file mode 100644 index 0000000000..639bfa9b13 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-95gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-95gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.bind()()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.bind()(); })())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-96-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-96-s.js new file mode 100644 index 0000000000..13bd538678 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-96-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-96-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.bind(null)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.bind(null)(); })()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-96gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-96gs.js new file mode 100644 index 0000000000..cc9ac970a2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-96gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-96gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.bind(null)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.bind(null)(); })())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-97-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-97-s.js new file mode 100644 index 0000000000..3846396033 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-97-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-97-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.bind(undefined)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.bind(undefined)();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-97gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-97gs.js new file mode 100644 index 0000000000..6456da757f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-97gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-97gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.bind(undefined)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.bind(undefined)(); })())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-98-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-98-s.js new file mode 100644 index 0000000000..25dee9fbfb --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-98-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-98-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.bind(someObject)()) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +assert((function () {"use strict"; return f.bind(o)();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-98gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-98gs.js new file mode 100644 index 0000000000..32f359592f --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-98gs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-98gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict Function.prototype.bind(someObject)()) +flags: [noStrict] +---*/ + +var o = {}; +function f() { return this===o;}; +if (! ((function () {"use strict"; return f.bind(o)();})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-99-s.js b/js/src/tests/test262/language/function-code/10.4.3-1-99-s.js new file mode 100644 index 0000000000..f7c0503bd3 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-99-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-99-s +description: > + Strict Mode - checking 'this' (non-strict function declaration + called by strict Function.prototype.bind(globalObject)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +assert((function () {"use strict"; return f.bind(global)();})()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-99gs.js b/js/src/tests/test262/language/function-code/10.4.3-1-99gs.js new file mode 100644 index 0000000000..9db4e50e40 --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-99gs.js @@ -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: 10.4.3-1-99gs +description: > + Strict - checking 'this' from a global scope (non-strict function + declaration called by strict + Function.prototype.bind(globalObject)()) +flags: [noStrict] +---*/ + +var global = this; +function f() { return this===global;}; +if (! ((function () {"use strict"; return f.bind(global)();})())){ + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/10.4.3-1-9gs-strict.js b/js/src/tests/test262/language/function-code/10.4.3-1-9gs-strict.js new file mode 100644 index 0000000000..54a0bfb6bf --- /dev/null +++ b/js/src/tests/test262/language/function-code/10.4.3-1-9gs-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3-1-9gs +description: > + Strict - checking 'this' from a global scope (FunctionExpression + defined within strict mode) +flags: [onlyStrict] +---*/ + +var f = function () { + return typeof this; +} +if (f() !== "undefined") { + throw "'this' had incorrect value!"; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.1.6_A1_T1.js b/js/src/tests/test262/language/function-code/S10.1.6_A1_T1.js new file mode 100644 index 0000000000..6b89a48d5a --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.1.6_A1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The activation object is initialised with a property with name arguments + and attributes {DontDelete} +es5id: 10.1.6_A1_T1 +description: Checking if deleting function parameter is possible +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(a){ + delete a; + return a; +} +if (f1(1) !== 1) + throw new Test262Error('#1: Function parameter was deleted'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A1.js b/js/src/tests/test262/language/function-code/S10.2.1_A1.js new file mode 100644 index 0000000000..e3ea653b8a --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If the caller supplies fewer parameter values than there are + formal parameters, the extra formal parameters have value undefined +es5id: 10.2.1_A1 +description: Calling function excluding a few parameters +---*/ + +//CHECK#1 +function f1(a, b){ + return (b === undefined); +} +if(!(f1(1, 2) === false)){ + throw new Test262Error('#1: f1(1, 2) === false'); +} else if(!(f1(1) === true)){ + throw new Test262Error('#1: f1(1) === true'); +} + +//CHECK#2 +function f2(a, b, c){ + return (b === undefined) && (c === undefined); +} +if(!(f2(1) === true)){ + throw new Test262Error('#2: f2(1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A2.js b/js/src/tests/test262/language/function-code/S10.2.1_A2.js new file mode 100644 index 0000000000..375e4c039d --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If two or more formal parameters share the same name, hence + the same property, the corresponding property is given the value that was + supplied for the last parameter with this name +es5id: 10.2.1_A2 +description: > + Creating functions initialized with two or more formal parameters, + which have the same name +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(x, x) { + return x; +} +if(!(f1(1, 2) === 2)) { + throw new Test262Error("#1: f1(1, 2) === 2"); +} + +//CHECK#2 +function f2(x, x, x){ + return x*x*x; +} +if(!(f2(1, 2, 3) === 27)){ + throw new Test262Error("f2(1, 2, 3) === 27"); +} + +//CHECK#3 +function f3(x, x) { + return 'a' + x; +} +if(!(f3(1, 2) === 'a2')){ + throw new Test262Error("#3: f3(1, 2) === 'a2'"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A3.js b/js/src/tests/test262/language/function-code/S10.2.1_A3.js new file mode 100644 index 0000000000..2a0f08d769 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If the value of this last parameter (which has the same + name as some previous parameters do) was not supplied by the + caller, the value of the corresponding property is undefined +es5id: 10.2.1_A3 +description: > + Creating functions with two or more formal parameters, that have + the same name. Calling this function excluding a few last + parameters +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(x, a, b, x){ + return x; +} +if(!(f1(1, 2) === undefined)){ + throw new Test262Error('#1: f1(1, 2) === undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A4_T1.js b/js/src/tests/test262/language/function-code/S10.2.1_A4_T1.js new file mode 100644 index 0000000000..b80961ada5 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A4_T1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Function declaration in function code - If the variable object + already has a property with the name of Function Identifier, replace its + value and attributes. Semantically, this step must follow the creation of + FormalParameterList properties +es5id: 10.2.1_A4_T1 +description: Checking existence of a function with passed parameter +flags: [noStrict] +---*/ + +//CHECK#1 +function f1(x){ + return x; + + function x(){ + return 7; + } +} +if(!(f1().constructor.prototype === Function.prototype)){ + throw new Test262Error('#1: f1() returns function'); +} + +//CHECK#2 +function f2(x){ + return typeof x; + + function x(){ + return 7; + } +} +if(!(f2() === "function")){ + throw new Test262Error('#2: f2() === "function"'); +} + +//CHECK#3 +function f3() { + return typeof arguments; + function arguments() { + return 7; + } +} +if (!(f3() === "function")){ + throw new Test262Error('#3: f3() === "function"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A4_T2.js b/js/src/tests/test262/language/function-code/S10.2.1_A4_T2.js new file mode 100644 index 0000000000..a8e6d2f409 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A4_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Function declaration in function code - If the variable object + already has a property with the name of Function Identifier, replace its + value and attributes. Semantically, this step must follow the creation of + FormalParameterList properties +es5id: 10.2.1_A4_T2 +description: Checking existence of a function with declared variable +---*/ + +//CHECK#1 +function f1(){ + var x; + + return x; + + function x(){ + return 7; + } +} + +assert.sameValue(f1().constructor.prototype, Function.prototype); + +//CHECK#2 +function f2(){ + var x; + + return typeof x; + + function x(){ + return 7; + } +} + +assert.sameValue(f2(), "function"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T1.js b/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T1.js new file mode 100644 index 0000000000..5cd72677b6 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + For each VariableDeclaration or VariableDeclarationNoIn in the + code, create a property of the variable object whose name is the Identifier + in the VariableDeclaration or VariableDeclarationNoIn, whose value is + undefined and whose attributes are determined by the type of code +es5id: 10.2.1_A5.1_T1 +description: Checking variable existence only +---*/ + +//CHECK#1 +function f1(){ + var x; + + return typeof x; +} + +assert.sameValue(f1(), "undefined"); + +//CHECK#2 +function f2(){ + var x; + + return x; +} + +assert.sameValue(f2(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T2.js b/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T2.js new file mode 100644 index 0000000000..f7343099ed --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A5.1_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + For each VariableDeclaration or VariableDeclarationNoIn in the + code, create a property of the variable object whose name is the Identifier + in the VariableDeclaration or VariableDeclarationNoIn, whose value is + undefined and whose attributes are determined by the type of code +es5id: 10.2.1_A5.1_T2 +description: > + Checking existence of the variable object property with formal + parameter +---*/ + +//CHECK#1 +function f1(x){ + var x; + + return typeof x; +} + +assert.sameValue(f1(), "undefined"); + +//CHECK#2 +function f2(x){ + var x; + + return x; +} + +assert.sameValue(f2(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.2.1_A5.2_T1.js b/js/src/tests/test262/language/function-code/S10.2.1_A5.2_T1.js new file mode 100644 index 0000000000..dcf162d809 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.2.1_A5.2_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If there is already a property of the variable object with the + name of a declared variable, the value of the property and its attributes + are not changed +es5id: 10.2.1_A5.2_T1 +description: > + Checking existence of the variable object property with formal + parameter +---*/ + +//CHECK#1 +function f1(x){ + var x; + + return typeof x; +} + +assert.sameValue(f1(1), "number"); + +//CHECK#2 +function f2(x){ + var x; + + return x; +} + +assert.sameValue(f2(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.4.3_A1-strict.js b/js/src/tests/test262/language/function-code/S10.4.3_A1-strict.js new file mode 100644 index 0000000000..034e4e0187 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.4.3_A1-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright 2011 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 10.4.3_A1 +description: > + When calling a strict anonymous function as a function, "this" + should be bound to undefined. +flags: [onlyStrict] +---*/ + +var that = (function() { return this; })(); +if (that !== undefined) { + throw new Test262Error('#1: "this" leaked as: ' + that); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.4A1.1_T2.js b/js/src/tests/test262/language/function-code/S10.4A1.1_T2.js new file mode 100644 index 0000000000..35c6edc24d --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.4A1.1_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Every function call enters a new execution context +es5id: 10.4A1.1_T2 +description: Recursive function call +---*/ + +var y; + +function f(a){ + var x; + + if (a === 1) + return x; + else { + if(x === undefined) { + x = 0; + } else { + x = 1; + } + return f(1); + } +} + +y = f(0); + +if(!(y === undefined)){ + throw new Test262Error("#1: Recursive function calls shares execution context"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/S10.4_A1.1_T1.js b/js/src/tests/test262/language/function-code/S10.4_A1.1_T1.js new file mode 100644 index 0000000000..a7c79fddd8 --- /dev/null +++ b/js/src/tests/test262/language/function-code/S10.4_A1.1_T1.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Every function call enters a new execution context +es5id: 10.4_A1.1_T1 +description: Sequence of function calls +---*/ + +var y; + +function f(){ + var x; + + if(x === undefined) { + x = 0; + } else { + x = 1; + } + + return x; +} + +y = f(); +y = f(); + +if(!(y === 0)){ + throw new Test262Error("#1: Sequenced function calls shares execution context"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/block-decl-onlystrict-strict.js b/js/src/tests/test262/language/function-code/block-decl-onlystrict-strict.js new file mode 100644 index 0000000000..e664e15eda --- /dev/null +++ b/js/src/tests/test262/language/function-code/block-decl-onlystrict-strict.js @@ -0,0 +1,41 @@ +'use strict'; +// 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: [onlyStrict] +---*/ + +var err1, err2; + +(function() { + try { + f; + } catch (exception) { + err1 = exception; + } + + { + function f() { } + } + + try { + f; + } catch (exception) { + err2 = exception; + } +}()); + +assert.sameValue(err1.constructor, ReferenceError); +assert.sameValue(err2.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/browser.js b/js/src/tests/test262/language/function-code/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/browser.js diff --git a/js/src/tests/test262/language/function-code/eval-param-env-with-computed-key.js b/js/src/tests/test262/language/function-code/eval-param-env-with-computed-key.js new file mode 100644 index 0000000000..1486e30be1 --- /dev/null +++ b/js/src/tests/test262/language/function-code/eval-param-env-with-computed-key.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = "outer"; + +function evalInComputedPropertyKey({[eval("var x = 'inner'")]: ignored}) { + assert.sameValue(x, "inner"); +} +evalInComputedPropertyKey({}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/eval-param-env-with-prop-initializer.js b/js/src/tests/test262/language/function-code/eval-param-env-with-prop-initializer.js new file mode 100644 index 0000000000..d23a874d76 --- /dev/null +++ b/js/src/tests/test262/language/function-code/eval-param-env-with-prop-initializer.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = "outer"; + +function evalInPropertyInitializer({a: ignored = eval("var x = 'inner'")}) { + assert.sameValue(x, "inner"); +} +evalInPropertyInitializer({}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/shell.js b/js/src/tests/test262/language/function-code/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/function-code/shell.js diff --git a/js/src/tests/test262/language/function-code/switch-case-decl-onlystrict-strict.js b/js/src/tests/test262/language/function-code/switch-case-decl-onlystrict-strict.js new file mode 100644 index 0000000000..e32e2efc96 --- /dev/null +++ b/js/src/tests/test262/language/function-code/switch-case-decl-onlystrict-strict.js @@ -0,0 +1,42 @@ +'use strict'; +// 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: [onlyStrict] +---*/ + +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.constructor, ReferenceError); +assert.sameValue(err2.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/function-code/switch-dflt-decl-onlystrict-strict.js b/js/src/tests/test262/language/function-code/switch-dflt-decl-onlystrict-strict.js new file mode 100644 index 0000000000..46b701702f --- /dev/null +++ b/js/src/tests/test262/language/function-code/switch-dflt-decl-onlystrict-strict.js @@ -0,0 +1,42 @@ +'use strict'; +// 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: [onlyStrict] +---*/ + +var err1, err2; + +(function() { + try { + f; + } catch (exception) { + err1 = exception; + } + + switch (1) { + default: + function f() { } + } + + try { + f; + } catch (exception) { + err2 = exception; + } +}()); + +assert.sameValue(err1.constructor, ReferenceError); +assert.sameValue(err2.constructor, ReferenceError); + +reportCompare(0, 0); |