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

Unified Diff: test/mjsunit/mirror-regexp.js

Issue 1427733005: Revert of Implement flag and source getters on RegExp.prototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@rproto
Patch Set: Created 5 years, 1 month 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 | « test/mjsunit/es6/regexp-flags.js ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/mirror-regexp.js
diff --git a/test/mjsunit/mirror-regexp.js b/test/mjsunit/mirror-regexp.js
index 882af8dd6ebff24db4bf7c087112e403713ea341..6c251d4ff6aeda18d6b6057f2538888a511ae39f 100644
--- a/test/mjsunit/mirror-regexp.js
+++ b/test/mjsunit/mirror-regexp.js
@@ -25,17 +25,19 @@
// (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: --expose-debug-as debug --harmony-regexps --harmony-unicode-regexps
+// Flags: --expose-debug-as debug --harmony-unicode-regexps
// Test the mirror object for regular expression values
-var dont_enum = debug.PropertyAttribute.DontEnum;
-var dont_delete = debug.PropertyAttribute.DontDelete;
-var expected_prototype_attributes = {
- 'source': dont_enum,
- 'global': dont_enum,
- 'ignoreCase': dont_enum,
- 'multiline': dont_enum,
- 'unicode' : dont_enum,
+var all_attributes = debug.PropertyAttribute.ReadOnly |
+ debug.PropertyAttribute.DontEnum |
+ debug.PropertyAttribute.DontDelete;
+var expected_attributes = {
+ 'source': all_attributes,
+ 'global': all_attributes,
+ 'ignoreCase': all_attributes,
+ 'multiline': all_attributes,
+ 'unicode' : all_attributes,
+ 'lastIndex': debug.PropertyAttribute.DontEnum | debug.PropertyAttribute.DontDelete
};
function MirrorRefCache(json_refs) {
@@ -68,12 +70,9 @@
assertTrue(mirror.isRegExp());
assertEquals('regexp', mirror.type());
assertFalse(mirror.isPrimitive());
- assertEquals(dont_enum | dont_delete,
- mirror.property('lastIndex').attributes());
- var proto_mirror = mirror.protoObject();
- for (var p in expected_prototype_attributes) {
- assertEquals(expected_prototype_attributes[p],
- proto_mirror.property(p).attributes(),
+ for (var p in expected_attributes) {
+ assertEquals(expected_attributes[p],
+ mirror.property(p).attributes(),
p + ' attributes');
}
@@ -84,12 +83,24 @@
var fromJSON = eval('(' + json + ')');
assertEquals('regexp', fromJSON.type);
assertEquals('RegExp', fromJSON.className);
- assertEquals('lastIndex', fromJSON.properties[0].name);
- assertEquals(dont_enum | dont_delete, fromJSON.properties[0].attributes);
- assertEquals(mirror.property('lastIndex').propertyType(),
- fromJSON.properties[0].propertyType);
- assertEquals(mirror.property('lastIndex').value().value(),
- refs.lookup(fromJSON.properties[0].ref).value);
+ for (var p in expected_attributes) {
+ for (var i = 0; i < fromJSON.properties.length; i++) {
+ if (fromJSON.properties[i].name == p) {
+ assertEquals(expected_attributes[p],
+ fromJSON.properties[i].attributes,
+ 'Unexpected value for ' + p + ' attributes');
+ assertEquals(mirror.property(p).propertyType(),
+ fromJSON.properties[i].propertyType,
+ 'Unexpected value for ' + p + ' propertyType');
+ assertEquals(mirror.property(p).value().handle(),
+ fromJSON.properties[i].ref,
+ 'Unexpected handle for ' + p);
+ assertEquals(mirror.property(p).value().value(),
+ refs.lookup(fromJSON.properties[i].ref).value,
+ 'Unexpected value for ' + p);
+ }
+ }
+ }
}
« no previous file with comments | « test/mjsunit/es6/regexp-flags.js ('k') | test/mjsunit/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698