2017-03-11 12:32:25 -08:00
|
|
|
// Flags: --pending-deprecation --no-warnings
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
|
2018-04-01 22:03:59 -07:00
|
|
|
const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
|
|
|
|
'issues. Please use the Buffer.alloc(), ' +
|
|
|
|
'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
|
2017-03-11 12:32:25 -08:00
|
|
|
|
2018-03-20 12:39:46 +01:00
|
|
|
common.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005');
|
2017-03-11 12:32:25 -08:00
|
|
|
|
2017-04-19 23:07:58 -07:00
|
|
|
// This is used to make sure that a warning is only emitted once even though
|
|
|
|
// `new Buffer()` is called twice.
|
|
|
|
process.on('warning', common.mustCall());
|
|
|
|
|
|
|
|
new Buffer(10);
|
|
|
|
|
2017-03-11 12:32:25 -08:00
|
|
|
new Buffer(10);
|