summaryrefslogtreecommitdiff
path: root/test/parallel/test-path.js
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-04-28 04:06:42 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-05-05 17:39:05 +0300
commit8b76c3e60c7b5c274c757257580a2c0faae69097 (patch)
treea9f686995887dbeb0b5c5b23c5f3188987c99b2e /test/parallel/test-path.js
parent6bcf65d4a788a73b3c3f27d75796609f948f7885 (diff)
downloadandroid-node-v8-8b76c3e60c7b5c274c757257580a2c0faae69097.tar.gz
android-node-v8-8b76c3e60c7b5c274c757257580a2c0faae69097.tar.bz2
android-node-v8-8b76c3e60c7b5c274c757257580a2c0faae69097.zip
test: reduce string concatenations
PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'test/parallel/test-path.js')
-rw-r--r--test/parallel/test-path.js33
1 files changed, 13 insertions, 20 deletions
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js
index 4aa0e8d5e6..cdf5c4d9f5 100644
--- a/test/parallel/test-path.js
+++ b/test/parallel/test-path.js
@@ -195,12 +195,10 @@ assert.strictEqual(path.win32.dirname('foo'), '.');
}
const actual = extname(input);
const expected = test[1];
- const fn = `path.${os}.extname(`;
- const message = fn + JSON.stringify(input) + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.extname(${JSON.stringify(input)})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -352,10 +350,9 @@ joinTests.forEach((test) => {
} 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);
+ const message =
+ `path.${os}.join(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
failures.push(`\n${message}`);
});
@@ -459,12 +456,11 @@ resolveTests.forEach((test) => {
actualAlt = actual.replace(/\//g, '\\');
const expected = test[1];
- const fn = `path.${os}.resolve(`;
- const message = fn + test[0].map(JSON.stringify).join(',') + ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message =
+ `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected && actualAlt !== expected)
- failures.push('\n' + message);
+ failures.push(`\n${message}`);
});
});
assert.strictEqual(failures.length, 0, failures.join(''));
@@ -560,12 +556,9 @@ relativeTests.forEach((test) => {
const actual = relative(test[0], test[1]);
const expected = test[2];
const os = relative === path.win32.relative ? 'win32' : 'posix';
- const fn = `path.${os}.relative(`;
- const message = fn +
- test.slice(0, 2).map(JSON.stringify).join(',') +
- ')' +
- '\n expect=' + JSON.stringify(expected) +
- '\n actual=' + JSON.stringify(actual);
+ const message = `path.${os}.relative(${
+ test.slice(0, 2).map(JSON.stringify).join(',')})\n expect=${
+ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`;
if (actual !== expected)
failures.push(`\n${message}`);
});