| Index: test/mjsunit/mirror-regexp.js
|
| ===================================================================
|
| --- test/mjsunit/mirror-regexp.js (revision 1079)
|
| +++ test/mjsunit/mirror-regexp.js (working copy)
|
| @@ -39,10 +39,24 @@
|
| 'lastIndex': debug.PropertyAttribute.DontEnum | debug.PropertyAttribute.DontDelete
|
| };
|
|
|
| +function MirrorRefCache(json_refs) {
|
| + var tmp = eval('(' + json_refs + ')');
|
| + this.refs_ = [];
|
| + for (var i = 0; i < tmp.length; i++) {
|
| + this.refs_[tmp[i].handle] = tmp[i];
|
| + }
|
| +}
|
| +
|
| +MirrorRefCache.prototype.lookup = function(handle) {
|
| + return this.refs_[handle];
|
| +}
|
| +
|
| function testRegExpMirror(r) {
|
| // Create mirror and JSON representation.
|
| var mirror = debug.MakeMirror(r);
|
| - var json = mirror.toJSONProtocol(true);
|
| + var serializer = debug.MakeMirrorSerializer();
|
| + var json = serializer.serializeValue(mirror);
|
| + var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
|
|
|
| // Check the mirror hierachy.
|
| assertTrue(mirror instanceof debug.Mirror);
|
| @@ -54,10 +68,6 @@
|
| assertTrue(mirror.isRegExp());
|
| assertEquals('regexp', mirror.type());
|
| assertFalse(mirror.isPrimitive());
|
| - assertEquals(mirror.source(), r.source, 'source');
|
| - assertEquals(mirror.global(), r.global, 'global');
|
| - assertEquals(mirror.ignoreCase(), r.ignoreCase, 'ignoreCase');
|
| - assertEquals(mirror.multiline(), r.multiline, 'multiline');
|
| for (var p in expected_attributes) {
|
| assertEquals(mirror.property(p).attributes(),
|
| expected_attributes[p],
|
| @@ -71,16 +81,21 @@
|
| var fromJSON = eval('(' + json + ')');
|
| assertEquals('regexp', fromJSON.type);
|
| assertEquals('RegExp', fromJSON.className);
|
| - assertEquals(fromJSON.source, r.source, 'source');
|
| - assertEquals(fromJSON.global, r.global, 'global');
|
| - assertEquals(fromJSON.ignoreCase, r.ignoreCase, 'ignoreCase');
|
| - assertEquals(fromJSON.multiline, r.multiline, 'multiline');
|
| for (var p in expected_attributes) {
|
| for (var i = 0; i < fromJSON.properties.length; i++) {
|
| if (fromJSON.properties[i].name == p) {
|
| - assertEquals(fromJSON.properties[i].attributes,
|
| - expected_attributes[p],
|
| - p + ' attributes');
|
| + 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);
|
| }
|
| }
|
| }
|
|
|