diff options
author | Katherine Walker <katherine.walker@mongodb.com> | 2017-10-04 14:24:18 -0400 |
---|---|---|
committer | Katherine Walker <katherine.walker@mongodb.com> | 2017-10-05 14:09:13 -0400 |
commit | b79c89cb665c85242607d66521fe1a2b91771188 (patch) | |
tree | 38c3747be8fc6f17037d0cff02079d919936ee46 /src/mongo/db/pipeline/expression_test.cpp | |
parent | 9e72a50f1ede62ab9f5899cf8f10dd93ca0c45d1 (diff) | |
download | mongo-b79c89cb665c85242607d66521fe1a2b91771188.tar.gz |
SERVER-31322 Rename year and week field names for $dateToParts and $dateFromParts
Diffstat (limited to 'src/mongo/db/pipeline/expression_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/expression_test.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/db/pipeline/expression_test.cpp b/src/mongo/db/pipeline/expression_test.cpp index 5dbd9ad12ee..41a9da08bd9 100644 --- a/src/mongo/db/pipeline/expression_test.cpp +++ b/src/mongo/db/pipeline/expression_test.cpp @@ -4541,19 +4541,19 @@ TEST_F(ExpressionDateFromPartsTest, OptimizesToConstantIfAllInputsAreConstant) { dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); ASSERT(dynamic_cast<ExpressionConstant*>(dateExp->optimize().get())); - // Test that it becomes a constant if both isoYear, and isoWeekYear are provided, and are both + // Test that it becomes a constant if both isoWeekYear, and isoWeek are provided, and are both // constants. - spec = BSON("$dateFromParts" << BSON("isoYear" << 2017 << "isoWeekYear" << 26)); + spec = BSON("$dateFromParts" << BSON("isoWeekYear" << 2017 << "isoWeek" << 26)); dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); ASSERT(dynamic_cast<ExpressionConstant*>(dateExp->optimize().get())); - // Test that it becomes a constant if both isoYear, isoWeekYear and isoDayOfWeek are provided, + // Test that it becomes a constant if both isoWeekYear, isoWeek and isoDayOfWeek are provided, // and are both expressions which evaluate to constants. - spec = BSON("$dateFromParts" << BSON("isoYear" << BSON("$add" << BSON_ARRAY(1017 << 1000)) - << "isoWeekYear" - << BSON("$add" << BSON_ARRAY(20 << 6)) - << "isoDayOfWeek" - << BSON("$add" << BSON_ARRAY(3 << 2)))); + spec = BSON("$dateFromParts" << BSON("isoWeekYear" << BSON("$add" << BSON_ARRAY(1017 << 1000)) + << "isoWeek" + << BSON("$add" << BSON_ARRAY(20 << 6)) + << "isoDayOfWeek" + << BSON("$add" << BSON_ARRAY(3 << 2)))); dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); ASSERT(dynamic_cast<ExpressionConstant*>(dateExp->optimize().get())); @@ -4573,10 +4573,11 @@ TEST_F(ExpressionDateFromPartsTest, OptimizesToConstantIfAllInputsAreConstant) { dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); ASSERT_FALSE(dynamic_cast<ExpressionConstant*>(dateExp->optimize().get())); - // Test that it does *not* become a constant if both isoYear and isoDayOfWeek are provided, but + // Test that it does *not* become a constant if both isoWeekYear and isoDayOfWeek are provided, + // but // isoDayOfWeek is not a constant. - spec = BSON("$dateFromParts" << BSON("isoYear" << 2017 << "isoDayOfWeek" - << "$isoDayOfWeekday")); + spec = BSON("$dateFromParts" << BSON("isoWeekYear" << 2017 << "isoDayOfWeek" + << "$isoDayOfWeekday")); dateExp = Expression::parseExpression(expCtx, spec, expCtx->variablesParseState); ASSERT_FALSE(dynamic_cast<ExpressionConstant*>(dateExp->optimize().get())); } |