You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
792 B

4 years ago
  1. 'use strict';
  2. var Buffer = require('../../').Buffer;
  3. var assert = require('assert');
  4. var util = require('util');
  5. var buffer = require('../../');
  6. buffer.INSPECT_MAX_BYTES = 2;
  7. var b = Buffer.allocUnsafe(4);
  8. b.fill('1234');
  9. var s = buffer.SlowBuffer(4);
  10. s.fill('1234');
  11. var expected = '<Buffer 31 32 ... >';
  12. assert.strictEqual(util.inspect(b), expected);
  13. assert.strictEqual(util.inspect(s), expected);
  14. b = Buffer.allocUnsafe(2);
  15. b.fill('12');
  16. s = buffer.SlowBuffer(2);
  17. s.fill('12');
  18. expected = '<Buffer 31 32>';
  19. assert.strictEqual(util.inspect(b), expected);
  20. assert.strictEqual(util.inspect(s), expected);
  21. buffer.INSPECT_MAX_BYTES = Infinity;
  22. assert.doesNotThrow(function() {
  23. assert.strictEqual(util.inspect(b), expected);
  24. assert.strictEqual(util.inspect(s), expected);
  25. });