diff options
Diffstat (limited to 'indra/test/test.cpp')
-rw-r--r-- | indra/test/test.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/indra/test/test.cpp b/indra/test/test.cpp index 06128e0902..48f20b2e79 100644 --- a/indra/test/test.cpp +++ b/indra/test/test.cpp @@ -156,7 +156,8 @@ public: // so that destroying the shared_ptr makes no attempt to delete std::cout. mStream(boost::shared_ptr<std::ostream>(&std::cout, boost::lambda::_1)), mReplayer(replayer) - { + if (stream) + { if (stream) { // We want a boost::iostreams::tee_device that will stream to two @@ -183,11 +184,11 @@ public: } virtual void group_started(const std::string& name) { - std::cout << "Unit test group_started name=" << name << std::endl; + *mStream << "Unit test group_started name=" << name << std::endl; } virtual void group_completed(const std::string& name) { - std::cout << "Unit test group_completed name=" << name << std::endl; + *mStream << "Unit test group_completed name=" << name << std::endl; } virtual void test_completed(const tut::test_result& tr) @@ -502,7 +503,7 @@ int main(int argc, char **argv) apr_getopt_t* os = NULL; if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv)) { - std::cerr << "Unable to pool" << std::endl; + std::cerr << "apr_getopt_init() failed" << std::endl; return 1; } @@ -516,7 +517,7 @@ int main(int argc, char **argv) apr_status_t apr_err; const char* opt_arg = NULL; int opt_id = 0; - std::ofstream *output = NULL; + boost::scoped_ptr<std::ofstream> output; const char *touch = NULL; while(true) @@ -546,7 +547,7 @@ int main(int argc, char **argv) verbose_mode = true; break; case 'o': - output = new std::ofstream; + output.reset(new std::ofstream); output->open(opt_arg); break; case 's': // --sourcedir @@ -618,12 +619,6 @@ int main(int argc, char **argv) std::cin.get(); } - if (output) - { - output->close(); - delete output; - } - if (touch && success) { std::ofstream s; |