summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch09/9.9
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch09/9.9
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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/ch09/9.9')
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A1.js33
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A2.js33
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A3.js41
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A4.js178
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A5.js71
-rw-r--r--js/src/tests/test262/ch09/9.9/S9.9_A6.js40
-rw-r--r--js/src/tests/test262/ch09/9.9/browser.js0
-rw-r--r--js/src/tests/test262/ch09/9.9/shell.js0
8 files changed, 396 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A1.js b/js/src/tests/test262/ch09/9.9/S9.9_A1.js
new file mode 100644
index 000000000..a1d36aabd
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A1.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * ToObject conversion from undefined value must throw TypeError
+ *
+ * @path ch09/9.9/S9.9_A1.js
+ * @description Trying to convert undefined to Object
+ * @noStrict
+ */
+
+// CHECK#1
+try{
+ undefined['foo'];
+ $ERROR('#1.1: undefined[\'foo\'] must throw TypeError. Actual: ' + (undefined['foo']));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ $ERROR('#1.2: undefined[\'foo\'] must throw TypeError. Actual: ' + (e));
+ }
+}
+
+// CHECK#2
+try{
+ with(undefined) x = 2;
+ $ERROR('#2.1: with(undefined) x = 2 must throw TypeError. Actual: x === ' + (x));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ $ERROR('#2.2: with(undefined) x = 2 must throw TypeError. Actual: ' + (e));
+ }
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A2.js b/js/src/tests/test262/ch09/9.9/S9.9_A2.js
new file mode 100644
index 000000000..42e1980e7
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A2.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * ToObject conversion from null value must throw TypeError
+ *
+ * @path ch09/9.9/S9.9_A2.js
+ * @description Trying to convert null to Object
+ * @noStrict
+ */
+
+// CHECK#1
+try{
+ null['foo'];
+ $ERROR('#1.1: null[\'foo\'] throw TypeError. Actual: ' + (null['foo']));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ $ERROR('#1.2: null[\'foo\'] must throw TypeError. Actual: ' + (e));
+ }
+}
+
+// CHECK#2
+try{
+ with(null) x = 2;
+ $ERROR('#2.1: with(null) x = 2 must throw TypeError. Actual: x === . Actual: ' + (x));
+}
+catch(e){
+ if((e instanceof TypeError) !== true){
+ $ERROR('#2.2: with(null) x = 2 must throw TypeError. Actual: ' + (e));
+ }
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A3.js b/js/src/tests/test262/ch09/9.9/S9.9_A3.js
new file mode 100644
index 000000000..f91cd8e82
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A3.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.
+
+/**
+ * ToObject conversion from Boolean: create a new Boolean object
+ * whose [[value]] property is set to the value of the boolean
+ *
+ * @path ch09/9.9/S9.9_A3.js
+ * @description Trying to convert from Boolean to Object
+ */
+
+// CHECK#1
+if (Object(true).valueOf() !== true){
+ $ERROR('#1: Object(true).valueOf() === true. Actual: ' + (Object(true).valueOf()));
+}
+
+// CHECK#2
+if (typeof Object(true) !== "object"){
+ $ERROR('#2: typeof Object(true) === "object". Actual: ' + (typeof Object(true)));
+}
+
+// CHECK#3
+if (Object(true).constructor.prototype !== Boolean.prototype){
+ $ERROR('#3: Object(true).constructor.prototype === Boolean.prototype. Actual: ' + (Object(true).constructor.prototype));
+}
+
+// CHECK#4
+if (Object(false).valueOf() !== false){
+ $ERROR('#4: Object(false).valueOf() === false. Actual: ' + (Object(false).valueOf()));
+}
+
+// CHECK#5
+if (typeof Object(false) !== "object"){
+ $ERROR('#5: typeof Object(false) === "object". Actual: ' + (typeof Object(false)));
+}
+
+// CHECK#6
+if (Object(false).constructor.prototype !== Boolean.prototype){
+ $ERROR('#6: Object(false).constructor.prototype === Boolean.prototype. Actual: ' + (Object(false).constructor.prototype));
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A4.js b/js/src/tests/test262/ch09/9.9/S9.9_A4.js
new file mode 100644
index 000000000..2f08bf52c
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A4.js
@@ -0,0 +1,178 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * ToObject conversion from Number: create a new Number object
+ * whose [[value]] property is set to the value of the number
+ *
+ * @path ch09/9.9/S9.9_A4.js
+ * @description Converting from various numbers to Object
+ */
+
+// CHECK#1
+if (Object(0).valueOf() !== 0){
+ $ERROR('#1: Object(0).valueOf() === 0. Actual: ' + (Object(0).valueOf()));
+}
+
+// CHECK#2
+if (typeof Object(0) !== "object"){
+ $ERROR('#2: typeof Object(0) === "object". Actual: ' + (typeof Object(0)));
+}
+
+// CHECK#3
+if (Object(0).constructor.prototype !== Number.prototype){
+ $ERROR('#3: Object(0).constructor.prototype === Number.prototype. Actual: ' + (Object(0).constructor.prototype));
+}
+
+// CHECK#4
+if (Object(-0).valueOf() !== -0){
+ $ERROR('#4.1: Object(-0).valueOf() === 0. Actual: ' + (Object(-0).valueOf()));
+} else if (1/Object(-0).valueOf() !== Number.NEGATIVE_INFINITY) {
+ $ERROR('#4.2: Object(-0).valueOf() === -0. Actual: +0');
+}
+
+// CHECK#5
+if (typeof Object(-0) !== "object"){
+ $ERROR('#5: typeof Object(-0) === "object". Actual: ' + (typeof Object(-0)));
+}
+
+// CHECK#6
+if (Object(-0).constructor.prototype !== Number.prototype){
+ $ERROR('#6: Object(-0).constructor.prototype === Number.prototype. Actual: ' + (Object(-0).constructor.prototype));
+}
+
+// CHECK#7
+if (Object(1).valueOf() !== 1){
+ $ERROR('#7: Object(1).valueOf() === 1. Actual: ' + (Object(1).valueOf()));
+}
+
+// CHECK#8
+if (typeof Object(1) !== "object"){
+ $ERROR('#8: typeof Object(1) === "object". Actual: ' + (typeof Object(1)));
+}
+
+// CHECK#9
+if (Object(1).constructor.prototype !== Number.prototype){
+ $ERROR('#9: Object(1).constructor.prototype === Number.prototype. Actual: ' + (Object(1).constructor.prototype));
+}
+
+// CHECK#10
+if (Object(-1).valueOf() !== -1){
+ $ERROR('#10: Object(-1).valueOf() === -1. Actual: ' + (Object(-1).valueOf()));
+}
+
+// CHECK#11
+if (typeof Object(-1) !== "object"){
+ $ERROR('#11: typeof Object(-1) === "object". Actual: ' + (typeof Object(-1)));
+}
+
+// CHECK#12
+if (Object(-1).constructor.prototype !== Number.prototype){
+ $ERROR('#12: Object(-1).constructor.prototype === Number.prototype. Actual: ' + (Object(-1).constructor.prototype));
+}
+
+// CHECK#13
+if (Object(Number.MIN_VALUE).valueOf() !== Number.MIN_VALUE){
+ $ERROR('#13: Object(Number.MIN_VALUE).valueOf() === Number.MIN_VALUE. Actual: ' + (Object(Number.MIN_VALUE).valueOf()));
+}
+
+// CHECK#14
+if (typeof Object(Number.MIN_VALUE) !== "object"){
+ $ERROR('#14: typeof Object(Number.MIN_VALUE) === "object". Actual: ' + (typeof Object(Number.MIN_VALUE)));
+}
+
+// CHECK#15
+if (Object(Number.MIN_VALUE).constructor.prototype !== Number.prototype){
+ $ERROR('#15: Object(Number.MIN_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MIN_VALUE).constructor.prototype));
+}
+
+// CHECK#16
+if (Object(Number.MAX_VALUE).valueOf() !== Number.MAX_VALUE){
+ $ERROR('#16: Object(Number.MAX_VALUE).valueOf() === Number.MAX_VALUE. Actual: ' + (Object(Number.MAX_VALUE).valueOf()));
+}
+
+// CHECK#17
+if (typeof Object(Number.MAX_VALUE) !== "object"){
+ $ERROR('#17: typeof Object(Number.MAX_VALUE) === "object". Actual: ' + (typeof Object(Number.MAX_VALUE)));
+}
+
+// CHECK#18
+if (Object(Number.MAX_VALUE).constructor.prototype !== Number.prototype){
+ $ERROR('#18: Object(Number.MAX_VALUE).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.MAX_VALUE).constructor.prototype));
+}
+
+// CHECK#19
+if (Object(Number.POSITIVE_INFINITY).valueOf() !== Number.POSITIVE_INFINITY){
+ $ERROR('#19: Object(Number.POSITIVE_INFINITY).valueOf() === Number.POSITIVE_INFINITY. Actual: ' + (Object(Number.POSITIVE_INFINITY).valueOf()));
+}
+
+// CHECK#20
+if (typeof Object(Number.POSITIVE_INFINITY) !== "object"){
+ $ERROR('#20: typeof Object(Number.POSITIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.POSITIVE_INFINITY)));
+}
+
+// CHECK#21
+if (Object(Number.POSITIVE_INFINITY).constructor.prototype !== Number.prototype){
+ $ERROR('#21: Object(Number.POSITIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.POSITIVE_INFINITY).constructor.prototype));
+}
+
+// CHECK#22
+if (Object(Number.NEGATIVE_INFINITY).valueOf() !== Number.NEGATIVE_INFINITY){
+ $ERROR('#22: Object(Number.NEGATIVE_INFINITY).valueOf() === Number.NEGATIVE_INFINITY. Actual: ' + (Object(Number.NEGATIVE_INFINITY).valueOf()));
+}
+
+// CHECK#23
+if (typeof Object(Number.NEGATIVE_INFINITY) !== "object"){
+ $ERROR('#23: typeof Object(Number.NEGATIVE_INFINITY) === "object". Actual: ' + (typeof Object(Number.NEGATIVE_INFINITY)));
+}
+
+// CHECK#24
+if (Object(Number.NEGATIVE_INFINITY).constructor.prototype !== Number.prototype){
+ $ERROR('#24: Object(Number.NEGATIVE_INFINITY).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NEGATIVE_INFINITY).constructor.prototype));
+}
+
+// CHECK#25
+if (isNaN(Object(Number.NaN).valueOf()) !== true){
+ $ERROR('#25: Object(Number.NaN).valueOf() === Not-a-Number. Actual: ' + (Object(Number.NaN).valueOf()));
+}
+
+// CHECK#26
+if (typeof Object(Number.NaN) !== "object"){
+ $ERROR('#26: typeof Object(Number.NaN) === "object". Actual: ' + (typeof Object(Number.NaN)));
+}
+
+// CHECK#27
+if (Object(Number.NaN).constructor.prototype !== Number.prototype){
+ $ERROR('#27: Object(Number.NaN).constructor.prototype === Number.prototype. Actual: ' + (Object(Number.NaN).constructor.prototype));
+}
+
+// CHECK#28
+if (Object(1.2345).valueOf() !== 1.2345){
+ $ERROR('#28: Object(1.2345).valueOf() === 1.2345. Actual: ' + (Object(1.2345).valueOf()));
+}
+
+// CHECK#29
+if (typeof Object(1.2345) !== "object"){
+ $ERROR('#29: typeof Object(1.2345) === "object". Actual: ' + (typeof Object(1.2345)));
+}
+
+// CHECK#30
+if (Object(1.2345).constructor.prototype !== Number.prototype){
+ $ERROR('#30: Object(1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(1.2345).constructor.prototype));
+}
+
+// CHECK#31
+if (Object(-1.2345).valueOf() !== -1.2345){
+ $ERROR('#31: Object(-1.2345).valueOf() === -1.2345. Actual: ' + (Object(-1.2345).valueOf()));
+}
+
+// CHECK#32
+if (typeof Object(-1.2345) !== "object"){
+ $ERROR('#32: typeof Object(-1.2345) === "object". Actual: ' + (typeof Object(-1.2345)));
+}
+
+// CHECK#33
+if (Object(-1.2345).constructor.prototype !== Number.prototype){
+ $ERROR('#33: Object(-1.2345).constructor.prototype === Number.prototype. Actual: ' + (Object(-1.2345).constructor.prototype));
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A5.js b/js/src/tests/test262/ch09/9.9/S9.9_A5.js
new file mode 100644
index 000000000..2f59c1182
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A5.js
@@ -0,0 +1,71 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * ToObject conversion from String: create a new String object
+ * whose [[value]] property is set to the value of the string
+ *
+ * @path ch09/9.9/S9.9_A5.js
+ * @description Converting from various strings to Object
+ */
+
+// CHECK#1
+if (Object("some string").valueOf() !== "some string"){
+ $ERROR('#1: Object("some string").valueOf() === "some string". Actual: ' + (Object("some string").valueOf()));
+}
+
+// CHECK#2
+if (typeof Object("some string") !== "object"){
+ $ERROR('#2: typeof Object("some string") === "object". Actual: ' + (typeof Object("some string")));
+}
+
+// CHECK#3
+if (Object("some string").constructor.prototype !== String.prototype){
+ $ERROR('#3: Object("some string").constructor.prototype === String.prototype. Actual: ' + (Object("some string").constructor.prototype));
+}
+
+// CHECK#4
+if (Object("").valueOf() !== ""){
+ $ERROR('#4: Object("").valueOf() === false. Actual: ' + (Object("").valueOf()));
+}
+
+// CHECK#5
+if (typeof Object("") !== "object"){
+ $ERROR('#5: typeof Object("") === "object". Actual: ' + (typeof Object("")));
+}
+
+// CHECK#6
+if (Object("").constructor.prototype !== String.prototype){
+ $ERROR('#6: Object("").constructor.prototype === String.prototype. Actual: ' + (Object("").constructor.prototype));
+}
+
+// CHECK#7
+if (Object("\r\t\b\n\v\f").valueOf() !== "\r\t\b\n\v\f"){
+ $ERROR('#7: Object("\\r\\t\\b\\n\\v\\f").valueOf() === false. Actual: ' + (Object("\r\t\b\n\v\f").valueOf()));
+}
+
+// CHECK#8
+if (typeof Object("\r\t\b\n\v\f") !== "object"){
+ $ERROR('#8: typeof Object("\\r\\t\\b\\n\\v\\f") === "object". Actual: ' + (typeof Object("\r\t\b\n\v\f")));
+}
+
+// CHECK#9
+if (Object("\r\t\b\n\v\f").constructor.prototype !== String.prototype){
+ $ERROR('#9: Object("\\r\\t\\b\\n\\v\\f").constructor.prototype === String.prototype. Actual: ' + (Object("\r\t\b\n\v\f").constructor.prototype));
+}
+
+// CHECK#10
+if (Object(String(10)).valueOf() !== "10"){
+ $ERROR('#10: Object(String(10)).valueOf() === false. Actual: ' + (Object(String(10)).valueOf()));
+}
+
+// CHECK#11
+if (typeof Object(String(10)) !== "object"){
+ $ERROR('#11: typeof Object(String(10)) === "object". Actual: ' + (typeof Object(String(10))));
+}
+
+// CHECK#12
+if (Object(String(10)).constructor.prototype !== String.prototype){
+ $ERROR('#12: Object(String(10)).constructor.prototype === String.prototype. Actual: ' + (Object(String(10)).constructor.prototype));
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/S9.9_A6.js b/js/src/tests/test262/ch09/9.9/S9.9_A6.js
new file mode 100644
index 000000000..a25679016
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/S9.9_A6.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.
+
+/**
+ * ToObject conversion from Object: The result is the input
+ * argument (no conversion)
+ *
+ * @path ch09/9.9/S9.9_A6.js
+ * @description Converting from Objects to Object
+ */
+
+function MyObject( val ) {
+ this.value = val;
+ this.valueOf = function (){ return this.value; }
+}
+
+var x = new MyObject(1);
+var y = Object(x);
+
+// CHECK#1
+if (y.valueOf() !== x.valueOf()){
+ $ERROR('#1: Object(obj).valueOf() === obj.valueOf(). Actual: ' + (Object(obj).valueOf()));
+}
+
+// CHECK#2
+if (typeof y !== typeof x){
+ $ERROR('#2: typeof Object(obj) === typeof obj. Actual: ' + (typeof Object(obj)));
+}
+
+// CHECK#3
+if (y.constructor.prototype !== x.constructor.prototype){
+ $ERROR('#3: Object(obj).constructor.prototype === obj.constructor.prototype. Actual: ' + (Object(obj).constructor.prototype));
+}
+
+
+// CHECK#4
+if (y !== x){
+ $ERROR('#4: Object(obj) === obj');
+}
+
diff --git a/js/src/tests/test262/ch09/9.9/browser.js b/js/src/tests/test262/ch09/9.9/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/browser.js
diff --git a/js/src/tests/test262/ch09/9.9/shell.js b/js/src/tests/test262/ch09/9.9/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch09/9.9/shell.js