Fix fs::set_current_path unit test

The test fails when there is a symlink on the path because then the path
returned by current_path will not match the one we have set. Instead of
doing a string match check the unique id of the two files.

llvm-svn: 292916
This commit is contained in:
Pavel Labath 2017-01-24 11:35:26 +00:00
parent 6340e54861
commit 504400977a
1 changed files with 5 additions and 1 deletions

View File

@ -1151,7 +1151,11 @@ TEST_F(FileSystemTest, set_current_path) {
ASSERT_NO_ERROR(fs::set_current_path(TestDirectory));
ASSERT_NO_ERROR(fs::current_path(path));
ASSERT_EQ(TestDirectory, path);
fs::UniqueID D1, D2;
ASSERT_NO_ERROR(fs::getUniqueID(TestDirectory, D1));
ASSERT_NO_ERROR(fs::getUniqueID(path, D2));
ASSERT_EQ(D1, D2) << "D1: " << TestDirectory << "\nD2: " << path;
}
} // anonymous namespace