MCPcopy Index your code
hub / github.com/nodejs/node / testErrorToString

Function testErrorToString

deps/v8/test/mjsunit/error-tostring.js:58–76  ·  view source on GitHub ↗
(nameValue, messageValue)

Source from the content-addressed store, hash-verified

56// on a given Error object. Verify the produced string representation.
57
58function testErrorToString(nameValue, messageValue) {
59 var seq = [];
60 var e = {
61 get name() {
62 seq.push(1);
63 return (nameValue === undefined) ? nameValue : {
64 toString: function() { seq.push(2); return nameValue; }
65 };
66 },
67 get message() {
68 seq.push(3);
69 return (messageValue === undefined) ? messageValue : {
70 toString: function() { seq.push(4); return messageValue; }
71 };
72 }
73 };
74 var string = Error.prototype.toString.call(e);
75 return [string,seq];
76}
77
78assertEquals(["Error",[1,3]], testErrorToString(undefined, undefined));
79assertEquals(["e1",[1,2,3]], testErrorToString("e1", undefined));

Callers 1

error-tostring.jsFile · 0.85

Calls 1

callMethod · 0.45

Tested by

no test coverage detected