Fix for 1091599.
[awesomized/libmemcached] / libtest / framework.cc
index 6cca8450abcbcffbc4a7672518acb96a668c0f0f..30f511afdbf484850dc5cb18125888e8f332040d 100644 (file)
  *
  */
 
-#include <config.h>
+#include "libtest/yatlcon.h"
 
 #include <libtest/common.h>
 #include <libtest/collection.h>
 #include <libtest/signal.h>
 
+#include <algorithm>
 #include <fnmatch.h>
 #include <iostream>
 
@@ -86,12 +87,8 @@ Framework::~Framework()
 
   delete _runner;
 
-  for (std::vector<Collection*>::iterator iter= _collection.begin();
-       iter != _collection.end();
-       ++iter)
-  {
-    delete *iter;
-  }
+  std::for_each(_collection.begin(), _collection.end(), DeleteFromVector());
+  _collection.clear();
 }
 
 bool Framework::match(const char* arg)
@@ -118,8 +115,7 @@ void Framework::exec()
 
     _total++;
 
-    try
-    {
+    try {
       switch ((*iter)->exec())
       {
       case TEST_FAILURE:
@@ -137,15 +133,15 @@ void Framework::exec()
         break;
       }
     }
-    catch (libtest::fatal& e)
+    catch (const libtest::fatal& e)
     {
       _failed++;
-      stream::cerr(e.file(), e.line(), e.func()) << e.mesg();
+      stream::cerr(e.file(), e.line(), e.func()) << e.what();
     }
-    catch (libtest::disconnected& e)
+    catch (const libtest::disconnected& e)
     {
       _failed++;
-      stream::cerr(e.file(), e.line(), e.func()) << "Unhandled disconnection occurred: " << e.mesg();
+      Error << "Unhandled disconnection occurred:" << e.what();
       throw;
     }
     catch (...)