test: check that pending warning is emitted once

Code for the new --pending-deprecation flag contains logic to make sure
the deprecation warning is emitted only once. However, this was not
being tested. Add test coverage for this situation.

PR-URL: https://github.com/nodejs/node/pull/12527
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Rich Trott 2017-04-19 23:07:58 -07:00 committed by James M Snell
parent 6ee6aaefa1
commit 75bfdad037

View File

@ -12,4 +12,10 @@ const bufferWarning = 'The Buffer() and new Buffer() constructors are not ' +
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);