diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch11/11.3 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch11/11.3')
51 files changed, 1243 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-1-s.js b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-1-s.js new file mode 100644 index 000000000..28b299108 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-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.3/11.3.1/11.3.1-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown if the identifier 'arguments' appear as a PostfixExpression(arguments++)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = arguments;
+ try {
+ eval("arguments++;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === arguments;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-1gs.js b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-1gs.js new file mode 100644 index 000000000..15456cd5c --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-1gs.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 ch11/11.3/11.3.1/11.3.1-2-1gs.js
+ * @description Strict Mode - SyntaxError is throw if the identifier arguments appear as a PostfixExpression(arguments++)
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+arguments++;
diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-2-s.js b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-2-s.js new file mode 100644 index 000000000..f71ea4568 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-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.3/11.3.1/11.3.1-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown if the identifier 'eval' appear as a PostfixExpression(eval++)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = eval;
+ try {
+ eval("eval++;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === eval;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-3-s.js b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-3-s.js new file mode 100644 index 000000000..e46a70606 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/11.3.1-2-3-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 ch11/11.3/11.3.1/11.3.1-2-3-s.js
+ * @description Strict Mode - SyntaxError is not thrown if the identifier 'arguments[...]' appears as a PostfixExpression(arguments++)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ arguments[1] = 7;
+ arguments[1]++;
+ return arguments[1]===8;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T1.js new file mode 100644 index 000000000..9f8bc65a1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "++" is not allowed + * + * @path ch11/11.3/11.3.1/S11.3.1_A1.1_T1.js + * @description Checking Line Feed + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u000A++"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T2.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T2.js new file mode 100644 index 000000000..4c97a56d1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "++" is not allowed + * + * @path ch11/11.3/11.3.1/S11.3.1_A1.1_T2.js + * @description Carriage Return + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u000D++"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T3.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T3.js new file mode 100644 index 000000000..16eb546f4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T3.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "++" is not allowed + * + * @path ch11/11.3/11.3.1/S11.3.1_A1.1_T3.js + * @description Checking Line Seprator + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u2028++"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T4.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T4.js new file mode 100644 index 000000000..8f9d56e71 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.1_T4.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "++" is not allowed + * + * @path ch11/11.3/11.3.1/S11.3.1_A1.1_T4.js + * @description Checking Paragraph separator + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u2029++"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.2_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.2_T1.js new file mode 100644 index 000000000..b8df6ebd7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A1.2_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * White Space between LeftHandSideExpression and "++" are allowed + * + * @path ch11/11.3/11.3.1/S11.3.1_A1.2_T1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; x\u0009++; x") !== 1) { + $ERROR('#1: var x = 0; x\\u0009++; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; x\u000B++; x") !== 1) { + $ERROR('#2: var x = 0; x\\u000B++; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; x\u000C++; x") !== 1) { + $ERROR('#3: var x = 0; x\\u000C++; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; x\u0020++; x") !== 1) { + $ERROR('#4: var x = 0; x\\u0020++; x === 1. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; x\u00A0++; x") !== 1) { + $ERROR('#5: var x = 0; x\\u00A0++; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; x\u0009\u000B\u000C\u0020\u00A0++; x") !== 1) { + $ERROR('#6: var x = 0; x\\u0009\\u000B\\u000C\\u0020\\u00A0++; x === 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js new file mode 100644 index 000000000..3f32ea5b7 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ uses GetValue and PutValue + * + * @path ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js + * @description Type(x) is Reference and GetBase(x) is not null + */ + +//CHECK#1 +var x = 1; +var y = x++; +if (y !== 1) { + $ERROR('#1: var x = 1; var y = x++; y === 1. Actual: ' + (y)); +} else { + if (x !== 1 + 1) { + $ERROR('#1: var x = 1; var y = x++; x === 1 + 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +var y = this.x++; +if (y !== 1) { + $ERROR('#2: this.x = 1; var y = this.x++; y === 1. Actual: ' + (y)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#2: this.x = 1; var y = this.x++; this.x === 1 + 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +var y = object.prop++; +if (y !== 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; y === 1. Actual: ' + (y)); +} else { + if (this.x !== 1 + 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; object.prop === 1 + 1. Actual: ' + (object.prop)); + } +} + + + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T2.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T2.js new file mode 100644 index 000000000..5bc1abbad --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ uses GetValue and PutValue + * + * @path ch11/11.3/11.3.1/S11.3.1_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x++; + $ERROR('#1.1: x++ throw ReferenceError. Actual: ' + (x++)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x++ throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T3.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T3.js new file mode 100644 index 000000000..fec236e6d --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ uses GetValue and PutValue + * + * @path ch11/11.3/11.3.1/S11.3.1_A2.1_T3.js + * @description If Type(x) is not Reference, throw ReferenceError (or SyntaxError) + * @negative + */ + +//CHECK#1 +try { + 1++; + $ERROR('#1.1: 1++ throw ReferenceError (or SyntaxError). Actual: ' + (1++)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: 1++ throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + 1++; + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.2_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.2_T1.js new file mode 100644 index 000000000..dc82a92da --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.2_T1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ uses [[Default Value]] + * + * @path ch11/11.3/11.3.1/S11.3.1_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +var y = object++; +if (y !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +var y = object++; +if (y !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +var y = object++; +if (y !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + var y = object++; + if (y !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y === 1. Actual: ' + (y)); + } else { + if (object !== 1 + 1) { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object++; object === 1 + 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y not throw "error"'); + } else { + $ERROR('#4.4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +var y = object++; +if (y !== 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +var y = object++; +if (y !== 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + var y = object++; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object++ throw "error". Actual: ' + (y)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object++ throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + var y = object++; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object++ throw TypeError. Actual: ' + (y)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object++ throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T1.js new file mode 100644 index 000000000..e3003d2d4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns x = ToNumber(x) + 1 + * + * @path ch11/11.3/11.3.1/S11.3.1_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +x++; +if (x !== 0 + 1) { + $ERROR('#1: var x = false; x++; x === 0 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(true); +x++; +if (x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); x++; x === 1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T2.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T2.js new file mode 100644 index 000000000..6b5560d1a --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns x = ToNumber(x) + 1 + * + * @path ch11/11.3/11.3.1/S11.3.1_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +x++; +if (x !== 0.1 + 1) { + $ERROR('#1: var x = 0.1; x++; x === 0.1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +x++; +if (x !== -1.1 + 1) { + $ERROR('#2: var x = new Number(-1.1); x++; x === -1.1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T3.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T3.js new file mode 100644 index 000000000..b43aa2c42 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns x = ToNumber(x) + 1 + * + * @path ch11/11.3/11.3.1/S11.3.1_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +x++; +if (x !== 1 + 1) { + $ERROR('#1: var x = "1"; x++; x === 1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +x++; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +x++; +if (x !== -1 + 1) { + $ERROR('#3: var x = new String("-1"); x++; x === -1 + 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T4.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T4.js new file mode 100644 index 000000000..1a6fd79ec --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns x = ToNumber(x) + 1 + * + * @path ch11/11.3/11.3.1/S11.3.1_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +x++; +if (isNaN(x) !== true) { + $ERROR('#1: var x; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +x++; +if (x !== 1) { + $ERROR('#2: var x = null; x++; x === 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T5.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T5.js new file mode 100644 index 000000000..c18fc2085 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns x = ToNumber(x) + 1 + * + * @path ch11/11.3/11.3.1/S11.3.1_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +x++; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +x++; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; x++; x === Not-a-Number. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T1.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T1.js new file mode 100644 index 000000000..174800a77 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns ToNumber(x) + * + * @path ch11/11.3/11.3.1/S11.3.1_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +var y = x++; +if (y !== 0) { + $ERROR('#1: var x = false; var y = x++; y === 0. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Boolean(true); +var y = x++; +if (y !== 1) { + $ERROR('#2: var x = new Boolean(true); var y = x++; y === 1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T2.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T2.js new file mode 100644 index 000000000..36fe9aec5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns ToNumber(x) + * + * @path ch11/11.3/11.3.1/S11.3.1_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = -0.1; +var y = x++; +if (y !== -0.1) { + $ERROR('#1: var x = -0.1; var y = x++; y === -0.1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Number(1.1); +var y = x++; +if (y !== 1.1) { + $ERROR('#2: var x = new Number(1.1); var y = x++; y === 1.1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T3.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T3.js new file mode 100644 index 000000000..540ee9024 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns ToNumber(x) + * + * @path ch11/11.3/11.3.1/S11.3.1_A4_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +var y = x++; +if (y !== 1) { + $ERROR('#1: var x = "1"; var y = x++; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = "x"; +var y = x++; +if (isNaN(y) !== true) { + $ERROR('#2: var x = "x"; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#3 +var x = new String("-1"); +var y = x++; +if (y !== -1) { + $ERROR('#3: var x = new String("-1"); var y = x++; y === -1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T4.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T4.js new file mode 100644 index 000000000..cf703689d --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns ToNumber(x) + * + * @path ch11/11.3/11.3.1/S11.3.1_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +var y = x++; +if (isNaN(y) !== true) { + $ERROR('#1: var x; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = null; +var y = x++; +if (y !== 0) { + $ERROR('#2: var x = null; var y = x++; y === 0. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T5.js b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T5.js new file mode 100644 index 000000000..09a248cf3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A4_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x++ returns ToNumber(x) + * + * @path ch11/11.3/11.3.1/S11.3.1_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +var y = x++; +if (isNaN(y) !== true) { + $ERROR('#1: var x = {}; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = function(){return 1}; +var y = x++; +if (isNaN(y) !== true) { + $ERROR('#2: var x = function(){return 1}; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/browser.js b/js/src/tests/test262/ch11/11.3/11.3.1/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/browser.js diff --git a/js/src/tests/test262/ch11/11.3/11.3.1/shell.js b/js/src/tests/test262/ch11/11.3/11.3.1/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.1/shell.js diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-1-s.js b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-1-s.js new file mode 100644 index 000000000..f40c73ac1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-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.3/11.3.2/11.3.2-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown if the identifier 'arguments' appear as a PostfixExpression(arguments--)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = arguments;
+ try {
+ eval("arguments--;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === arguments;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-2-s.js b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-2-s.js new file mode 100644 index 000000000..09c186fd3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-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.3/11.3.2/11.3.2-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown if the identifier 'eval' appear as a PostfixExpression(eval--)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ var blah = eval;
+ try {
+ eval("eval--;");
+ return false;
+ } catch (e) {
+ return e instanceof SyntaxError && blah === eval;
+ }
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-3-s.js b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-3-s.js new file mode 100644 index 000000000..6eb43dbbd --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/11.3.2-2-3-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 ch11/11.3/11.3.2/11.3.2-2-3-s.js
+ * @description Strict Mode - SyntaxError is not thrown if the identifier 'arguments[...]' appears as a PostfixExpression(arguments--)
+ * @onlyStrict
+ */
+
+
+function testcase() {
+ "use strict";
+ arguments[1] = 7;
+ arguments[1]--;
+ return arguments[1]===6;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T1.js new file mode 100644 index 000000000..2fe2120bf --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "--" is not allowed + * + * @path ch11/11.3/11.3.2/S11.3.2_A1.1_T1.js + * @description Checking Line Feed + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u000A--"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T2.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T2.js new file mode 100644 index 000000000..49654288a --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "--" is not allowed + * + * @path ch11/11.3/11.3.2/S11.3.2_A1.1_T2.js + * @description Checking Carriage Return + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u000D--"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T3.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T3.js new file mode 100644 index 000000000..5e0af0e99 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T3.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "--" is not allowed + * + * @path ch11/11.3/11.3.2/S11.3.2_A1.1_T3.js + * @description Checking Page separator + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u2028--"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T4.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T4.js new file mode 100644 index 000000000..e7d54a741 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.1_T4.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Line Terminator between LeftHandSideExpression and "--" is not allowed + * + * @path ch11/11.3/11.3.2/S11.3.2_A1.1_T4.js + * @description Checking Line separator + * @negative + */ + +//CHECK#1 +eval("var x = 1; x\u2029--"); + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.2_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.2_T1.js new file mode 100644 index 000000000..8140d2b8e --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A1.2_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * White Space between LeftHandSideExpression and "--" are allowed + * + * @path ch11/11.3/11.3.2/S11.3.2_A1.2_T1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; x\u0009--; x") !== -1) { + $ERROR('#1: var x = 0; x\\u0009--; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; x\u000B--; x") !== -1) { + $ERROR('#2: var x = 0; x\\u000B--; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; x\u000C--; x") !== -1) { + $ERROR('#3: var x = 0; x\\u000C--; x === -1. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; x\u0020--; x") !== -1) { + $ERROR('#4: var x = 0; x\\u0020--; x === -1. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; x\u00A0--; x") !== -1) { + $ERROR('#5: var x = 0; x\\u00A0--; x === -1. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; x\u0009\u000B\u000C\u0020\u00A0--; x") !== -1) { + $ERROR('#6: var x = 0; x\\u0009\\u000B\\u000C\\u0020\\u00A0--; x === -1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T1.js new file mode 100644 index 000000000..b665af599 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- uses GetValue and PutValue + * + * @path ch11/11.3/11.3.2/S11.3.2_A2.1_T1.js + * @description Type(x) is Reference and GetBase(x) is not null + */ + +//CHECK#1 +var x = 1; +if (x-- !== 1) { + $ERROR('#1: var x = 1; x-- === 1. Actual: ' + (x--)); +} else { + if (x !== 1 - 1) { + $ERROR('#1: var x = 1; x--; x === 1 - 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (this.x-- !== 1) { + $ERROR('#2: this.x = 1; this.x-- === 1. Actual: ' + (this.x--)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#2: this.x = 1; this.x--; this.x === 1 - 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (object.prop-- !== 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; object.prop-- === 1. Actual: ' + (object.prop--)); +} else { + if (this.x !== 1 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; object.prop--; object.prop === 1 - 1. Actual: ' + (object.prop)); + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T2.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T2.js new file mode 100644 index 000000000..cae6d80b5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- uses GetValue and PutValue + * + * @path ch11/11.3/11.3.2/S11.3.2_A2.1_T2.js + * @description If GetBase(x) is null, throw ReferenceError + */ + +//CHECK#1 +try { + x--; + $ERROR('#1.1: x-- throw ReferenceError. Actual: ' + (x--)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: x-- throw ReferenceError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T3.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T3.js new file mode 100644 index 000000000..adcf758c3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.1_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- uses GetValue and PutValue + * + * @path ch11/11.3/11.3.2/S11.3.2_A2.1_T3.js + * @description If Type(x) is not Reference, throw ReferenceError (or SyntaxError) + * @negative + */ + +//CHECK#1 +try { + 1--; + $ERROR('#1.1: 1-- throw ReferenceError (or SyntaxError). Actual: ' + (1--)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: 1-- throw ReferenceError (or SyntaxError). Actual: ' + (e)); + } else { + 1--; + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.2_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.2_T1.js new file mode 100644 index 000000000..22f31a1fa --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A2.2_T1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- uses [[Default Value]] + * + * @path ch11/11.3/11.3.2/S11.3.2_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +var y = object--; +if (y !== 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +var y = object--; +if (y !== 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +var y = object--; +if (y !== 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + var y = object--; + if (y !== 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object--; y === 1. Actual: ' + (y)); + } else { + if (object !== 1 - 1) { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object--; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; y not throw "error"'); + } else { + $ERROR('#4.4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; y not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +var y = object--; +if (y !== 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + $ERROR('#5.2: var object = {toString: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +var y = object--; +if (y !== 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + var y = object--; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object-- throw "error". Actual: ' + (y)); +} +catch (e) { + if (e !== "error") { + $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object-- throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + var y = object--; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object-- throw TypeError. Actual: ' + (y)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object-- throw TypeError. Actual: ' + (e)); + } +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T1.js new file mode 100644 index 000000000..d35aeffc5 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns x = ToNumber(x) - 1 + * + * @path ch11/11.3/11.3.2/S11.3.2_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +x--; +if (x !== 0) { + $ERROR('#1: var x = true; x--; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(false); +x--; +if (x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); x--; x === 0 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T2.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T2.js new file mode 100644 index 000000000..cf1435a4c --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns x = ToNumber(x) - 1 + * + * @path ch11/11.3/11.3.2/S11.3.2_A3_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 1.1; +x--; +if (x !== 1.1 - 1) { + $ERROR('#1: var x = 1.1; x--; x === 1.1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-0.1); +x--; +if (x !== -0.1 - 1) { + $ERROR('#2: var x = new Number(-0.1); x--; x === -0.1 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T3.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T3.js new file mode 100644 index 000000000..63108752b --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns x = ToNumber(x) - 1 + * + * @path ch11/11.3/11.3.2/S11.3.2_A3_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +x--; +if (x !== 1 - 1) { + $ERROR('#1: var x = "1"; x--; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +x--; +if (isNaN(x) !== true) { + $ERROR('#2: var x = "x"; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +x--; +if (x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); x--; x === -1 - 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T4.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T4.js new file mode 100644 index 000000000..ea248bfb0 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns x = ToNumber(x) - 1 + * + * @path ch11/11.3/11.3.2/S11.3.2_A3_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +x--; +if (isNaN(x) !== true) { + $ERROR('#1: var x; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +x--; +if (x !== -1) { + $ERROR('#2: var x = null; x--; x === -1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T5.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T5.js new file mode 100644 index 000000000..b571f0654 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns x = ToNumber(x) - 1 + * + * @path ch11/11.3/11.3.2/S11.3.2_A3_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +x--; +if (isNaN(x) !== true) { + $ERROR('#1: var x = {}; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +x--; +if (isNaN(x) !== true) { + $ERROR('#2: var x = function(){return 1}; x--; x === Not-a-Number. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T1.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T1.js new file mode 100644 index 000000000..4d07e77e4 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns ToNumber(x) + * + * @path ch11/11.3/11.3.2/S11.3.2_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +var y = x--; +if (y !== 1) { + $ERROR('#1: var x = true; var y = x--; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Boolean(false); +var y = x--; +if (y !== 0) { + $ERROR('#2: var x = new Boolean(false); var y = x--; y === 0. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T2.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T2.js new file mode 100644 index 000000000..eb5c3bcde --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns ToNumber(x) + * + * @path ch11/11.3/11.3.2/S11.3.2_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 1.1; +var y = x--; +if (y !== 1.1) { + $ERROR('#1: var x = 1.1; var y = x--; y === 1.1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Number(-0.1); +var y = x--; +if (y !== -0.1) { + $ERROR('#2: var x = new Number(-0.1); var y = x--; y === -0.1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T3.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T3.js new file mode 100644 index 000000000..8a4edfca8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns ToNumber(x) + * + * @path ch11/11.3/11.3.2/S11.3.2_A4_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +var y = x--; +if (y !== 1) { + $ERROR('#1: var x = "1"; var y = x--; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = "x"; +var y = x--; +if (isNaN(y) !== true) { + $ERROR('#2: var x = "x"; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#3 +var x = new String("-1"); +var y = x--; +if (y !== -1) { + $ERROR('#3: var x = new String("-1"); var y = x--; y === -1. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T4.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T4.js new file mode 100644 index 000000000..add21d32a --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns ToNumber(x) + * + * @path ch11/11.3/11.3.2/S11.3.2_A4_T4.js + * @description If Type(x) is undefined or null + */ + +//CHECK#1 +var x; +var y = x--; +if (isNaN(y) !== true) { + $ERROR('#1: var x; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = null; +var y = x--; +if (y !== 0) { + $ERROR('#2: var x = null; var y = x--; y === 0. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T5.js b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T5.js new file mode 100644 index 000000000..aa6856568 --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/S11.3.2_A4_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Operator x-- returns ToNumber(x) + * + * @path ch11/11.3/11.3.2/S11.3.2_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +var y = x--; +if (isNaN(y) !== true) { + $ERROR('#1: var x = {}; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = function(){return 1}; +var y = x--; +if (isNaN(y) !== true) { + $ERROR('#2: var x = function(){return 1}; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/browser.js b/js/src/tests/test262/ch11/11.3/11.3.2/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/browser.js diff --git a/js/src/tests/test262/ch11/11.3/11.3.2/shell.js b/js/src/tests/test262/ch11/11.3/11.3.2/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/11.3.2/shell.js diff --git a/js/src/tests/test262/ch11/11.3/browser.js b/js/src/tests/test262/ch11/11.3/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/browser.js diff --git a/js/src/tests/test262/ch11/11.3/shell.js b/js/src/tests/test262/ch11/11.3/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.3/shell.js |