From fd74f970679076a27e31aeeecced8111589f248c Mon Sep 17 00:00:00 2001
From: Alexey Shvayka <shvaikalesh@gmail.com>
Date: Fri, 8 May 2020 18:33:25 +0300
Subject: [PATCH] Add String.prototype.search test

---
 .../custom-searcher-emulates-undefined.js     | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 test/annexB/built-ins/String/prototype/search/custom-searcher-emulates-undefined.js

diff --git a/test/annexB/built-ins/String/prototype/search/custom-searcher-emulates-undefined.js b/test/annexB/built-ins/String/prototype/search/custom-searcher-emulates-undefined.js
new file mode 100644
index 0000000000..c7ee789459
--- /dev/null
+++ b/test/annexB/built-ins/String/prototype/search/custom-searcher-emulates-undefined.js
@@ -0,0 +1,29 @@
+// 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: >
+  [[IsHTMLDDA]] object as @@search method gets called.
+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
+      i. Return ? Call(searcher, regexp, « O »).
+features: [Symbol.search, IsHTMLDDA]
+---*/
+
+var regexp = $262.IsHTMLDDA;
+var searcherGets = 0;
+Object.defineProperty(regexp, Symbol.search, {
+  get: function() {
+    searcherGets += 1;
+    return regexp;
+  },
+  configurable: true,
+});
+
+assert.sameValue("".search(regexp), null);
+assert.sameValue(searcherGets, 1);