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

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

Issue 6869007: Cleanup of mjsunit.js code and make assertEquals more strict. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 years, 8 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
« no previous file with comments | « test/mjsunit/mirror-number.js ('k') | test/mjsunit/mjsunit.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/mirror-object.js
diff --git a/test/mjsunit/mirror-object.js b/test/mjsunit/mirror-object.js
index 188855497d2322e4999d37725db1a4e302229380..d4d228cf07d3008e67ed6cd7bc0fca4e717564ba 100644
--- a/test/mjsunit/mirror-object.js
+++ b/test/mjsunit/mirror-object.js
@@ -38,7 +38,7 @@ function MirrorRefCache(json_refs) {
MirrorRefCache.prototype.lookup = function(handle) {
return this.refs_[handle];
-}
+};
function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) {
// Create mirror and JSON representation.
@@ -66,7 +66,7 @@ function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) {
assertFalse(mirror.hasIndexedInterceptor(), 'No indexed interceptor expected');
var names = mirror.propertyNames();
- var properties = mirror.properties()
+ var properties = mirror.properties();
assertEquals(names.length, properties.length);
for (var i = 0; i < properties.length; i++) {
assertTrue(properties[i] instanceof debug.Mirror, 'Unexpected mirror hierachy');
@@ -130,15 +130,20 @@ function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) {
assertTrue(typeof(fromJSON.properties[i].attributes) === 'undefined', 'Unexpected serialized attributes');
}
- // Lookup the serialized object from the handle reference.
+ // Lookup the serialized object from the handle reference.
var o = refs.lookup(fromJSON.properties[i].ref);
assertTrue(o != void 0, 'Referenced object is not serialized');
assertEquals(properties[i].value().type(), o.type, 'Unexpected serialized property type for ' + name);
if (properties[i].value().isPrimitive()) {
- // Special check for NaN as NaN == NaN is false.
- if (properties[i].value().isNumber() && isNaN(properties[i].value().value())) {
- assertEquals('NaN', o.value, 'Unexpected serialized property value for ' + name);
+ if (properties[i].value().type() == "null" ||
+ properties[i].value().type() == "undefined") {
+ // Null and undefined has no value property.
+ assertFalse("value" in o, 'Unexpected value property for ' + name);
+ } else if (properties[i].value().type() == "number" &&
+ !isFinite(properties[i].value().value())) {
+ assertEquals(String(properties[i].value().value()), o.value,
+ 'Unexpected serialized property value for ' + name);
} else {
assertEquals(properties[i].value().value(), o.value, 'Unexpected serialized property value for ' + name);
}
« no previous file with comments | « test/mjsunit/mirror-number.js ('k') | test/mjsunit/mjsunit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698