diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2005-10-04 19:09:00 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2005-10-04 19:09:00 (GMT) |
commit | 13627538b9330e0a82f9c570fbdff52df1392c24 (patch) | |
tree | 85e5ed43c891300b434be93dca42dbc88b71605c /Source/kwsys/testSystemTools.cxx | |
parent | 89569f07eda48a5896a153d5b9d123cc05776f3a (diff) | |
download | CMake-13627538b9330e0a82f9c570fbdff52df1392c24.zip CMake-13627538b9330e0a82f9c570fbdff52df1392c24.tar.gz CMake-13627538b9330e0a82f9c570fbdff52df1392c24.tar.bz2 |
ENH: add kwsys test for DetectFileType
Diffstat (limited to 'Source/kwsys/testSystemTools.cxx')
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 484fdf4..7805c2a 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -27,6 +27,8 @@ # include "kwsys_ios_iostream.h.in" #endif +#include "testSystemTools.h" + //---------------------------------------------------------------------------- const char* toUnixPaths[][2] = { @@ -91,6 +93,32 @@ bool CheckEscapeChars(kwsys_stl::string input, } //---------------------------------------------------------------------------- +bool CheckDetectFileType() +{ + bool res = true; + + if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_EXE) != + kwsys::SystemTools::FileTypeBinary) + { + kwsys_ios::cerr + << "Problem with DetectFileType - failed to detect type of: " + << TEST_SYSTEMTOOLS_EXE << kwsys_ios::endl; + res = false; + } + + if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_SRC) != + kwsys::SystemTools::FileTypeText) + { + kwsys_ios::cerr + << "Problem with DetectFileType - failed to detect type of: " + << TEST_SYSTEMTOOLS_SRC << kwsys_ios::endl; + res = false; + } + + return res; +} + +//---------------------------------------------------------------------------- int main(/*int argc, char* argv*/) { bool res = true; @@ -115,5 +143,7 @@ int main(/*int argc, char* argv*/) *checkEscapeChars[cc][2], checkEscapeChars[cc][3]); } + res &= CheckDetectFileType(); + return res ? 0 : 1; } |