Skip to content

Commit

Permalink
Printing the constructor name for non-plain objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Wolf committed Nov 10, 2017
1 parent 71e24db commit be1c8d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/typed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var inspect = require('../');
var test = require('tape');

test('prototype is Object.prototype', function (t) {
t.plan(1);
var obj = {};
t.equal(inspect(obj), '{}');
});

test('prototype is null', function (t) {
t.plan(1);
var obj = Object.create(null);
t.equal(inspect(obj), '{}');
});

test('prototype from new', function (t) {
t.plan(1);
function Foo() {}
var obj = new Foo();
t.equal(inspect(obj), 'Foo {}');
});

0 comments on commit be1c8d7

Please sign in to comment.