| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3c79bbd commit 4717ea9
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1007,8 +1007,8 @@ const win32 = { | |||
| 1007 | 1007 | isAbsolute = true; | |
| 1008 | 1008 | ||
| 1009 | 1009 | code = path.charCodeAt(1); | |
| 1010 | + rootEnd = 1; | ||
| 1010 | 1011 | if (code === 47/*/*/ || code === 92/*\*/) { | |
| 1011 | - rootEnd = 1; | ||
| 1012 | 1012 | // Matched double path separator at beginning | |
| 1013 | 1013 | var j = 2; | |
| 1014 | 1014 | var last = j; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,10 @@ const winPaths = [ | |||
| 20 | 20 | '\\\\?\\UNC\\server\\share' | |
| 21 | 21 | ]; | |
| 22 | 22 | ||
| 23 | + const winSpecialCaseParseTests = [ | ||
| 24 | + ['/foo/bar', {root: '/'}] | ||
| 25 | + ]; | ||
| 26 | + | ||
| 23 | 27 | const winSpecialCaseFormatTests = [ | |
| 24 | 28 | [{dir: 'some\\dir'}, 'some\\dir\\'], | |
| 25 | 29 | [{base: 'index.html'}, 'index.html'], | |
@@ -86,6 +90,7 @@ const errors = [ | |||
| 86 | 90 | ||
| 87 | 91 | checkParseFormat(path.win32, winPaths); | |
| 88 | 92 | checkParseFormat(path.posix, unixPaths); | |
| 93 | + checkSpecialCaseParseFormat(path.win32, winSpecialCaseParseTests); | ||
| 89 | 94 | checkErrors(path.win32); | |
| 90 | 95 | checkErrors(path.posix); | |
| 91 | 96 | checkFormat(path.win32, winSpecialCaseFormatTests); | |
@@ -184,6 +189,17 @@ function checkParseFormat(path, paths) { | |||
| 184 | 189 | }); | |
| 185 | 190 | } | |
| 186 | 191 | ||
| 192 | + function checkSpecialCaseParseFormat(path, testCases) { | ||
| 193 | + testCases.forEach(function(testCase) { | ||
| 194 | + const element = testCase[0]; | ||
| 195 | + const expect = testCase[1]; | ||
| 196 | + const output = path.parse(element); | ||
| 197 | + Object.keys(expect).forEach(function(key) { | ||
| 198 | + assert.strictEqual(output[key], expect[key]); | ||
| 199 | + }); | ||
| 200 | + }); | ||
| 201 | + } | ||
| 202 | + | ||
| 187 | 203 | function checkFormat(path, testCases) { | |
| 188 | 204 | testCases.forEach(function(testCase) { | |
| 189 | 205 | assert.strictEqual(path.format(testCase[0]), testCase[1]); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments