diff --git a/src/main.cpp b/src/main.cpp index ba23ff80d..153f539a3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include +#include #include #include @@ -108,18 +109,20 @@ int main(int argc, char* argv[]) } else if (vm.count("test")) { - std::vector vCmd; - int iCmd = vm.count("parameters"); + int iCmd = vm.count("parameters"); + std::vector pvCmd; + + pvCmd.push_back(argv[0]); if (iCmd) + { + std::vector vCmd; + vCmd = vm["parameters"].as >(); - std::vector pvCmd; - - pvCmd.resize(iCmd); - - for (int i=0; i != iCmd; ++i) - pvCmd[i] = (char*) (vCmd[i].c_str()); + BOOST_FOREACH(std::string& param, vCmd) + pvCmd.push_back(const_cast(param.c_str())); + } iResult = unit_test_main(init_unit_test, iCmd, &pvCmd[0]); }