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

Unified Diff: test/mjsunit/harmony/regexp-flags.js

Issue 788053003: Make `RegExp.prototype.flags` getter configurable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « src/harmony-regexp.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/regexp-flags.js
diff --git a/test/mjsunit/harmony/regexp-flags.js b/test/mjsunit/harmony/regexp-flags.js
index b20044343b8ef55830492c1185dc2a1adbfde151..475fda493c13530c29f424a4cf50c0b6f6241564 100644
--- a/test/mjsunit/harmony/regexp-flags.js
+++ b/test/mjsunit/harmony/regexp-flags.js
@@ -4,7 +4,6 @@
// Flags: --harmony-regexps
-delete RegExp.prototype.flags;
RegExp.prototype.flags = 'setter should be undefined';
assertEquals('', RegExp('').flags);
@@ -18,7 +17,7 @@ assertEquals('gimy', /foo/ymig.flags);
assertThrows(function() { RegExp('', 'yumig').flags; }, SyntaxError);
var descriptor = Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags');
-assertFalse(descriptor.configurable);
+assertTrue(descriptor.configurable);
assertFalse(descriptor.enumerable);
assertInstanceof(descriptor.get, Function);
assertEquals(undefined, descriptor.set);
@@ -38,3 +37,25 @@ assertThrows(function() { testGenericFlags(true); }, TypeError);
assertThrows(function() { testGenericFlags(false); }, TypeError);
assertThrows(function() { testGenericFlags(''); }, TypeError);
assertThrows(function() { testGenericFlags(42); }, TypeError);
+
+var counter = 0;
+var map = {};
+var object = {
+ get global() {
+ map.g = counter++;
+ },
+ get ignoreCase() {
+ map.i = counter++;
+ },
+ get multiline() {
+ map.m = counter++;
+ },
+ get unicode() {
+ map.u = counter++;
+ },
+ get sticky() {
+ map.y = counter++;
+ }
+};
+testGenericFlags(object);
+assertEquals({ g: 0, i: 1, m: 2, u: 3, y: 4 }, map);
« no previous file with comments | « src/harmony-regexp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698