summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/query_planner_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/query_planner_test.cpp')
-rw-r--r--src/mongo/db/query/query_planner_test.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp
index 7b9642011e5..32084f95db5 100644
--- a/src/mongo/db/query/query_planner_test.cpp
+++ b/src/mongo/db/query/query_planner_test.cpp
@@ -33,7 +33,6 @@
#include "mongo/db/query/query_planner_test_lib.h"
#include <ostream>
-#include <sstream>
#include "mongo/db/jsobj.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"
@@ -203,18 +202,14 @@ namespace {
return solns.size();
}
- void dumpSolutions(ostream& ost) const {
+ void dumpSolutions(mongoutils::str::stream& ost) const {
for (vector<QuerySolution*>::const_iterator it = solns.begin();
it != solns.end();
++it) {
- ost << (*it)->toString() << endl;
+ ost << (*it)->toString() << '\n';
}
}
- void dumpSolutions() const {
- dumpSolutions(std::cout);
- }
-
/**
* Checks number solutions. Generates assertion message
* containing solution dump if applicable.
@@ -223,11 +218,11 @@ namespace {
if (getNumSolutions() == expectSolutions) {
return;
}
- std::stringstream ss;
+ mongoutils::str::stream ss;
ss << "expected " << expectSolutions << " solutions but got " << getNumSolutions()
- << " instead. solutions generated: " << std::endl;
+ << " instead. solutions generated: " << '\n';
dumpSolutions(ss);
- FAIL(ss.str());
+ FAIL(ss);
}
size_t numSolutionMatches(const string& solnJson) const {
@@ -256,12 +251,12 @@ namespace {
if (numMatches == matches) {
return;
}
- std::stringstream ss;
+ mongoutils::str::stream ss;
ss << "expected " << numMatches << " matches for solution " << solnJson
<< " but got " << matches
- << " instead. all solutions generated: " << std::endl;
+ << " instead. all solutions generated: " << '\n';
dumpSolutions(ss);
- FAIL(ss.str());
+ FAIL(ss);
}
/**
@@ -280,12 +275,12 @@ namespace {
if (1U == matches) {
return;
}
- std::stringstream ss;
+ mongoutils::str::stream ss;
ss << "assertHasOneSolutionOf expected one matching solution"
<< " but got " << matches
- << " instead. all solutions generated: " << std::endl;
+ << " instead. all solutions generated: " << '\n';
dumpSolutions(ss);
- FAIL(ss.str());
+ FAIL(ss);
}
BSONObj queryObj;