diff options
author | Alexander Kornienko <alexfh@google.com> | 2014-10-15 11:36:48 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2014-10-15 11:36:48 +0000 |
commit | bebe0c6918e96f4f9e7fb21d6edf95e5753096aa (patch) | |
tree | e4dad7d02e3c4b8829b6c0a15eb5fcfd19a5e774 /clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp | |
parent | 636af924db2aa8d45b1f87010b76e01075c2d862 (diff) | |
download | llvm-bebe0c6918e96f4f9e7fb21d6edf95e5753096aa.zip llvm-bebe0c6918e96f4f9e7fb21d6edf95e5753096aa.tar.gz llvm-bebe0c6918e96f4f9e7fb21d6edf95e5753096aa.tar.bz2 |
Reformatted code samples in the unit test. No functional changes.
llvm-svn: 219788
Diffstat (limited to 'clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp')
-rw-r--r-- | clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp | 175 |
1 files changed, 111 insertions, 64 deletions
diff --git a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp index 00e9034..a35f29a 100644 --- a/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp +++ b/clang-tools-extra/unittests/clang-tidy/LLVMModuleTest.cpp @@ -35,93 +35,140 @@ static std::string runHeaderGuardCheckWithEndif(StringRef Code, } TEST(LLVMHeaderGuardCheckTest, FixHeaderGuards) { - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif\n", - runHeaderGuardCheck("#ifndef FOO\n#define FOO\n#endif\n", + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif\n", + runHeaderGuardCheck("#ifndef FOO\n" + "#define FOO\n" + "#endif\n", "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/1)); // Allow trailing underscores. - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H_\n#define LLVM_ADT_FOO_H_\n#endif\n", - runHeaderGuardCheck( - "#ifndef LLVM_ADT_FOO_H_\n#define LLVM_ADT_FOO_H_\n#endif\n", - "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/0)); - - EXPECT_EQ( - "#ifndef LLVM_CLANG_C_BAR_H\n#define LLVM_CLANG_C_BAR_H\n\n\n#endif\n", - runHeaderGuardCheck("", "./include/clang-c/bar.h", - /*ExpectedWarnings=*/1)); - - EXPECT_EQ("#ifndef LLVM_CLANG_LIB_CODEGEN_C_H\n#define " - "LLVM_CLANG_LIB_CODEGEN_C_H\n\n\n#endif\n", + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H_\n" + "#define LLVM_ADT_FOO_H_\n" + "#endif\n", + runHeaderGuardCheck("#ifndef LLVM_ADT_FOO_H_\n" + "#define LLVM_ADT_FOO_H_\n" + "#endif\n", + "include/llvm/ADT/foo.h", + /*ExpectedWarnings=*/0)); + + EXPECT_EQ("#ifndef LLVM_CLANG_C_BAR_H\n" + "#define LLVM_CLANG_C_BAR_H\n" + "\n" + "\n" + "#endif\n", + runHeaderGuardCheck("", "./include/clang-c/bar.h", + /*ExpectedWarnings=*/1)); + + EXPECT_EQ("#ifndef LLVM_CLANG_LIB_CODEGEN_C_H\n" + "#define LLVM_CLANG_LIB_CODEGEN_C_H\n" + "\n" + "\n" + "#endif\n", runHeaderGuardCheck("", "tools/clang/lib/CodeGen/c.h", /*ExpectedWarnings=*/1)); - EXPECT_EQ("#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_X_H\n#define " - "LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_X_H\n\n\n#endif\n", + EXPECT_EQ("#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_X_H\n" + "#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_X_H\n" + "\n" + "\n" + "#endif\n", runHeaderGuardCheck("", "tools/clang/tools/extra/clang-tidy/x.h", /*ExpectedWarnings=*/1)); - EXPECT_EQ( - "int foo;\n#ifndef LLVM_CLANG_BAR_H\n#define LLVM_CLANG_BAR_H\n#endif\n", - runHeaderGuardCheck("int foo;\n#ifndef LLVM_CLANG_BAR_H\n" - "#define LLVM_CLANG_BAR_H\n#endif\n", - "include/clang/bar.h", /*ExpectedWarnings=*/1)); - - EXPECT_EQ("#ifndef LLVM_CLANG_BAR_H\n#define LLVM_CLANG_BAR_H\n\n" - "int foo;\n#ifndef FOOLOLO\n#define FOOLOLO\n#endif\n\n#endif\n", - runHeaderGuardCheck( - "int foo;\n#ifndef FOOLOLO\n#define FOOLOLO\n#endif\n", - "include/clang/bar.h", /*ExpectedWarnings=*/1)); - - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif " - " // LLVM_ADT_FOO_H\n", - runHeaderGuardCheckWithEndif("#ifndef FOO\n#define FOO\n#endif\n", + EXPECT_EQ("int foo;\n" + "#ifndef LLVM_CLANG_BAR_H\n" + "#define LLVM_CLANG_BAR_H\n" + "#endif\n", + runHeaderGuardCheck("int foo;\n" + "#ifndef LLVM_CLANG_BAR_H\n" + "#define LLVM_CLANG_BAR_H\n" + "#endif\n", + "include/clang/bar.h", /*ExpectedWarnings=*/1)); + + EXPECT_EQ("#ifndef LLVM_CLANG_BAR_H\n" + "#define LLVM_CLANG_BAR_H\n" + "\n" + "int foo;\n" + "#ifndef FOOLOLO\n" + "#define FOOLOLO\n" + "#endif\n" + "\n" + "#endif\n", + runHeaderGuardCheck("int foo;\n" + "#ifndef FOOLOLO\n" + "#define FOOLOLO\n" + "#endif\n", + "include/clang/bar.h", /*ExpectedWarnings=*/1)); + + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif // LLVM_ADT_FOO_H\n", + runHeaderGuardCheckWithEndif("#ifndef FOO\n" + "#define FOO\n" + "#endif\n", "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/1)); - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif " - " // LLVM_ADT_FOO_H\n", - runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n#define " - "LLVM_ADT_FOO_H\n#endif // LLVM_H\n", + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif // LLVM_ADT_FOO_H\n", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif // LLVM_H\n", "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/1)); - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif" - " /* LLVM_ADT_FOO_H */\n", - runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n#define " - "LLVM_ADT_FOO_H\n" + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif /* LLVM_ADT_FOO_H */\n", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" "#endif /* LLVM_ADT_FOO_H */\n", "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/0)); - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H_\n#define LLVM_ADT_FOO_H_\n#endif " - "// LLVM_ADT_FOO_H_\n", - runHeaderGuardCheckWithEndif( - "#ifndef LLVM_ADT_FOO_H_\n#define " - "LLVM_ADT_FOO_H_\n#endif // LLVM_ADT_FOO_H_\n", - "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/0)); - - EXPECT_EQ( - "#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif // " - "LLVM_ADT_FOO_H\n", - runHeaderGuardCheckWithEndif( - "#ifndef LLVM_ADT_FOO_H_\n#define LLVM_ADT_FOO_H_\n#endif // LLVM\n", - "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/1)); - - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif \\ \n// " - "LLVM_ADT_FOO_H\n", - runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n#define " - "LLVM_ADT_FOO_H\n#endif \\ \n// " - "LLVM_ADT_FOO_H\n", + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H_\n" + "#define LLVM_ADT_FOO_H_\n" + "#endif // LLVM_ADT_FOO_H_\n", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H_\n" + "#define LLVM_ADT_FOO_H_\n" + "#endif // LLVM_ADT_FOO_H_\n", + "include/llvm/ADT/foo.h", + /*ExpectedWarnings=*/0)); + + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif // LLVM_ADT_FOO_H\n", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H_\n" + "#define LLVM_ADT_FOO_H_\n" + "#endif // LLVM\n", "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/1)); - EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif /* " - "LLVM_ADT_FOO_H\\ \n FOO */", - runHeaderGuardCheckWithEndif( - "#ifndef LLVM_ADT_FOO_H\n#define LLVM_ADT_FOO_H\n#endif /* " - "LLVM_ADT_FOO_H\\ \n FOO */", - "include/llvm/ADT/foo.h", /*ExpectedWarnings=*/0)); + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif \\ \n" + "// LLVM_ADT_FOO_H\n", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif \\ \n" + "// LLVM_ADT_FOO_H\n", + "include/llvm/ADT/foo.h", + /*ExpectedWarnings=*/1)); + + EXPECT_EQ("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif /* LLVM_ADT_FOO_H\\ \n" + " FOO */", + runHeaderGuardCheckWithEndif("#ifndef LLVM_ADT_FOO_H\n" + "#define LLVM_ADT_FOO_H\n" + "#endif /* LLVM_ADT_FOO_H\\ \n" + " FOO */", + "include/llvm/ADT/foo.h", + /*ExpectedWarnings=*/0)); } #endif |