Removes uses of deprecated AssertionFailure() API (by Vlad Losev).

This commit is contained in:
zhanyong.wan
2010-09-27 22:09:42 +00:00
parent b5d3a17805
commit 2d1835b086
5 changed files with 82 additions and 115 deletions

View File

@@ -238,21 +238,19 @@ AssertionResult AssertPred%(n)sHelper(const char* pred_text""" % DEFS
impl += """) {
if (pred(%(vs)s)) return AssertionSuccess();
Message msg;
""" % DEFS
impl += ' msg << pred_text << "("'
impl += ' return AssertionFailure() << pred_text << "("'
impl += Iter(n, """
<< e%s""", sep=' << ", "')
<< e%s""", sep=' << ", "')
impl += ' << ") evaluates to false, where"'
impl += Iter(n, """
<< "\\n" << e%s << " evaluates to " << v%s""")
<< "\\n" << e%s << " evaluates to " << v%s""")
impl += """;
return AssertionFailure(msg);
}
// Internal macro for implementing {EXPECT|ASSERT}_PRED_FORMAT%(n)s.
@@ -478,15 +476,14 @@ testing::AssertionResult PredFormatFunction%(n)s(""" % DEFS
if (PredFunction%(n)s(%(vs)s))
return testing::AssertionSuccess();
testing::Message msg;
msg << """ % DEFS
return testing::AssertionFailure()
<< """ % DEFS
tests += Iter(n, 'e%s', sep=' << " + " << ')
tests += """
<< " is expected to be positive, but evaluates to "
<< %(v_sum)s << ".";
return testing::AssertionFailure(msg);
}
""" % DEFS