summaryrefslogtreecommitdiffstats
path: root/Tests/Complex/Executable/complex.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Complex/Executable/complex.cxx')
-rw-r--r--Tests/Complex/Executable/complex.cxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 85fe299..6b88e85 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -13,6 +13,7 @@ extern "C" {
#include "cmDynamicLoader.h"
#include "cmSystemTools.h"
#include "cmOrderLinkDirectories.h"
+#include "cmGeneratedFileStream.h"
int cm_passed = 0;
int cm_failed = 0;
@@ -179,6 +180,71 @@ void TestDir(const char* filename)
// ======================================================================
+void TestCMGeneratedFileSTream()
+{
+ cmGeneratedFileStream gm;
+ std::string file1 = std::string(BINARY_DIR) + std::string("/generatedFile1");
+ std::string file2 = std::string(BINARY_DIR) + std::string("/generatedFile2");
+ std::string file3 = std::string(BINARY_DIR) + std::string("/generatedFile3");
+ std::string file1tmp = file1 + ".tmp";
+ std::string file2tmp = file2 + ".tmp";
+ std::string file3tmp = file3 + ".tmp";
+ gm.Open(file1.c_str());
+ gm << "This is generated file 1";
+ gm.Close();
+ gm.Open(file2.c_str());
+ gm << "This is generated file 2";
+ gm.Close();
+ gm.Open(file3.c_str());
+ gm << "This is generated file 3";
+ gm.Close();
+ if ( cmSystemTools::FileExists(file1.c_str()) )
+ {
+ if ( cmSystemTools::FileExists(file2.c_str()) )
+ {
+ if ( cmSystemTools::FileExists(file3.c_str()) )
+ {
+ if ( cmSystemTools::FileExists(file1tmp.c_str()) )
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file1tmp.c_str());
+ }
+ else if ( cmSystemTools::FileExists(file2tmp.c_str()) )
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file2tmp.c_str());
+ }
+ else if ( cmSystemTools::FileExists(file3tmp.c_str()) )
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Temporary file is still here: ", file3tmp.c_str());
+ }
+ else
+ {
+ cmPassed("cmGeneratedFileStream works.");
+ }
+ }
+ else
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file3.c_str());
+ }
+ }
+ else
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file2.c_str());
+ }
+ }
+ else
+ {
+ cmFailed("Something wrong with cmGeneratedFileStream. Cannot find file: ", file1.c_str());
+ }
+ cmSystemTools::RemoveFile(file1.c_str());
+ cmSystemTools::RemoveFile(file2.c_str());
+ cmSystemTools::RemoveFile(file3.c_str());
+ cmSystemTools::RemoveFile(file1tmp.c_str());
+ cmSystemTools::RemoveFile(file2tmp.c_str());
+ cmSystemTools::RemoveFile(file3tmp.c_str());
+}
+
+// ======================================================================
+
int main()
{
std::string lib = BINARY_DIR;
@@ -1036,6 +1102,9 @@ int main()
{
cmFailed("CMake cmOrderLinkDirectories failed.");
}
+
+ // Test the generated file stream.
+ TestCMGeneratedFileSTream();
// ----------------------------------------------------------------------
// Summary