diff options
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 319f63ded51..d2ec4e645c9 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -14,7 +14,6 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/MemoryBuffer.h" #include "gtest/gtest.h" #define DEBUG_TYPE "format-test" @@ -11200,33 +11199,6 @@ TEST_F(FormatTest, FormatsTableGenCode) { verifyFormat("include \"a.td\"\ninclude \"b.td\"", Style); } -TEST(FormatStyle, GetStyleOfFile) { - vfs::InMemoryFileSystem FS; - // Test 1: format file in the same directory. - ASSERT_TRUE( - FS.addFile("/a/.clang-format", 0, - llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: LLVM"))); - ASSERT_TRUE( - FS.addFile("/a/test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int i;"))); - auto Style1 = getStyle("file", "/a/.clang-format", "Google", &FS); - ASSERT_EQ(Style1, getLLVMStyle()); - - // Test 2: fallback to default. - ASSERT_TRUE( - FS.addFile("/b/test.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int i;"))); - auto Style2 = getStyle("file", "/b/test.cpp", "Mozilla", &FS); - ASSERT_EQ(Style2, getMozillaStyle()); - - // Test 3: format file in parent directory. - ASSERT_TRUE( - FS.addFile("/c/.clang-format", 0, - llvm::MemoryBuffer::getMemBuffer("BasedOnStyle: Google"))); - ASSERT_TRUE(FS.addFile("/c/sub/sub/sub/test.cpp", 0, - llvm::MemoryBuffer::getMemBuffer("int i;"))); - auto Style3 = getStyle("file", "/c/sub/sub/sub/test.cpp", "LLVM", &FS); - ASSERT_EQ(Style3, getGoogleStyle()); -} - class ReplacementTest : public ::testing::Test { protected: tooling::Replacement createReplacement(SourceLocation Start, unsigned Length, |