summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/search
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/String/prototype/search')
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1.1_T1.js18
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A10.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A11.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T1.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T10.js29
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T11.js32
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T12.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T13.js29
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T14.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T2.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T4.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T5.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T6.js21
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T7.js19
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T8.js25
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T9.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T1.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T2.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T3.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T4.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T5.js23
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T6.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T7.js20
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T1.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T2.js22
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A6.js18
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A7.js21
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A8.js43
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A9.js38
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/cstm-search-get-err.js26
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/cstm-search-invocation.js36
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/cstm-search-is-null.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search-searcher-undef.js53
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search.js43
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/name.js28
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/not-a-constructor.js35
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/String/prototype/search/this-value-not-obj-coercible.js22
39 files changed, 997 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1.1_T1.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1.1_T1.js
new file mode 100644
index 0000000000..7b2bf39051
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1.1_T1.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.search (regexp) without arguments behaves like with
+ argument "undefined"
+es5id: 15.5.4.12_A1.1_T1
+description: Call search() is the same search(undefined)
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+var x = "".search();
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A10.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A10.js
new file mode 100644
index 0000000000..030386b614
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search.length property has the attribute ReadOnly
+es5id: 15.5.4.12_A10
+description: >
+ Checking if varying the String.prototype.search.length property
+ fails
+includes: [propertyHelper.js]
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(String.prototype.search.hasOwnProperty('length'))) {
+ throw new Test262Error('#1: String.prototype.search.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.search.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var __obj = String.prototype.search.length;
+
+verifyNotWritable(String.prototype.search, "length", null, function() {
+ return "shifted";
+});
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.search.length !== __obj) {
+ throw new Test262Error('#2: __obj = String.prototype.search.length; String.prototype.search.length = function(){return "shifted";}; String.prototype.search.length === __obj. Actual: ' + String.prototype.search.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A11.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A11.js
new file mode 100644
index 0000000000..795e80eb73
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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 search method is 1
+es5id: 15.5.4.12_A11
+description: Checking String.prototype.search.length
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!(String.prototype.search.hasOwnProperty("length"))) {
+ throw new Test262Error('#1: String.prototype.search.hasOwnProperty("length") return true. Actual: ' + String.prototype.search.hasOwnProperty("length"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.search.length !== 1) {
+ throw new Test262Error('#2: String.prototype.search.length === 1. Actual: ' + String.prototype.search.length);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T1.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T1.js
new file mode 100644
index 0000000000..79d929eb54
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search (regexp)
+es5id: 15.5.4.12_A1_T1
+description: Argument is true, and instance is object
+---*/
+
+var __instance = new Object(true);
+
+__instance.search = String.prototype.search;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.search(true) !== 0) {
+ throw new Test262Error('#1: __instance = new Object(true); __instance.search = String.prototype.search; __instance.search(true) === 0. Actual: ' + __instance.search(true));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T10.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T10.js
new file mode 100644
index 0000000000..334411e1a5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T10.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T10
+description: >
+ Argument is object, and instance is string. Object with overrided
+ toString function
+---*/
+
+var __obj = {
+ toString: function() {
+ return "\u0041B";
+ }
+};
+var __str = "ssABB\u0041BABAB";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__str.search(__obj) !== 2) {
+ throw new Test262Error('#1: var __obj = {toString:function(){return "\u0041B";}}; var __str = "ssABB\u0041BABAB"; __str.search(__obj) ===2. Actual: ' + __str.search(__obj));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T11.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T11.js
new file mode 100644
index 0000000000..a07f263f8f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T11.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T11
+description: >
+ Argument is object, and instance is string. Object with overrided
+ toString function, that throw exception
+---*/
+
+var __obj = {
+ toString: function() {
+ throw "intostr";
+ }
+}
+var __str = "ABB\u0041BABAB";
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var x = __str.search(__obj);
+ throw new Test262Error('#1: var x = __str.search(__obj) lead to throwing exception');
+} catch (e) {
+ if (e !== "intostr") {
+ throw new Test262Error('#1.1: Exception === "intostr". Actual: ' + e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T12.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T12.js
new file mode 100644
index 0000000000..c35de14041
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T12.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: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T12
+description: >
+ Argument is object, and instance is string. Object with overrided
+ toString and valueOf functions, valueOf throw exception
+---*/
+
+var __obj = {
+ toString: function() {
+ return {};
+ },
+ valueOf: function() {
+ throw "intostr";
+ }
+}
+var __str = new String("ABB\u0041BABAB");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+try {
+ var x = __str.search(__obj);
+ throw new Test262Error('#1: var x = __str.search(__obj) lead to throwing exception');
+} catch (e) {
+ if (e !== "intostr") {
+ throw new Test262Error('#1.1: Exception === "intostr". Actual: ' + e);
+ }
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T13.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T13.js
new file mode 100644
index 0000000000..73014d35cf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T13.js
@@ -0,0 +1,29 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T13
+description: >
+ Argument is object, and instance is string. Object with overrided
+ toString and valueOf functions
+---*/
+
+var __obj = {
+ toString: function() {
+ return {};
+ },
+ valueOf: function() {
+ return 1;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ("ABB\u0041B\u0031ABAB\u0031BBAA".search(__obj) !== 5) {
+ throw new Test262Error('#1: var __obj = {toString:function(){return {};},valueOf:function(){return 1;}}; "ABB\\u0041B\\u0031ABAB\\u0031BBAA".search(__obj) ===5. Actual: ' + ("ABB\u0041B\u0031ABAB\u0031BBAA".search(__obj)));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T14.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T14.js
new file mode 100644
index 0000000000..289769742f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T14.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T14
+description: Instance is string, argument is regular expression
+---*/
+
+var __reg = new RegExp("77");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if ("ABB\u0041BABAB\u0037\u0037BBAA".search(__reg) !== 9) {
+ throw new Test262Error('#1: var __reg = new RegExp("77"); "ABB\\u0041BABAB\\u0037\\u0037BBAA".search(__reg) === 9. Actual: ' + ("ABB\u0041BABAB\u0037\u0037BBAA".search(__reg)));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T2.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T2.js
new file mode 100644
index 0000000000..7598936a11
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T2.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: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T2
+description: Argument is function call, and instance is Boolean
+---*/
+
+var __instance = new Boolean;
+
+__instance.search = String.prototype.search;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (__instance.search(function() {
+ return false;
+ }()) !== 0) {
+ throw new Test262Error('#1: __instance = new Boolean; __instance.search = String.prototype.search; __instance.search(function(){return false;}()) === 0. Actual: ' + __instance.search(function() {
+ return false;
+ }()));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T4.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T4.js
new file mode 100644
index 0000000000..d537dae330
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T4.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.search (regexp)
+es5id: 15.5.4.12_A1_T4
+description: Call search (regexp) without arguments
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString() evaluates to "" search() evaluates to search("")
+if ("".search() !== 0) {
+ throw new Test262Error('#1: "".search() === 0. Actual: ' + ("".search()));
+}
+
+if ("--undefined--".search() != 0) {
+ throw new Test262Error('#1: "--undefined--".search() === 0. Actual: ' + ("--undefined--".search()));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T5.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T5.js
new file mode 100644
index 0000000000..3b391cea83
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search (regexp)
+es5id: 15.5.4.12_A1_T5
+description: Argument is null, and instance is function call, that return string
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString(null) evaluates to "null" search(null) evaluates to search("null")
+if (function() {
+ return "gnulluna"
+ }().search(null) !== 1) {
+ throw new Test262Error('#1: function(){return "gnulluna"}().search(null) === 1. Actual: ' + function() {
+ return "gnulluna"
+ }().search(null));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T6.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T6.js
new file mode 100644
index 0000000000..b576d87328
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T6.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.search (regexp)
+es5id: 15.5.4.12_A1_T6
+description: Argument is x, and instance is new String, x is undefined variable
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString(undefined) evaluates to "undefined" search(undefined) evaluates to search("undefined")
+if (new String("undefined").search(x) !== 0) {
+ throw new Test262Error('#1: var x; new String("undefined").search(x) === 0. Actual: ' + new String("undefined").search(x));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+var x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T7.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T7.js
new file mode 100644
index 0000000000..a63e0ef059
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search (regexp)
+es5id: 15.5.4.12_A1_T7
+description: Argument is undefined, and instance is new String
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString(undefined) evaluates to "undefined" search(undefined) evaluates to search("undefined")
+if (String("undefined").search(undefined) !== 0) {
+ throw new Test262Error('#1: String("undefined").search(undefined) === 0. Actual: ' + String("undefined").search(undefined));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T8.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T8.js
new file mode 100644
index 0000000000..71b0c1603f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T8.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.search (regexp)
+es5id: 15.5.4.12_A1_T8
+description: >
+ Argument is void 0, and instance is String object with overrided
+ toString function
+---*/
+
+var __obj = {
+ toString: function() {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString(void 0) evaluates to "undefined" search(void 0) evaluates to search("undefined")
+if (String(__obj).search(void 0) !== 0) {
+ throw new Test262Error('#1: __obj = {toString:function(){}}; String(__obj).search(void 0) === 0. Actual: ' + String(__obj).search(void 0));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T9.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T9.js
new file mode 100644
index 0000000000..eb6fefb2b9
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A1_T9.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: String.prototype.search (regexp)
+es5id: 15.5.4.12_A1_T9
+description: >
+ Argument is function call, and instance is String object with
+ overrided toString and valueOf functions
+---*/
+
+var __obj = {
+ valueOf: function() {},
+ toString: void 0
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+//since ToString(undefined) evaluates to "undefined" search(undefined) evaluates to search("undefined")
+if (new String(__obj).search(function() {}()) !== 0) {
+ throw new Test262Error('#1: __obj = {valueOf:function(){}, toString:void 0}; new String(__obj).search(function(){}()) === 0. Actual: ' + new String(__obj).search(function() {}()));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T1.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T1.js
new file mode 100644
index 0000000000..2adddf946b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T1.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T1
+description: Simple search substring inside string
+---*/
+
+var aString = new String("test string");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search("string") !== 5) {
+ throw new Test262Error('#1: var aString = new String("test string"); aString.search("string")=== 5. Actual: ' + aString.search("string"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T2.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T2.js
new file mode 100644
index 0000000000..3d967fad65
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T2.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T2
+description: Checking case sensitive of search, argument is string
+---*/
+
+var aString = new String("test string");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search("String") !== -1) {
+ throw new Test262Error('#1: var aString = new String("test string"); aString.search("String")=== -1. Actual: ' + aString.search("String"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T3.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T3.js
new file mode 100644
index 0000000000..ca382ff62c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T3.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T3
+description: Checking disabling of case sensitive of search, argument is RegExp
+---*/
+
+var aString = new String("test string");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search(/String/i) !== 5) {
+ throw new Test262Error('#1: var aString = new String("test string"); aString.search(/String/i)=== 5. Actual: ' + aString.search(/String/i));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T4.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T4.js
new file mode 100644
index 0000000000..9f5f130e23
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T4.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.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T4
+description: >
+ Checking case sensitive of search, argument is RegExp with
+ uppercase symbols
+---*/
+
+var bString = new String("one two three four five");
+var regExp = /Four/;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (bString.search(regExp) !== -1) {
+ throw new Test262Error('#1: var bString = new String("one two three four five"); var regExp = /Four/; bString.search(regExp)=== -1. Actual: ' + bString.search(regExp));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T5.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T5.js
new file mode 100644
index 0000000000..3dcb067da5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_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.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T5
+description: >
+ Checking case sensitive of search, argument is RegExp without
+ uppercase symbols
+---*/
+
+var bString = new String("one two three four five");
+var regExp = /four/;
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (bString.search(regExp) !== 14) {
+ throw new Test262Error('#1: var bString = new String("one two three four five"); var regExp = /four/; bString.search(regExp)=== 14. Actual: ' + bString.search(regExp));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T6.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T6.js
new file mode 100644
index 0000000000..fd4dc1a24f
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T6.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T6
+description: Searching the non-existent "notexist" substring
+---*/
+
+var aString = new String("test string");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search("notexist") !== -1) {
+ throw new Test262Error('#1: var aString = new String("test string"); aString.search("notexist")=== -1. Actual: ' + aString.search("notexist"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T7.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T7.js
new file mode 100644
index 0000000000..ddd916faad
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A2_T7.js
@@ -0,0 +1,20 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: String.prototype.search (regexp) returns ...
+es5id: 15.5.4.12_A2_T7
+description: Simple search sentence inside string
+---*/
+
+var aString = new String("test string probe");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search("string pro") !== 5) {
+ throw new Test262Error('#1: var aString = new String("test string probe"); aString.search("string pro")=== 5. Actual: ' + aString.search("string pro"));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T1.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T1.js
new file mode 100644
index 0000000000..8f2594a3ca
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_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.search (regexp) ignores global properties of regexp
+es5id: 15.5.4.12_A3_T1
+description: >
+ Checking results of search regexp with and without global
+ properties
+---*/
+
+var aString = new String("power of the power of the power of the power of the power of the power of the great sword");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search(/the/) !== aString.search(/the/g)) {
+ throw new Test262Error('#1: var aString = new String("power of the power of the power of the power of the power of the power of the great sword"); aString.search(/the/)=== aString.search(/the/g). Actual: ' + aString.search(/the/));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T2.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_T2.js
new file mode 100644
index 0000000000..c46377f63d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A3_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.search (regexp) ignores global properties of regexp
+es5id: 15.5.4.12_A3_T2
+description: >
+ Checking results of search regexp with and without global
+ properties. Unicode symbols used
+---*/
+
+var aString = new String("power \u006F\u0066 the power of the power \u006F\u0066 the power of the power \u006F\u0066 the power of the great sword");
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (aString.search(/of/) !== aString.search(/of/g)) {
+ throw new Test262Error('#1: var aString = new String("power \\u006F\\u0066 the power of the power \\u006F\\u0066 the power of the power \\u006F\\u0066 the power of the great sword"); aString.search(/of/)=== aString.search(/of/g). Actual: ' + aString.search(/of/));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A6.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A6.js
new file mode 100644
index 0000000000..e4f90d82a8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search has not prototype property
+es5id: 15.5.4.12_A6
+description: Checking String.prototype.search.prototype
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (String.prototype.search.prototype !== undefined) {
+ throw new Test262Error('#1: String.prototype.search.prototype === undefined. Actual: ' + String.prototype.search.prototype);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A7.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A7.js
new file mode 100644
index 0000000000..d8e865cd03
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search can't be used as constructor
+es5id: 15.5.4.12_A7
+description: Checking if creating the String.prototype.search object fails
+---*/
+
+var __FACTORY = String.prototype.search;
+
+try {
+ var __instance = new __FACTORY;
+ throw new Test262Error('#1: __FACTORY = String.prototype.search; "__instance = new __FACTORY" lead to throwing exception');
+} catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#1.1: __FACTORY = String.prototype.search; "__instance = new __FACTORY" throw a TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A8.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A8.js
new file mode 100644
index 0000000000..1735dfb811
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search.length property has the attribute DontEnum
+es5id: 15.5.4.12_A8
+description: >
+ Checking if enumerating the String.prototype.search.length
+ property fails
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#0
+if (!(String.prototype.search.hasOwnProperty('length'))) {
+ throw new Test262Error('#0: String.prototype.search.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.search.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+// CHECK#1
+if (String.prototype.search.propertyIsEnumerable('length')) {
+ throw new Test262Error('#1: String.prototype.search.propertyIsEnumerable(\'length\') return false');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+// CHECK#2
+var count = 0;
+
+for (var p in String.prototype.search) {
+ if (p === "length") count++;
+}
+
+if (count !== 0) {
+ throw new Test262Error('#2: count=0; for (p in String.prototype.search){if (p==="length") count++;}; count === 0. Actual: ' + count);
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A9.js b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_A9.js
new file mode 100644
index 0000000000..ffe40c992a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/S15.5.4.12_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.search.length property does not have the attribute
+ DontDelete
+es5id: 15.5.4.12_A9
+description: >
+ Checking if deleting the String.prototype.search.length property
+ fails
+---*/
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#0
+if (!(String.prototype.search.hasOwnProperty('length'))) {
+ throw new Test262Error('#0: String.prototype.search.hasOwnProperty(\'length\') return true. Actual: ' + String.prototype.search.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!delete String.prototype.search.length) {
+ throw new Test262Error('#1: delete String.prototype.search.length return true');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (String.prototype.search.hasOwnProperty('length')) {
+ throw new Test262Error('#2: delete String.prototype.search.length; String.prototype.search.hasOwnProperty(\'length\') return false. Actual: ' + String.prototype.search.hasOwnProperty('length'));
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/browser.js b/js/src/tests/test262/built-ins/String/prototype/search/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/browser.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-get-err.js b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-get-err.js
new file mode 100644
index 0000000000..c9b996d864
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-get-err.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Behavior when error is thrown accessing @@search property
+es6id: 21.1.3.15
+info: |
+ [...]
+ 3. If regexp is neither undefined nor null, then
+ a. Let searcher be GetMethod(regexp, @@search).
+ b. ReturnIfAbrupt(searcher).
+features: [Symbol.search]
+---*/
+
+var poisonedSearch = {};
+Object.defineProperty(poisonedSearch, Symbol.search, {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+assert.throws(Test262Error, function() {
+ ''.search(poisonedSearch);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-invocation.js b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-invocation.js
new file mode 100644
index 0000000000..2ec7e813ef
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-invocation.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invocation of @@search property of user-supplied objects
+es6id: 21.1.3.15
+info: |
+ [...]
+ 3. If regexp is neither undefined nor null, then
+ a. Let searcher be GetMethod(regexp, @@search).
+ b. ReturnIfAbrupt(searcher).
+ c. If searcher is not undefined, then
+ i. Return Call(searcher, regexp, «O»)
+features: [Symbol.search]
+---*/
+
+var regexp = {};
+var returnVal = {};
+var callCount = 0;
+var thisVal, args;
+
+regexp[Symbol.search] = function() {
+ callCount += 1;
+ thisVal = this;
+ args = arguments;
+ return returnVal;
+};
+
+assert.sameValue('O'.search(regexp), returnVal);
+assert.sameValue(callCount, 1, 'Invokes the method exactly once');
+assert.sameValue(thisVal, regexp);
+assert.notSameValue(args, undefined);
+assert.sameValue(args.length, 1);
+assert.sameValue(args[0], 'O');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-is-null.js b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-is-null.js
new file mode 100644
index 0000000000..ef09cfdaec
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/cstm-search-is-null.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-string.prototype.search
+description: >
+ If regexp's Symbol.search property is null, no error is thrown.
+info: |
+ String.prototype.search ( regexp )
+
+ [...]
+ 2. If regexp is neither undefined nor null, then
+ a. Let searcher be ? GetMethod(regexp, @@search).
+ b. If searcher is not undefined, then
+ [...]
+ [...]
+ 5. Return ? Invoke(rx, @@search, « string »).
+
+ GetMethod ( V, P )
+
+ [...]
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+features: [Symbol.search]
+---*/
+
+var regexp = {};
+regexp[Symbol.search] = null;
+regexp.toString = function() { return "\\d"; };
+regexp.valueOf = function() { throw new Test262Error("should not be called"); };
+
+assert.sameValue("abc".search(regexp), -1);
+assert.sameValue("ab3c".search(regexp), 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search-searcher-undef.js b/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search-searcher-undef.js
new file mode 100644
index 0000000000..5a92adc0a4
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search-searcher-undef.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 Mike Pennisi. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Invocation of @@search property of internally-created RegExps when `this` value has an `undefined` @@search property
+es6id: 21.1.3.15
+info: |
+ [...]
+ 3. If regexp is neither undefined nor null, then
+ a. Let searcher be GetMethod(regexp, @@search).
+ b. ReturnIfAbrupt(searcher).
+ c. If searcher is not undefined , then
+ [...]
+ [...]
+ 6. Let rx be RegExpCreate(regexp, undefined) (see 21.2.3.2.3).
+ 7. ReturnIfAbrupt(rx).
+ 8. Return Invoke(rx, @@search, «S»).
+features: [Symbol.search]
+---*/
+
+var target = new String('target');
+var originalSearch = RegExp.prototype[Symbol.search];
+var returnVal = {};
+var result, thisVal, args;
+
+target[Symbol.search] = undefined;
+
+// Fail early if the method is undefined. This test's cleanup logic would
+// otherwise install the value `undefined` to the `Symbol.search` property of
+// the built-in prototype.
+assert.notSameValue(originalSearch, undefined);
+
+RegExp.prototype[Symbol.search] = function() {
+ thisVal = this;
+ args = arguments;
+ return returnVal;
+};
+
+try {
+ result = target.search('string source');
+
+ assert(thisVal instanceof RegExp);
+ assert.sameValue(thisVal.source, 'string source');
+ assert.sameValue(thisVal.flags, '');
+ assert.sameValue(args.length, 1);
+ assert.sameValue(args[0], 'target');
+ assert.sameValue(result, returnVal);
+} finally {
+ RegExp.prototype[Symbol.search] = originalSearch;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search.js b/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search.js
new file mode 100644
index 0000000000..6eec9da7fd
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/invoke-builtin-search.js
@@ -0,0 +1,43 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Invocation of @@search property of internally-created RegExps
+es6id: 21.1.3.15
+info: |
+ [...]
+ 6. Let rx be RegExpCreate(regexp, undefined) (see 21.2.3.2.3).
+ 7. ReturnIfAbrupt(rx).
+ 8. Return Invoke(rx, @@search, «S»).
+features: [Symbol.search]
+---*/
+
+var originalSearch = RegExp.prototype[Symbol.search];
+var returnVal = {};
+var result, thisVal, args;
+
+// Fail early if the method is undefined. This test's cleanup logic would
+// otherwise install the value `undefined` to the `Symbol.search` property of
+// the built-in prototype.
+assert.notSameValue(originalSearch, undefined);
+
+RegExp.prototype[Symbol.search] = function() {
+ thisVal = this;
+ args = arguments;
+ return returnVal;
+};
+
+try {
+ result = 'target'.search('string source');
+
+ assert(thisVal instanceof RegExp);
+ assert.sameValue(thisVal.source, 'string source');
+ assert.sameValue(thisVal.flags, '');
+ assert.sameValue(args.length, 1);
+ assert.sameValue(args[0], 'target');
+ assert.sameValue(result, returnVal);
+} finally {
+ RegExp.prototype[Symbol.search] = originalSearch;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/name.js b/js/src/tests/test262/built-ins/String/prototype/search/name.js
new file mode 100644
index 0000000000..ad555b4841
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/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.15
+description: >
+ String.prototype.search.name is "search".
+info: |
+ String.prototype.search ( regexp )
+
+ 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.search.name, "search");
+
+verifyNotEnumerable(String.prototype.search, "name");
+verifyNotWritable(String.prototype.search, "name");
+verifyConfigurable(String.prototype.search, "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/not-a-constructor.js b/js/src/tests/test262/built-ins/String/prototype/search/not-a-constructor.js
new file mode 100644
index 0000000000..c61e4f3b16
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/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.search 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.search),
+ false,
+ 'isConstructor(String.prototype.search) must return false'
+);
+
+assert.throws(TypeError, () => {
+ new String.prototype.search();
+}, '`new String.prototype.search()` throws TypeError');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/shell.js b/js/src/tests/test262/built-ins/String/prototype/search/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/shell.js
diff --git a/js/src/tests/test262/built-ins/String/prototype/search/this-value-not-obj-coercible.js b/js/src/tests/test262/built-ins/String/prototype/search/this-value-not-obj-coercible.js
new file mode 100644
index 0000000000..955dac4149
--- /dev/null
+++ b/js/src/tests/test262/built-ins/String/prototype/search/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.search
+description: The "this" value must be object-coercible
+info: |
+ 1. Let O be ? RequireObjectCoercible(this value).
+---*/
+
+var search = String.prototype.search;
+
+assert.sameValue(typeof search, 'function');
+
+assert.throws(TypeError, function() {
+ search.call(undefined, /./);
+}, 'undefined');
+
+assert.throws(TypeError, function() {
+ search.call(null, /./);
+}, 'null');
+
+reportCompare(0, 0);