diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-08-29 16:01:58 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-08-29 16:01:58 (GMT) |
commit | ef13337c1f4fb7d02b89f54780c50f99d81643a0 (patch) | |
tree | c86f99e977c28bc60bbaa2a943fa57b436d1334b /Tests/StringFileTest/CMakeLists.txt | |
parent | e80acd971cdbd159140e1da76944258f437b96f4 (diff) | |
download | CMake-ef13337c1f4fb7d02b89f54780c50f99d81643a0.zip CMake-ef13337c1f4fb7d02b89f54780c50f99d81643a0.tar.gz CMake-ef13337c1f4fb7d02b89f54780c50f99d81643a0.tar.bz2 |
ENH: added tests for the CMAKE_MATCH_(0..9) variables, which get set by
regex matches (STRING(REGEX), IF(MATCHES))
Alex
Diffstat (limited to 'Tests/StringFileTest/CMakeLists.txt')
-rw-r--r-- | Tests/StringFileTest/CMakeLists.txt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 36d15ce..9768947 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -56,6 +56,39 @@ STRING(TOUPPER "CMake" tuvar) STRING(TOLOWER "CMake" tlvar) STRING(REPLACE "Autoconf" "CMake" repvar "People should use Autoconf") +IF("abc" STREQUAL "xyz") + MESSAGE(SEND_ERROR "Problem with the IF(STREQUAL), \"abc\" and \"xyz\" considered equal") +ENDIF("abc" STREQUAL "xyz") + +IF("CMake is cool" MATCHES "(CMake) (is).+") + IF(NOT "${CMAKE_MATCH_0}" STREQUAL "CMake is cool") + MESSAGE(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"CMake is cool\"") + ENDIF(NOT "${CMAKE_MATCH_0}" STREQUAL "CMake is cool") + IF(NOT "${CMAKE_MATCH_1}" STREQUAL "CMake") + MESSAGE(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"CMake\"") + ENDIF(NOT "${CMAKE_MATCH_1}" STREQUAL "CMake") + IF(NOT "${CMAKE_MATCH_2}" STREQUAL "is") + MESSAGE(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected \"is\"") + ENDIF(NOT "${CMAKE_MATCH_2}" STREQUAL "is") +ELSE("CMake is cool" MATCHES "(CMake) (is).+") + MESSAGE(SEND_ERROR "Problem with the IF(MATCHES), no match found") +ENDIF("CMake is cool" MATCHES "(CMake) (is).+") + +STRING(REGEX MATCH "(People).+CMake" matchResultVar "People should use CMake") +IF(NOT "${matchResultVar}" STREQUAL "People should use CMake") + MESSAGE(SEND_ERROR "STRING(REGEX MATCH) problem: \"${matchResultVar}\", expected \"People should use CMake\"") +ENDIF(NOT "${matchResultVar}" STREQUAL "People should use CMake") +IF(NOT "${CMAKE_MATCH_0}" STREQUAL "People should use CMake") + MESSAGE(SEND_ERROR "CMAKE_MATCH_0 wrong: \"${CMAKE_MATCH_0}\", expected \"People should use CMake\"") +ENDIF(NOT "${CMAKE_MATCH_0}" STREQUAL "People should use CMake") +IF(NOT "${CMAKE_MATCH_1}" STREQUAL "People") + MESSAGE(SEND_ERROR "CMAKE_MATCH_1 wrong: \"${CMAKE_MATCH_1}\", expected \"People\"") +ENDIF(NOT "${CMAKE_MATCH_1}" STREQUAL "People") +IF(NOT "${CMAKE_MATCH_2}" STREQUAL "") + MESSAGE(SEND_ERROR "CMAKE_MATCH_2 wrong: \"${CMAKE_MATCH_2}\", expected empty string") +ENDIF(NOT "${CMAKE_MATCH_2}" STREQUAL "") + + STRING(STRIP " ST1 " ST1) |