diff options
author | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-10-09 18:27:27 +0000 |
---|---|---|
committer | Ariel J. Bernal <ariel.j.bernal@intel.com> | 2013-10-09 18:27:27 +0000 |
commit | d4099c3348589e845f9f4666fb0b8ef9b7a4a796 (patch) | |
tree | a2afe7073172d7a6a3b76f0198f121caf752ad20 /unittests/Tooling/RefactoringTest.cpp | |
parent | 5bd0d44c8da50f3a629c90fee92ce5cf1e31c9ff (diff) | |
download | clang-d4099c3348589e845f9f4666fb0b8ef9b7a4a796.tar.gz clang-d4099c3348589e845f9f4666fb0b8ef9b7a4a796.tar.bz2 clang-d4099c3348589e845f9f4666fb0b8ef9b7a4a796.tar.xz |
Revert commit r192299 until find a way to account for simlinks in OS X.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Tooling/RefactoringTest.cpp')
-rw-r--r-- | unittests/Tooling/RefactoringTest.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/unittests/Tooling/RefactoringTest.cpp b/unittests/Tooling/RefactoringTest.cpp index 9dce26fb51..8c7bfa1c76 100644 --- a/unittests/Tooling/RefactoringTest.cpp +++ b/unittests/Tooling/RefactoringTest.cpp @@ -244,10 +244,6 @@ public: return Context.Sources.createFileID(File, SourceLocation(), SrcMgr::C_User); } - StringRef getFilePath(llvm::StringRef Name) { - return TemporaryFiles.lookup(Name); - } - std::string getFileContentFromDisk(llvm::StringRef Name) { std::string Path = TemporaryFiles.lookup(Name); assert(!Path.empty()); @@ -274,55 +270,6 @@ TEST_F(FlushRewrittenFilesTest, StoresChangesOnDisk) { getFileContentFromDisk("input.cpp")); } -TEST_F(FlushRewrittenFilesTest, GetFilePath) { - // Create a temporary file. - createFile("input.cpp", "line1\nline2\nline3\nline4"); - - StringRef FilePath = getFilePath("input.cpp"); - StringRef TempPath = llvm::sys::path::parent_path(FilePath); - StringRef TempFile = llvm::sys::path::filename(FilePath); - - // Save current path. - SmallString<512> CurrentPath; - llvm::sys::fs::current_path(CurrentPath); - - // Change directory to the temporary directory. - EXPECT_FALSE(chdir(TempPath.str().c_str())); - llvm::sys::fs::current_path(CurrentPath); - - // Get a FileEntry from the current directory. - FileManager Files((FileSystemOptions())); - const FileEntry *Entry = Files.getFile(TempFile); - ASSERT_TRUE(Entry != NULL); - - // We expect to get just the filename and "." in the FileEntry - // since paths are relative to the current directory. - EXPECT_EQ(TempFile, Entry->getName()); - EXPECT_STREQ(".", Entry->getDir()->getName()); - - FileID ID = Context.Sources.createFileID(Entry, SourceLocation(), - SrcMgr::C_User); - - Replacement R = Replacement(Context.Sources, Context.getLocation(ID, 2, 1), - 5, "replaced"); - - // Change back to the original path so we can verify that replacements - // are being applied independently of the location. - EXPECT_EQ(0, chdir(CurrentPath.c_str())); - - // We expect that the file path of the replacement is using the absolute - // path. - EXPECT_EQ(R.getFilePath(), getFilePath("input.cpp")); - - // Apply replacements. - Replacements Replaces; - Replaces.insert(R); - EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite)); - EXPECT_FALSE(Context.Rewrite.overwriteChangedFiles()); - EXPECT_EQ("line1\nreplaced\nline3\nline4", - getFileContentFromDisk("input.cpp")); -} - namespace { template <typename T> class TestVisitor : public clang::RecursiveASTVisitor<T> { |