Navigation Menu

Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
test: for #2109
Browse files Browse the repository at this point in the history
  • Loading branch information
koichik committed Jan 22, 2012
1 parent f901443 commit 93298af
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/simple/test-util-inspect.js
Expand Up @@ -42,6 +42,27 @@ assert.equal(util.inspect(a), "[ 'foo', , 'baz' ]");
assert.equal(util.inspect(a, true), "[ 'foo', , 'baz', [length]: 3 ]");
assert.equal(util.inspect(new Array(5)), '[ , , , , ]');

// test for property descriptors
var getter = Object.create(null, {
a: {
get: function() { return 'aaa'; }
}
});
var setter = Object.create(null, {
b: {
set: function() {}
},
});
var getterAndSetter = Object.create(null, {
c: {
get: function() { return 'ccc'; },
set: function() {}
}
});
assert.equal(util.inspect(getter, true), "{ [a]: [Getter] }");
assert.equal(util.inspect(setter, true), "{ [b]: [Setter] }");
assert.equal(util.inspect(getterAndSetter, true), "{ [c]: [Getter/Setter] }");

// exceptions should print the error message, not "{}"
assert.equal(util.inspect(new Error()), '[Error]');
assert.equal(util.inspect(new Error('FAIL')), '[Error: FAIL]');
Expand Down

0 comments on commit 93298af

Please sign in to comment.