diff options
author | Alexander Kornienko <alexfh@google.com> | 2017-01-03 14:35:47 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2017-01-03 14:35:47 +0000 |
commit | 9bab1991469c1c04f832a80d52e3f5065914cc39 (patch) | |
tree | f1ad91b2d9a89579e4e544b4097727c1554d1994 /clang/unittests/Tooling/ReplacementsYamlTest.cpp | |
parent | 32a552f6b02d9174aa30bf8c90a9baa5b5a5867c (diff) | |
download | bcm5719-llvm-9bab1991469c1c04f832a80d52e3f5065914cc39.tar.gz bcm5719-llvm-9bab1991469c1c04f832a80d52e3f5065914cc39.zip |
[clang-tidy] Add check name to YAML export
Add a field indicating the associated check for every replacement to the YAML
report generated with the '-export-fixes' option. Update
clang-apply-replacements to handle the new format.
Patch by Alpha Abdoulaye!
Differential revision: https://reviews.llvm.org/D26137
llvm-svn: 290892
Diffstat (limited to 'clang/unittests/Tooling/ReplacementsYamlTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/ReplacementsYamlTest.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/unittests/Tooling/ReplacementsYamlTest.cpp b/clang/unittests/Tooling/ReplacementsYamlTest.cpp index a20dde76140..3e4193d2adf 100644 --- a/clang/unittests/Tooling/ReplacementsYamlTest.cpp +++ b/clang/unittests/Tooling/ReplacementsYamlTest.cpp @@ -22,11 +22,8 @@ TEST(ReplacementsYamlTest, serializesReplacements) { TranslationUnitReplacements Doc; Doc.MainSourceFile = "/path/to/source.cpp"; - Doc.Context = "some context"; - Doc.Replacements - .push_back(Replacement("/path/to/file1.h", 232, 56, "replacement #1")); - Doc.Replacements - .push_back(Replacement("/path/to/file2.h", 301, 2, "replacement #2")); + Doc.Replacements.emplace_back("/path/to/file1.h", 232, 56, "replacement #1"); + Doc.Replacements.emplace_back("/path/to/file2.h", 301, 2, "replacement #2"); std::string YamlContent; llvm::raw_string_ostream YamlContentStream(YamlContent); @@ -37,7 +34,6 @@ TEST(ReplacementsYamlTest, serializesReplacements) { // NOTE: If this test starts to fail for no obvious reason, check whitespace. ASSERT_STREQ("---\n" "MainSourceFile: /path/to/source.cpp\n" - "Context: some context\n" "Replacements: \n" // Extra whitespace here! " - FilePath: /path/to/file1.h\n" " Offset: 232\n" @@ -54,7 +50,6 @@ TEST(ReplacementsYamlTest, serializesReplacements) { TEST(ReplacementsYamlTest, deserializesReplacements) { std::string YamlContent = "---\n" "MainSourceFile: /path/to/source.cpp\n" - "Context: some context\n" "Replacements:\n" " - FilePath: /path/to/file1.h\n" " Offset: 232\n" @@ -71,7 +66,6 @@ TEST(ReplacementsYamlTest, deserializesReplacements) { ASSERT_FALSE(YAML.error()); ASSERT_EQ(2u, DocActual.Replacements.size()); ASSERT_EQ("/path/to/source.cpp", DocActual.MainSourceFile); - ASSERT_EQ("some context", DocActual.Context); ASSERT_EQ("/path/to/file1.h", DocActual.Replacements[0].getFilePath()); ASSERT_EQ(232u, DocActual.Replacements[0].getOffset()); ASSERT_EQ(56u, DocActual.Replacements[0].getLength()); @@ -98,7 +92,6 @@ TEST(ReplacementsYamlTest, deserializesWithoutContext) { ASSERT_FALSE(YAML.error()); ASSERT_EQ("/path/to/source.cpp", DocActual.MainSourceFile); ASSERT_EQ(1u, DocActual.Replacements.size()); - ASSERT_EQ(std::string(), DocActual.Context); ASSERT_EQ("target_file.h", DocActual.Replacements[0].getFilePath()); ASSERT_EQ(1u, DocActual.Replacements[0].getOffset()); ASSERT_EQ(10u, DocActual.Replacements[0].getLength()); |