GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: change forEach to for...of in path extname · nodejs/node@bb7d764

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-path-extname.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-path-extname.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-path-extname.js
+15-14Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const path = require('path');
66
const failures = [];
77
const slashRE = /\//g;
88

9-
[
9+
const testPaths = [
1010
[__filename, '.js'],
1111
['', ''],
1212
['/path/to/file', ''],
@@ -50,10 +50,13 @@ const slashRE = /\//g;
5050
['file//', ''],
5151
['file./', '.'],
5252
['file.//', '.'],
53-
].forEach((test) => {
54-
const expected = test[1];
55-
[path.posix.extname, path.win32.extname].forEach((extname) => {
56-
let input = test[0];
53+
];
54+
55+
for (const testPath of testPaths) {
56+
const expected = testPath[1];
57+
const extNames = [path.posix.extname, path.win32.extname];
58+
for (const extname of extNames) {
59+
let input = testPath[0];
5760
let os;
5861
if (extname === path.win32.extname) {
5962
input = input.replace(slashRE, '\\');
@@ -66,16 +69,14 @@ const slashRE = /\//g;
6669
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
6770
if (actual !== expected)
6871
failures.push(`\n${message}`);
69-
});
70-
{
71-
const input = `C:${test[0].replace(slashRE, '\\')}`;
72-
const actual = path.win32.extname(input);
73-
const message = `path.win32.extname(${JSON.stringify(input)})\n expect=${
74-
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
75-
if (actual !== expected)
76-
failures.push(`\n${message}`);
7772
}
78-
});
73+
const input = `C:${testPath[0].replace(slashRE, '\\')}`;
74+
const actual = path.win32.extname(input);
75+
const message = `path.win32.extname(${JSON.stringify(input)})\n expect=${
76+
JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
77+
if (actual !== expected)
78+
failures.push(`\n${message}`);
79+
}
7980
assert.strictEqual(failures.length, 0, failures.join(''));
8081

8182
// On Windows, backslash is a path separator.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.