mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
508890d795
PR-URL: https://github.com/nodejs/node/pull/39928 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
24 lines
556 B
JavaScript
24 lines
556 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.match(util.inspect(buf), /^<Buffer (?:78 ){50}\.\.\. 1 more byte>$/);
|
|
}
|