mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: use eslint to fix var->const/let
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: https://github.com/nodejs/node/pull/11775 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
de63698066
commit
db61c952de
806 files changed
+5031
-4995
No files matched your search
@@ -1,18 +1,18 @@
|
||||
'use strict';
|
||||
require('../common');
|
||||
var assert = require('assert');
|
||||
const assert = require('assert');
|
||||
// minimum string size to overflow into external string space
|
||||
var EXTERN_APEX = 0xFBEE9;
|
||||
const EXTERN_APEX = 0xFBEE9;
|
||||
|
||||
// manually controlled string for checking binary output
|
||||
var ucs2_control = 'a\u0000';
|
||||
var write_str = 'a';
|
||||
let ucs2_control = 'a\u0000';
|
||||
let write_str = 'a';
|
||||
|
||||
|
||||
// first do basic checks
|
||||
var b = Buffer.from(write_str, 'ucs2');
|
||||
let b = Buffer.from(write_str, 'ucs2');
|
||||
// first check latin1
|
||||
var c = b.toString('latin1');
|
||||
let c = b.toString('latin1');
|
||||
assert.equal(b[0], 0x61);
|
||||
assert.equal(b[1], 0);
|
||||
assert.equal(ucs2_control, c);
|
||||
@@ -23,7 +23,7 @@ assert.equal(b[1], 0);
|
||||
assert.equal(ucs2_control, c);
|
||||
|
||||
// now create big strings
|
||||
var size = 1 + (1 << 20);
|
||||
const size = 1 + (1 << 20);
|
||||
write_str = Array(size).join(write_str);
|
||||
ucs2_control = Array(size).join(ucs2_control);
|
||||
|
||||
@@ -36,19 +36,19 @@ for (let i = 0; i < b.length; i += 2) {
|
||||
}
|
||||
|
||||
// create another string to create an external string
|
||||
var b_ucs = b.toString('ucs2');
|
||||
const b_ucs = b.toString('ucs2');
|
||||
|
||||
// check control against external binary string
|
||||
var l_bin = b.toString('latin1');
|
||||
const l_bin = b.toString('latin1');
|
||||
assert.equal(ucs2_control, l_bin);
|
||||
|
||||
// check control against external binary string
|
||||
var b_bin = b.toString('binary');
|
||||
const b_bin = b.toString('binary');
|
||||
assert.equal(ucs2_control, b_bin);
|
||||
|
||||
// create buffer copy from external
|
||||
var c_bin = Buffer.from(l_bin, 'latin1');
|
||||
var c_ucs = Buffer.from(b_ucs, 'ucs2');
|
||||
const c_bin = Buffer.from(l_bin, 'latin1');
|
||||
const c_ucs = Buffer.from(b_ucs, 'ucs2');
|
||||
// make sure they're the same length
|
||||
assert.equal(c_bin.length, c_ucs.length);
|
||||
// make sure Buffers from externals are the same
|
||||
@@ -62,9 +62,9 @@ assert.equal(c_ucs.toString('latin1'), ucs2_control);
|
||||
|
||||
|
||||
// now let's test BASE64 and HEX ecoding/decoding
|
||||
var RADIOS = 2;
|
||||
var PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS;
|
||||
var PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
|
||||
const RADIOS = 2;
|
||||
const PRE_HALF_APEX = Math.ceil(EXTERN_APEX / 2) - RADIOS;
|
||||
const PRE_3OF4_APEX = Math.ceil((EXTERN_APEX / 4) * 3) - RADIOS;
|
||||
|
||||
{
|
||||
for (let j = 0; j < RADIOS * 2; j += 1) {
|
||||
|
||||
Reference in new issue
Block a user