Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rolf Eike Beer
KWSys
Commits
c97d98bd
Commit
c97d98bd
authored
19 years ago
by
Sebastien Barre
Browse files
Options
Downloads
Patches
Plain Diff
ENH: add kwsys test for DetectFileType
parent
f7e092fa
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+8
-0
8 additions, 0 deletions
CMakeLists.txt
testSystemTools.cxx
+30
-0
30 additions, 0 deletions
testSystemTools.cxx
testSystemTools.h.in
+20
-0
20 additions, 0 deletions
testSystemTools.h.in
with
58 additions
and
0 deletions
CMakeLists.txt
+
8
−
0
View file @
c97d98bd
...
...
@@ -635,6 +635,14 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
ENDIF
(
EXECUTABLE_OUTPUT_PATH
)
IF
(
BUILD_TESTING
)
GET_TARGET_PROPERTY
(
TEST_SYSTEMTOOLS_EXE testSystemTools LOCATION
)
SET
(
TEST_SYSTEMTOOLS_SRC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/testSystemTools.cxx"
)
CONFIGURE_FILE
(
${
PROJECT_SOURCE_DIR
}
/testSystemTools.h.in
${
PROJECT_BINARY_DIR
}
/testSystemTools.h
)
INCLUDE_DIRECTORIES
(
${
PROJECT_BINARY_DIR
}
)
IF
(
CTEST_TEST_KWSYS
)
CONFIGURE_FILE
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/ExtraTest.cmake.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/ExtraTest.cmake"
)
...
...
This diff is collapsed.
Click to expand it.
testSystemTools.cxx
+
30
−
0
View file @
c97d98bd
...
...
@@ -27,6 +27,8 @@
# include "kwsys_ios_iostream.h.in"
#endif
#include
"testSystemTools.h"
//----------------------------------------------------------------------------
const
char
*
toUnixPaths
[][
2
]
=
{
...
...
@@ -90,6 +92,32 @@ bool CheckEscapeChars(kwsys_stl::string input,
return
true
;
}
//----------------------------------------------------------------------------
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*/
)
{
...
...
@@ -115,5 +143,7 @@ int main(/*int argc, char* argv*/)
*
checkEscapeChars
[
cc
][
2
],
checkEscapeChars
[
cc
][
3
]);
}
res
&=
CheckDetectFileType
();
return
res
?
0
:
1
;
}
This diff is collapsed.
Click to expand it.
testSystemTools.h.in
0 → 100644
+
20
−
0
View file @
c97d98bd
/*=========================================================================
Program: KWSys - Kitware System Library
Module: testSystemTools.h.in
Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef @KWSYS_NAMESPACE@_testSystemtools_h
#define @KWSYS_NAMESPACE@_testSystemtools_h
#define TEST_SYSTEMTOOLS_EXE "@TEST_SYSTEMTOOLS_EXE@"
#define TEST_SYSTEMTOOLS_SRC "@TEST_SYSTEMTOOLS_SRC@"
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment