diff options
author | koichik <koichik@improvement.jp> | 2012-01-22 12:35:28 +0400 |
---|---|---|
committer | koichik <koichik@improvement.jp> | 2012-01-22 12:35:28 +0400 |
commit | 93298afc4e2835e5b526ab871922018999e98bcb (patch) | |
tree | 1c12175b337c3437244e53bf814bf3498acb44c9 /test | |
parent | f9014438c79b06d222df861f87e9af3cb919e495 (diff) |
test: for #2109
Diffstat (limited to 'test')
-rw-r--r-- | test/simple/test-util-inspect.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/simple/test-util-inspect.js b/test/simple/test-util-inspect.js index d866b41dd2e..f21123e82f1 100644 --- a/test/simple/test-util-inspect.js +++ b/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]'); |