ENH: if no arguments are given and there is only one test, then run it

This commit is contained in:
Bill Hoffman 2002-03-26 12:37:25 -05:00
parent 8d594bdcce
commit f4bf694bae
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,7 @@
// cmCreateTestSourceList // cmCreateTestSourceList
bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn) bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
{ {
if (argsIn.size() < 5) if (argsIn.size() < 3)
{ {
this->SetError("called with wrong number of arguments."); this->SetError("called with wrong number of arguments.");
return false; return false;
@ -75,6 +75,9 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
fout << " int i;\n"; fout << " int i;\n";
fout << " if(ac < 2)\n"; fout << " if(ac < 2)\n";
fout << " {\n"; fout << " {\n";
fout << " // if there is only one test, then run it with the arguments\n";
fout << " if(NumTests == 1)\n";
fout << " { return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av); }\n";
fout << " printf(\"Available tests:\\n\");\n"; fout << " printf(\"Available tests:\\n\");\n";
fout << " for(i =0; i < NumTests; ++i)\n"; fout << " for(i =0; i < NumTests; ++i)\n";
fout << " {\n"; fout << " {\n";
@ -97,6 +100,9 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
fout << " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac-1, av+1);\n"; fout << " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac-1, av+1);\n";
fout << " }\n"; fout << " }\n";
fout << " }\n"; fout << " }\n";
fout << " // if there is only one test, then run it with the arguments\n";
fout << " if(NumTests == 1)\n";
fout << " { return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av); }\n";
fout << " printf(\"Available tests:\\n\");\n"; fout << " printf(\"Available tests:\\n\");\n";
fout << " for(i =0; i < NumTests; ++i)\n"; fout << " for(i =0; i < NumTests; ++i)\n";
fout << " {\n"; fout << " {\n";