ENH: add more coverage tests

This commit is contained in:
Andy Cedilnik 2003-07-21 13:48:18 -04:00
parent 8540b88e69
commit 187a58430b
1 changed files with 21 additions and 2 deletions

View File

@ -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})