Skip to content

Commit

Permalink
SERVER-9625 Logging arguments of failed test case in expression unit …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
jamesfcohan committed Aug 14, 2015
1 parent e13d0ca commit e73b7d6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/mongo/db/pipeline/expression_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ static void assertExpectedResults(
std::string expression,
std::initializer_list<std::pair<std::vector<Value>, Value>> operations) {
for (auto&& op : operations) {
VariablesIdGenerator idGenerator;
VariablesParseState vps(&idGenerator);
const BSONObj obj = BSON(expression << Value(op.first));
Value result = Expression::parseExpression(obj.firstElement(), vps)->evaluate(Document());
ASSERT_EQUALS(op.second, result);
ASSERT_EQUALS(op.second.getType(), result.getType());
try {
VariablesIdGenerator idGenerator;
VariablesParseState vps(&idGenerator);
const BSONObj obj = BSON(expression << Value(op.first));
Value result =
Expression::parseExpression(obj.firstElement(), vps)->evaluate(Document());
ASSERT_EQUALS(op.second, result);
ASSERT_EQUALS(op.second.getType(), result.getType());
} catch (...) {
log() << "failed with arguments: " << Value(op.first);
throw;
}
}
}

Expand Down

0 comments on commit e73b7d6

Please sign in to comment.