mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
607 B
26 lines
607 B
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const RuleTester = require('../../tools/eslint').RuleTester;
|
|
const rule = require('../../tools/eslint-rules/buffer-constructor');
|
|
|
|
const message = 'Use of the Buffer() constructor has been deprecated. ' +
|
|
'Please use either Buffer.alloc(), Buffer.allocUnsafe(), ' +
|
|
'or Buffer.from()';
|
|
|
|
new RuleTester().run('buffer-constructor', rule, {
|
|
valid: [
|
|
'Buffer.from(foo)'
|
|
],
|
|
invalid: [
|
|
{
|
|
code: 'Buffer(foo)',
|
|
errors: [{ message }]
|
|
},
|
|
{
|
|
code: 'new Buffer(foo)',
|
|
errors: [{ message }]
|
|
}
|
|
]
|
|
});
|
|
|