From e73b7d634c66e73f80a4ba1521354de00a0db885 Mon Sep 17 00:00:00 2001 From: James Cohan Date: Thu, 13 Aug 2015 17:08:32 -0400 Subject: [PATCH] SERVER-9625 Logging arguments of failed test case in expression unit tests --- src/mongo/db/pipeline/expression_test.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp index cfe9361ecc5..fdb8f50c11b 100644 --- a/src/mongo/db/pipeline/expression_test.cpp +++ b/src/mongo/db/pipeline/expression_test.cpp @@ -51,12 +51,18 @@ static void assertExpectedResults( std::string expression, std::initializer_list, 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; + } } }