11cb0ef41Sopenharmony_ci// Flags: --pending-deprecation --no-warnings 21cb0ef41Sopenharmony_ci'use strict'; 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciconst bufferWarning = 'Buffer() is deprecated due to security and usability ' + 71cb0ef41Sopenharmony_ci 'issues. Please use the Buffer.alloc(), ' + 81cb0ef41Sopenharmony_ci 'Buffer.allocUnsafe(), or Buffer.from() methods instead.'; 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_cicommon.expectWarning('DeprecationWarning', bufferWarning, 'DEP0005'); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ci// This is used to make sure that a warning is only emitted once even though 131cb0ef41Sopenharmony_ci// `new Buffer()` is called twice. 141cb0ef41Sopenharmony_ciprocess.on('warning', common.mustCall()); 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_cinew Buffer(10); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cinew Buffer(10); 19