summaryrefslogtreecommitdiff
path: root/test/parallel/test-buffer-pending-deprecation.js
blob: 060eae2a51622e0e9c13b1aaf6aea70ad68c14fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Flags: --pending-deprecation --no-warnings
'use strict';

const common = require('../common');

const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
                      'recommended for use due to security and usability ' +
                      'concerns. Please use the new Buffer.alloc(), ' +
                      'Buffer.allocUnsafe(), or Buffer.from() construction ' +
                      'methods instead.';

common.expectWarning('DeprecationWarning', bufferWarning);

// 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);

new Buffer(10);