Skip to content

Commit

Permalink
test: fix assertions in test-snapshot-dns-lookup*
Browse files Browse the repository at this point in the history
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: #44633
PR-URL: #46618
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Filip Skokan <[email protected]>
Reviewed-By: Harshitha K P <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
tniessen authored and MylesBorins committed Feb 20, 2023
1 parent 6a8b04d commit 2239e24
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions test/internet/test-snapshot-dns-lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const env = {

tmpdir.refresh();
function checkOutput(stderr, stdout) {
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
assert(stdout.match(stdout, /family: 4/));
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
assert.match(stdout, /family: 4/);
assert.strictEqual(stdout.trim().split('\n').length, 2);
}
{
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-snapshot-dns-lookup-localhost-promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
// We allow failures as it's not always possible to resolve localhost.
// Functional tests are done in test/internet instead.
if (!stderr.startsWith('error:')) {
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
assert(stdout.match(stdout, /family: 4/));
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
assert.match(stdout, /family: 4/);
assert.strictEqual(stdout.trim().split('\n').length, 2);
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-snapshot-dns-lookup-localhost.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function checkOutput(stderr, stdout) {
// We allow failures as it's not always possible to resolve localhost.
// Functional tests are done in test/internet instead.
if (!stderr.startsWith('error:')) {
assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/));
assert(stdout.match(stdout, /family: 4/));
assert.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/);
assert.match(stdout, /family: 4/);
assert.strictEqual(stdout.trim().split('\n').length, 2);
}
}
Expand Down

0 comments on commit 2239e24

Please sign in to comment.