summaryrefslogtreecommitdiffstats
path: root/Source/cmDumpDocumentation.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-07-24 14:58:40 (GMT)
committerBrad King <brad.king@kitware.com>2003-07-24 14:58:40 (GMT)
commit08441daded83d314c95016b1a6f7bb047b85e0f2 (patch)
tree9ced40f442855405d882bc06c2a3c494475a314d /Source/cmDumpDocumentation.cxx
parent1a0ca7264885f953a8adbe90ae5d6b9dfdf9142c (diff)
downloadCMake-08441daded83d314c95016b1a6f7bb047b85e0f2.zip
CMake-08441daded83d314c95016b1a6f7bb047b85e0f2.tar.gz
CMake-08441daded83d314c95016b1a6f7bb047b85e0f2.tar.bz2
ENH: Added CommandLineTest to add coverage for command line arguments to cmake executables. This replaces the old DumpDocumentation test.
Diffstat (limited to 'Source/cmDumpDocumentation.cxx')
-rw-r--r--Source/cmDumpDocumentation.cxx42
1 files changed, 35 insertions, 7 deletions
diff --git a/Source/cmDumpDocumentation.cxx b/Source/cmDumpDocumentation.cxx
index 0b474c4..0155ac2 100644
--- a/Source/cmDumpDocumentation.cxx
+++ b/Source/cmDumpDocumentation.cxx
@@ -41,7 +41,9 @@ static const cmDocumentationEntry cmDocumentationUsage[] =
static const cmDocumentationEntry cmDocumentationDescription[] =
{
{0,
- "CMake reads ... ", 0},
+ "The \"DumpDocumentation\" executable is only available in the build "
+ "tree. It is used for testing, coverage, and documentation.", 0},
+ CMAKE_STANDARD_INTRODUCTION,
{0,0,0}
};
@@ -73,7 +75,7 @@ int DumpHTML(const char* outname)
return 0;
}
-int DumpForCoverage()
+int DumpForCoverageToStream(std::ostream& out)
{
cmake cmi;
cmDocumentation doc;
@@ -87,13 +89,31 @@ int DumpForCoverage()
doc.SetOptionsSection(cmDocumentationOptions);
doc.SetCommandsSection(&commands[0]);
doc.SetGeneratorsSection(&generators[0]);
- doc.PrintDocumentation(cmDocumentation::Usage, std::cout);
- doc.PrintDocumentation(cmDocumentation::Full, std::cout);
- doc.PrintDocumentation(cmDocumentation::HTML, std::cout);
- doc.PrintDocumentation(cmDocumentation::Man, std::cout);
+ doc.PrintDocumentation(cmDocumentation::Usage, out);
+ doc.PrintDocumentation(cmDocumentation::Full, out);
+ doc.PrintDocumentation(cmDocumentation::HTML, out);
+ doc.PrintDocumentation(cmDocumentation::Man, out);
return 0;
}
+int DumpForCoverage(const char* outname)
+{
+ if(outname)
+ {
+ std::ofstream fout(outname);
+ if(!fout)
+ {
+ std::cerr << "failed to open output file: " << outname << "\n";
+ return -1;
+ }
+ return DumpForCoverageToStream(fout);
+ }
+ else
+ {
+ return DumpForCoverageToStream(std::cout);
+ }
+}
+
int main(int ac, char** av)
{
cmSystemTools::EnableMSVCDebugHook();
@@ -104,6 +124,14 @@ int main(int ac, char** av)
if(strcmp(av[1], "--all-for-coverage") == 0)
{
coverage = true;
+ if(ac > 2)
+ {
+ outname = av[2];
+ }
+ else
+ {
+ outname = 0;
+ }
}
else
{
@@ -113,7 +141,7 @@ int main(int ac, char** av)
if(coverage)
{
- return DumpForCoverage();
+ return DumpForCoverage(outname);
}
else
{