diff options
author | Brad King <brad.king@kitware.com> | 2002-11-06 22:35:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2002-11-06 22:35:27 (GMT) |
commit | 42c464c05e8f79f82babf83909d918bf26317425 (patch) | |
tree | 10589e522b1acf98fea7f81a6430052c446c6082 /Tests | |
parent | 5417d02a61dfaed3377a017b2ffeaea66f8344ce (diff) | |
download | CMake-42c464c05e8f79f82babf83909d918bf26317425.zip CMake-42c464c05e8f79f82babf83909d918bf26317425.tar.gz CMake-42c464c05e8f79f82babf83909d918bf26317425.tar.bz2 |
ENH: Added STRING command.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Complex/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/CMakeLists.txt | 17 |
3 files changed, 51 insertions, 0 deletions
diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index bcc56a5..aa4bb4b 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -212,6 +212,23 @@ CONFIGURE_FILE( ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES) +# Test regular expression commands. +STRING(REGEX MATCH "b" RESULT "abc") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX MATCHALL "b" RESULT "abcb") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX REPLACE "(b)" "[\\1]" RESULT "abcde") +IF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") + SET(STRING_REGEX_PASSED 1) +ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") +IF(NOT STRING_REGEX_PASSED) + MESSAGE(SEND_ERROR "STRING(REGEX REPLACE ... ) test failed.") +ENDIF(NOT STRING_REGEX_PASSED) + # # Create the libs and the main exe # diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index bcc56a5..aa4bb4b 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -212,6 +212,23 @@ CONFIGURE_FILE( ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES) +# Test regular expression commands. +STRING(REGEX MATCH "b" RESULT "abc") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX MATCHALL "b" RESULT "abcb") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX REPLACE "(b)" "[\\1]" RESULT "abcde") +IF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") + SET(STRING_REGEX_PASSED 1) +ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") +IF(NOT STRING_REGEX_PASSED) + MESSAGE(SEND_ERROR "STRING(REGEX REPLACE ... ) test failed.") +ENDIF(NOT STRING_REGEX_PASSED) + # # Create the libs and the main exe # diff --git a/Tests/ComplexRelativePaths/CMakeLists.txt b/Tests/ComplexRelativePaths/CMakeLists.txt index bcc56a5..aa4bb4b 100644 --- a/Tests/ComplexRelativePaths/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/CMakeLists.txt @@ -212,6 +212,23 @@ CONFIGURE_FILE( ${Complex_SOURCE_DIR}/cmTestConfigureEscape.h.in ${Complex_BINARY_DIR}/cmTestConfigureEscape.h ESCAPE_QUOTES) +# Test regular expression commands. +STRING(REGEX MATCH "b" RESULT "abc") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCH ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX MATCHALL "b" RESULT "abcb") +IF(NOT RESULT) + MESSAGE(SEND_ERROR "STRING(REGEX MATCHALL ... ) test failed.") +ENDIF(NOT RESULT) +STRING(REGEX REPLACE "(b)" "[\\1]" RESULT "abcde") +IF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") + SET(STRING_REGEX_PASSED 1) +ENDIF("x${RESULT}" MATCHES "^xa\\[b\\]cde$") +IF(NOT STRING_REGEX_PASSED) + MESSAGE(SEND_ERROR "STRING(REGEX REPLACE ... ) test failed.") +ENDIF(NOT STRING_REGEX_PASSED) + # # Create the libs and the main exe # |