From 9c333792259130d26df2848874f659e59b3a2847 Mon Sep 17 00:00:00 2001 From: Mark Miller Date: Fri, 23 Sep 2011 23:50:15 -0700 Subject: [PATCH] Added all tests added to repairES5.js since the last time I contributed SES-relevant tests to test262. --- .../S8.6.2_A8.js | 19 ++++++++ .../10.4.2_Eval_Code/S10.2.2_A1.2_T11.js | 9 ++-- .../10.4.2_Eval_Code/S10.4.2.1_A1.js | 14 ++++++ .../S10.4.3_A1.js | 13 ++++++ .../11.4.1_The_delete_Operator/S11.4.1_A4.js | 4 +- .../11.4.1_The_delete_Operator/S11.4.1_A5.js | 22 +++++++++ .../S13.2.2_A19_T8.js | 2 +- .../S13.2.3_A1.js | 45 +++++++++++++++++++ .../S13.2_A6_T1.js | 9 ++++ .../S13.2_A6_T2.js | 9 ++++ .../S13.2_A7_T1.js | 10 +++++ .../S13.2_A7_T2.js | 10 +++++ .../S13.2_A8_T1.js | 10 +++++ .../S13.2_A8_T2.js | 10 +++++ .../15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js | 41 +++++------------ .../S15.2.3.4_A1_T1.js | 21 +++++++++ .../S15.2.3.6_A1.js | 34 ++++++++++++++ .../S15.2.3.6_A2.js | 14 ++++++ .../S15.2.4.4_A15.js | 13 ++++++ .../S15.3.3.1_A4.js | 20 +++++++++ .../S15.3.4.5_A3.js | 10 +++++ .../S15.3.4.5_A4.js | 15 +++++++ .../S15.3.4.5_A5.js | 15 +++++++ 23 files changed, 331 insertions(+), 38 deletions(-) create mode 100644 test/suite/sputnik/Conformance/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2_A8.js create mode 100644 test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js create mode 100644 test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js create mode 100644 test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.3_A1.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T1.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T2.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T1.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T2.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T1.js create mode 100644 test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T2.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.4_Object.getOwnPropertyNames/S15.2.3.4_A1_T1.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A1.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A2.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.4_Properties_of_the_Object_Prototype_Object/15.2.4.4_Object.prototype.valueOf/S15.2.4.4_A15.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A4.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A3.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A4.js create mode 100644 test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A5.js diff --git a/test/suite/sputnik/Conformance/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2_A8.js b/test/suite/sputnik/Conformance/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2_A8.js new file mode 100644 index 0000000000..ea0ead56eb --- /dev/null +++ b/test/suite/sputnik/Conformance/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2_A8.js @@ -0,0 +1,19 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description It should not be possible to change the [[Prototype]] + * of a non-extensible object + */ +var x = Object.preventExtensions({}); +var y = {}; +try { + x.__proto__ = y; +} catch (err) { + // As far as this test is concerned, we allow the above assignment + // to fail. This failure does violate the spec and should probably + // be tested separately. +} +if (Object.getPrototypeOf(x) !== Object.prototype) { + $ERROR("Prototype of non-extensible object mutated"); +} diff --git a/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js index 5a9a459a0e..378efe0530 100644 --- a/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js +++ b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.2.2_A1.2_T11.js @@ -4,9 +4,10 @@ /** * @name: S10.2.2_A1.2_T11; * @section: 10.2.2; - * @assertion: The scope chain is initialised to contain the same objects, + * @assertion: The scope chain is initialised to contain the same objects, * in the same order, as the calling context's scope chain; * @description: eval within global execution context; + * @noStrict */ function f(){ @@ -14,14 +15,14 @@ function f(){ var j; str1 = ''; str2 = ''; - + for(i in this){ str1+=i; } - + eval('for(j in this){\nstr2+=j;\n}'); - return (str1 === str2); + return (str1 === str2); this.x = 1; this.y = 2; diff --git a/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js new file mode 100644 index 0000000000..2bceaa9937 --- /dev/null +++ b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.2_Eval_Code/S10.4.2.1_A1.js @@ -0,0 +1,14 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Strict indirect eval should not leak top level + * declarations into the global scope + * @strictOnly + */ +if (!('foo' in this)) { + (1,eval)('"use strict"; var foo = 88;'); + if ('foo' in this) { + $ERROR("Strict indirect eval leaked a top level declaration"); + } +} \ No newline at end of file diff --git a/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js new file mode 100644 index 0000000000..2233f0cb98 --- /dev/null +++ b/test/suite/sputnik/Conformance/10_Execution_Contexts/10.4_Establishing_An_Execution_Context/10.4.3_Entering_Function_Code/S10.4.3_A1.js @@ -0,0 +1,13 @@ +// Copyright 2011 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description When calling a strict anonymous function as a + * function, "this" should be bound to undefined. + * @strictOnly + */ + +var that = (function() { return this; })(); +if (that !== undefined) { + $ERROR('#1: "this" leaked as: ' + that); +} diff --git a/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js index 3456dafcfc..d740834e34 100644 --- a/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js +++ b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A4.js @@ -9,8 +9,8 @@ */ //CHECK#1 -obj = new Object(); -ref = obj; +var obj = new Object(); +var ref = obj; delete ref; if (typeof obj !== "object") { $ERROR('#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' + (typeof obj)); diff --git a/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js new file mode 100644 index 0000000000..94fe08f2d3 --- /dev/null +++ b/test/suite/sputnik/Conformance/11_Expressions/11.4_Unary_Operators/11.4.1_The_delete_Operator/S11.4.1_A5.js @@ -0,0 +1,22 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * A strict delete should either succeed, returning true, or it + * should fail by throwing a TypeError. Under no circumstances + * should a strict delete return false. + * + * @description See if a strict delete returns false when deleting a + * non-standard property. + * @strictOnly + */ + +var deleted = 'unassigned'; +try { + deleted = delete RegExp.leftContext; +} catch (err) { + +} +if (deleted === false) { + $ERROR('Strict delete returned false'); +} diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A19_T8.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A19_T8.js index b9e03c493d..e14f3332cf 100644 --- a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A19_T8.js +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A19_T8.js @@ -26,7 +26,7 @@ with (__obj) var __func = function() { return a; - } + }; break; } } diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.3_A1.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.3_A1.js new file mode 100644 index 0000000000..f77844a607 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.3_A1.js @@ -0,0 +1,45 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check that all poisoning use the [[ThrowTypeError]] + * function object. + * @strictOnly + */ +var poison = Object.getOwnPropertyDescriptor(function() {}, 'caller').get; + +if (typeof poison !== 'function') { + $ERROR("#1: A strict function's .caller should be poisoned with a function"); +} +var threw = null; +try { + poison(); +} catch (err) { + threw = err; +} +if (!threw || !(threw instanceof TypeError)) { + $ERROR("#2: Poisoned property should throw TypeError"); +} + +function checkPoison(obj, name) { + var desc = Object.getOwnPropertyDescriptor(obj, name); + if (desc.enumerable) { + $ERROR("#3: Poisoned " + name + " should not be enumerable"); + } + if (desc.configurable) { + $ERROR("#4: Poisoned " + name + " should not be configurable"); + } + if (poison !== desc.get) { + $ERROR("#5: " + name + "'s getter not poisoned with same poison"); + } + if (poison !== desc.set) { + $ERROR("#6: " + name + "'s setter not poisoned with same poison"); + } +} + +checkPoison(function() {}, 'caller'); +checkPoison(function() {}, 'arguments'); +checkPoison((function() { return arguments; })(), 'caller'); +checkPoison((function() { return arguments; })(), 'callee'); +checkPoison((function() {}).bind(null), 'caller'); +checkPoison((function() {}).bind(null), 'arguments'); diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T1.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T1.js new file mode 100644 index 0000000000..364b9df9d9 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T1.js @@ -0,0 +1,9 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "caller" poisoning poisons + * getOwnPropertyDescriptor too + * @strictOnly + */ +Object.getOwnPropertyDescriptor(function(){}, 'caller'); diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T2.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T2.js new file mode 100644 index 0000000000..f5b3062dc9 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A6_T2.js @@ -0,0 +1,9 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "arguments" poisoning poisons + * getOwnPropertyDescriptor too + * @strictOnly + */ +Object.getOwnPropertyDescriptor(function(){}, 'arguments'); diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T1.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T1.js new file mode 100644 index 0000000000..eb76266ae6 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T1.js @@ -0,0 +1,10 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "caller" poisoning poisons + * hasOwnProperty too + * @strictOnly + */ +(function(){}).hasOwnProperty('caller'); + diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T2.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T2.js new file mode 100644 index 0000000000..9c12447831 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A7_T2.js @@ -0,0 +1,10 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "arguments" poisoning poisons + * hasOwnProperty too + * @strictOnly + */ +(function(){}).hasOwnProperty('arguments'); + diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T1.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T1.js new file mode 100644 index 0000000000..597b7a4964 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T1.js @@ -0,0 +1,10 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "caller" poisoning poisons + * "in" too + * @strictOnly + */ +'caller' in function() {}; + diff --git a/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T2.js b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T2.js new file mode 100644 index 0000000000..fb8582f7f3 --- /dev/null +++ b/test/suite/sputnik/Conformance/13_Function_Definition/13.2_Creating_Function_Objects/S13.2_A8_T2.js @@ -0,0 +1,10 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description check if "arguments" poisoning poisons + * "in" too + * @strictOnly + */ +'arguments' in function() {}; + diff --git a/test/suite/sputnik/Conformance/15_Native/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js b/test/suite/sputnik/Conformance/15_Native/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js index 1923d6fd35..4bee01b01c 100644 --- a/test/suite/sputnik/Conformance/15_Native/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js +++ b/test/suite/sputnik/Conformance/15_Native/15.1_The_Global_Object/15.1.2_Function_Properties_of_the_Global_Object/15.1.2.2_parseInt/S15.1.2.2_A5.1_T1.js @@ -2,34 +2,13 @@ // This code is governed by the BSD license found in the LICENSE file. /** - * @name: S15.1.2.2_A5.1_T1; - * @section: 15.1.2.2; - * @assertion: If the length of S is at least 1 and the first character of S is 0, - * then at the implementation's discretion either let R = 8 or R = 10; - * @description: Either R = 8, or R = 10; -*/ - -//CHECK# -var res8 = 1; -var res10 = 1; -if (parseInt("08") !== parseInt("08", 8)) { - res8 = 0; -} -if (parseInt("08") !== parseInt("08", 10)) { - res10 = 0; -} -if (parseInt("09") !== parseInt("09", 8)) { - res8 = 0; -} -if (parseInt("09") !== parseInt("09", 10)) { - res10 = 0; -} -if (parseInt("010") !== parseInt("010", 8)) { - res8 = 0; -} -if (parseInt("010") !== parseInt("010", 10)) { - res10 = 0; -} -if (res8 + res10 !== 1) { - $ERROR('#1: If the length of S is at least 1 and the first character of S is 0, then at the implementation\'s discretion either let R = 8 or R = 10'); -} + * parseInt is no longer allowed to treat a leading zero as indicating + * octal. "If radix is undefined or 0, it is assumed to be 10 except + * when the number begins with the character pairs 0x or 0X, in which + * case a radix of 16 is assumed." + * + * @description Check if parseInt still accepts octal + */ +if (parseInt('010') !== 10) { + $ERROR("parseInt should no longer accept octal"); +} \ No newline at end of file diff --git a/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.4_Object.getOwnPropertyNames/S15.2.3.4_A1_T1.js b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.4_Object.getOwnPropertyNames/S15.2.3.4_A1_T1.js new file mode 100644 index 0000000000..ca8d66bf80 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.4_Object.getOwnPropertyNames/S15.2.3.4_A1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2011 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Object.getOwnProperties and Object.prototype.hasOwnProperty should + * agree on what the own properties are. + * + * @description Check that all the own property names reported by + * Object.getOwnPropertyNames on a strict function are names that + * hasOwnProperty agrees are own properties. + * @strictOnly + */ + +function foo() {} + +var names = Object.getOwnPropertyNames(foo); +for (var i = 0, len = names.length; i < len; i++) { + if (!foo.hasOwnProperty(names[i])) { + $ERROR('Phantom own property: ' + names[i]); + } +} \ No newline at end of file diff --git a/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A1.js b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A1.js new file mode 100644 index 0000000000..3a80c2f4ee --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A1.js @@ -0,0 +1,34 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * If a particular API exists (document.createElement, as happens to + * exist in a browser environment), check if the form objects it makes + * obey the constraints that even host objects must obey. In this + * case, that if defineProperty seems to have successfully installed a + * non-configurable getter, that it is still there. + * + * @description Do getters on HTMLFormElements disappear? + */ +function getter() { return 'gotten'; } + +if (typeof document !== 'undefined' && + typeof document.createElement === 'function') { + var f = document.createElement("form"); + var refused = false; + try { + Object.defineProperty(f, 'foo', { + get: getter, + set: void 0 + }); + } catch (err) { + // A host object may refuse to install the getter + refused = true; + } + if (!refused) { + var desc = Object.getOwnPropertyDescriptor(f, 'foo'); + if (desc.get !== getter) { + $ERROR('Getter on HTMLFormElement disappears'); + } + } +} \ No newline at end of file diff --git a/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A2.js b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A2.js new file mode 100644 index 0000000000..15cba82610 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.3_Properties_of_the_Object_Constructor/15.2.3.6_Object.defineProperty/S15.2.3.6_A2.js @@ -0,0 +1,14 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Checks if an inherited accessor property appears to be + * an own property. + */ +var base = {}; +var derived = Object.create(base); +function getter() { return 'gotten'; } +Object.defineProperty(base, 'foo', {get: getter}); +if (derived.hasOwnProperty('foo')) { + $ERROR('Accessor properties inherit as own properties'); +} diff --git a/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.4_Properties_of_the_Object_Prototype_Object/15.2.4.4_Object.prototype.valueOf/S15.2.4.4_A15.js b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.4_Properties_of_the_Object_Prototype_Object/15.2.4.4_Object.prototype.valueOf/S15.2.4.4_A15.js new file mode 100644 index 0000000000..13fb7de3fd --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.2_Object_Objects/15.2.4_Properties_of_the_Object_Prototype_Object/15.2.4.4_Object.prototype.valueOf/S15.2.4.4_A15.js @@ -0,0 +1,13 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.2.4.4_A14; +* @section: 15.2.4.4; +* @assertion: Let O be the result of calling ToObject passing the this value as the argument. +* @description: Checking Object.prototype.valueOf when called as a global function. +* @negative +*/ + +var v = Object.prototype.valueOf; +v(); diff --git a/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A4.js b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A4.js new file mode 100644 index 0000000000..1e1c2f4088 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A4.js @@ -0,0 +1,20 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Detects whether the value of a function's "prototype" property + * as seen by normal object operations might deviate from the value + * as seem by Object.getOwnPropertyDescriptor + * + * @description Checks if reading a function's .prototype directly + * agrees with reading it via Object.getOwnPropertyDescriptor, after + * having set it by Object.defineProperty. + */ + +function foo() {} + +Object.defineProperty(foo, 'prototype', { value: {} }); +if (foo.prototype !== + Object.getOwnPropertyDescriptor(foo, 'prototype').value) { + $ERROR("A function.prototype's descriptor lies"); +} diff --git a/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A3.js b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A3.js new file mode 100644 index 0000000000..424bf3c1b0 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A3.js @@ -0,0 +1,10 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Function.prototype.bind must exist + */ + +if (!('bind' in Function.prototype)) { + $ERROR('Function.prototype.bind is missing'); +} diff --git a/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A4.js b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A4.js new file mode 100644 index 0000000000..f0a6530c39 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A4.js @@ -0,0 +1,15 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Function.prototype.bind call the original's internal + * [[Call]] method rather than its .apply method. + */ + +function foo() {} + +var b = foo.bind(33, 44); +foo.apply = function() { + $ERROR("Function.prototype.bind called original's .apply method"); +}; +b(55, 66); diff --git a/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A5.js b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A5.js new file mode 100644 index 0000000000..95dac6cae3 --- /dev/null +++ b/test/suite/sputnik/Conformance/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A5.js @@ -0,0 +1,15 @@ +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @description Function.prototype.bind must curry [[Construct]] as + * well as [[Call]]. + */ +function construct(f, args) { + var bound = Function.prototype.bind.apply(f, [null].concat(args)); + return new bound(); +} +var d = construct(Date, [1957, 5, 27]); +if (Object.prototype.toString.call(d) !== '[object Date]') { + $ERROR('Using the Date constructor via .bind did not create a Date.'); +} \ No newline at end of file