Skip to content

Commit 3a77d1e

Browse files
TrottBethGriggs
authored andcommitted
test: adjust comments for upcoming lint rule
Enforce `//` for multiline comments. Some tests mixed and matched, and at least one did so in a (to me) surprising way. PR-URL: #35485 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8cdc59b commit 3a77d1e

File tree

58 files changed

+566
-674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+566
-674
lines changed

test/async-hooks/test-enable-disable.js

+80-81
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,84 @@
1-
/*
2-
* Test Steps Explained
3-
* ====================
4-
*
5-
* Initializing hooks:
6-
*
7-
* We initialize 3 hooks. For hook2 and hook3 we register a callback for the
8-
* "before" and in case of hook3 also for the "after" invocations.
9-
*
10-
* Enabling hooks initially:
11-
*
12-
* We only enable hook1 and hook3 initially.
13-
*
14-
* Enabling hook2:
15-
*
16-
* When hook3's "before" invocation occurs we enable hook2. Since this
17-
* happens right before calling `onfirstImmediate` hook2 will miss all hook
18-
* invocations until then, including the "init" and "before" of the first
19-
* Immediate.
20-
* However afterwards it collects all invocations that follow on the first
21-
* Immediate as well as all invocations on the second Immediate.
22-
*
23-
* This shows that a hook can enable another hook inside a life time event
24-
* callback.
25-
*
26-
*
27-
* Disabling hook1
28-
*
29-
* Since we registered the "before" callback for hook2 it will execute it
30-
* right before `onsecondImmediate` is called.
31-
* At that point we disable hook1 which is why it will miss all invocations
32-
* afterwards and thus won't include the second "after" as well as the
33-
* "destroy" invocations
34-
*
35-
* This shows that a hook can disable another hook inside a life time event
36-
* callback.
37-
*
38-
* Disabling hook3
39-
*
40-
* When the second "after" invocation occurs (after onsecondImmediate), hook3
41-
* disables itself.
42-
* As a result it will not receive the "destroy" invocation.
43-
*
44-
* This shows that a hook can disable itself inside a life time event callback.
45-
*
46-
* Sample Test Log
47-
* ===============
48-
*
49-
* - setting up first Immediate
50-
* hook1.init.uid-5
51-
* hook3.init.uid-5
52-
* - finished setting first Immediate
53-
54-
* hook1.before.uid-5
55-
* hook3.before.uid-5
56-
* - enabled hook2
57-
* - entering onfirstImmediate
58-
59-
* - setting up second Immediate
60-
* hook1.init.uid-6
61-
* hook3.init.uid-6
62-
* hook2.init.uid-6
63-
* - finished setting second Immediate
1+
// Test Steps Explained
2+
// ====================
3+
//
4+
// Initializing hooks:
5+
//
6+
// We initialize 3 hooks. For hook2 and hook3 we register a callback for the
7+
// "before" and in case of hook3 also for the "after" invocations.
8+
//
9+
// Enabling hooks initially:
10+
//
11+
// We only enable hook1 and hook3 initially.
12+
//
13+
// Enabling hook2:
14+
//
15+
// When hook3's "before" invocation occurs we enable hook2. Since this
16+
// happens right before calling `onfirstImmediate` hook2 will miss all hook
17+
// invocations until then, including the "init" and "before" of the first
18+
// Immediate.
19+
// However afterwards it collects all invocations that follow on the first
20+
// Immediate as well as all invocations on the second Immediate.
21+
//
22+
// This shows that a hook can enable another hook inside a life time event
23+
// callback.
24+
//
25+
//
26+
// Disabling hook1
27+
//
28+
// Since we registered the "before" callback for hook2 it will execute it
29+
// right before `onsecondImmediate` is called.
30+
// At that point we disable hook1 which is why it will miss all invocations
31+
// afterwards and thus won't include the second "after" as well as the
32+
// "destroy" invocations
33+
//
34+
// This shows that a hook can disable another hook inside a life time event
35+
// callback.
36+
//
37+
// Disabling hook3
38+
//
39+
// When the second "after" invocation occurs (after onsecondImmediate), hook3
40+
// disables itself.
41+
// As a result it will not receive the "destroy" invocation.
42+
//
43+
// This shows that a hook can disable itself inside a life time event callback.
44+
//
45+
// Sample Test Log
46+
// ===============
47+
//
48+
// - setting up first Immediate
49+
// hook1.init.uid-5
50+
// hook3.init.uid-5
51+
// - finished setting first Immediate
52+
//
53+
// hook1.before.uid-5
54+
// hook3.before.uid-5
55+
// - enabled hook2
56+
// - entering onfirstImmediate
57+
//
58+
// - setting up second Immediate
59+
// hook1.init.uid-6
60+
// hook3.init.uid-6
61+
// hook2.init.uid-6
62+
// - finished setting second Immediate
63+
//
64+
// - exiting onfirstImmediate
65+
// hook1.after.uid-5
66+
// hook3.after.uid-5
67+
// hook2.after.uid-5
68+
// hook1.destroy.uid-5
69+
// hook3.destroy.uid-5
70+
// hook2.destroy.uid-5
71+
// hook1.before.uid-6
72+
// hook3.before.uid-6
73+
// hook2.before.uid-6
74+
// - disabled hook1
75+
// - entering onsecondImmediate
76+
// - exiting onsecondImmediate
77+
// hook3.after.uid-6
78+
// - disabled hook3
79+
// hook2.after.uid-6
80+
// hook2.destroy.uid-6
6481

65-
* - exiting onfirstImmediate
66-
* hook1.after.uid-5
67-
* hook3.after.uid-5
68-
* hook2.after.uid-5
69-
* hook1.destroy.uid-5
70-
* hook3.destroy.uid-5
71-
* hook2.destroy.uid-5
72-
* hook1.before.uid-6
73-
* hook3.before.uid-6
74-
* hook2.before.uid-6
75-
* - disabled hook1
76-
* - entering onsecondImmediate
77-
* - exiting onsecondImmediate
78-
* hook3.after.uid-6
79-
* - disabled hook3
80-
* hook2.after.uid-6
81-
* hook2.destroy.uid-6
82-
*/
8382

