diff options
Diffstat (limited to 'js/src/tests/test262/ch08/8.7')
29 files changed, 677 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-1-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-1-s.js new file mode 100644 index 000000000..a7f5f5b2c --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-1-s.js @@ -0,0 +1,22 @@ +/// 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.7/8.7.2/8.7.2-1-s.js
+ * @description Strict Mode - ReferenceError is thrown if LeftHandSide evaluates to an unresolvable Reference
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ try {
+ eval("_8_7_2_1 = 11;");
+ return false;
+ } catch (e) {
+ return e instanceof ReferenceError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-2-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-2-s.js new file mode 100644 index 000000000..abbfbc7fe --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-2-s.js @@ -0,0 +1,18 @@ +/// 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.7/8.7.2/8.7.2-2-s.js
+ * @description Strict Mode - ReferenceError isn't thrown if LeftHandSide evaluates to a resolvable Reference
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var b = 11;
+ return b === 11;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-1-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-1-s.js new file mode 100644 index 000000000..7695a3cb8 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-1-s.js @@ -0,0 +1,19 @@ +/// 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.7/8.7.2/8.7.2-3-1-s.js
+ * @description eval - a property named 'eval' is permitted
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ 'use strict';
+
+ var o = { eval: 42};
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-1gs.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-1gs.js new file mode 100644 index 000000000..88dc77f61 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-1gs.js @@ -0,0 +1,15 @@ +/// 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.7/8.7.2/8.7.2-3-a-1gs.js
+ * @description Strict Mode - ReferenceError is thrown if LeftHandSide evaluate to an unresolvable Reference
+ * @onlyStrict
+ * @negative .
+ */
+
+"use strict";
+b = 11;
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-2gs.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-2gs.js new file mode 100644 index 000000000..402e7dcfb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-a-2gs.js @@ -0,0 +1,16 @@ +/// 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.7/8.7.2/8.7.2-3-a-2gs.js
+ * @description Strict Mode - 'runtime' error is thrown before LeftHandSide evaluates to an unresolvable Reference
+ * @onlyStrict
+ * @negative NotEarlyError
+ */
+
+"use strict";
+throw NotEarlyError;
+b = 11;
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-s.js new file mode 100644 index 000000000..b61a53046 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-3-s.js @@ -0,0 +1,27 @@ +/// 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.7/8.7.2/8.7.2-3-s.js
+ * @description Strict Mode - TypeError is thrown if LeftHandSide is a reference to a non-writable data property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_3 = {};
+ Object.defineProperty(_8_7_2_3, "b", {
+ writable: false
+ });
+
+ try {
+ _8_7_2_3.b = 11;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-4-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-4-s.js new file mode 100644 index 000000000..f8bb3cfc2 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-4-s.js @@ -0,0 +1,28 @@ +/// 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.7/8.7.2/8.7.2-4-s.js
+ * @description Strict Mode - TypeError is thrown if LeftHandSide is a reference to an accessor property with no setter
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_4 = {};
+ var _8_7_2_4_bValue = 1;
+ Object.defineProperty(_8_7_2_4, "b", {
+ get: function () { return _8_7_2_4_bValue; }
+ });
+
+ try {
+ _8_7_2_4.b = 11;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-5-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-5-s.js new file mode 100644 index 000000000..ece372934 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-5-s.js @@ -0,0 +1,25 @@ +/// 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.7/8.7.2/8.7.2-5-s.js
+ * @description Strict Mode - TypeError is thrown if LeftHandSide is a reference to a non-existent property of an non-extensible object
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_5 = {};
+ Object.preventExtensions(_8_7_2_5);
+
+ try {
+ _8_7_2_5.b = 11;
+ return false;
+ } catch (e) {
+ return e instanceof TypeError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-6-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-6-s.js new file mode 100644 index 000000000..298485f94 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-6-s.js @@ -0,0 +1,24 @@ +/// 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.7/8.7.2/8.7.2-6-s.js
+ * @description Strict Mode - TypeError isn't thrown if LeftHandSide is a reference to a writable data property
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_6 = {};
+ Object.defineProperty(_8_7_2_6, "b", {
+ writable: true
+ });
+
+ _8_7_2_6.b = 11;
+
+ return _8_7_2_6.b === 11;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-7-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-7-s.js new file mode 100644 index 000000000..bc2f19543 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-7-s.js @@ -0,0 +1,25 @@ +/// 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.7/8.7.2/8.7.2-7-s.js
+ * @description Strict Mode - TypeError isn't thrown if LeftHandSide is a reference to an accessor property with setter
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_7 = {};
+ var _8_7_2_7_bValue = 1;
+ Object.defineProperty(_8_7_2_7, "b", {
+ get: function () { return _8_7_2_7_bValue; },
+ set: function (value) { _8_7_2_7_bValue = value; }
+ });
+
+ _8_7_2_7.b = 11;
+ return _8_7_2_7.b === 11;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-8-s.js b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-8-s.js new file mode 100644 index 000000000..1e69c3305 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/8.7.2-8-s.js @@ -0,0 +1,21 @@ +/// 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.7/8.7.2/8.7.2-8-s.js
+ * @description Strict Mode - TypeError isn't thrown if LeftHandSide is a reference to a property of an extensible object
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var _8_7_2_8 = {};
+
+ _8_7_2_8.b = 11;
+
+ return _8_7_2_8.b === 11;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/browser.js b/js/src/tests/test262/ch08/8.7/8.7.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/browser.js diff --git a/js/src/tests/test262/ch08/8.7/8.7.2/shell.js b/js/src/tests/test262/ch08/8.7/8.7.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/8.7.2/shell.js diff --git a/js/src/tests/test262/ch08/8.7/S8.7.1_A1.js b/js/src/tests/test262/ch08/8.7/S8.7.1_A1.js new file mode 100644 index 000000000..624b2d71f --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.1_A1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Delete operator deletes pure property, so it returns true to be applyed to this.property + * + * @path ch08/8.7/S8.7.1_A1.js + * @description Try to delete this.y, where y is this.y=1 + */ + +this.y = 1; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if((delete this.y) !== true){ + $ERROR('#1: this.y = 1; (delete this.y) === true. Actual: ' + ((delete this.y))); +}; +// +////////////////////////////////////////////////////////////////////////////// + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (this.y !== undefined){ + $ERROR('#2: this.y = 1; (delete this.y) === true; this.y === undefined. Actual: ' + (this.y)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7.1_A2.js b/js/src/tests/test262/ch08/8.7/S8.7.1_A2.js new file mode 100644 index 000000000..eb9c4caff --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.1_A2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Delete operator can't delete reference, so it returns false to be applyed to reference + * + * @path ch08/8.7/S8.7.1_A2.js + * @description Try to delete y, where y is var y=1 + * @noStrict + */ + +var y = 1; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if(delete y){ + $ERROR('#1: y = 1; (delete y) === false. Actual: ' + ((delete y))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (y !== 1) { + $ERROR('#2: y = 1; delete y; y === 1. Actual: ' + (y)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T1.js b/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T1.js new file mode 100644 index 000000000..c7908106d --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * GetValue(V) mast fail + * + * @path ch08/8.7/S8.7.2_A1_T1.js + * @description Checking if execution of "'litera'=1;" fails + * @negative + */ + +'litera'=1; + diff --git a/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T2.js b/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T2.js new file mode 100644 index 000000000..97a38cc0b --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.2_A1_T2.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * GetValue(V) mast fail + * + * @path ch08/8.7/S8.7.2_A1_T2.js + * @description Checking if execution of "1=1" fails + * @negative + */ + +1=1; + diff --git a/js/src/tests/test262/ch08/8.7/S8.7.2_A2.js b/js/src/tests/test262/ch08/8.7/S8.7.2_A2.js new file mode 100644 index 000000000..53f3a8d5b --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.2_A2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * x++ calls GetValue then PutValue so after applying postfix increment(actually conrete operator type is unimportant) + * we must have reference to defined value + * + * @path ch08/8.7/S8.7.2_A2.js + * @description Execute x++, where x is var x + */ + +var x; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== undefined) { + $ERROR('#1: var x; x === undefined. Actual: ' + (x)); +} +// +////////////////////////////////////////////////////////////////////////////// +x++; +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (x === undefined) { + $ERROR('#2: var x; x++; x !== undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7.2_A3.js b/js/src/tests/test262/ch08/8.7/S8.7.2_A3.js new file mode 100644 index 000000000..7877e4e2b --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7.2_A3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * this.x++ calls GetValue then PutValue so after applying postfix increment(actually conrete operator type is unimportan) + * we must have reference to defined value + * + * @path ch08/8.7/S8.7.2_A3.js + * @description Execute this.x++, where this.x is undefined + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (this.x !== undefined) { + $ERROR('#1: this.x === undefined. Actual: ' + (this.x)); +} +// +////////////////////////////////////////////////////////////////////////////// +this.x++; +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (x === undefined) { + $ERROR('#2: this.x; this.x++; x !== undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A1.js b/js/src/tests/test262/ch08/8.7/S8.7_A1.js new file mode 100644 index 000000000..7743600bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_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. + +/** + * Multiple Variables should Referring to a Single Object + * + * @path ch08/8.7/S8.7_A1.js + * @description Create object and refers to the other object, modify a property in the original object. + * We now see that that change is represented in both variables + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +// Set obj to an empty object +// +var obj = new Object(); +// objRef now refers to the other object +// +var objRef = obj; +// Modify a property in the original object +objRef.oneProperty = -1; +obj.oneProperty = true; +// We now see that that change is represented in both variables +// (Since they both refer to the same object) +if(objRef.oneProperty !== true){ + $ERROR('#1: var obj = new Object(); var objRef = obj; objRef.oneProperty = -1; obj.oneProperty = true; objRef.oneProperty === true. Actual: ' + (objRef.oneProperty)); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A2.js b/js/src/tests/test262/ch08/8.7/S8.7_A2.js new file mode 100644 index 000000000..8e1e1e933 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A2.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Reference to Self-Modifying Object remain the integrity + * + * @path ch08/8.7/S8.7_A2.js + * @description Create a reference to the array, and change original array + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +// Create an array of items +var items = new Array( "one", "two", "three" ); +// Create a reference to the array of items +var itemsRef = items; +// Add an item to the original array +items.push( "four" );var itemsRef = items; +// The length of each array should be the same, +// since they both point to the same array object +if( itemsRef.length !== 4){ + $ERROR('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items.push( "four" );var itemsRef = items; itemsRef.length !== 4'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +// Create an array of items +var items = new Array( "one", "two", "three" ); +// Create a reference to the array of items +var itemsRef = items; +// Add an item to the original array +items[1]="duo"; +// The length of each array should be the same, +// since they both point to the same array object +if( itemsRef[1] !== "duo"){ + $ERROR('#2: var items = new Array( "one", "two", "three" ); var itemsRef = items; items[1]="duo"; itemsRef[1] === "duo". Actual: ' + (itemsRef[1])); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A3.js b/js/src/tests/test262/ch08/8.7/S8.7_A3.js new file mode 100644 index 000000000..b7266bee7 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Changing the Reference of an Object While Maintaining Integrity + * + * @path ch08/8.7/S8.7_A3.js + * @description Create a reference to the array, and redefine original array with new array + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +// Set items to an array (object) of strings +var items = new Array( "one", "two", "three" ); +// Set itemsRef to a reference to items +// +var itemsRef = items; +// Set items to equal a new object +// +items = new Array( "new", "array" ); +// items and itemsRef now point to different objects. +// items points to new Array( "new", "array" ) +// itemsRef points to new Array( "one", "two", "three" ) +if( items == itemsRef ){ + $ERROR('#1: var items = new Array( "one", "two", "three" ); var itemsRef = items; items = new Array( "new", "array" ); items != itemsRef'); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A4.js b/js/src/tests/test262/ch08/8.7/S8.7_A4.js new file mode 100644 index 000000000..f2c7b4562 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Object Modification Resulting in a New Object for Not a Self-Modified Object leads to loss of integrity + * + * @path ch08/8.7/S8.7_A4.js + * @description Create a reference to the string, and Concatenate some new text onto the string object + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +// Set item equal to a new string object +var item = new String("test"); +// itemRef now refers to the same string object +var itemRef = item; +// Concatenate some new text onto the string object +// NOTE: This creates a new object, and does not modify +// the original object. +item += "ing"; +// The values of item and itemRef are NOT equal, as a whole +// new string object has been created +if( item == itemRef ){ + $ERROR('#1: var item = new String("test"); var itemRef = item; item += "ing"; item != itemRef'); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A5_T1.js b/js/src/tests/test262/ch08/8.7/S8.7_A5_T1.js new file mode 100644 index 000000000..32796bdd3 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A5_T1.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Delete unary operator can't delete object to be referenced + * + * @path ch08/8.7/S8.7_A5_T1.js + * @description Delete referenced object, var __ref = obj + * @noStrict + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof(__ref) !== "undefined"){ + $ERROR('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +var obj = new Object(); +var __ref = obj; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof(__ref) === "undefined"){ + $ERROR('#2: obj = new Object(); var __ref = obj; typeof(__ref) !== "undefined"'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (delete __ref !== false){ + $ERROR('#3: obj = new Object(); var __ref = obj; delete __ref === false. Actual: ' + (delete __ref)); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (typeof(__ref) !== "object"){ + $ERROR('#4: obj = new Object(); var __ref = obj; delete __ref; typeof(__ref) === "object". Actual: ' + (typeof(__ref))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof(obj) !== "object"){ + $ERROR('#5: obj = new Object(); var __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A5_T2.js b/js/src/tests/test262/ch08/8.7/S8.7_A5_T2.js new file mode 100644 index 000000000..a76b36c19 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A5_T2.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Delete unary operator can't delete object to be referenced + * + * @path ch08/8.7/S8.7_A5_T2.js + * @description Delete referenced object, __ref = obj + * @noStrict + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof(__ref) !== "undefined"){ + $ERROR('#1: typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +var obj = new Object(); +__ref = obj; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof(__ref) === "undefined"){ + $ERROR('#2: obj = new Object(); __ref = obj; typeof(__ref) !== "undefined"'); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (delete __ref !== true){ + $ERROR('#3: obj = new Object(); __ref = obj; delete __ref === true. Actual: ' + (delete __ref)); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (typeof(__ref) !== "undefined"){ + $ERROR('#4: obj = new Object(); __ref = obj; delete __ref; typeof(__ref) === "undefined". Actual: ' + (typeof(__ref))); +}; +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof(obj) !== "object"){ + $ERROR('#5: obj = new Object(); __ref = obj; delete __ref; typeof(obj) === "object". Actual: ' + (typeof(obj))); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A6.js b/js/src/tests/test262/ch08/8.7/S8.7_A6.js new file mode 100644 index 000000000..40882f1a5 --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A6.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Passing arguments by value differs from by reference and do not change values to be passed + * + * @path ch08/8.7/S8.7_A6.js + * @description Adding original variable with referenced one inside function + */ + +var n = 1; +var m = n; + +function addFirst2Second(first, second){first += second;} + +addFirst2Second(n, m); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (m !== 1) { + $ERROR('#1: var n = 1; var m = n; function addFirst2Second(first, second){first += second;} addFirst2Second(n, m); m === 1. Actual: ' + (m)); +} + +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch08/8.7/S8.7_A7.js b/js/src/tests/test262/ch08/8.7/S8.7_A7.js new file mode 100644 index 000000000..17e8eb59c --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/S8.7_A7.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Passing arguments by reference do change values of reference to be passed + * + * @path ch08/8.7/S8.7_A7.js + * @description Add new property to original variable inside function + */ + +var n = {}; +var m = n; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof m !== "object") { + $ERROR('#1: var n = {}; var m = n; typeof m === "object". Actual: ' + (typeof m)); +} +// +////////////////////////////////////////////////////////////////////////////// + +function populateAge(person){person.age = 50;} + +populateAge(m); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (n.age !== 50) { + $ERROR('#2: var n = {}; var m = n; function populateAge(person){person.age = 50;} populateAge(m); n.age === 50. Actual: ' + (n.age)); +} + +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/js/src/tests/test262/ch08/8.7/browser.js b/js/src/tests/test262/ch08/8.7/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/browser.js diff --git a/js/src/tests/test262/ch08/8.7/shell.js b/js/src/tests/test262/ch08/8.7/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch08/8.7/shell.js |