Index: test/mjsunit/regexp.js |
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js |
index beed6cd30f23224bada5ca703b2ba1a59834d249..04c723665a60162c40b8c8876905cf581c2f8b08 100644 |
--- a/test/mjsunit/regexp.js |
+++ b/test/mjsunit/regexp.js |
@@ -748,3 +748,19 @@ RegExp.prototype.exec = RegExpPrototypeExec; |
var re = /./; |
re.lastIndex = { [Symbol.toPrimitive]: 42 }; |
try { "abc".search(re); } catch (_) {} // Ensure we don't crash. |
+ |
+// Test lastIndex values of -0.0 and NaN (since @@search uses SameValue). |
+ |
+var re = /./; |
+re.exec = function(str) { assertEquals(0, re.lastIndex); return []; } |
+re.lastIndex = -0.0; |
+assertEquals(-0, re.lastIndex); |
+"abc".search(re); |
+assertEquals(-0, re.lastIndex); |
+ |
+var re = /./; |
+re.exec = function(str) { assertEquals(0, re.lastIndex); return []; } |
+re.lastIndex = NaN; |
+assertEquals(NaN, re.lastIndex); |
+"abc".search(re); |
+assertEquals(NaN, re.lastIndex); |