mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 15:17:17 +00:00

This adds the number of hidden items in case INSPECT_MAX_BYTES is exceeded. PR-URL: https://github.com/nodejs/node/pull/22289 Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
24 lines
558 B
JavaScript
24 lines
558 B
JavaScript
'use strict';
|
|
require('../common');
|
|
|
|
// lib/buffer.js defines Buffer.prototype.inspect() to override how buffers are
|
|
// presented by util.inspect().
|
|
|
|
const assert = require('assert');
|
|
const util = require('util');
|
|
|
|
{
|
|
const buf = Buffer.from('fhqwhgads');
|
|
assert.strictEqual(util.inspect(buf), '<Buffer 66 68 71 77 68 67 61 64 73>');
|
|
}
|
|
|
|
{
|
|
const buf = Buffer.from('');
|
|
assert.strictEqual(util.inspect(buf), '<Buffer >');
|
|
}
|
|
|
|
{
|
|
const buf = Buffer.from('x'.repeat(51));
|
|
assert.ok(/^<Buffer (?:78 ){50}\.\.\. 1 more byte>$/.test(util.inspect(buf)));
|
|
}
|