From 551152f7d8c330692ed8ea9fc26fb6dd5efd118b Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Sat, 16 Mar 2013 15:00:51 +0000 Subject: Test case for graceful handling of long file names on Windows. Patch thanks to Paul Robinson! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177223 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Support/Path.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'unittests') diff --git a/unittests/Support/Path.cpp b/unittests/Support/Path.cpp index c31cb5306d..4511259797 100644 --- a/unittests/Support/Path.cpp +++ b/unittests/Support/Path.cpp @@ -224,6 +224,18 @@ TEST_F(FileSystemTest, TempFiles) { // Make sure Temp1 doesn't exist. ASSERT_NO_ERROR(fs::exists(Twine(TempPath), TempFileExists)); EXPECT_FALSE(TempFileExists); + +#ifdef LLVM_ON_WIN32 + // Path name > 260 chars should get an error. + const char *Path270 = + "abcdefghijklmnopqrstuvwxyz9abcdefghijklmnopqrstuvwxyz8" + "abcdefghijklmnopqrstuvwxyz7abcdefghijklmnopqrstuvwxyz6" + "abcdefghijklmnopqrstuvwxyz5abcdefghijklmnopqrstuvwxyz4" + "abcdefghijklmnopqrstuvwxyz3abcdefghijklmnopqrstuvwxyz2" + "abcdefghijklmnopqrstuvwxyz1abcdefghijklmnopqrstuvwxyz0"; + EXPECT_EQ(fs::unique_file(Twine(Path270), FileDescriptor, TempPath), + windows_error::path_not_found); +#endif } TEST_F(FileSystemTest, DirectoryIteration) { -- cgit v1.2.3