summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-06-21 14:24:48 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-06-21 14:24:48 +0000
commit17236ae1f194e1cbf12bfb6e3d7c43021380d1ca (patch)
tree21b2b12d8b45079fb494e08de1234e9e864e3457 /unittests
parentdb2950fa29d80a325e737bf8f65dbb23f1b571c6 (diff)
Switch to using an API that handles non-ASCII paths appropriately on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/Path.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp
index 74b74ac4195..1a6ffa50e98 100644
--- a/unittests/Support/Path.cpp
+++ b/unittests/Support/Path.cpp
@@ -1057,6 +1057,32 @@ TEST_F(FileSystemTest, PathFromFDWin32) {
::close(FileDescriptor);
}
+TEST_F(FileSystemTest, PathFromFDUnicode) {
+ // Create a temp file.
+ int FileDescriptor;
+ SmallString<64> TempPath;
+
+ // Test Unicode: "<temp directory>/(pi)r^2<temp rand chars>.aleth.0"
+ ASSERT_NO_ERROR(
+ fs::createTemporaryFile("\xCF\x80r\xC2\xB2",
+ "\xE2\x84\xB5.0", FileDescriptor, TempPath));
+
+ // Make sure it exists.
+ ASSERT_TRUE(sys::fs::exists(Twine(TempPath)));
+
+ SmallVector<char, 8> ResultPath;
+ std::error_code ErrorCode =
+ fs::getPathFromOpenFD(FileDescriptor, ResultPath);
+
+ if (!ErrorCode) {
+ fs::UniqueID D1, D2;
+ ASSERT_NO_ERROR(fs::getUniqueID(Twine(TempPath), D1));
+ ASSERT_NO_ERROR(fs::getUniqueID(Twine(ResultPath), D2));
+ ASSERT_EQ(D1, D2);
+ }
+ ::close(FileDescriptor);
+}
+
TEST_F(FileSystemTest, OpenFileForRead) {
// Create a temp file.
int FileDescriptor;