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.4 | |
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.4')
20 files changed, 559 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-1-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-1-s.js new file mode 100644 index 000000000..f7e9b82de --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-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.4/11.4.4-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.4/11.4.4-2-2-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-2-s.js new file mode 100644 index 000000000..142adabef --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-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.4/11.4.4-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.4/11.4.4-2-3-s.js b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-2-3-s.js new file mode 100644 index 000000000..00d6448e3 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/11.4.4-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.4/11.4.4-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]===8;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A1.js new file mode 100644 index 000000000..1a6f53940 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_A1.js + * @description Checking by using eval + */ + +//CHECK#1 +if (eval("var x = 0; ++\u0009x") !== 1) { + $ERROR('#1: var x = 0; ++\\u0009x; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +if (eval("var x = 0; ++\u000Bx") !== 1) { + $ERROR('#2: var x = 0; ++\\u000Bx; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +if (eval("var x = 0; ++\u000Cx") !== 1) { + $ERROR('#3: var x = 0; ++\\u000Cx; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +if (eval("var x = 0; ++\u0020x") !== 1) { + $ERROR('#4: var x = 0; ++\\u0020x; x === 1. Actual: ' + (x)); +} + +//CHECK#5 +if (eval("var x = 0; ++\u00A0x") !== 1) { + $ERROR('#5: var x = 0; ++\\u00A0x; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +if (eval("var x = 0; ++\u000Ax") !== 1) { + $ERROR('#6: var x = 0; ++\\u000Ax; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +if (eval("var x = 0; ++\u000Dx") !== 1) { + $ERROR('#7: var x = 0; ++\\u000Dx; x === 1. Actual: ' + (x)); +} + +//CHECK#8 +if (eval("var x = 0; ++\u2028x") !== 1) { + $ERROR('#8: var x = 0; ++\\u2028x; x === 1. Actual: ' + (x)); +} + +//CHECK#9 +if (eval("var x = 0; ++\u2029x") !== 1) { + $ERROR('#9: var x = 0; ++\\u2029x; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +if (eval("var x = 0; ++\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x") !== 1) { + $ERROR('#10: var x = 0; ++\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === 1. Actual: ' + (x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T1.js new file mode 100644 index 000000000..253e2a970 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T2.js new file mode 100644 index 000000000..a67137e4b --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/11.4.4/S11.4.4_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.4/S11.4.4_A2.1_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js new file mode 100644 index 000000000..7faa4d81f --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.1_T3.js @@ -0,0 +1,25 @@ +// 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.4/S11.4.4_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.4/S11.4.4_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A2.2_T1.js new file mode 100644 index 000000000..bdc909df1 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T1.js new file mode 100644 index 000000000..9c41505c9 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/11.4.4/S11.4.4_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T2.js new file mode 100644 index 000000000..52296a948 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T3.js new file mode 100644 index 000000000..aee3607dd --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/11.4.4/S11.4.4_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T4.js new file mode 100644 index 000000000..89619003e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A3_T5.js new file mode 100644 index 000000000..d08522f72 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A4_T1.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T1.js new file mode 100644 index 000000000..585e75091 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_A4_T1.js + * @description Type(x) is boolean primitive or Boolean object + */ + +//CHECK#1 +var x = false; +if (++x !== 0 + 1) { + $ERROR('#1: var x = false; ++x === 0 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (++x !== 1 + 1) { + $ERROR('#2: var x = new Boolean(true); ++x === 1 + 1. Actual: ' + (++x)); +} + diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T2.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T2.js new file mode 100644 index 000000000..3aacac1b8 --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A4_T3.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T3.js new file mode 100644 index 000000000..4e2d5f22a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/S11.4.4_A4_T4.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T4.js new file mode 100644 index 000000000..f0edb536e --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_A4_T4.js + * @description Type(x) is undefined or null + */ + +//CHECK#1 +var x; +if (isNaN(++x) !== true) { + $ERROR('#1: var 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.4/S11.4.4_A4_T5.js b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_A4_T5.js new file mode 100644 index 000000000..c6c9d526a --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/S11.4.4_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.4/S11.4.4_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.4/browser.js b/js/src/tests/test262/ch11/11.4/11.4.4/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/browser.js diff --git a/js/src/tests/test262/ch11/11.4/11.4.4/shell.js b/js/src/tests/test262/ch11/11.4/11.4.4/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch11/11.4/11.4.4/shell.js |