diff options
author | Rich Trott <rtrott@gmail.com> | 2016-04-15 21:21:12 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-04-18 17:19:11 -0700 |
commit | 31600735f40e02935b936802ff42d66d49e9769b (patch) | |
tree | 29093a1796aad2d127cf514dbe3202423c82ac43 /test/parallel/test-path.js | |
parent | c1d82ac2ff15594840e2a1b9531b506ae067ed27 (diff) | |
download | android-node-v8-31600735f40e02935b936802ff42d66d49e9769b.tar.gz android-node-v8-31600735f40e02935b936802ff42d66d49e9769b.tar.bz2 android-node-v8-31600735f40e02935b936802ff42d66d49e9769b.zip |
lib,test,tools: alignment on variable assignments
Correct alignment on variable assignments that span multiple lines in
preparation for lint rule to enforce such alignment.
PR-URL: https://github.com/nodejs/node/pull/6242
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-path.js')
-rw-r--r-- | test/parallel/test-path.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index b6859f79bc..e2cfdf5cab 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -155,13 +155,16 @@ assert.throws(path.win32.dirname.bind(null, {}), TypeError); ].forEach(function(test) { [path.posix.extname, path.win32.extname].forEach(function(extname) { let input = test[0]; - if (extname === path.win32.extname) + let os; + if (extname === path.win32.extname) { input = input.replace(/\//g, '\\'); + os = 'win32'; + } else { + os = 'posix'; + } const actual = extname(input); const expected = test[1]; - const fn = 'path.' + - (extname === path.win32.extname ? 'win32' : 'posix') + - '.extname('; + const fn = `path.${os}.extname(`; const message = fn + JSON.stringify(input) + ')' + '\n expect=' + JSON.stringify(expected) + '\n actual=' + JSON.stringify(actual); @@ -319,11 +322,15 @@ joinTests.forEach(function(test) { // For non-Windows specific tests with the Windows join(), we need to try // replacing the slashes since the non-Windows specific tests' `expected` // use forward slashes - const actualAlt = (join === path.win32.join) ? - actual.replace(/\\/g, '/') : undefined; - const fn = 'path.' + - (join === path.win32.join ? 'win32' : 'posix') + - '.join('; + let actualAlt; + let os; + if (join === path.win32.join) { + actualAlt = actual.replace(/\\/g, '/'); + os = 'win32'; + } else { + os = 'posix'; + } + const fn = `path.${os}.join(`; const message = fn + test[0].map(JSON.stringify).join(',') + ')' + '\n expect=' + JSON.stringify(expected) + '\n actual=' + JSON.stringify(actual); @@ -423,14 +430,14 @@ resolveTests.forEach(function(test) { test[1].forEach(function(test) { const actual = resolve.apply(null, test[0]); let actualAlt; + const os = resolve === path.win32.resolve ? 'win32' : 'posix'; if (resolve === path.win32.resolve && !common.isWindows) actualAlt = actual.replace(/\\/g, '/'); else if (resolve !== path.win32.resolve && common.isWindows) actualAlt = actual.replace(/\//g, '\\'); + const expected = test[1]; - const fn = 'path.' + - (resolve === path.win32.resolve ? 'win32' : 'posix') + - '.resolve('; + const fn = `path.${os}.resolve(`; const message = fn + test[0].map(JSON.stringify).join(',') + ')' + '\n expect=' + JSON.stringify(expected) + '\n actual=' + JSON.stringify(actual); @@ -517,9 +524,8 @@ relativeTests.forEach(function(test) { test[1].forEach(function(test) { const actual = relative(test[0], test[1]); const expected = test[2]; - const fn = 'path.' + - (relative === path.win32.relative ? 'win32' : 'posix') + - '.relative('; + const os = relative === path.win32.relative ? 'win32' : 'posix'; + const fn = `path.${os}.relative(`; const message = fn + test.slice(0, 2).map(JSON.stringify).join(',') + ')' + |