0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-buffer-zero-fill.js
James M Snell 7eb1b4658e buffer: zero fill Buffer(num) by default
PR-URL: https://github.com/nodejs/node/pull/12141
Ref: https://github.com/nodejs/CTC/issues/89
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2017-04-03 09:57:24 -07:00

15 lines
315 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const Buffer = require('buffer').Buffer;
const buf1 = Buffer(100);
const buf2 = new Buffer(100);
for (let n = 0; n < buf1.length; n++)
assert.strictEqual(buf1[n], 0);
for (let n = 0; n < buf2.length; n++)
assert.strictEqual(buf2[n], 0);