diff options
author | Roman Reiss <me@silverwind.io> | 2015-09-22 18:31:01 +0200 |
---|---|---|
committer | Roman Reiss <me@silverwind.io> | 2015-10-06 18:10:49 +0200 |
commit | 81e98e9363c918899f964a6e054a41a82c04dc1b (patch) | |
tree | e30db1ac6b0a3025bcef3deb7ccea0cbe03a23bd /test/parallel/test-process-chdir.js | |
parent | 070aac4a87a04380463da4f3730568c3bf5bf729 (diff) | |
download | android-node-v8-81e98e9363c918899f964a6e054a41a82c04dc1b.tar.gz android-node-v8-81e98e9363c918899f964a6e054a41a82c04dc1b.tar.bz2 android-node-v8-81e98e9363c918899f964a6e054a41a82c04dc1b.zip |
test: use normalize() for unicode paths
OS X 10.11 changed the unicode normalization form of certain code points
returned by system calls like getcwd() from NFC to NFD which made
results in this test failing.
The consensus of https://github.com/nodejs/node/issues/2165 is to delegate
the task of unicode normalization to the user, and work will continue to
document how to handle unicode in a form-sensitive file system.
PR-URL: https://github.com/nodejs/node/pull/3007
Fixes: https://github.com/nodejs/node/issues/2165
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/parallel/test-process-chdir.js')
-rw-r--r-- | test/parallel/test-process-chdir.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/test/parallel/test-process-chdir.js b/test/parallel/test-process-chdir.js index ed8bf83af4..abf06b3c52 100644 --- a/test/parallel/test-process-chdir.js +++ b/test/parallel/test-process-chdir.js @@ -9,18 +9,26 @@ assert.notStrictEqual(process.cwd(), __dirname); process.chdir(__dirname); assert.strictEqual(process.cwd(), __dirname); -const dir = path.resolve(common.tmpDir, - 'weird \uc3a4\uc3ab\uc3af characters \u00e1\u00e2\u00e3'); +let dirName; +if (process.versions.icu) { + // ICU is available, use characters that could possibly be decomposed + dirName = 'weird \uc3a4\uc3ab\uc3af characters \u00e1\u00e2\u00e3'; +} else { + // ICU is unavailable, use characters that can't be decomposed + dirName = 'weird \ud83d\udc04 characters \ud83d\udc05'; +} +const dir = path.resolve(common.tmpDir, dirName); // Make sure that the tmp directory is clean common.refreshTmpDir(); fs.mkdirSync(dir); process.chdir(dir); -assert.strictEqual(process.cwd(), dir); +assert.strictEqual(process.cwd().normalize(), dir.normalize()); process.chdir('..'); -assert.strictEqual(process.cwd(), path.resolve(common.tmpDir)); +assert.strictEqual(process.cwd().normalize(), + path.resolve(common.tmpDir).normalize()); assert.throws(function() { process.chdir({}); }, TypeError, 'Bad argument.'); assert.throws(function() { process.chdir(); }, TypeError, 'Bad argument.'); |