Skip to content

Commit 765de7e

Browse files
committed
test: fix assertions in test-snapshot-dns-lookup*
Due to the unfortunate nature of JavaScript, the extraneous arguments are silently ignored. In this case, the assertion trivially passes regardless of the given regular expressions. Refs: nodejs#44633
1 parent a37c083 commit 765de7e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

test/internet/test-snapshot-dns-lookup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const env = {
1919

2020
tmpdir.refresh();
2121
function checkOutput(stderr, stdout) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
{

test/parallel/test-snapshot-dns-lookup-localhost-promise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
1919
// We allow failures as it's not always possible to resolve localhost.
2020
// Functional tests are done in test/internet instead.
2121
if (!stderr.startsWith('error:')) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
}

test/parallel/test-snapshot-dns-lookup-localhost.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
1919
// We allow failures as it's not always possible to resolve localhost.
2020
// Functional tests are done in test/internet instead.
2121
if (!stderr.startsWith('error:')) {
22-
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
23-
assert(stdout.match(stdout, /family: 4/));
22+
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
23+
assert.match(stdout, /family: 4/);
2424
assert.strictEqual(stdout.trim().split('\n').length, 2);
2525
}
2626
}

0 commit comments

Comments
 (0)