8483
'use strict';
8584

test/common/index.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ const PIPE = (() => {
194194
return path.join(pipePrefix, pipeName);
195195
})();
196196

197-
/*
198-
* Check that when running a test with
199-
* `$node --abort-on-uncaught-exception $file child`
200-
* the process aborts.
201-
*/
197+
// Check that when running a test with
198+
// `$node --abort-on-uncaught-exception $file child`
199+
// the process aborts.
202200
function childShouldThrowAndAbort() {
203201
let testCmd = '';
204202
if (!isWindows) {

test/internet/test-dns-ipv6.js

+22-23
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,18 @@ TEST(async function test_lookup_ipv6_explicit(done) {
103103
checkWrap(req);
104104
});
105105

106-
/* This ends up just being too problematic to test
107-
TEST(function test_lookup_ipv6_implicit(done) {
108-
var req = dns.lookup(addresses.INET6_HOST, function(err, ip, family) {
109-
assert.ifError(err);
110-
assert.ok(net.isIPv6(ip));
111-
assert.strictEqual(family, 6);
106+
// This ends up just being too problematic to test
107+
// TEST(function test_lookup_ipv6_implicit(done) {
108+
// var req = dns.lookup(addresses.INET6_HOST, function(err, ip, family) {
109+
// assert.ifError(err);
110+
// assert.ok(net.isIPv6(ip));
111+
// assert.strictEqual(family, 6);
112112

113-
done();
114-
});
113+
// done();
114+
// });
115115

116-
checkWrap(req);
117-
});
118-
*/
116+
// checkWrap(req);
117+
// });
119118

120119
TEST(async function test_lookup_ipv6_explicit_object(done) {
121120
function validateResult(res) {
@@ -233,15 +232,15 @@ TEST(function test_lookupservice_ip_ipv6(done) {
233232
checkWrap(req);
234233
});
235234

236-
/* Disabled because it appears to be not working on linux. */
237-
/* TEST(function test_lookup_localhost_ipv6(done) {
238-
var req = dns.lookup('localhost', 6, function(err, ip, family) {
239-
assert.ifError(err);
240-
assert.ok(net.isIPv6(ip));
241-
assert.strictEqual(family, 6);
242-
243-
done();
244-
});
245-
246-
checkWrap(req);
247-
}); */
235+
// Disabled because it appears to be not working on Linux.
236+
// TEST(function test_lookup_localhost_ipv6(done) {
237+
// var req = dns.lookup('localhost', 6, function(err, ip, family) {
238+
// assert.ifError(err);
239+
// assert.ok(net.isIPv6(ip));
240+
// assert.strictEqual(family, 6);
241+
//
242+
// done();
243+
// });
244+
//
245+
// checkWrap(req);
246+
// });

test/internet/test-http-dns-fail.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
/*
24-
* Repeated requests for a domain that fails to resolve
25-
* should trigger the error event after each attempt.
26-
*/
23+
24+
// Repeated requests for a domain that fails to resolve
25+
// should trigger the error event after each attempt.
2726

2827
const common = require('../common');
2928
const assert = require('assert');

test/node-api/test_make_callback/test.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@ assert.strictEqual(makeCallback(this,
3131

3232
// TODO(node-api): napi_make_callback needs to support
3333
// strings passed for the func argument
34-
/*
35-
const recv = {
36-
one: common.mustCall(function() {
37-
assert.strictEqual(0, arguments.length);
38-
assert.strictEqual(this, recv);
39-
return 42;
40-
}),
41-
two: common.mustCall(function(x) {
42-
assert.strictEqual(1, arguments.length);
43-
assert.strictEqual(this, recv);
44-
assert.strictEqual(x, 1337);
45-
return 42;
46-
}),
47-
};
34+
//
35+
// const recv = {
36+
// one: common.mustCall(function() {
37+
// assert.strictEqual(0, arguments.length);
38+
// assert.strictEqual(this, recv);
39+
// return 42;
40+
// }),
41+
// two: common.mustCall(function(x) {
42+
// assert.strictEqual(1, arguments.length);
43+
// assert.strictEqual(this, recv);
44+
// assert.strictEqual(x, 1337);
45+
// return 42;
46+
// }),
47+
// };
48+
//
49+
// assert.strictEqual(makeCallback(recv, 'one'), 42);
50+
// assert.strictEqual(makeCallback(recv, 'two', 1337), 42);
51+
//
52+
// // Check that callbacks on a receiver from a different context works.
53+
// const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })');
54+
// assert.strictEqual(makeCallback(foreignObject, 'fortytwo'), 42);
4855

49-
assert.strictEqual(makeCallback(recv, 'one'), 42);
50-
assert.strictEqual(makeCallback(recv, 'two', 1337), 42);
51-
52-
// Check that callbacks on a receiver from a different context works.
53-
const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })');
54-
assert.strictEqual(makeCallback(foreignObject, 'fortytwo'), 42);
55-
*/
5656

5757
// Check that the callback is made in the context of the receiver.
5858
const target = vm.runInNewContext(`

test/parallel/test-buffer-parent-property.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
'use strict';
22

3-
/*
4-
* Fix for https://github.com/nodejs/node/issues/8266
5-
*
6-
* Zero length Buffer objects should expose the `buffer` property of the
7-
* TypedArrays, via the `parent` property.
8-
*/
3+
// Fix for https://github.com/nodejs/node/issues/8266
4+
//
5+
// Zero length Buffer objects should expose the `buffer` property of the
6+
// TypedArrays, via the `parent` property.
97
require('../common');
108
const assert = require('assert');
119

test/parallel/test-buffer-writeuint.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
require('../common');
44
const assert = require('assert');
55

6-
/*
7-
* We need to check the following things:
8-
* - We are correctly resolving big endian (doesn't mean anything for 8 bit)
9-
* - Correctly resolving little endian (doesn't mean anything for 8 bit)
10-
* - Correctly using the offsets
11-
* - Correctly interpreting values that are beyond the signed range as unsigned
12-
*/
6+
// We need to check the following things:
7+
// - We are correctly resolving big endian (doesn't mean anything for 8 bit)
8+
// - Correctly resolving little endian (doesn't mean anything for 8 bit)
9+
// - Correctly using the offsets
10+
// - Correctly interpreting values that are beyond the signed range as unsigned
1311

1412
{ // OOB
1513
const data = Buffer.alloc(8);

test/parallel/test-child-process-cwd.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ tmpdir.refresh();
2727
const assert = require('assert');
2828
const { spawn } = require('child_process');
2929

30-
/*
31-
Spawns 'pwd' with given options, then test
32-
- whether the exit code equals expectCode,
33-
- optionally whether the trimmed stdout result matches expectData
34-
*/
30+
// Spawns 'pwd' with given options, then test
31+
// - whether the exit code equals expectCode,
32+
// - optionally whether the trimmed stdout result matches expectData
3533
function testCwd(options, expectCode = 0, expectData) {
3634
const child = spawn(...common.pwdCommand, options);
3735

test/parallel/test-child-process-double-pipe.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ if (isWindows) {
4747
echo = spawn('echo', ['hello\nnode\nand\nworld\n']);
4848
}
4949

50-
/*
51-
* grep and sed hang if the spawn function leaks file descriptors to child
52-
* processes.
53-
* This happens when calling pipe(2) and then forgetting to set the
54-
* FD_CLOEXEC flag on the resulting file descriptors.
55-
*
56-
* This test checks child processes exit, meaning they don't hang like
57-
* explained above.
58-
*/
50+
// If the spawn function leaks file descriptors to subprocesses, grep and sed
51+
// hang.
52+
// This happens when calling pipe(2) and then forgetting to set the
53+
// FD_CLOEXEC flag on the resulting file descriptors.
54+
//
55+
// This test checks child processes exit, meaning they don't hang like
56+
// explained above.
5957

6058

6159
// pipe echo | grep

0 commit comments

Comments
 (0)