diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-04-23 08:50:36 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-04-23 08:50:36 +0000 |
commit | d6824876c2a9123dd98b5053acff9d88d7b09abe (patch) | |
tree | 5067e981b1447bc1793853e6b19731fddb3e4d98 /clang/unittests/Format/FormatTestProto.cpp | |
parent | 0d5c5936cbe0ff3cf7d78ade4df52053f95fd6a1 (diff) | |
download | bcm5719-llvm-d6824876c2a9123dd98b5053acff9d88d7b09abe.tar.gz bcm5719-llvm-d6824876c2a9123dd98b5053acff9d88d7b09abe.zip |
Revert "[clang-format] Improve Incomplete detection for (text) protos"
This reverts commit r330016.
The incomplete detection has too many false positives, picking up typos
for hard failures and refusing to format anything in that case.
llvm-svn: 330569
Diffstat (limited to 'clang/unittests/Format/FormatTestProto.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 8634a36b9d9..4b1480b074a 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -18,21 +18,13 @@ namespace clang { namespace format { class FormatTestProto : public ::testing::Test { - enum StatusCheck { SC_ExpectComplete, SC_ExpectIncomplete }; - protected: static std::string format(llvm::StringRef Code, unsigned Offset, - unsigned Length, const FormatStyle &Style, - StatusCheck CheckComplete = SC_ExpectComplete) { + unsigned Length, const FormatStyle &Style) { DEBUG(llvm::errs() << "---\n"); DEBUG(llvm::errs() << Code << "\n\n"); std::vector<tooling::Range> Ranges(1, tooling::Range(Offset, Length)); - FormattingAttemptStatus Status; - tooling::Replacements Replaces = - reformat(Style, Code, Ranges, "<stdin>", &Status); - bool ExpectedCompleteFormat = CheckComplete == SC_ExpectComplete; - EXPECT_EQ(ExpectedCompleteFormat, Status.FormatComplete) - << Code << "\n\n"; + tooling::Replacements Replaces = reformat(Style, Code, Ranges); auto Result = applyAllReplacements(Code, Replaces); EXPECT_TRUE(static_cast<bool>(Result)); DEBUG(llvm::errs() << "\n" << *Result << "\n\n"); @@ -49,12 +41,6 @@ protected: EXPECT_EQ(Code.str(), format(Code)) << "Expected code is not stable"; EXPECT_EQ(Code.str(), format(test::messUp(Code))); } - - static void verifyIncompleteFormat(llvm::StringRef Code) { - FormatStyle Style = getGoogleStyle(FormatStyle::LK_Proto); - EXPECT_EQ(Code.str(), - format(Code, 0, Code.size(), Style, SC_ExpectIncomplete)); - } }; TEST_F(FormatTestProto, FormatsMessages) { @@ -506,12 +492,5 @@ TEST_F(FormatTestProto, AcceptsOperatorAsKeyInOptions) { "};"); } -TEST_F(FormatTestProto, IncompleteFormat) { - verifyIncompleteFormat("option ("); - verifyIncompleteFormat("option (MyProto.options) = { bbbbbbbbb:"); - verifyIncompleteFormat("option (MyProto.options) = { bbbbbbbbb: <\n"); - verifyIncompleteFormat("option (MyProto.options) = { bbbbbbbbb: [\n"); -} - } // end namespace tooling } // end namespace clang |