diff options
author | Ashley Whetter <ashley@awhetter.co.uk> | 2016-01-28 21:29:10 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-02-03 16:13:17 (GMT) |
commit | 0205f882ae252998686f65b843a758268b4c62bc (patch) | |
tree | 33c19806797e81f6ef65ee3fbe53b0c1188dae72 /Tests/RunCMake/list | |
parent | a58abc69c23ef30fc2215eb72878af29f7e860fd (diff) | |
download | CMake-0205f882ae252998686f65b843a758268b4c62bc.zip CMake-0205f882ae252998686f65b843a758268b4c62bc.tar.gz CMake-0205f882ae252998686f65b843a758268b4c62bc.tar.bz2 |
list: Add FILTER subcommand (#3986)
Create a `list(FILTER)` command to filter lists by regular expression.
Diffstat (limited to 'Tests/RunCMake/list')
25 files changed, 61 insertions, 0 deletions
diff --git a/Tests/RunCMake/list/EmptyFilterRegex-result.txt b/Tests/RunCMake/list/EmptyFilterRegex-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex-stderr.txt diff --git a/Tests/RunCMake/list/EmptyFilterRegex.cmake b/Tests/RunCMake/list/EmptyFilterRegex.cmake new file mode 100644 index 0000000..33849cd --- /dev/null +++ b/Tests/RunCMake/list/EmptyFilterRegex.cmake @@ -0,0 +1,2 @@ +set(mylist "") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-NotList-result.txt b/Tests/RunCMake/list/FILTER-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-NotList-stderr.txt b/Tests/RunCMake/list/FILTER-NotList-stderr.txt new file mode 100644 index 0000000..159c28d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-NotList.cmake:2 \(list\): + list sub-command FILTER requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-NotList.cmake b/Tests/RunCMake/list/FILTER-NotList.cmake new file mode 100644 index 0000000..1e15635 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(FILTER nosuchlist EXCLUDE REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt new file mode 100644 index 0000000..7f783fa --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidMode.cmake:2 \(list\): + list sub-command FILTER does not recognize mode NOOP +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake new file mode 100644 index 0000000..e02b929 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidMode.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE NOOP "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt new file mode 100644 index 0000000..94f2427 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidOperator.cmake:2 \(list\): + list sub-command FILTER does not recognize operator RM +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake new file mode 100644 index 0000000..9624622 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidOperator.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist RM REGEX "^FILTER_THIS_.+") diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt new file mode 100644 index 0000000..9e98cbf --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-InvalidRegex.cmake:2 \(list\): + list sub-command FILTER, mode REGEX failed to compile regex "UHOH!\)\(". +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake new file mode 100644 index 0000000..0641062 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-InvalidRegex.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "UHOH!)(") diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt new file mode 100644 index 0000000..ec7f41c --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at FILTER-REGEX-TooManyArguments.cmake:2 \(list\): + list sub-command FILTER, mode REGEX requires five arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake new file mode 100644 index 0000000..d9cd8eb --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-TooManyArguments.cmake @@ -0,0 +1,2 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+" one_too_many) diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt new file mode 100644 index 0000000..d9ba38d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: DO_NOT_FILTER_THIS;thisisanitem$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake new file mode 100644 index 0000000..f395e61 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid0.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist EXCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt new file mode 100644 index 0000000..5e5280d --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1-stderr.txt @@ -0,0 +1,2 @@ +^mylist was: FILTER_THIS_BIT;DO_NOT_FILTER_THIS;thisisanitem;FILTER_THIS_THING +mylist is: FILTER_THIS_BIT;FILTER_THIS_THING$ diff --git a/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake new file mode 100644 index 0000000..e659281 --- /dev/null +++ b/Tests/RunCMake/list/FILTER-REGEX-Valid1.cmake @@ -0,0 +1,4 @@ +set(mylist FILTER_THIS_BIT DO_NOT_FILTER_THIS thisisanitem FILTER_THIS_THING) +message("mylist was: ${mylist}") +list(FILTER mylist INCLUDE REGEX "^FILTER_THIS_.+") +message("mylist is: ${mylist}") diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 25d6a03..b002ab3 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -1,5 +1,6 @@ include(RunCMake) +run_cmake(EmptyFilterRegex) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) @@ -8,17 +9,25 @@ run_cmake(NoArguments) run_cmake(InvalidSubcommand) run_cmake(GET-CMP0007-WARN) +run_cmake(FILTER-REGEX-InvalidRegex) run_cmake(GET-InvalidIndex) run_cmake(INSERT-InvalidIndex) run_cmake(REMOVE_AT-InvalidIndex) +run_cmake(FILTER-REGEX-TooManyArguments) run_cmake(LENGTH-TooManyArguments) run_cmake(REMOVE_DUPLICATES-TooManyArguments) run_cmake(REVERSE-TooManyArguments) run_cmake(SORT-TooManyArguments) +run_cmake(FILTER-NotList) run_cmake(REMOVE_AT-NotList) run_cmake(REMOVE_DUPLICATES-NotList) run_cmake(REMOVE_ITEM-NotList) run_cmake(REVERSE-NotList) run_cmake(SORT-NotList) + +run_cmake(FILTER-REGEX-InvalidMode) +run_cmake(FILTER-REGEX-InvalidOperator) +run_cmake(FILTER-REGEX-Valid0) +run_cmake(FILTER-REGEX-Valid1) |