Skip to content

Commit

Permalink
test: replaced foreach with for
Browse files Browse the repository at this point in the history
  • Loading branch information
bluescreen committed Nov 7, 2023
1 parent 5e3217c commit 56800c3
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions test/parallel/test-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ const typeErrorTests = [true, false, 7, null, {}, undefined, [], NaN];
function fail(fn) {
const args = Array.from(arguments).slice(1);

assert.throws(() => {
fn.apply(null, args);
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
assert.throws(
() => {
fn.apply(null, args);
},
{ code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' }
);
}

typeErrorTests.forEach((test) => {
[path.posix, path.win32].forEach((namespace) => {
for (const test of typeErrorTests) {
for (const namespace of [path.posix, path.win32]) {
fail(namespace.join, test);
fail(namespace.resolve, test);
fail(namespace.normalize, test);
Expand All @@ -52,8 +55,8 @@ typeErrorTests.forEach((test) => {
if (test !== undefined) {
fail(namespace.basename, 'foo', test);
}
});
});
}
}

// path.sep tests
// windows
Expand All @@ -67,7 +70,5 @@ assert.strictEqual(path.win32.delimiter, ';');
// posix
assert.strictEqual(path.posix.delimiter, ':');

if (common.isWindows)
assert.strictEqual(path, path.win32);
else
assert.strictEqual(path, path.posix);
if (common.isWindows) assert.strictEqual(path, path.win32);
else assert.strictEqual(path, path.posix);

0 comments on commit 56800c3

Please sign in to comment.