Skip to content

Commit

Permalink
test: use for-of instead of forEach
Browse files Browse the repository at this point in the history
PR-URL: #49790
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruy Adorno <ruy@vlt.sh>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
gibbyfree committed May 12, 2024
1 parent 2b57e47 commit 33370ee
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/parallel/test-path-parse-format.js
Expand Up @@ -148,13 +148,11 @@ const trailingTests = [
],
];
const failures = [];
trailingTests.forEach((test) => {
const parse = test[0];
for (const [parse, testList] of trailingTests) {
const os = parse === path.win32.parse ? 'win32' : 'posix';
test[1].forEach((test) => {
const actual = parse(test[0]);
const expected = test[1];
const message = `path.${os}.parse(${JSON.stringify(test[0])})\n expect=${
for (const [input, expected] of testList) {
const actual = parse(input);
const message = `path.${os}.parse(${JSON.stringify(input)})\n expect=${
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
const actualKeys = Object.keys(actual);
const expectedKeys = Object.keys(expected);
Expand All @@ -170,8 +168,8 @@ trailingTests.forEach((test) => {
}
if (failed)
failures.push(`\n${message}`);
});
});
}
}
assert.strictEqual(failures.length, 0, failures.join(''));

function checkErrors(path) {
Expand Down

0 comments on commit 33370ee

Please sign in to comment.