( path: typeof windows | typeof posix, testCases: Array<[string, string, string?]>, )
| 90 | ]; |
| 91 | |
| 92 | function checkParseFormat( |
| 93 | path: typeof windows | typeof posix, |
| 94 | testCases: Array<[string, string, string?]>, |
| 95 | ) { |
| 96 | testCases.forEach(([element, root, formatted]) => { |
| 97 | const output = path.parse(element); |
| 98 | assertEquals(typeof output.root, "string"); |
| 99 | assertEquals(typeof output.dir, "string"); |
| 100 | assertEquals(typeof output.base, "string"); |
| 101 | assertEquals(typeof output.ext, "string"); |
| 102 | assertEquals(typeof output.name, "string"); |
| 103 | assertEquals(output.root, root); |
| 104 | assertEquals(output.dir, output.dir ? path.dirname(element) : ""); |
| 105 | assertEquals(output.base, path.basename(element)); |
| 106 | assertEquals(output.ext, path.extname(element)); |
| 107 | // We normalize incorrect paths during parsing, so some "incorrect" |
| 108 | // input cannot be asserted for equality onto itself. |
| 109 | if (formatted) { |
| 110 | assertEquals(path.format(output), formatted); |
| 111 | } else { |
| 112 | assertEquals(path.format(output), element); |
| 113 | } |
| 114 | }); |
| 115 | } |
| 116 | |
| 117 | function checkSpecialCaseParseFormat( |
| 118 | path: typeof windows | typeof posix, |
no test coverage detected