summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2014-09-22 10:41:39 +0000
committerAlexander Kornienko <alexfh@google.com>2014-09-22 10:41:39 +0000
commit33fc3db9a16f8174bb0fcabc5b323c1f8b48cf4c (patch)
tree8bd7322e39bfb512b561dd6e3e18fc9e8a7335a9 /clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
parent3a3bf0bbe35fee25219e075ee9b76abb8633c24b (diff)
downloadbcm5719-llvm-33fc3db9a16f8174bb0fcabc5b323c1f8b48cf4c.tar.gz
bcm5719-llvm-33fc3db9a16f8174bb0fcabc5b323c1f8b48cf4c.zip
Add NamespaceCommentCheck to the Google module.
Summary: This uses a bit hacky way to set the defaults for the spaces before comments, but it's also one of the simplest ways. Fixed a bug with how the SpacesBeforeComments option was used. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5410 llvm-svn: 218240
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp79
1 files changed, 0 insertions, 79 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
index be615080216..a9afb820271 100644
--- a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
+++ b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp
@@ -1,91 +1,12 @@
#include "ClangTidyTest.h"
#include "llvm/HeaderGuardCheck.h"
#include "llvm/IncludeOrderCheck.h"
-#include "llvm/NamespaceCommentCheck.h"
#include "gtest/gtest.h"
namespace clang {
namespace tidy {
namespace test {
-TEST(NamespaceCommentCheckTest, Basic) {
- EXPECT_EQ("namespace i {\n} // namespace i",
- runCheckOnCode<NamespaceCommentCheck>("namespace i {\n}"));
- EXPECT_EQ("namespace {\n} // namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n}"));
- EXPECT_EQ(
- "namespace i { namespace j {\n} // namespace j\n } // namespace i",
- runCheckOnCode<NamespaceCommentCheck>("namespace i { namespace j {\n} }"));
-}
-
-TEST(NamespaceCommentCheckTest, SingleLineNamespaces) {
- EXPECT_EQ(
- "namespace i { namespace j { } }",
- runCheckOnCode<NamespaceCommentCheck>("namespace i { namespace j { } }"));
-}
-
-TEST(NamespaceCommentCheckTest, CheckExistingComments) {
- EXPECT_EQ("namespace i { namespace j {\n"
- "} /* namespace j */ } // namespace i\n"
- " /* random comment */",
- runCheckOnCode<NamespaceCommentCheck>(
- "namespace i { namespace j {\n"
- "} /* namespace j */ } /* random comment */"));
- EXPECT_EQ("namespace {\n"
- "} // namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} // namespace"));
- EXPECT_EQ("namespace {\n"
- "} //namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} //namespace"));
- EXPECT_EQ("namespace {\n"
- "} // anonymous namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} // anonymous namespace"));
- EXPECT_EQ(
- "namespace My_NameSpace123 {\n"
- "} // namespace My_NameSpace123",
- runCheckOnCode<NamespaceCommentCheck>("namespace My_NameSpace123 {\n"
- "} // namespace My_NameSpace123"));
- EXPECT_EQ(
- "namespace My_NameSpace123 {\n"
- "} //namespace My_NameSpace123",
- runCheckOnCode<NamespaceCommentCheck>("namespace My_NameSpace123 {\n"
- "} //namespace My_NameSpace123"));
- EXPECT_EQ("namespace My_NameSpace123 {\n"
- "} // end namespace My_NameSpace123",
- runCheckOnCode<NamespaceCommentCheck>(
- "namespace My_NameSpace123 {\n"
- "} // end namespace My_NameSpace123"));
- // Understand comments only on the same line.
- EXPECT_EQ("namespace {\n"
- "} // namespace\n"
- "// namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "}\n"
- "// namespace"));
- // Leave unknown comments.
- EXPECT_EQ("namespace {\n"
- "} // namespace // random text",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} // random text"));
-}
-
-TEST(NamespaceCommentCheckTest, FixWrongComments) {
- EXPECT_EQ("namespace i { namespace jJ0_ {\n"
- "} // namespace jJ0_\n"
- " } // namespace i\n"
- " /* random comment */",
- runCheckOnCode<NamespaceCommentCheck>(
- "namespace i { namespace jJ0_ {\n"
- "} /* namespace qqq */ } /* random comment */"));
- EXPECT_EQ("namespace {\n"
- "} // namespace",
- runCheckOnCode<NamespaceCommentCheck>("namespace {\n"
- "} // namespace asdf"));
-}
-
// FIXME: It seems this might be incompatible to dos path. Investigating.
#if !defined(_WIN32)
static std::string runHeaderGuardCheck(StringRef Code, const Twine &Filename,
OpenPOWER on IntegriCloud