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.4/11.4.5 | |
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.4/11.4.5')
21 files changed, 575 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-1-s.js new file mode 100644 index 000000000..2c0d4c1a1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-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.4/11.4.5/11.4.5-2-1-s.js
+ * @description Strict Mode - SyntaxError is thrown for --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.4/11.4.5/11.4.5-2-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2-s.js new file mode 100644 index 000000000..373dabe9e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-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.4/11.4.5/11.4.5-2-2-s.js
+ * @description Strict Mode - SyntaxError is thrown for --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.4/11.4.5/11.4.5-2-2gs.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-2gs.js new file mode 100644 index 000000000..3040d8029 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-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 ch11/11.4/11.4.5/11.4.5-2-2gs.js
+ * @description Strict Mode - SyntaxError is throw if the UnaryExpression operated upon by a Prefix Increment operator(--arguments)
+ * @onlyStrict
+ * @negative ^((?!NotEarlyError).)*$
+ */
+
+"use strict";
+throw NotEarlyError;
+--arguments;
diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-2-3-s.js new file mode 100644 index 000000000..9af3f7bcb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/11.4.5-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.4/11.4.5/11.4.5-2-3-s.js
+ * @description Strict Mode - SyntaxError is not thrown for --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.4/11.4.5/S11.4.5_A1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A1.js new file mode 100644 index 000000000..5be2493ee --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * White Space and Line Terminator between "--" and UnaryExpression are allowed + * + * @path ch11/11.4/11.4.5/S11.4.5_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 1; --\u0009x") !== 0) { + $ERROR('#1: var x = 1; --\\u0009x; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 1; --\u000Bx") !== 0) { + $ERROR('#2: var x = 1; --\\u000Bx; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 1; --\u000Cx") !== 0) { + $ERROR('#3: var x = 1; --\\u000Cx; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 1; --\u0020x") !== 0) { + $ERROR('#4: var x = 1; --\\u0020x; x === 0. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 1; --\u00A0x") !== 0) { + $ERROR('#5: var x = 1; --\\u00A0x; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 1; --\u000Ax") !== 0) { + $ERROR('#6: var x = 1; --\\u000Ax; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 1; --\u000Dx") !== 0) { + $ERROR('#7: var x = 1; --\\u000Dx; x === 0. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 1; --\u2028x") !== 0) { + $ERROR('#8: var x = 1; --\\u2028x; x === 0. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 1; --\u2029x") !== 0) { + $ERROR('#9: var x = 1; --\\u2029x; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 1; --\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 0) { + $ERROR('#10: var x = 1; --\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 0. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T1.js new file mode 100644 index 000000000..136b72c51 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A2.1_T1.js + * @description Type(x) is Reference and GetBase(x) is not null + */ + +//CHECK#1 +var x = 1; +if (--x !== 1 - 1) { + $ERROR('#1: var x = 1; --x === 1 - 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 - 1) { + $ERROR('#2: this.x = 1; --this.x === 1 - 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 - 1) { + $ERROR('#3: var object = new Object(); object.prop = 1; --object.prop === 1 - 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.4/11.4.5/S11.4.5_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T2.js new file mode 100644 index 000000000..2dabef975 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T2.js @@ -0,0 +1,22 @@ +// 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.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A2.1_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.1_T3.js new file mode 100644 index 000000000..5700185b9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js new file mode 100644 index 000000000..6f19db9db --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js @@ -0,0 +1,104 @@ +// 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.4/11.4.5/S11.4.5_A2.2_T1.js + * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) + */ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} 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}}; +if (--object !== 1 - 1) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object === 1 - 1. Actual: ' + (--object)); +} 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 {}}}; +if (--object !== 1 - 1) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object === 1 - 1. Actual: ' + (--object)); +} 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"}}; + if (--object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object === 1 - 1. Actual: ' + (--object)); + } else { + if (object !== 1 - 1) { + $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw "error"'); + } else { + $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (--object !== 1 - 1) { + $ERROR('#5.1: var object = {toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} 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}} +if (--object !== 1 - 1) { + $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} 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}}; + --object; + $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (--object)); +} +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 {}}}; + --object; + $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (--object)); +} +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.4/11.4.5/S11.4.5_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T1.js new file mode 100644 index 000000000..f7fd9fc7b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A3_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +--x; +if (x !== 1 - 1) { + $ERROR('#1: var x = true; --x; x === 1 - 1. 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.4/11.4.5/S11.4.5_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T2.js new file mode 100644 index 000000000..a946e8648 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T3.js new file mode 100644 index 000000000..6ed487073 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A3_T3.js + * @description Type(x) is primitive string 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.4/11.4.5/S11.4.5_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T4.js new file mode 100644 index 000000000..ed0d7798b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A3_T5.js new file mode 100644 index 000000000..0fd3f76ac --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_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.4/11.4.5/S11.4.5_A4_T1.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T1.js new file mode 100644 index 000000000..7f424a239 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T1.js @@ -0,0 +1,22 @@ +// 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) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = true; +if (--x !== 1 - 1) { + $ERROR('#1: var x = true; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Boolean(false); +if (--x !== 0 - 1) { + $ERROR('#2: var x = new Boolean(false); --x === 0 - 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T2.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T2.js new file mode 100644 index 000000000..c5c77de06 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T2.js @@ -0,0 +1,22 @@ +// 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) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T2.js + * @description Type(x) is number primitive or Number object + */ + +//CHECK#1 +var x = 0.1; +if (--x !== 0.1 - 1) { + $ERROR('#1: var x = 0.1; --x === 0.1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (--x !== -1.1 - 1) { + $ERROR('#2: var x = new Number(-1.1); --x === -1.1- 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T3.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T3.js new file mode 100644 index 000000000..29d4d123f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T3.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. + +/** + * Operator --x returns ToNumber(x) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T3.js + * @description Type(x) is string primitive or String object + */ + +//CHECK#1 +var x = "1"; +if (--x !== 1 - 1) { + $ERROR('#1: var x = "1"; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = "x"; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#3 +var x = new String("-1"); +if (--x !== -1 - 1) { + $ERROR('#3: var x = new String("-1"); --x === -1 - 1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.js new file mode 100644 index 000000000..a1f600ace --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T4.js @@ -0,0 +1,22 @@ +// 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) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +if (isNaN(--x) !== true) { + $ERROR('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +if (--x !== -1) { + $ERROR('#2: var x = null; --x === -1. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.js b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.js new file mode 100644 index 000000000..fe40976df --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/S11.4.5_A4_T5.js @@ -0,0 +1,22 @@ +// 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) - 1 + * + * @path ch11/11.4/11.4.5/S11.4.5_A4_T5.js + * @description Type(x) is Object object or Function object + */ + +//CHECK#1 +var x = {}; +if (isNaN(--x) !== true) { + $ERROR('#1: var x = {}; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(--x) !== true) { + $ERROR('#2: var x = function(){return 1}; --x === Not-a-Number. Actual: ' + (--x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/browser.js b/js/src/tests/test262/ch11/11.4/11.4.5/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.5/shell.js b/js/src/tests/test262/ch11/11.4/11.4.5/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.5/shell.js |