Skip to content

Commit

Permalink
benchmark,lib,test: adjust for linting
Browse files Browse the repository at this point in the history
Formatting changes for upcoming linter update.

PR-URL: #10561
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Mar 9, 2017
1 parent c8d2ca7 commit b4cf8c4
Show file tree
Hide file tree
Showing 42 changed files with 454 additions and 429 deletions.
10 changes: 6 additions & 4 deletions lib/internal/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ function stripBOM(content) {
return content;
}

exports.builtinLibs = ['assert', 'buffer', 'child_process', 'cluster',
'crypto', 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net',
'os', 'path', 'punycode', 'querystring', 'readline', 'repl', 'stream',
'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'];
exports.builtinLibs = [
'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns',
'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode',
'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'tls', 'tty',
'url', 'util', 'v8', 'vm', 'zlib'
];

function addBuiltinLibsToObject(object) {
// Make built-in modules available directly (loaded lazily).
Expand Down
27 changes: 14 additions & 13 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const debug = util.debuglog('repl');
const parentModule = module;
const replMap = new WeakMap();

const GLOBAL_OBJECT_PROPERTIES = ['NaN', 'Infinity', 'undefined',
'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI',
'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
'Object', 'Function', 'Array', 'String', 'Boolean', 'Number',
'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
'Math', 'JSON'];
const GLOBAL_OBJECT_PROPERTIES = [
'NaN', 'Infinity', 'undefined', 'eval', 'parseInt', 'parseFloat', 'isNaN',
'isFinite', 'decodeURI', 'decodeURIComponent', 'encodeURI',
'encodeURIComponent', 'Object', 'Function', 'Array', 'String', 'Boolean',
'Number', 'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'Math', 'JSON'
];
const GLOBAL_OBJECT_PROPERTY_MAP = {};
GLOBAL_OBJECT_PROPERTIES.forEach((p) => GLOBAL_OBJECT_PROPERTY_MAP[p] = p);

Expand Down Expand Up @@ -1215,12 +1215,13 @@ function addStandardGlobals(completionGroups, filter) {
// Common keywords. Exclude for completion on the empty string, b/c
// they just get in the way.
if (filter) {
completionGroups.push(['break', 'case', 'catch', 'const',
'continue', 'debugger', 'default', 'delete', 'do', 'else',
'export', 'false', 'finally', 'for', 'function', 'if',
'import', 'in', 'instanceof', 'let', 'new', 'null', 'return',
'switch', 'this', 'throw', 'true', 'try', 'typeof', 'undefined',
'var', 'void', 'while', 'with', 'yield']);
completionGroups.push([
'break', 'case', 'catch', 'const', 'continue', 'debugger', 'default',
'delete', 'do', 'else', 'export', 'false', 'finally', 'for', 'function',
'if', 'import', 'in', 'instanceof', 'let', 'new', 'null', 'return',
'switch', 'this', 'throw', 'true', 'try', 'typeof', 'undefined', 'var',
'void', 'while', 'with', 'yield'
]);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function formatValue(ctx, value, recurseTimes) {
if (keys.length === 0) {
if (typeof value === 'function') {
return ctx.stylize(`[Function${value.name ? `: ${value.name}` : ''}]`,
'special');
'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
Expand Down Expand Up @@ -659,7 +659,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
for (var i = 0; i < maxLength; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
String(i), true));
} else {
output.push('');
}
Expand All @@ -670,7 +670,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
keys.forEach(function(key) {
if (typeof key === 'symbol' || !key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
key, true));
}
});
return output;
Expand Down
8 changes: 4 additions & 4 deletions test/inspector/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ function testSetBreakpointAndResume(session) {
const commands = [
{ 'method': 'Debugger.setBreakpointByUrl',
'params': { 'lineNumber': 5,
'url': session.mainScriptPath,
'columnNumber': 0,
'condition': ''
}
'url': session.mainScriptPath,
'columnNumber': 0,
'condition': ''
}
},
{ 'method': 'Debugger.resume'},
[ { 'method': 'Debugger.getScriptSource',
Expand Down
92 changes: 47 additions & 45 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,61 +36,61 @@ function checkWrap(req) {

TEST(function test_resolve4(done) {
const req = dns.resolve4('www.google.com',
common.mustCall((err, ips) => {
assert.ifError(err);
common.mustCall((err, ips) => {
assert.ifError(err);

assert.ok(ips.length > 0);
assert.ok(ips.length > 0);

for (let i = 0; i < ips.length; i++) {
assert.ok(isIPv4(ips[i]));
}
for (let i = 0; i < ips.length; i++) {
assert.ok(isIPv4(ips[i]));
}

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_reverse_ipv4(done) {
const req = dns.reverse('8.8.8.8',
common.mustCall((err, domains) => {
assert.ifError(err);
common.mustCall((err, domains) => {
assert.ifError(err);

assert.ok(domains.length > 0);
assert.ok(domains.length > 0);

for (let i = 0; i < domains.length; i++) {
assert.ok(domains[i]);
assert.ok(typeof domains[i] === 'string');
}
for (let i = 0; i < domains.length; i++) {
assert.ok(domains[i]);
assert.ok(typeof domains[i] === 'string');
}

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_ipv4_explicit(done) {
const req = dns.lookup('www.google.com', 4,
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_ipv4_implicit(done) {
const req = dns.lookup('www.google.com',
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});
Expand Down Expand Up @@ -125,26 +125,26 @@ TEST(function test_lookup_ipv4_hint_addrconfig(done) {

TEST(function test_lookup_ip_ipv4(done) {
const req = dns.lookup('127.0.0.1',
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_localhost_ipv4(done) {
const req = dns.lookup('localhost', 4,
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});
Expand All @@ -164,21 +164,23 @@ TEST(function test_lookup_all_ipv4(done) {
});

done();
}
));
})
);

checkWrap(req);
});

TEST(function test_lookupservice_ip_ipv4(done) {
const req = dns.lookupService('127.0.0.1', 80,
const req = dns.lookupService(
'127.0.0.1', 80,
common.mustCall((err, host, service) => {
assert.ifError(err);
assert.strictEqual(typeof host, 'string');
assert(host);
assert(['http', 'www', '80'].includes(service));
done();
}));
})
);

checkWrap(req);
});
62 changes: 32 additions & 30 deletions test/internet/test-dns-ipv6.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,45 +41,45 @@ function checkWrap(req) {

TEST(function test_resolve6(done) {
const req = dns.resolve6('ipv6.google.com',
common.mustCall((err, ips) => {
assert.ifError(err);
common.mustCall((err, ips) => {
assert.ifError(err);

assert.ok(ips.length > 0);
assert.ok(ips.length > 0);

for (let i = 0; i < ips.length; i++)
assert.ok(isIPv6(ips[i]));
for (let i = 0; i < ips.length; i++)
assert.ok(isIPv6(ips[i]));

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_reverse_ipv6(done) {
const req = dns.reverse('2001:4860:4860::8888',
common.mustCall((err, domains) => {
assert.ifError(err);
common.mustCall((err, domains) => {
assert.ifError(err);

assert.ok(domains.length > 0);
assert.ok(domains.length > 0);

for (let i = 0; i < domains.length; i++)
assert.ok(typeof domains[i] === 'string');
for (let i = 0; i < domains.length; i++)
assert.ok(typeof domains[i] === 'string');

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_ipv6_explicit(done) {
const req = dns.lookup('ipv6.google.com', 6,
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(isIPv6(ip));
assert.strictEqual(family, 6);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(isIPv6(ip));
assert.strictEqual(family, 6);

done();
}));
done();
}));

checkWrap(req);
});
Expand Down Expand Up @@ -142,13 +142,13 @@ TEST(function test_lookup_ipv6_hint(done) {

TEST(function test_lookup_ip_ipv6(done) {
const req = dns.lookup('::1',
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(isIPv6(ip));
assert.strictEqual(family, 6);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(isIPv6(ip));
assert.strictEqual(family, 6);

done();
}));
done();
}));

checkWrap(req);
});
Expand All @@ -169,14 +169,15 @@ TEST(function test_lookup_all_ipv6(done) {
});

done();
}
));
})
);

checkWrap(req);
});

TEST(function test_lookupservice_ip_ipv6(done) {
const req = dns.lookupService('::1', 80,
const req = dns.lookupService(
'::1', 80,
common.mustCall((err, host, service) => {
if (err) {
// Not skipping the test, rather checking an alternative result,
Expand All @@ -188,7 +189,8 @@ TEST(function test_lookupservice_ip_ipv6(done) {
assert(host);
assert(['http', 'www', '80'].includes(service));
done();
}));
})
);

checkWrap(req);
});
Expand Down
Loading

0 comments on commit b4cf8c4

Please sign in to comment.