PrettyPrinter allows an object to have a toString that isn't a function

- Fixes #1389
This commit is contained in:
Gregg Van Hove
2017-07-17 22:01:06 -07:00
parent aa72b0b7cf
commit 22e9d6df20
3 changed files with 14 additions and 6 deletions

View File

@@ -257,6 +257,14 @@ describe("jasmineUnderTest.pp", function () {
}
});
it("should stringify objects have have a toString that isn't a function", function() {
var obj = {
toString: "foo"
};
expect(jasmineUnderTest.pp(obj)).toEqual("Object({ toString: 'foo' })");
});
it("should stringify objects from anonymous constructors with custom toString", function () {
var MyAnonymousConstructor = (function() { return function () {}; })();
MyAnonymousConstructor.toString = function () { return ''; };