summaryrefslogtreecommitdiffstats
path: root/Tests/ComplexRelativePaths
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-14 13:30:50 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-07-14 13:30:50 (GMT)
commit308db351cc51397e22e50ab42898358556f1fece (patch)
treef4715d2afab1f162caa6747d76e0380aa94a8f2e /Tests/ComplexRelativePaths
parent0af5ef0e999da5fac5d3dc602cc1b4d16c09e57f (diff)
downloadCMake-308db351cc51397e22e50ab42898358556f1fece.zip
CMake-308db351cc51397e22e50ab42898358556f1fece.tar.gz
CMake-308db351cc51397e22e50ab42898358556f1fece.tar.bz2
ENH: Add a test for cmGeneratedFileStream
Diffstat (limited to 'Tests/ComplexRelativePaths')
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx69
1 files changed, 69 insertions, 0 deletions
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 85fe299..6b88e85 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/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