diff options
author | Brad King <brad.king@kitware.com> | 2015-07-14 13:41:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-14 14:25:38 (GMT) |
commit | e5ca59b456d3a1a51d0b5387ec9d04a51beaa0be (patch) | |
tree | 6166bc6a150f2a319c946e6395fc3636267e7bb6 /Tests/RunCMake/list | |
parent | 0699e0d3e4305fc4e615c36b831d0171c2f8c757 (diff) | |
download | CMake-e5ca59b456d3a1a51d0b5387ec9d04a51beaa0be.zip CMake-e5ca59b456d3a1a51d0b5387ec9d04a51beaa0be.tar.gz CMake-e5ca59b456d3a1a51d0b5387ec9d04a51beaa0be.tar.bz2 |
Tests: Move command failure cases into RunCMake infrastructure
Move failure cases from the CMake.{If,List,While,GetProperty} tests over
to the RunCMake.{if,list,while,get_property} tests to use the more
modern infrastructure. This also avoids using REGEX_ESCAPE_STRING to
try to regex-match full paths.
Diffstat (limited to 'Tests/RunCMake/list')
45 files changed, 126 insertions, 0 deletions
diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt new file mode 100644 index 0000000..a0f8837 --- /dev/null +++ b/Tests/RunCMake/list/GET-CMP0007-WARN-stderr.txt @@ -0,0 +1,8 @@ +^CMake Warning \(dev\) at GET-CMP0007-WARN.cmake:4 \(list\): + Policy CMP0007 is not set: list command no longer ignores empty elements. + Run "cmake --help-policy CMP0007" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. List has value = + \[;NEW;OLD\]. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/list/GET-CMP0007-WARN.cmake b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake new file mode 100644 index 0000000..833f352 --- /dev/null +++ b/Tests/RunCMake/list/GET-CMP0007-WARN.cmake @@ -0,0 +1,7 @@ +cmake_policy(VERSION 2.4) +set(thelist "" NEW OLD) + +list(GET thelist 1 thevalue) +if (NOT thevalue STREQUAL "OLD") + message(SEND_ERROR "returned element '${thevalue}', but expected 'OLD'") +endif() diff --git a/Tests/RunCMake/list/GET-InvalidIndex-result.txt b/Tests/RunCMake/list/GET-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt new file mode 100644 index 0000000..0409464 --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at GET-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/GET-InvalidIndex.cmake b/Tests/RunCMake/list/GET-InvalidIndex.cmake new file mode 100644 index 0000000..178295a --- /dev/null +++ b/Tests/RunCMake/list/GET-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(GET mylist 3 result) diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt new file mode 100644 index 0000000..6e15c0b --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at INSERT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/INSERT-InvalidIndex.cmake b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake new file mode 100644 index 0000000..4103d97 --- /dev/null +++ b/Tests/RunCMake/list/INSERT-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(INSERT mylist 3 delta) diff --git a/Tests/RunCMake/list/InvalidSubcommand-result.txt b/Tests/RunCMake/list/InvalidSubcommand-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/InvalidSubcommand-stderr.txt b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt new file mode 100644 index 0000000..74703d2 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at InvalidSubcommand.cmake:1 \(list\): + list does not recognize sub-command NO_SUCH_SUBCOMMAND +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/InvalidSubcommand.cmake b/Tests/RunCMake/list/InvalidSubcommand.cmake new file mode 100644 index 0000000..f35a118 --- /dev/null +++ b/Tests/RunCMake/list/InvalidSubcommand.cmake @@ -0,0 +1 @@ +list(NO_SUCH_SUBCOMMAND mylist) diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt new file mode 100644 index 0000000..239e708 --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at LENGTH-TooManyArguments.cmake:1 \(list\): + list sub-command LENGTH requires two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake new file mode 100644 index 0000000..327db6a --- /dev/null +++ b/Tests/RunCMake/list/LENGTH-TooManyArguments.cmake @@ -0,0 +1 @@ +list(LENGTH mylist result one_too_many) diff --git a/Tests/RunCMake/list/NoArguments-result.txt b/Tests/RunCMake/list/NoArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/NoArguments-stderr.txt b/Tests/RunCMake/list/NoArguments-stderr.txt new file mode 100644 index 0000000..6fdf9cc --- /dev/null +++ b/Tests/RunCMake/list/NoArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at NoArguments.cmake:1 \(list\): + list must be called with at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/NoArguments.cmake b/Tests/RunCMake/list/NoArguments.cmake new file mode 100644 index 0000000..7916aaa --- /dev/null +++ b/Tests/RunCMake/list/NoArguments.cmake @@ -0,0 +1 @@ +list() diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt new file mode 100644 index 0000000..6f58875 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-InvalidIndex.cmake:2 \(list\): + list index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake new file mode 100644 index 0000000..d4f3921 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-InvalidIndex.cmake @@ -0,0 +1,2 @@ +set(mylist alpha bravo charlie) +list(REMOVE_AT mylist 3) diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt new file mode 100644 index 0000000..d6e8d85 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_AT-NotList.cmake:2 \(list\): + list sub-command REMOVE_AT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_AT-NotList.cmake b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake new file mode 100644 index 0000000..5266c7f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_AT-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_AT nosuchlist 0) diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt new file mode 100644 index 0000000..96f3446 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-NotList.cmake:2 \(list\): + list sub-command REMOVE_DUPLICATES requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake new file mode 100644 index 0000000..218f227 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_DUPLICATES nosuchlist) diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt new file mode 100644 index 0000000..f5c8711 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_DUPLICATES-TooManyArguments.cmake:1 \(list\): + list sub-command REMOVE_DUPLICATES only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake new file mode 100644 index 0000000..b5eb46e --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_DUPLICATES-TooManyArguments.cmake @@ -0,0 +1 @@ +list(REMOVE_DUPLICATES mylist one_too_many) diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt new file mode 100644 index 0000000..c32a4c0 --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REMOVE_ITEM-NotList.cmake:2 \(list\): + list sub-command REMOVE_ITEM requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake new file mode 100644 index 0000000..079e7fb --- /dev/null +++ b/Tests/RunCMake/list/REMOVE_ITEM-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REMOVE_ITEM nosuchlist alpha) diff --git a/Tests/RunCMake/list/REVERSE-NotList-result.txt b/Tests/RunCMake/list/REVERSE-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-NotList-stderr.txt b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt new file mode 100644 index 0000000..e9dcc06 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-NotList.cmake:2 \(list\): + list sub-command REVERSE requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REVERSE-NotList.cmake b/Tests/RunCMake/list/REVERSE-NotList.cmake new file mode 100644 index 0000000..977e2cc --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(REVERSE nosuchlist) diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt new file mode 100644 index 0000000..7dabd9d --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at REVERSE-TooManyArguments.cmake:1 \(list\): + list sub-command REVERSE only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake new file mode 100644 index 0000000..3a554a0 --- /dev/null +++ b/Tests/RunCMake/list/REVERSE-TooManyArguments.cmake @@ -0,0 +1 @@ +list(REVERSE mylist one_too_many) diff --git a/Tests/RunCMake/list/RunCMakeTest.cmake b/Tests/RunCMake/list/RunCMakeTest.cmake index 555051d..25d6a03 100644 --- a/Tests/RunCMake/list/RunCMakeTest.cmake +++ b/Tests/RunCMake/list/RunCMakeTest.cmake @@ -3,3 +3,22 @@ include(RunCMake) run_cmake(EmptyGet0) run_cmake(EmptyRemoveAt0) run_cmake(EmptyInsert-1) + +run_cmake(NoArguments) +run_cmake(InvalidSubcommand) +run_cmake(GET-CMP0007-WARN) + +run_cmake(GET-InvalidIndex) +run_cmake(INSERT-InvalidIndex) +run_cmake(REMOVE_AT-InvalidIndex) + +run_cmake(LENGTH-TooManyArguments) +run_cmake(REMOVE_DUPLICATES-TooManyArguments) +run_cmake(REVERSE-TooManyArguments) +run_cmake(SORT-TooManyArguments) + +run_cmake(REMOVE_AT-NotList) +run_cmake(REMOVE_DUPLICATES-NotList) +run_cmake(REMOVE_ITEM-NotList) +run_cmake(REVERSE-NotList) +run_cmake(SORT-NotList) diff --git a/Tests/RunCMake/list/SORT-NotList-result.txt b/Tests/RunCMake/list/SORT-NotList-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-NotList-stderr.txt b/Tests/RunCMake/list/SORT-NotList-stderr.txt new file mode 100644 index 0000000..396c5b5 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-NotList.cmake:2 \(list\): + list sub-command SORT requires list to be present. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-NotList.cmake b/Tests/RunCMake/list/SORT-NotList.cmake new file mode 100644 index 0000000..8f48e10 --- /dev/null +++ b/Tests/RunCMake/list/SORT-NotList.cmake @@ -0,0 +1,2 @@ +unset(nosuchlist) +list(SORT nosuchlist) diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-result.txt b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt new file mode 100644 index 0000000..d3fad60 --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at SORT-TooManyArguments.cmake:1 \(list\): + list sub-command SORT only takes one argument. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/list/SORT-TooManyArguments.cmake b/Tests/RunCMake/list/SORT-TooManyArguments.cmake new file mode 100644 index 0000000..81b195d --- /dev/null +++ b/Tests/RunCMake/list/SORT-TooManyArguments.cmake @@ -0,0 +1 @@ +list(SORT mylist one_too_many) |