summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/charAt
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/charAt')
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1.1.js28
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A10.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A11.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T1.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T10.js25
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T4.js19
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T5.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T6.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T7.js19
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T8.js19
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T9.js21
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A2.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A3.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T1.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T2.js25
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T3.js25
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A5.js33
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A6.js18
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A7.js21
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A8.js43
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A9.js38
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A1.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A2.js24
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/name.js28
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-err.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-string.js18
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/pos-rounding.js27
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/charAt/this-value-not-obj-coercible.js22
32 files changed, 754 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1.1.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1.1.js
new file mode 100644
index 0000000000..82a34b6a53
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1.1.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.
+
+/*---
+info: String.prototype.charAt() can accept many arguments
+es5id: 15.5.4.4_A1.1
+description: Checking by using eval
+---*/
+
+function __FACTORY() {
+ this.toString = function() {
+ return "wizard";
+ };
+};
+
+__FACTORY.prototype.charAt = String.prototype.charAt;
+
+var __instance = new __FACTORY;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.charAt(eval("1"), true, null, {}) !== "i") {
+ throw new Test262Error('#1: __instance.charAt(eval("1"),true,null,{})=== "i". Actual: ' + __instance.charAt(eval("1"), true, null, {}));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A10.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A10.js
new file mode 100644
index 0000000000..3c5e38db4c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A10.js
@@ -0,0 +1,35 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The String.prototype.charAt.length property has the attribute ReadOnly
+es5id: 15.5.4.4_A10
+description: >
+ Checking if varying the String.prototype.charAt.length property
+ fails
+includes: [propertyHelper.js]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(String.prototype.charAt.hasOwnProperty('length'))) {
+ throw new Test262Error('#1: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.charAt.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = String.prototype.charAt.length;
+
+verifyNotWritable(String.prototype.charAt, "length", null, function() {
+ return "shifted";
+});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.charAt.length !== __obj) {
+ throw new Test262Error('#2: __obj = String.prototype.charAt.length; String.prototype.charAt.length = function(){return "shifted";}; String.prototype.charAt.length === __obj. Actual: ' + String.prototype.charAt.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A11.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A11.js
new file mode 100644
index 0000000000..6e29517e39
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A11.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The length property of the charAt method is 1
+es5id: 15.5.4.4_A11
+description: Checking String.prototype.charAt.length
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(String.prototype.charAt.hasOwnProperty("length"))) {
+ throw new Test262Error('#1: String.prototype.charAt.hasOwnProperty("length") return true. Actual: ' + String.prototype.charAt.hasOwnProperty("length"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.charAt.length !== 1) {
+ throw new Test262Error('#2: String.prototype.charAt.length === 1. Actual: ' + String.prototype.charAt.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T1.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T1.js
new file mode 100644
index 0000000000..72a0bd2238
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_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.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T1
+description: pos is false and true, and instance is object
+---*/
+
+var __instance = new Object(42);
+
+__instance.charAt = String.prototype.charAt;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.charAt(false) + __instance.charAt(true) !== "42") {
+ throw new Test262Error('#1: __instance = new Object(42); __instance.charAt = String.prototype.charAt; __instance = new Object(42); __instance.charAt = String.prototype.charAt; __instance.charAt(false)+__instance.charAt(true) === "42". Actual: ' + __instance.charAt(false) + __instance.charAt(true));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T10.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T10.js
new file mode 100644
index 0000000000..ac98653b3f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T10.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.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T10
+description: Call charAt() function with object argument
+---*/
+
+var __obj = {
+ toString: function() {
+ return 1;
+ }
+}
+var __str = "lego";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str.charAt(__obj) !== "e") {
+ throw new Test262Error('#1: var __obj = {toString:function(){return 1;}}; var __str = "lego"; __str.charAt(__obj) === "e". Actual: ' + __str.charAt(__obj));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T2.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T2.js
new file mode 100644
index 0000000000..f6d675d698
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_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.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T2
+description: pos is equation with false and true, and instance is Boolean object
+---*/
+
+var __instance = new Boolean;
+
+__instance.charAt = String.prototype.charAt;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.charAt(false) + __instance.charAt(true) + __instance.charAt(true + 1) !== "fal") {
+ throw new Test262Error('#1: __instance = new Boolean; __instance.charAt = String.prototype.charAt; __instance = new Boolean; __instance.charAt = String.prototype.charAt; __instance.charAt(false)+__instance.charAt(true)+__instance.charAt(true+1) === "fal". Actual: ' + __instance.charAt(false) + __instance.charAt(true) + __instance.charAt(true + 1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T4.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T4.js
new file mode 100644
index 0000000000..6c6a051597
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T4.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T4
+description: Call charAt() function without argument of string object
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger() evaluates to 0 charAt() evaluates to charAt(0)
+if ("lego".charAt() !== "l") {
+ throw new Test262Error('#1: "lego".charAt() === "l". Actual: "lego".charAt() ===' + ("lego".charAt()));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T5.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T5.js
new file mode 100644
index 0000000000..138d7948f5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T5.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T5
+description: Call charAt() function with null argument of function object
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger(null) evaluates to 0 charAt() evaluates to charAt(0)
+if (function() {
+ return "lego"
+ }().charAt(null) !== "l") {
+ throw new Test262Error('#1: function(){return "lego"}().charAt(null) === "l". Actual: function(){return "lego"}().charAt(null) ===' + function() {
+ return "lego"
+ }().charAt(null));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T6.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T6.js
new file mode 100644
index 0000000000..d207385458
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T6.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T6
+description: >
+ Call charAt() function with x argument of new String object, where
+ x is undefined variable
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger(undefined) evaluates to 0 charAt() evaluates to charAt(0)
+if (new String("lego").charAt(x) !== "l") {
+ throw new Test262Error('#1: var x; new String("lego").charAt(x) === "l". Actual: new String("lego").charAt(x) ===' + new String("lego").charAt(x));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T7.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T7.js
new file mode 100644
index 0000000000..73c0998587
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T7.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T7
+description: Call charAt() function with undefined argument of string object
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger(undefined) evaluates to 0 charAt() evaluates to charAt(0)
+if (String("lego").charAt(undefined) !== "l") {
+ throw new Test262Error('#1: String("lego").charAt(undefined) === "l". Actual: String("lego").charAt(undefined) ===' + String("lego").charAt(undefined));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T8.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T8.js
new file mode 100644
index 0000000000..8c4bc9dc0f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T8.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T8
+description: Call charAt() function with void 0 argument of string object
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger(void 0) evaluates to 0 charAt() evaluates to charAt(0)
+if (String(42).charAt(void 0) !== "4") {
+ throw new Test262Error('#1: String(42).charAt(void 0) === "4". Actual: String(42).charAt(void 0) ===' + String(42).charAt(void 0));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T9.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T9.js
new file mode 100644
index 0000000000..c45374025b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A1_T9.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.
+
+/*---
+info: String.prototype.charAt(pos)
+es5id: 15.5.4.4_A1_T9
+description: >
+ Call charAt() function with function(){}() argument of string
+ object
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToInteger(undefined) evaluates to 0 charAt() evaluates to charAt(0)
+if (new String(42).charAt(function() {}()) !== "4") {
+ throw new Test262Error('#1: new String(42).charAt(function(){}()) === "4". Actual: new String(42).charAt(function(){}()) ===' + new String(42).charAt(function() {}()));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A2.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A2.js
new file mode 100644
index 0000000000..139d75b06d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A2.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ When String.prototype.charAt(pos) calls if ToInteger(pos) less than 0 the
+ empty string returns
+es5id: 15.5.4.4_A2
+description: Call charAt(pos) with negative pos
+---*/
+
+function __FACTORY() {};
+
+__FACTORY.prototype.charAt = String.prototype.charAt;
+
+var __instance = new __FACTORY;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.charAt(-1) !== "") {
+ throw new Test262Error('#1: __instance.charAt(-1) === "". Actual: __instance.charAt(-1) ===' + __instance.charAt(-1));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A3.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A3.js
new file mode 100644
index 0000000000..dd32dcbd8b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A3.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.
+
+/*---
+info: |
+ When String.prototype.charAt(pos) calls if ToInteger(pos) not less than
+ ToString(this value) the empty string returns
+es5id: 15.5.4.4_A3
+description: pos is bigger of string length
+---*/
+
+var __instance = new String("ABC");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.charAt(3) !== "") {
+ throw new Test262Error('#1: __instance = new String("ABC"); __instance.charAt(3) === "". Actual: __instance.charAt(3) ===' + __instance.charAt(3));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T1.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T1.js
new file mode 100644
index 0000000000..7bd0ab8cb4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T1.js
@@ -0,0 +1,23 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ If pos is a value of Number type that is an integer, then the result of
+ x.charAt(pos) is equal to the result of x.substring(pos, pos+1)
+es5id: 15.5.4.4_A4_T1
+description: Compare results of x.charAt(pos) and x.substring(pos, pos+1)
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (var i = 0; i < 6; i++) {
+ if ("ABC\u0041\u0042\u0043".charAt(i) !== "\u0041\u0042\u0043ABC".substring(i, i + 1)) {
+ throw new Test262Error('#' + i + ': "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') === "\\u0041\\u0042\\u0043ABC".substring(' + i + ', ' + (i + 1) + '). Actual: "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') ===' + ("ABC\u0041\u0042\u0043".charAt(i)));
+ }
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T2.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T2.js
new file mode 100644
index 0000000000..4624ccef9f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T2.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.
+
+/*---
+info: |
+ If pos is a value of Number type that is an integer, then the result of
+ x.charAt(pos) is equal to the result of x.substring(pos, pos+1)
+es5id: 15.5.4.4_A4_T2
+description: >
+ Compare results of x.charAt(pos) and x.substring(pos, pos+1), wheb
+ pos is smaller of zero
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (var i = -2; i < 0; i++) {
+ if ("ABC\u0041\u0042\u0043".charAt(i) !== "\u0041\u0042\u0043ABC".substring(i, i + 1)) {
+ throw new Test262Error('#' + (i + 2) + ': "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') === "\\u0041\\u0042\\u0043ABC".substring(' + i + ', ' + (i + 1) + '). Actual: "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') ===' + ("ABC\u0041\u0042\u0043".charAt(i)));
+ }
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T3.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_T3.js
new file mode 100644
index 0000000000..da7368b170
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A4_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.
+
+/*---
+info: |
+ If pos is a value of Number type that is an integer, then the result of
+ x.charAt(pos) is equal to the result of x.substring(pos, pos+1)
+es5id: 15.5.4.4_A4_T3
+description: >
+ Compare results of x.charAt(pos) and x.substring(pos, pos+1), wheb
+ pos is bigger string length
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+for (var i = 6; i < 8; i++) {
+ if ("ABC\u0041\u0042\u0043".charAt(i) !== "\u0041\u0042\u0043ABC".substring(i, i + 1)) {
+ throw new Test262Error('#' + (i - 5) + ': "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') === "\\u0041\\u0042\\u0043ABC".substring(' + i + ', ' + (i + 1) + '). Actual: "ABC\\u0041\\u0042\\u0043".charAt(' + i + ') ===' + ("ABC\u0041\u0042\u0043".charAt(i)));
+ }
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A5.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A5.js
new file mode 100644
index 0000000000..37320912bb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A5.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.
+
+/*---
+info: |
+ When String.prototype.charAt(pos) calls first calls ToString, giving it
+ the this value as its argument
+es5id: 15.5.4.4_A5
+description: Change toString function, it trow exception, and call charAt()
+---*/
+
+var __obj = {
+ valueOf: 1,
+ toString: function() {
+ throw 'intostring'
+ },
+ charAt: String.prototype.charAt
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var x = __obj.charAt();
+ throw new Test262Error('#1: __obj={valueOf:1,toString:function(){throw \'intostring\'},charAt:String.prototype.charAt}; "var x = __obj.charAt()" lead to throwing exception');
+} catch (e) {
+ if (e !== 'intostring') {
+ throw new Test262Error('#1.1: Exception === \'intostring\'. Actual: exception ===' + e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A6.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A6.js
new file mode 100644
index 0000000000..6298c66ddc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A6.js
@@ -0,0 +1,18 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.charAt has not prototype property
+es5id: 15.5.4.4_A6
+description: Checking String.prototype.charAt.prototype
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (String.prototype.charAt.prototype !== undefined) {
+ throw new Test262Error('#1: String.prototype.charAt.prototype === undefined. Actual: ' + String.prototype.charAt.prototype);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A7.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A7.js
new file mode 100644
index 0000000000..0d79526df8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A7.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.
+
+/*---
+info: String.prototype.charAt can't be used as constructor
+es5id: 15.5.4.4_A7
+description: Checking if creating the String.prototype.charAt object fails
+---*/
+
+var __FACTORY = String.prototype.charAt;
+
+try {
+ var __instance = new __FACTORY;
+ throw new Test262Error('#1: __FACTORY = String.prototype.charAt; "__instance = new __FACTORY" lead to throwing exception');
+} catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1.2: undefined = 1 throw a TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A8.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A8.js
new file mode 100644
index 0000000000..c7a23c927e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A8.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: The String.prototype.charAt.length property has the attribute DontEnum
+es5id: 15.5.4.4_A8
+description: >
+ Checking if enumerating the String.prototype.charAt.length
+ property fails
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#0
+if (!(String.prototype.charAt.hasOwnProperty('length'))) {
+ throw new Test262Error('#0: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.charAt.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+// CHECK#1
+if (String.prototype.charAt.propertyIsEnumerable('length')) {
+ throw new Test262Error('#1: String.prototype.charAt.propertyIsEnumerable(\'length\') return false. Actual: ' + String.prototype.charAt.propertyIsEnumerable('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// CHECK#2
+var count = 0;
+
+for (var p in String.prototype.charAt) {
+ if (p === "length") count++;
+}
+
+if (count !== 0) {
+ throw new Test262Error('#2: count=0; for (p in String.prototype.charAt){if (p==="length") count++;}; count === 0. Actual: count ===' + count);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A9.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A9.js
new file mode 100644
index 0000000000..b75e7537e4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S15.5.4.4_A9.js
@@ -0,0 +1,38 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The String.prototype.charAt.length property does not have the attribute
+ DontDelete
+es5id: 15.5.4.4_A9
+description: >
+ Checking if deleting the String.prototype.charAt.length property
+ fails
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#0
+if (!(String.prototype.charAt.hasOwnProperty('length'))) {
+ throw new Test262Error('#0: String.prototype.charAt.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.charAt.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!delete String.prototype.charAt.length) {
+ throw new Test262Error('#1: delete String.prototype.charAt.length return true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.charAt.hasOwnProperty('length')) {
+ throw new Test262Error('#2: delete String.prototype.charAt.length; String.prototype.charAt.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.charAt.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A1.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A1.js
new file mode 100644
index 0000000000..37aa8620dc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A1.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.
+
+/*---
+info: If ToNumber(value) is NaN, ToInteger(value) returns +0
+es5id: 9.4_A1
+description: >
+ Check what position is defined by Number.NaN in string "abc":
+ "abc".charAt(Number.NaN)
+---*/
+
+// CHECK#1
+if ("abc".charAt(Number.NaN) !== "a") {
+ throw new Test262Error('#1: "abc".charAt(Number.NaN) === "a". Actual: ' + ("abc".charAt(Number.NaN)));
+}
+
+// CHECK#2
+if ("abc".charAt("x") !== "a") {
+ throw new Test262Error('#2: "abc".charAt("x") === "a". Actual: ' + ("abc".charAt("x")));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A2.js b/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A2.js
new file mode 100644
index 0000000000..3a0fdfdf94
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/S9.4_A2.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.
+
+/*---
+info: |
+ If ToNumber(value) is +0, -0, +Infinity, or -Infinity,
+ return ToNumber(value)
+es5id: 9.4_A2
+description: >
+ Check what position is defined by Number.NaN in string "abc":
+ "abc".charAt(Number.NaN)
+---*/
+
+// CHECK#1
+if ("abc".charAt(0.0) !== "a") {
+ throw new Test262Error('#1: "abc".charAt(0.0) === "a". Actual: ' + ("abc".charAt(0.0)));
+}
+
+// CHECK#2
+if ("abc".charAt(-0.0) !== "a") {
+ throw new Test262Error('#2: "abc".charAt(-0.0) === "a". Actual: ' + ("abc".charAt(-0.0)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/browser.js b/js/src/tests/test262/built-ins/String/prototype/charAt/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/browser.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/name.js b/js/src/tests/test262/built-ins/String/prototype/charAt/name.js
new file mode 100644
index 0000000000..13a245e2fc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/name.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es6id: 21.1.3.1
+description: >
+ String.prototype.charAt.name is "charAt".
+info: |
+ String.prototype.charAt ( pos )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+---*/
+
+assert.sameValue(String.prototype.charAt.name, "charAt");
+
+verifyNotEnumerable(String.prototype.charAt, "name");
+verifyNotWritable(String.prototype.charAt, "name");
+verifyConfigurable(String.prototype.charAt, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/charAt/not-a-constructor.js
new file mode 100644
index 0000000000..6e00163a90
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/not-a-constructor.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ String.prototype.charAt does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(
+ isConstructor(String.prototype.charAt),
+ false,
+ 'isConstructor(String.prototype.charAt) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new String.prototype.charAt();
+}, '`new String.prototype.charAt()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-err.js b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-err.js
new file mode 100644
index 0000000000..a2ea4dac46
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-err.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-string.prototype.charat
+description: Error when attempting to coerce providec "pos" to a Number
+info: |
+ [...]
+ 3. Let position be ? ToInteger(pos).
+ [...]
+
+ 7.1.4 ToInteger
+
+ 1. Let number be ? ToNumber(argument).
+---*/
+
+var noCoerce = Object.create(null);
+
+assert.throws(TypeError, function() {
+ ''.charAt(noCoerce);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-string.js b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-string.js
new file mode 100644
index 0000000000..51cdde8314
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-coerce-string.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-string.prototype.charat
+description: Coercion of "pos" string value into number
+info: |
+ [...]
+ 3. Let position be ? ToInteger(pos).
+ [...]
+
+ 7.1.4 ToInteger
+
+ 1. Let number be ? ToNumber(argument).
+---*/
+
+assert.sameValue('abcd'.charAt(' +00200.0000E-0002 '), 'c');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/pos-rounding.js b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-rounding.js
new file mode 100644
index 0000000000..0f516f73c5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/pos-rounding.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-string.prototype.charat
+description: Rounding of the provided "pos" number
+info: |
+ [...]
+ 3. Let position be ? ToInteger(pos).
+ [...]
+
+ 7.1.4 ToInteger
+
+ 1. Let number be ? ToNumber(argument).
+ 2. If number is NaN, return +0.
+ 3. If number is +0, -0, +∞, or -∞, return number.
+ 4. Return the number value that is the same sign as number and whose
+ magnitude is floor(abs(number)).
+---*/
+
+assert.sameValue('abc'.charAt(-0.99999), 'a', '-0.99999');
+assert.sameValue('abc'.charAt(-0.00001), 'a', '-0.00001');
+assert.sameValue('abc'.charAt(0.00001), 'a', '0.00001');
+assert.sameValue('abc'.charAt(0.99999), 'a', '0.99999');
+assert.sameValue('abc'.charAt(1.00001), 'b', '1.00001');
+assert.sameValue('abc'.charAt(1.99999), 'b', '1.99999');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/shell.js b/js/src/tests/test262/built-ins/String/prototype/charAt/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/shell.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/charAt/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/charAt/this-value-not-obj-coercible.js
new file mode 100644
index 0000000000..3028c94073
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/charAt/this-value-not-obj-coercible.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-string.prototype.charat
+description: The "this" value must be object-coercible
+info: |
+ 1. Let O be ? RequireObjectCoercible(this value).
+---*/
+
+var charAt = String.prototype.charAt;
+
+assert.sameValue(typeof charAt, 'function');
+
+assert.throws(TypeError, function() {
+ charAt.call(undefined, 0);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ charAt.call(null, 0);
+}, 'null');
+
+reportCompare(0, 0);