Tidy up some uses of test macros.
Change-Id: Ifbe3200923b060feecdd33a3bc1be375e98d8df7
Reviewed-on: https://code-review.googlesource.com/2870
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/testing/re2_arg_test.cc b/re2/testing/re2_arg_test.cc
index f09cbee..ad6c936 100644
--- a/re2/testing/re2_arg_test.cc
+++ b/re2/testing/re2_arg_test.cc
@@ -86,22 +86,22 @@
const int kNumStrings = arraysize(kSuccessTable);
-// It's ugly to use a macro, but we apparently can't use the ASSERT_TRUE_M
+// It's ugly to use a macro, but we apparently can't use the EXPECT_EQ
// macro outside of a TEST block and this seems to be the only way to
// avoid code duplication. I can also pull off a couple nice tricks
// using concatenation for the type I'm checking against.
#define PARSE_FOR_TYPE(type, column) { \
type r; \
- for ( int i = 0; i < kNumStrings; ++i ) { \
+ for (int i = 0; i < kNumStrings; ++i) { \
RE2::Arg arg(&r); \
const char* const p = kSuccessTable[i].value_string; \
bool retval = arg.Parse(p, strlen(p)); \
bool success = kSuccessTable[i].success[column]; \
- ASSERT_TRUE_M(retval == success, \
- StringPrintf("Parsing '%s' for type " #type " should return %d", \
- p, success).c_str()); \
- if ( success ) { \
- ASSERT_EQUALS(r, (type)kSuccessTable[i].value); \
+ EXPECT_EQ(retval, success) \
+ << "Parsing '" << p << "' for type " #type " should return " \
+ << success; \
+ if (success) { \
+ EXPECT_EQ(r, (type)kSuccessTable[i].value); \
} \
} \
}
diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc
index ad15b34..e4b3c2a 100644
--- a/re2/testing/re2_test.cc
+++ b/re2/testing/re2_test.cc
@@ -385,8 +385,8 @@
const RE2::Options& options = RE2::DefaultOptions) {
string quoted = RE2::QuoteMeta(unquoted);
RE2 re(quoted, options);
- EXPECT_TRUE_M(RE2::FullMatch(unquoted, re),
- "Unquoted='" + unquoted + "', quoted='" + quoted + "'.");
+ EXPECT_TRUE(RE2::FullMatch(unquoted, re))
+ << "Unquoted='" << unquoted << "', quoted='" << quoted << "'.";
}
// A meta-quoted string, interpreted as a pattern, should always match
@@ -395,8 +395,8 @@
const RE2::Options& options = RE2::DefaultOptions) {
string quoted = RE2::QuoteMeta(unquoted);
RE2 re(quoted, options);
- EXPECT_FALSE_M(RE2::FullMatch(should_not_match, re),
- "Unquoted='" + unquoted + "', quoted='" + quoted + "'.");
+ EXPECT_FALSE(RE2::FullMatch(should_not_match, re))
+ << "Unquoted='" << unquoted << "', quoted='" << quoted << "'.";
}
// Tests that quoted meta characters match their original strings,
diff --git a/util/test.h b/util/test.h
index d48fef0..45ca6fa 100644
--- a/util/test.h
+++ b/util/test.h
@@ -31,11 +31,6 @@
#define EXPECT_GE CHECK_GE
#define EXPECT_FALSE(x) CHECK(!(x))
-#define EXPECT_TRUE_M(x, y) CHECK(x) << (y)
-#define EXPECT_FALSE_M(x, y) CHECK(!(x)) << (y)
-#define ASSERT_TRUE_M(x, y) CHECK(x) << (y)
-#define ASSERT_EQUALS(x, y) CHECK_EQ(x, y)
-
const bool UsingMallocCounter = false;
namespace testing {
class MallocCounter {