summaryrefslogtreecommitdiffstats
path: root/Tests/StringFileTest
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-21 17:48:18 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-21 17:48:18 (GMT)
commit187a58430b1f52e3e2a8a91ad26e2212183fe654 (patch)
tree4e3466476af6a743083047fd90fb447c9dd7e597 /Tests/StringFileTest
parent8540b88e69d0812be903fac3fbd0c8a18e595a7a (diff)
downloadCMake-187a58430b1f52e3e2a8a91ad26e2212183fe654.zip
CMake-187a58430b1f52e3e2a8a91ad26e2212183fe654.tar.gz
CMake-187a58430b1f52e3e2a8a91ad26e2212183fe654.tar.bz2
ENH: add more coverage tests
Diffstat (limited to 'Tests/StringFileTest')
-rw-r--r--Tests/StringFileTest/CMakeLists.txt23
1 files changed, 21 insertions, 2 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index b2a62cb..2af415a 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -1,7 +1,10 @@
PROJECT(StringFileTest)
INCLUDE_DIRECTORIES(${StringFileTest_BINARY_DIR})
+# Read file test
FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/InputFile.h.in" infile)
+
+# String test
STRING(REGEX MATCH "[cC][mM][aA][kK][eE]" rmvar "CMake is great")
STRING(REGEX MATCHALL "[cC][mM][aA][kK][eE]" rmallvar "CMake is better than cmake or CMake")
STRING(REGEX REPLACE "[Aa][uU][tT][oO]([cC][oO][nN][fF]|[mM][aA][kK][eE])"
@@ -18,8 +21,20 @@ STRING(ASCII 67 109 97 107 101 savar)
STRING(TOUPPER "CMake" tuvar)
STRING(TOLOWER "CMake" tlvar)
-FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Includes")
+# Escaping test
+SET(var "\\ \" \ \t \n \r \# \( \) \0")
+MESSAGE(STATUS "Output: [${var}]")
+SET(var \\ \" \ \t \n \r \# \( \) \0)
+MESSAGE(STATUS "Output: [${var}]")
+
+# Make directories test
+FILE(MAKE_DIRECTORY
+ "${CMAKE_CURRENT_BINARY_DIR}/Includes"
+ "${CMAKE_CURRENT_BINARY_DIR}/Directory1"
+ "${CMAKE_CURRENT_BINARY_DIR}/Directory2"
+ )
+# Write results to the file (test write file)
SET(file "${CMAKE_CURRENT_BINARY_DIR}/Includes/Values.h")
FILE(WRITE "${file}" "/* this file is generated */\n")
FOREACH(var
@@ -40,7 +55,11 @@ FOREACH(var
FILE(APPEND "${file}" "#define ${var} \"${${var}}\"\n")
ENDFOREACH(var)
+# Write include file to a file
STRING(REGEX REPLACE "includefile" "${file}" outfile "${infile}")
FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/OutputFile.h" "${outfile}")
-ADD_EXECUTABLE(StringFileTest StringFile.cxx)
+# Test file glob
+FILE(GLOB src_files "${CMAKE_CURRENT_SOURCE_DIR}/[sS][!a-su-zA-Z0-9][^a-qs-zA-Z0-9]ing?ile*.cxx")
+
+ADD_EXECUTABLE(StringFileTest ${src_files})