From 2239e243067af91022513efab557198505e300ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sat, 18 Feb 2023 02:58:50 +0100 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/44633 PR-URL: https://github.com/nodejs/node/pull/46618 Reviewed-By: Colin Ihrig Reviewed-By: Antoine du Hamel Reviewed-By: Joyee Cheung Reviewed-By: Filip Skokan Reviewed-By: Harshitha K P Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- test/internet/test-snapshot-dns-lookup.js | 4 ++-- test/parallel/test-snapshot-dns-lookup-localhost-promise.js | 4 ++-- test/parallel/test-snapshot-dns-lookup-localhost.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/internet/test-snapshot-dns-lookup.js b/test/internet/test-snapshot-dns-lookup.js index 842e73e0568839..e0725b91ea9aae 100644 --- a/test/internet/test-snapshot-dns-lookup.js +++ b/test/internet/test-snapshot-dns-lookup.js @@ -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); } { diff --git a/test/parallel/test-snapshot-dns-lookup-localhost-promise.js b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js index d19488a716aa04..b614b62b725cc6 100644 --- a/test/parallel/test-snapshot-dns-lookup-localhost-promise.js +++ b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js @@ -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); } } diff --git a/test/parallel/test-snapshot-dns-lookup-localhost.js b/test/parallel/test-snapshot-dns-lookup-localhost.js index af00480bcca89b..28b9f0565b3b95 100644 --- a/test/parallel/test-snapshot-dns-lookup-localhost.js +++ b/test/parallel/test-snapshot-dns-lookup-localhost.js @@ -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); } }