aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Neto <dneto@google.com>2017-05-15 10:33:02 -0400
committerDavid Neto <dneto@google.com>2017-05-15 13:35:31 -0400
commit4a6edb2f740b9b87b04306a7815f42de5ca149a4 (patch)
treee36bf73d6b4d8ba6d2c1ce8c0069d7aeaaf71fb5
parent0e9246000b05a93cc6cfbfc744b973caf9be4499 (diff)
downloadeffcee-4a6edb2f740b9b87b04306a7815f42de5ca149a4.tar.gz
Remove Check::Description method
Error messages are generated by other means, so Check::Description no longer serves a purpose.
-rw-r--r--effcee/check.cc17
-rw-r--r--effcee/check.h3
-rw-r--r--effcee/check_test.cc15
3 files changed, 1 insertions, 34 deletions
diff --git a/effcee/check.cc b/effcee/check.cc
index 2e5591a..612f7f1 100644
--- a/effcee/check.cc
+++ b/effcee/check.cc
@@ -51,17 +51,6 @@ Type TypeForSuffix(StringPiece suffix) {
assert(pair_iter != type_str_table.end());
return pair_iter->second;
}
-
-StringPiece SuffixForType(Type type) {
- const auto& type_str_table = TypeStringTable();
- const auto pair_iter =
- std::find_if(type_str_table.begin(), type_str_table.end(),
- [type](const std::pair<StringPiece, Type>& elem) {
- return type == elem.second;
- });
- assert(pair_iter != type_str_table.end());
- return pair_iter->first;
-}
} // namespace
namespace effcee {
@@ -139,12 +128,6 @@ bool Check::Matches(StringPiece* input, StringPiece* captured,
return matched;
}
-std::string Check::Description(const Options& options) const {
- std::ostringstream out;
- out << options.prefix() << SuffixForType(type()) << ": " << param();
- return out.str();
-}
-
namespace {
// Returns a parts list for the given pattern. This splits out regular expressions as
// delimited by {{ and }}, and also variable uses and definitions.
diff --git a/effcee/check.h b/effcee/check.h
index 005d00c..35a5c0b 100644
--- a/effcee/check.h
+++ b/effcee/check.h
@@ -168,9 +168,6 @@ class Check {
// instance is not default-constructed.
bool Matches(StringPiece* str, StringPiece* captured, VarMapping* vars) const;
- // Returns a string describing this check.
- std::string Description(const Options& options) const;
-
private:
// The type of check.
Type type_;
diff --git a/effcee/check_test.cc b/effcee/check_test.cc
index b0d70e4..ec6de8e 100644
--- a/effcee/check_test.cc
+++ b/effcee/check_test.cc
@@ -279,8 +279,7 @@ TEST_P(CheckMatchTest, Samples) {
VarMapping vars;
const bool matched = GetParam().check.Matches(&str, &captured, &vars);
EXPECT_THAT(matched, Eq(GetParam().expected))
- << "Failed " << GetParam().check.Description(Options()) << " on input "
- << GetParam().input;
+ << "Failed on input " << GetParam().input;
EXPECT_THAT(std::string(str.data(), str.size()), Eq(GetParam().remaining));
EXPECT_THAT(std::string(captured.data(), captured.size()),
Eq(GetParam().captured));
@@ -313,18 +312,6 @@ INSTANTIATE_TEST_CASE_P(
{"in hello now", Check(Type::Not, "hello"), true, " now", "hello"},
}), );
-// Check::Description
-TEST(CheckDescription, Samples) {
- EXPECT_THAT(Check(Type::Simple, "hello").Description(Options()),
- Eq("CHECK: hello"));
- EXPECT_THAT(
- Check(Type::Simple, "magic").Description(Options().SetPrefix("Zing")),
- Eq("Zing: magic"));
- EXPECT_THAT(Check(Type::DAG, "now").Description(Options()),
- Eq("CHECK-DAG: now"));
- EXPECT_THAT(Check(Type::Next, "it").Description(Options().SetPrefix("Boo")),
- Eq("Boo-NEXT: it"));
-}
// Check::Part::Regex