Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test case for custom inspect() functionality.

  • Loading branch information...
commit 86810e3609f4edd74423d50cfb2d8c45c482d1d2 1 parent cb757e3
@TooTallNate authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 test/simple/test-util-inspect.js
View
13 test/simple/test-util-inspect.js
@@ -79,3 +79,16 @@ assert.doesNotThrow(function () {
// GH-2225
var x = { inspect: util.inspect };
assert.ok(util.inspect(x).indexOf('inspect') != -1);
+
+// test for custom inspect() functionality
+var o = { foo: 'bar' };
+var inspectCalled = false;
+o.inspect = function (d, h, c) {
+ inspectCalled = true;
+ assert.equal(d, 10);
+ assert.equal(h, false);
+ assert.equal(c, true);
+ return this.foo;
+}
+assert.equal(util.inspect(o, false, 10, true), 'bar');
+assert.ok(inspectCalled);
Please sign in to comment.
Something went wrong with that request. Please try again.