diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2016-06-21 14:24:48 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2016-06-21 14:24:48 +0000 |
commit | 0ad004620cbf9f99543bec896903a39281c541c8 (patch) | |
tree | 2863d274cbb2a9c6e8a1d4fb99a6816c85072ea8 /llvm/unittests/Support/Path.cpp | |
parent | 3d6a130fee309468cef9cd93fe44090d326d76d7 (diff) | |
download | bcm5719-llvm-0ad004620cbf9f99543bec896903a39281c541c8.tar.gz bcm5719-llvm-0ad004620cbf9f99543bec896903a39281c541c8.zip |
Switch to using an API that handles non-ASCII paths appropriately on Windows.
llvm-svn: 273262
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 74b74ac4195..1a6ffa50e98 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/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; |