Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Unified Diff: test/mjsunit/regexp-not-sticky-yet.js

Issue 567313003: RegExp: Add support for the ES6-proposed sticky flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add tests Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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"));
« test/mjsunit/harmony/regexp-sticky.js ('K') | « test/mjsunit/harmony/regexp-sticky.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698