Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test: for #2109

  • Loading branch information...
commit 93298afc4e2835e5b526ab871922018999e98bcb 1 parent f901443
@koichik koichik authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 test/simple/test-util-inspect.js
View
21 test/simple/test-util-inspect.js
@@ -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]');
Please sign in to comment.
Something went wrong with that request. Please try again.