We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f901443 commit 93298afCopy full SHA for 93298af
test/simple/test-util-inspect.js
@@ -42,6 +42,27 @@ assert.equal(util.inspect(a), "[ 'foo', , 'baz' ]");
42
assert.equal(util.inspect(a, true), "[ 'foo', , 'baz', [length]: 3 ]");
43
assert.equal(util.inspect(new Array(5)), '[ , , , , ]');
44
45
+// test for property descriptors
46
+var getter = Object.create(null, {
47
+ a: {
48
+ get: function() { return 'aaa'; }
49
+ }
50
+});
51
+var setter = Object.create(null, {
52
+ b: {
53
+ set: function() {}
54
+ },
55
56
+var getterAndSetter = Object.create(null, {
57
+ c: {
58
+ get: function() { return 'ccc'; },
59
60
61
62
+assert.equal(util.inspect(getter, true), "{ [a]: [Getter] }");
63
+assert.equal(util.inspect(setter, true), "{ [b]: [Setter] }");
64
+assert.equal(util.inspect(getterAndSetter, true), "{ [c]: [Getter/Setter] }");
65
+
66
// exceptions should print the error message, not "{}"
67
assert.equal(util.inspect(new Error()), '[Error]');
68
assert.equal(util.inspect(new Error('FAIL')), '[Error: FAIL]');
0 commit comments