Explicitly test pretty printing objects with nested invalid toString
This commit is contained in:
@@ -344,8 +344,12 @@ describe("jasmineUnderTest.pp", function () {
|
|||||||
},
|
},
|
||||||
bar: {
|
bar: {
|
||||||
toString: function() {
|
toString: function() {
|
||||||
// Invalid: toString returning an object
|
// Really invalid: a nested bad toString().
|
||||||
return new Error("bar");
|
return {
|
||||||
|
toString: function() {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Valid: an actual number
|
// Valid: an actual number
|
||||||
@@ -354,6 +358,6 @@ describe("jasmineUnderTest.pp", function () {
|
|||||||
qux: new Error("bar")
|
qux: new Error("bar")
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ foo: [object Number], bar: [object Error], baz: 3, qux: Error: bar })");
|
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ foo: [object Number], bar: [object Object], baz: 3, qux: Error: bar })");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user