mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: use for-of instead of forEach
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
@@ -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);
|
||||
@@ -170,8 +168,8 @@ trailingTests.forEach((test) => {
|
||||
}
|
||||
if (failed)
|
||||
failures.push(`\n${message}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
assert.strictEqual(failures.length, 0, failures.join(''));
|
||||
|
||||
function checkErrors(path) {
|
||||
|
||||
Reference in New Issue
Block a user