node/test/parallel/test-buffer-zero-fill.js
Сковорода Никита Андреевич 8ed44ff1c4
test,benchmark: use new Buffer API where appropriate
For tests / benchmarks that are creating Buffer instances for
any reason other than to test Buffer constructor, use the new
Buffer.alloc/Buffer.from API instead of the deprecated API.

PR-URL: https://github.com/nodejs/node/pull/18980
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-03-04 12:50:15 +01:00

15 lines
316 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
// Tests deprecated Buffer API on purpose
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);