diff options
Diffstat (limited to 'js/src/tests/test262/ch08/8.12/8.12.5')
7 files changed, 210 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_1.js b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_1.js new file mode 100644 index 000000000..0ed875ef4 --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_1.js @@ -0,0 +1,40 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch08/8.12/8.12.5/8.12.5-3-b_1.js
+ * @description Changing the value of a data property should not affect it's non-value property descriptor attributes.
+ */
+
+
+function testcase() {
+ var origReduce = Array.prototype.reduce;
+ var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
+ var newDesc;
+
+ try {
+ Array.prototype.reduce = function () {;};
+ newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce");
+ var descArray = [origDesc, newDesc];
+
+ for (var j in descArray) { //Ensure no attributes are magically added to newDesc
+ for (var i in descArray[j]) {
+ if (i==="value") {
+ if (origDesc[i]===newDesc[i]) {
+ return false;
+ }
+ }
+ else if (origDesc[i]!==newDesc[i]) {
+ return false;
+ }
+ }
+ }
+ return true;
+
+ } finally {
+ Array.prototype.reduce = origReduce;
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_2.js b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_2.js new file mode 100644 index 000000000..f6b760ce3 --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-3-b_2.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch08/8.12/8.12.5/8.12.5-3-b_2.js
+ * @description Changing the value of a data property should not affect it's non-value property descriptor attributes.
+ */
+
+
+function testcase() {
+ var tempObj = {};
+
+ Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true});
+ var origReduce = tempObj.reduce;
+ var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
+
+ var newDesc;
+
+ try {
+ tempObj.reduce = 123;
+ newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
+ var descArray = [origDesc, newDesc];
+
+ for (var j in descArray) {
+ for (var i in descArray[j]) {
+ if (i==="value") {
+ if (origDesc[i]===newDesc[i]) {
+ return false;
+ }
+ }
+ else if (origDesc[i]!==newDesc[i]) {
+ return false;
+ }
+ }
+ }
+ return true;
+
+ } finally {
+ tempObj.reduce = origReduce;
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-5-b_1.js b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-5-b_1.js new file mode 100644 index 000000000..b3c013ef5 --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/8.12.5-5-b_1.js @@ -0,0 +1,39 @@ +/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch08/8.12/8.12.5/8.12.5-5-b_1.js
+ * @description Changing the value of an accessor property should not affect it's property descriptor attributes.
+ */
+
+
+function testcase() {
+ var tempObj = {};
+
+ Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}});
+ var origReduce = tempObj.reduce;
+ var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
+
+ var newDesc;
+
+ try {
+ tempObj.reduce = 123;
+ newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce");
+ var descArray = [origDesc, newDesc];
+
+ for (var j in descArray) {
+ for (var i in descArray[j]) {
+ if (origDesc[i]!==newDesc[i]) {
+ return false;
+ }
+ }
+ }
+ return tempObj.reduce===456;
+
+ } finally {
+ tempObj.reduce = origReduce;
+ }
+}
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A1.js b/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A1.js new file mode 100644 index 000000000..e6f4bba20 --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A1.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When the [[Put]] method of O is called with property P and value V, + * and If O doesn't have a property with name P, then + * creates a property with name P, set its value to V and give it empty attributes + * + * @path ch08/8.12/8.12.5/S8.12.5_A1.js + * @description Put to not existent properties + */ + +var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__map[1] !== "one") { + $ERROR('#1: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map[1] === "one". Actual: ' + (__map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__map["two"] !== 2) { + $ERROR('#2: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map["two"] === 2. Actual: ' + (__map["two"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__map["3"] !== "tre") { + $ERROR('#3: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map["3"] === "tre". Actual: ' + (__map["3"])); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A2.js b/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A2.js new file mode 100644 index 000000000..02f67e0b8 --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/S8.12.5_A2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * When the [[Put]] method of O is called with property P and value V, + * then set the value of the property to V. The attributes of the property are not changed + * + * @path ch08/8.12/8.12.5/S8.12.5_A2.js + * @description Put to existent properties + */ + +var _map={1:"one",two:2}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +_map[1]="uno"; +if (_map[1] !== "uno") { + $ERROR('#1: var _map={1:"one",two:2}; _map[1]="uno"; _map[1] === "uno". Actual: ' + (_map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +_map["1"]=1; +if (_map[1] !== 1) { + $ERROR('#2: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map[1] === 1. Actual: ' + (_map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +_map["two"]="two"; +if (_map["two"] !== "two") { + $ERROR('#3: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map["two"]="two"; _map["two"] === "two". Actual: ' + (_map["two"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +_map.two="duo"; +if (_map.two !== "duo") { + $ERROR('#4: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map["two"]="two"; _map.two="duo"; _map.two === "duo". Actual: ' + (_map.two)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/browser.js b/js/src/tests/test262/ch08/8.12/8.12.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/browser.js diff --git a/js/src/tests/test262/ch08/8.12/8.12.5/shell.js b/js/src/tests/test262/ch08/8.12/8.12.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.12/8.12.5/shell.js |