Index: test/mjsunit/regress/string-split-monkey-patching.js |
diff --git a/test/cctest/test-platform.cc b/test/mjsunit/regress/string-split-monkey-patching.js |
similarity index 81% |
copy from test/cctest/test-platform.cc |
copy to test/mjsunit/regress/string-split-monkey-patching.js |
index 6c20b853c5e7408b1877ee74617c01c3fc32ed5f..ea5c8679cb6e5931c96e9494288e5134c313648f 100644 |
--- a/test/cctest/test-platform.cc |
+++ b/test/mjsunit/regress/string-split-monkey-patching.js |
@@ -25,13 +25,16 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#include <stdlib.h> |
+// Test that String.prototype.split with an regexp does not call the |
+// monkey-patchable Array.prototype.push or PutValue. |
-#include "cctest.h" |
-#include "platform.h" |
+Array.prototype.push = assertUnreachable; |
-using namespace ::v8::internal; |
+Object.defineProperty(Array.prototype, "0", { |
+ get: assertUnreachable, |
+ set: assertUnreachable }); |
-TEST(NumberOfCores) { |
- CHECK_GT(OS::NumberOfCores(), 0); |
-} |
+"-".split(/-/); |
+"I-must-not-use-push!".split(/-/); |
+"Oh-no!".split(/(-)/); |
+"a".split(/(a)|(b)/); |