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 <[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 marco-ippolito committed Jun 17, 2024
1 parent 0fb7c18 commit 0513e07
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 0513e07

Please sign in to comment.