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: nodejs#49790
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruy Adorno <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
gibbyfree authored and bmeck committed Jun 22, 2024
1 parent 4680d5e commit 934ca8b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions test/parallel/test-path-parse-format.js
Original file line number Diff line number Diff line change
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 934ca8b

Please sign in to comment.