ENH: add dump documentation test

This commit is contained in:
Bill Hoffman 2001-08-23 17:40:07 -04:00
parent 852be8a520
commit a4f40c31f1
4 changed files with 18 additions and 12 deletions

View File

@ -53,6 +53,7 @@ LINK_LIBRARIES(CMakeLib)
LINK_DIRECTORIES(${CMake_BINARY_DIR}/Sources)
ADD_EXECUTABLE(cmake cmakemain)
ADD_EXECUTABLE(DumpDocumentation cmDumpDocumentation)
ADD_EXECUTABLE(ctest ctest.cxx cmSystemTools.cxx cmRegularExpression.cxx)
@ -66,6 +67,8 @@ IF(BUILD_TESTING)
CONFIGURE_FILE(
${CMake_SOURCE_DIR}/Source/cmaketest.h.in
${CMake_BINARY_DIR}/Source/cmaketest.h ESCAPE_QUOTES)
ADD_TEST(DumpDocumentation ${CMake_BINARY_DIR}/Source/DumpDocumentation
${CMake_BINARY_DIR}/CMakeDoc.html )
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
${CMake_SOURCE_DIR}/Tests/Simple
${CMake_BINARY_DIR}/Tests/Simple simple )

View File

@ -3,10 +3,20 @@
//
#include "cmMakefile.h"
int main()
int main(int ac, char** av)
{
cmMakefile makefile;
makefile.DumpDocumentationToFile("cmake.txt");
const char* outname = "cmake.html";
if(ac > 1)
{
outname = av[1];
}
std::ofstream fout(outname);
if(!fout)
{
std::cerr << "failed to open output file: " << outname << "\n";
return -1;
}
makefile.DumpDocumentationToFile(fout);
return 0;
}

View File

@ -797,16 +797,9 @@ const char* cmMakefile::GetDefinition(const char* name)
return cmCacheManager::GetInstance()->GetCacheValue(name);
}
int cmMakefile::DumpDocumentationToFile(const char *fileName)
int cmMakefile::DumpDocumentationToFile(std::ostream& f)
{
// Open the supplied filename
std::ofstream f;
f.open(fileName, std::ios::out);
if ( f.fail() )
{
return 0;
}
// Loop over all registered commands and print out documentation
const char *name;

View File

@ -487,7 +487,7 @@ public:
* Dump documentation to a file. If 0 is returned, the
* operation failed.
*/
int DumpDocumentationToFile(const char *fileName);
int DumpDocumentationToFile(std::ostream&);
/**
* Expand all defined varibles in the string.