mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-9625 Logging arguments of failed test case in expression unit tests
This commit is contained in:
parent
e13d0ca1b0
commit
e73b7d634c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user