Skip to content

Commit 8a7e68f

Browse files
bnoordhuisevanlucas
authored andcommitted
test: check that 2nd handle.close() call is a nop
Verify that a second call to handle.close() is a no-op. PR-URL: #6395 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent bbf3b3e commit 8a7e68f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

test/parallel/test-handle-wrap-isrefed-tty.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if (process.argv[2] === 'child') {
2020
tty.unref();
2121
assert(tty._handle.unrefed(), true);
2222
tty._handle.close(common.mustCall(() => assert(tty._handle.unrefed(), true)));
23+
tty._handle.close(common.fail);
2324
assert(tty._handle.unrefed(), true);
2425
return;
2526
}

test/parallel/test-handle-wrap-isrefed.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function makeAssert(message) {
2323
cp.ref();
2424
assert(cp._handle.unrefed(), false);
2525
cp._handle.close(common.mustCall(() => assert(cp._handle.unrefed(), true)));
26+
cp._handle.close(common.fail);
2627
assert(cp._handle.unrefed(), false);
2728
}
2829

@@ -41,6 +42,7 @@ function makeAssert(message) {
4142
assert(sock4._handle.unrefed(), false);
4243
sock4._handle.close(
4344
common.mustCall(() => assert(sock4._handle.unrefed(), true)));
45+
sock4._handle.close(common.fail);
4446
assert(sock4._handle.unrefed(), false);
4547

4648
const sock6 = dgram.createSocket('udp6');
@@ -52,6 +54,7 @@ function makeAssert(message) {
5254
assert(sock6._handle.unrefed(), false);
5355
sock6._handle.close(
5456
common.mustCall(() => assert(sock6._handle.unrefed(), true)));
57+
sock6._handle.close(common.fail);
5558
assert(sock6._handle.unrefed(), false);
5659
}
5760

@@ -68,6 +71,7 @@ function makeAssert(message) {
6871
handle.ref();
6972
assert(handle.unrefed(), false);
7073
handle.close(common.mustCall(() => assert(handle.unrefed(), true)));
74+
handle.close(common.fail);
7175
assert(handle.unrefed(), false);
7276
}
7377

@@ -88,6 +92,7 @@ function makeAssert(message) {
8892
assert(server._unref, false);
8993
server._handle.close(
9094
common.mustCall(() => assert(server._handle.unrefed(), true)));
95+
server._handle.close(common.fail);
9196
assert(server._handle.unrefed(), false);
9297
}
9398

@@ -103,5 +108,6 @@ function makeAssert(message) {
103108
assert(timer._handle.unrefed(), false);
104109
timer._handle.close(
105110
common.mustCall(() => assert(timer._handle.unrefed(), true)));
111+
timer._handle.close(common.fail);
106112
assert(timer._handle.unrefed(), false);
107113
}

0 commit comments

Comments
 (0)