[llvm] r297484 - Fix test failure when Home directory cannot be found.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 10 09:47:14 PST 2017
Author: zturner
Date: Fri Mar 10 11:47:13 2017
New Revision: 297484
URL: http://llvm.org/viewvc/llvm-project?rev=297484&view=rev
Log:
Fix test failure when Home directory cannot be found.
Modified:
llvm/trunk/unittests/Support/Path.cpp
Modified: llvm/trunk/unittests/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=297484&r1=297483&r2=297484&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/Path.cpp (original)
+++ llvm/trunk/unittests/Support/Path.cpp Fri Mar 10 11:47:13 2017
@@ -522,15 +522,14 @@ TEST_F(FileSystemTest, RealPath) {
EXPECT_EQ(Expected, Actual);
SmallString<64> HomeDir;
- ASSERT_TRUE(llvm::sys::path::home_directory(HomeDir));
- ASSERT_NO_ERROR(fs::real_path(HomeDir, Expected));
- ASSERT_NO_ERROR(fs::real_path("~", Actual, true));
- EXPECT_EQ(Expected, Actual);
- ASSERT_NO_ERROR(fs::real_path("~/", Actual, true));
- EXPECT_EQ(Expected, Actual);
-
- fs::real_path(Twine(TestDirectory) + "/does_not_exist", Actual);
- EXPECT_EQ("", Actual);
+ bool Result = llvm::sys::path::home_directory(HomeDir);
+ if (Result) {
+ ASSERT_NO_ERROR(fs::real_path(HomeDir, Expected));
+ ASSERT_NO_ERROR(fs::real_path("~", Actual, true));
+ EXPECT_EQ(Expected, Actual);
+ ASSERT_NO_ERROR(fs::real_path("~/", Actual, true));
+ EXPECT_EQ(Expected, Actual);
+ }
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/test1"));
}
More information about the llvm-commits
mailing list