diff options
Diffstat (limited to 'js/src/tests/test262/ch11/11.1/11.1.5')
32 files changed, 852 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.js new file mode 100644 index 000000000..5ff963de5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-1.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.
+/**
+ * it isn't clear what specific requirements of the specificaiton are being tested here. This test should
+ * probably be replaced by some more targeted tests. AllenWB
+ *
+ * @path ch11/11.1/11.1.5/11.1.5-0-1.js
+ * @description Object literal - get set property
+ */
+
+
+function testcase() {
+ var s1 = "In getter";
+ var s2 = "In setter";
+ var s3 = "Modified by setter";
+ eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};");
+ if(o.foo !== s1)
+ return false;
+ o.foo=10;
+ if(s2 !== s3)
+ return false;
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js new file mode 100644 index 000000000..3f820b441 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-0-2.js @@ -0,0 +1,32 @@ +/// 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.
+/**
+ * it isn't clear what specific requirements of the specificaiton are being tested here. This test should
+ * probably be replaced by some more targeted tests. AllenWB
+ *
+ * @path ch11/11.1/11.1.5/11.1.5-0-2.js
+ * @description Object literal - multiple get set properties
+ */
+
+
+function testcase() {
+ var s1 = "First getter";
+ var s2 = "First setter";
+ var s3 = "Second getter";
+ eval("var o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};");
+ if(o.foo !== s1)
+ return false;
+ o.foo = 10;
+ if(s2 !== s3)
+ return false;
+ if(o.bar !== s3)
+ return false;
+ o.bar = "Second setter";
+ if(o.bar !== "Second setter")
+ return false;
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js new file mode 100644 index 000000000..371c0aceb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1-s.js @@ -0,0 +1,23 @@ +/// 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 ch11/11.1/11.1.5/11.1.5-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {set _11_1_5_1_fun(eval) {}};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js new file mode 100644 index 000000000..6d7766e3e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-1gs.js @@ -0,0 +1,14 @@ +/// 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 ch11/11.1/11.1.5/11.1.5-1gs.js
+ * @description Strict Mode - SyntaxError is thrown when 'eval' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+var obj = { set _11_1_5_1_fun(eval) {}};
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js new file mode 100644 index 000000000..5b763b78a --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2-s.js @@ -0,0 +1,23 @@ +/// 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 ch11/11.1/11.1.5/11.1.5-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {set _11_1_5_2_fun(arguments) {} };");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js new file mode 100644 index 000000000..f45f20b51 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-2gs.js @@ -0,0 +1,14 @@ +/// 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 ch11/11.1/11.1.5/11.1.5-2gs.js
+ * @description Strict Mode - SyntaxError is thrown when eval code contains an ObjectLiteral with more than one definition of any data property
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+"use strict";
+throw NotEarlyError;
+var obj = { _11_1_5_2_gs: 10, _11_1_5_2_gs: 10 };
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-s.js new file mode 100644 index 000000000..72219037e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-3-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 ch11/11.1/11.1.5/11.1.5-3-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'evals' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {set _11_1_5_3_fun(eval) { \"use strict\"; }};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-s.js new file mode 100644 index 000000000..8e4185c91 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5-4-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 ch11/11.1/11.1.5/11.1.5-4-s.js
+ * @description Strict Mode - SyntaxError is thrown when 'arguments' occurs as the Identifier in a PropertySetParameterList of a PropertyAssignment if its FunctionBody is strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {set _11_1_5_4_fun(arguments) {\"use strict\";}};");
+ return false;
+ } catch (e) {
+ return (e instanceof SyntaxError);
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js new file mode 100644 index 000000000..54b381128 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_3-3-1.js @@ -0,0 +1,31 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyAssignment
+ * 3.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_3-3-1.js
+ * @description Object initialization using PropertyNameAndValueList (PropertyAssignment) when property (read-only) exists in Object.prototype (step 3)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Object.prototype, "prop", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+ var obj = { prop: 12 };
+
+ return obj.hasOwnProperty("prop") && obj.prop === 12;
+ } finally {
+ delete Object.prototype.prop;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js new file mode 100644 index 000000000..837c309b3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-2.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
+ * a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-4-a-2.js
+ * @description Object literal - Duplicate data property name allowed if not in strict mode
+ */
+
+
+function testcase() {
+
+ eval("({foo:0,foo:1});");
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js new file mode 100644 index 000000000..9d37ec89d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-4-a-3.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
+ * a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-4-a-3.js
+ * @description Object literal - Duplicate data property name allowed gets last defined value
+ */
+
+
+function testcase() {
+
+ var o = eval("({foo:0,foo:1});");
+ return o.foo===1;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js new file mode 100644 index 000000000..ff06c134b --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_4-5-1.js @@ -0,0 +1,32 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
+ * 5.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false.
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_4-5-1.js
+ * @description Object initialization using PropertyNameAndValueList (PropertyNameAndValueList , PropertyAssignment) when property (read-only) exists in Object.prototype (Step 5)
+ */
+
+
+function testcase() {
+ try {
+ Object.defineProperty(Object.prototype, "prop2", {
+ value: 100,
+ writable: false,
+ configurable: true
+ });
+
+ var obj = { prop1: 101, prop2: 12 };
+
+ return obj.hasOwnProperty("prop2");
+ } finally {
+ delete Object.prototype.prop2;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.js new file mode 100644 index 000000000..7af0a34ec --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_5-4-1.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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : PropertyName : AssignmentExpression
+ * 4.Let desc be the Property Descriptor{[[Value]]: propValue, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_5-4-1.js
+ * @description Object literal - property descriptor for assignment expression
+ */
+
+
+function testcase() {
+
+ var o = {foo : 1};
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.value === 1 &&
+ desc.writable === true &&
+ desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js new file mode 100644 index 000000000..090d90944 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-1-s.js @@ -0,0 +1,30 @@ +/// 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 ch11/11.1/11.1.5/11.1.5_6-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var obj = {\
+ get _11_1_5_6_2_1() {\
+ public = 42;\
+ return public;\
+ }\
+ };");
+
+ var _11_1_5_6_2_1 = obj._11_1_5_6_2_1;
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js new file mode 100644 index 000000000..32afa56ed --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-2-2-s.js @@ -0,0 +1,29 @@ +/// 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 ch11/11.1/11.1.5/11.1.5_6-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word or a future reserved word is made inside a strict mode FunctionBody of a PropertyAssignment
+ * @onlyStrict
+ */
+
+
+function testcase() {
+
+ try {
+ eval("var obj = {\
+ get _11_1_5_6_2_2() {\
+ \"use strict\";\
+ public = 42;\
+ return public;\
+ }\
+ };\
+ var _11_1_5_6_2_2 = obj._11_1_5_6_2_2;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.js new file mode 100644 index 000000000..6514561d9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-1.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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_6-3-1.js
+ * @description Object literal - property descriptor for get property assignment
+ */
+
+
+function testcase() {
+
+ eval("var o = {get foo(){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js new file mode 100644 index 000000000..dc0665d69 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_6-3-2.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_6-3-2.js
+ * @description Object literal - property descriptor for get property assignment should not create a set function
+ */
+
+
+function testcase() {
+
+ eval("var o = {get foo(){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ return desc.set === undefined
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js new file mode 100644 index 000000000..71aacfa2e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-1-s.js @@ -0,0 +1,30 @@ +/// 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 ch11/11.1/11.1.5/11.1.5_7-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is contained in strict code
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var data = \"data\";\
+ var obj = {\
+ set _11_1_5_7_2_1(value) {\
+ public = 42;\
+ data = value;\
+ }\
+ };\
+ obj._11_1_5_7_2_1 = 1;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js new file mode 100644 index 000000000..b351a43f7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-2-2-s.js @@ -0,0 +1,30 @@ +/// 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 ch11/11.1/11.1.5/11.1.5_7-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown when an assignment to a reserved word is made in a strict FunctionBody of a PropertyAssignment
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+
+ try {
+ eval("var data = \"data\";\
+ var obj = {\
+ set _11_1_5_7_2_2(value) {\
+ public = 42;\
+ data = value;\
+ }\
+ };\
+ obj._11_1_5_7_2_2 = 1;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.js new file mode 100644 index 000000000..ae453873d --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-1.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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : set PropertyName( PropertySetParameterList ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Set]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_7-3-1.js
+ * @description Object literal - property descriptor for set property assignment
+ */
+
+
+function testcase() {
+
+ eval("var o = {set foo(arg){return 1;}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ if(desc.enumerable === true &&
+ desc.configurable === true)
+ return true;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js new file mode 100644 index 000000000..216f80a2e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/11.1.5_7-3-2.js @@ -0,0 +1,23 @@ +/// 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.
+/**
+ * Refer 11.1.5;
+ * The production
+ * PropertyAssignment : get PropertyName ( ) { FunctionBody }
+ * 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true}
+ *
+ * @path ch11/11.1/11.1.5/11.1.5_7-3-2.js
+ * @description Object literal - property descriptor for set property assignment should not create a get function
+ */
+
+
+function testcase() {
+
+ eval("var o = {set foo(arg){}};");
+ var desc = Object.getOwnPropertyDescriptor(o,"foo");
+ return desc.get === undefined
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.js new file mode 100644 index 000000000..0f4a1936e --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.1.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. + +/** + * Evaluate the production ObjectLiteral: { } + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.1.js + * @description Checking various properteis of the object defined with "var object = {}" + */ + +var object = {}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object.toString() !== "[object Object]") { + $ERROR('#4: var object = {}; object.toString === "[object Object]". Actual: ' + (object.toString)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.js new file mode 100644 index 000000000..9eff82640 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.2.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. + +/** + * Evaluate the production ObjectLiteral: { NumericLiteral : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.2.js + * @description Checking various properteis and contents of the object defined with "var object = {1 : true}" + */ + +var object = {1 : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {1 : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {1 : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {1 : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object[1] !== true) { + $ERROR('#4: var object = {1 : true}; object[1] === true'); +} + +//CHECK#5 +if (object["1"] !== true) { + $ERROR('#5: var object = {1 : true}; object["1"] === true'); +} + + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js new file mode 100644 index 000000000..dea77e509 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.3.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { StringLiteral : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.3.js + * @description Checking various properteis and contents of the object defined with "var object = {"x" : true}" + */ + +var object = {"x" : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {"x" : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {"x" : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {"x" : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["x"] !== true) { + $ERROR('#4: var object = {"x" : true}; object["x"] === true'); +} + +//CHECK#5 +if (object.x !== true) { + $ERROR('#5: var object = {"x" : true}; object.x === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js new file mode 100644 index 000000000..5919596dc --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A1.4.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { Identifier : AssignmentExpression} + * + * @path ch11/11.1/11.1.5/S11.1.5_A1.4.js + * @description Checking various properteis and contents of the object defined with "var object = {prop : true}" + */ + +var object = {prop : true}; + +//CHECK#1 +if (typeof object !== "object") { + $ERROR('#1: var object = {prop : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + $ERROR('#2: var object = {prop : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + $ERROR('#3: var object = {prop : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["prop"] !== true) { + $ERROR('#4: var object = {prop : true}; object["prop"] === true'); +} + +//CHECK#5 +if (object.prop !== true) { + $ERROR('#5: var object = {prop : true}; object.prop === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js new file mode 100644 index 000000000..808578392 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A2.js @@ -0,0 +1,94 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Evaluate the production ObjectLiteral: { PropertyName : AssignmentExpression } + * + * @path ch11/11.1/11.1.5/S11.1.5_A2.js + * @description Creating property "prop" of various types(boolean, number and etc.) + */ + +//CHECK#1 +var x = true; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#2 +var x = new Boolean(true); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#3 +var x = 1; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#4 +var x = new Number(1); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#5 +var x = "1"; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#5: var x = "1"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#6 +var x = new String(1); +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#7 +var x = undefined; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#8 +var x = null; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#9 +var x = {}; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#10 +var x = [1,2]; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#11 +var x = function() {}; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#12 +var x = this; +var object = {prop : x}; +if (object.prop !== x) { + $ERROR('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A3.js new file mode 100644 index 000000000..1d0024a9f --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_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. + +/** + * Evaluate the production ObjectLiteral: { PropertyNameAndValueList } + * + * @path ch11/11.1/11.1.5/S11.1.5_A3.js + * @description Creating the object defined with "var object = {0 : 1, "1" : "x", o : {}}" + */ + +var object = {0 : 1, "1" : "x", o : {}}; + +//CHECK#1 +if (object[0] !== 1) { + $ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; object[0] === 1. Actual: ' + (object[0])); +} + +//CHECK#2 +if (object["1"] !== "x") { + $ERROR('#2: var object = {0 : 1; "1" : "x"; o : {}}; object["1"] === "x". Actual: ' + (object["1"])); +} + +//CHECK#3 +if (typeof object.o !== "object") { + $ERROR('#1: var object = {0 : 1; "1" : "x"; o : {}}; typeof object.o === "object". Actual: ' + (typeof object.o)); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.js new file mode 100644 index 000000000..b1d2a2f90 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.1.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. + +/** + * The PropertyName is not really a BooleanLiteral + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.1.js + * @description Checking if execution of "var object = {true : 1}" does not fail + */ + +//CHECK#1 +var object = {true : 1}; + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js new file mode 100644 index 000000000..ebeb5fbc6 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.2.js @@ -0,0 +1,12 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The PropertyName is not really a nullLiteral + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.2.js + * @description Checking if execution of "var object = {null : true}" does not fail + */ + +//CHECK#1 +var object = {null : true}; diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.js b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.js new file mode 100644 index 000000000..03c89ee99 --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/S11.1.5_A4.3.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. + +/** + * The PropertyName is undefined, ToString(BooleanLiteral), ToString(nullLiteral) + * + * @path ch11/11.1/11.1.5/S11.1.5_A4.3.js + * @description Creating properties with following names: undefined, 'true', 'null' + */ + +//CHECK#1 +var object = {undefined : true}; +if (object.undefined !== true) { + $ERROR('#1: var object = {undefined : true}; object.undefined === true'); +} + +//CHECK#2 +var object = {undefined : true}; +if (object["undefined"] !== true) { + $ERROR('#2: var object = {undefined : true}; object["undefined"] === true'); +} + +//CHECK#3 +var object = {"true" : true}; +if (object["true"] !== true) { + $ERROR('#3: var object = {"true" : true}; object["true"] === true'); +} + +//CHECK#4 +var object = {"null" : true}; +if (object["null"] !== true) { + $ERROR('#4: var object = {"null" : true}; object["null"] === true'); +} + diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/browser.js b/js/src/tests/test262/ch11/11.1/11.1.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/browser.js diff --git a/js/src/tests/test262/ch11/11.1/11.1.5/shell.js b/js/src/tests/test262/ch11/11.1/11.1.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.1/11.1.5/shell.js |