summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-07-21 14:16:22 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-07-21 14:16:26 (GMT)
commit81005ff16b9fe0177e6d5bea29d087ec1a658716 (patch)
treee4c74391d6283386f88e1c96fc9a6c912ee83f30 /Tests/RunCMake
parentb7e8b0e2604f36294f34228b912d94f321ec381d (diff)
parentb7941641430feeefadc6f16e2cecf6b50bd9fbe3 (diff)
downloadCMake-81005ff16b9fe0177e6d5bea29d087ec1a658716.zip
CMake-81005ff16b9fe0177e6d5bea29d087ec1a658716.tar.gz
CMake-81005ff16b9fe0177e6d5bea29d087ec1a658716.tar.bz2
Merge topic 'string-clear-intermediate-matches'
b7941641 cmStringCommand: clear intermediate matches Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1065
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/string/RegexMultiMatchClear-stderr.txt12
-rw-r--r--Tests/RunCMake/string/RegexMultiMatchClear.cmake20
-rw-r--r--Tests/RunCMake/string/RunCMakeTest.cmake1
3 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/string/RegexMultiMatchClear-stderr.txt b/Tests/RunCMake/string/RegexMultiMatchClear-stderr.txt
new file mode 100644
index 0000000..4360d79
--- /dev/null
+++ b/Tests/RunCMake/string/RegexMultiMatchClear-stderr.txt
@@ -0,0 +1,12 @@
+^matches: Some::;Scope
+results from: string\(REGEX MATCHALL\)
+CMAKE_MATCH_0: -->Scope<--
+CMAKE_MATCH_1: -->Scope<--
+CMAKE_MATCH_2: --><--
+CMAKE_MATCH_COUNT: -->1<--
+replace: \[Some\]\[Scope\]
+results from: string\(REGEX REPLACE\)
+CMAKE_MATCH_0: -->Scope<--
+CMAKE_MATCH_1: -->Scope<--
+CMAKE_MATCH_2: --><--
+CMAKE_MATCH_COUNT: -->1<--$
diff --git a/Tests/RunCMake/string/RegexMultiMatchClear.cmake b/Tests/RunCMake/string/RegexMultiMatchClear.cmake
new file mode 100644
index 0000000..80b6b3c
--- /dev/null
+++ b/Tests/RunCMake/string/RegexMultiMatchClear.cmake
@@ -0,0 +1,20 @@
+cmake_minimum_required (VERSION 3.0)
+project (RegexClear NONE)
+
+function (output_results msg)
+ message("results from: ${msg}")
+ message("CMAKE_MATCH_0: -->${CMAKE_MATCH_0}<--")
+ message("CMAKE_MATCH_1: -->${CMAKE_MATCH_1}<--")
+ message("CMAKE_MATCH_2: -->${CMAKE_MATCH_2}<--")
+ message("CMAKE_MATCH_COUNT: -->${CMAKE_MATCH_COUNT}<--")
+endfunction ()
+
+set(haystack "Some::Scope")
+
+string(REGEX MATCHALL "^([^:]+)(::)?" matches "${haystack}")
+message("matches: ${matches}")
+output_results("string(REGEX MATCHALL)")
+
+string(REGEX REPLACE "^([^:]+)(::)?" "[\\1]" replace "${haystack}")
+message("replace: ${replace}")
+output_results("string(REGEX REPLACE)")
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
index 38a77b0..32b61b5 100644
--- a/Tests/RunCMake/string/RunCMakeTest.cmake
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -20,6 +20,7 @@ run_cmake(UuidMissingTypeValue)
run_cmake(UuidBadType)
run_cmake(RegexClear)
+run_cmake(RegexMultiMatchClear)
run_cmake(UTF-16BE)
run_cmake(UTF-16LE)