mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
1 parent
e6b6ce429c
commit
a6bd287724
732 files changed
+3390
-3371
No files matched your search
@@ -6,15 +6,15 @@
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const SD = require('string_decoder').StringDecoder;
|
||||
var encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2'];
|
||||
const encodings = ['base64', 'hex', 'utf8', 'utf16le', 'ucs2'];
|
||||
|
||||
var bufs = [ '☃💩', 'asdf' ].map(function(b) {
|
||||
const bufs = [ '☃💩', 'asdf' ].map(function(b) {
|
||||
return Buffer.from(b);
|
||||
});
|
||||
|
||||
// also test just arbitrary bytes from 0-15.
|
||||
for (var i = 1; i <= 16; i++) {
|
||||
var bytes = new Array(i).join('.').split('.').map(function(_, j) {
|
||||
for (let i = 1; i <= 16; i++) {
|
||||
const bytes = new Array(i).join('.').split('.').map(function(_, j) {
|
||||
return j + 0x78;
|
||||
});
|
||||
bufs.push(Buffer.from(bytes));
|
||||
@@ -34,21 +34,21 @@ function testBuf(encoding, buf) {
|
||||
console.error('# %s', encoding, buf);
|
||||
|
||||
// write one byte at a time.
|
||||
var s = new SD(encoding);
|
||||
var res1 = '';
|
||||
for (var i = 0; i < buf.length; i++) {
|
||||
let s = new SD(encoding);
|
||||
let res1 = '';
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
res1 += s.write(buf.slice(i, i + 1));
|
||||
}
|
||||
res1 += s.end();
|
||||
|
||||
// write the whole buffer at once.
|
||||
var res2 = '';
|
||||
let res2 = '';
|
||||
s = new SD(encoding);
|
||||
res2 += s.write(buf);
|
||||
res2 += s.end();
|
||||
|
||||
// .toString() on the buffer
|
||||
var res3 = buf.toString(encoding);
|
||||
const res3 = buf.toString(encoding);
|
||||
|
||||
console.log('expect=%j', res3);
|
||||
console.log('res1=%j', res1);
|
||||
|
||||
Reference in new issue
Block a user