Skip to content

Commit

Permalink
test: use Buffer.alloc
Browse files Browse the repository at this point in the history
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
PR-URL: #8748
  • Loading branch information
Eugene Ostroukhov authored and jasnell committed Sep 29, 2016
1 parent 46f3322 commit e32f945
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/inspector/inspector-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ function checkHttpResponse(port, path, callback) {
}

function makeBufferingDataCallback(dataCallback) {
let buffer = new Buffer(0);
let buffer = Buffer.alloc(0);
return (data) => {
const newData = Buffer.concat([buffer, data]);
const str = newData.toString('utf8');
const lines = str.split('\n');
if (str.endsWith('\n'))
buffer = new Buffer(0);
buffer = Buffer.alloc(0);
else
buffer = Buffer.from(lines.pop(), 'utf8');
for (var line of lines)
Expand All @@ -123,7 +123,7 @@ const TestSession = function(socket, harness) {
this.expectedId_ = 1;
this.lastMessageResponseCallback_ = null;

let buffer = new Buffer(0);
let buffer = Buffer.alloc(0);
socket.on('data', (data) => {
buffer = Buffer.concat([buffer, data]);
let consumed;
Expand Down

0 comments on commit e32f945

Please sign in to comment.