Index: test/mjsunit/regexp-not-sticky-yet.js |
diff --git a/test/mjsunit/compiler/smi-stores-opt.js b/test/mjsunit/regexp-not-sticky-yet.js |
similarity index 60% |
copy from test/mjsunit/compiler/smi-stores-opt.js |
copy to test/mjsunit/regexp-not-sticky-yet.js |
index ca0923abc99501096d182bcdcd05f6f4020de9c9..571a960388460c17330b2bf478ba94ad1de99068 100644 |
--- a/test/mjsunit/compiler/smi-stores-opt.js |
+++ b/test/mjsunit/regexp-not-sticky-yet.js |
@@ -25,25 +25,30 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+// Test that sticky regexp support is not affecting V8 when the |
+// --harmony-regexps flag is not on. |
-var o = {a:1.5}; |
-o.a = 0; |
-var a = o.a; |
+assertThrows(function() { eval("/foo.bar/y"); }, SyntaxError); |
+assertThrows(function() { eval("/foobar/y"); }, SyntaxError); |
+assertThrows(function() { eval("/foo.bar/gy"); }, SyntaxError); |
+assertThrows(function() { eval("/foobar/gy"); }, SyntaxError); |
+assertThrows(function() { new RegExp("foo.bar", "y"); }, SyntaxError); |
+assertThrows(function() { new RegExp("foobar", "y"); }, SyntaxError); |
+assertThrows(function() { new RegExp("foo.bar", "gy"); }, SyntaxError); |
+assertThrows(function() { new RegExp("foobar", "gy"); }, SyntaxError); |
-function g() { |
- return 1; |
-} |
+var re = /foo.bar/; |
+assertEquals("/foo.bar/", "" + re); |
+var plain = /foobar/; |
+assertEquals("/foobar/", "" + plain); |
-var o2 = {a:{}}; |
+var global = /foo.bar/g; |
+assertEquals("/foo.bar/g", "" + global); |
+var plainglobal = /foobar/g; |
+assertEquals("/foobar/g", "" + plainglobal); |
-function f() { |
- var result = {a: a}; |
- var literal = {x:g()}; |
- return [result, literal]; |
-} |
+assertEquals(void 0, re.sticky); |
+re.sticky = true; // Has no effect on the regexp, just sets a property. |
+assertTrue(re.sticky); |
-f(); |
-f(); |
-%OptimizeFunctionOnNextCall(f); |
-assertEquals(1, f()[1].x); |
+assertTrue(re.test("..foo.bar")); |