• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3
4// lib/buffer.js defines Buffer.prototype.inspect() to override how buffers are
5// presented by util.inspect().
6
7const assert = require('assert');
8const util = require('util');
9
10{
11  const buf = Buffer.from('fhqwhgads');
12  assert.strictEqual(util.inspect(buf), '<Buffer 66 68 71 77 68 67 61 64 73>');
13}
14
15{
16  const buf = Buffer.from('');
17  assert.strictEqual(util.inspect(buf), '<Buffer >');
18}
19
20{
21  const buf = Buffer.from('x'.repeat(51));
22  assert.ok(/^<Buffer (?:78 ){50}\.\.\. 1 more byte>$/.test(util.inspect(buf)));
23}
24