2017-02-27 23:56:39 -08:00
|
|
|
'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));
|
2021-08-29 10:14:22 +02:00
|
|
|
assert.match(util.inspect(buf), /^<Buffer (?:78 ){50}\.\.\. 1 more byte>$/);
|
2017-02-27 23:56:39 -08:00
|
|
|
}
|