summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2015-07-06 20:28:04 (GMT)
committerBrad King <brad.king@kitware.com>2015-07-07 13:23:21 (GMT)
commit2b18cdcaba48ffeee753d97d8241dbf2a8333493 (patch)
tree6f87bea38ccac379a746d349179824f802fef30e /Tests
parent7e86f567aca6b913689dc2d8c17a17936284b811 (diff)
downloadCMake-2b18cdcaba48ffeee753d97d8241dbf2a8333493.zip
CMake-2b18cdcaba48ffeee753d97d8241dbf2a8333493.tar.gz
CMake-2b18cdcaba48ffeee753d97d8241dbf2a8333493.tar.bz2
string: add APPEND subcommand
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/string/Append.cmake58
-rw-r--r--Tests/RunCMake/string/AppendNoArgs-result.txt1
-rw-r--r--Tests/RunCMake/string/AppendNoArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/string/AppendNoArgs.cmake1
-rw-r--r--Tests/RunCMake/string/RunCMakeTest.cmake3
5 files changed, 67 insertions, 0 deletions
diff --git a/Tests/RunCMake/string/Append.cmake b/Tests/RunCMake/string/Append.cmake
new file mode 100644
index 0000000..2634274
--- /dev/null
+++ b/Tests/RunCMake/string/Append.cmake
@@ -0,0 +1,58 @@
+set(out)
+string(APPEND out)
+if(DEFINED out)
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+set(out "")
+string(APPEND out)
+if(NOT out STREQUAL "")
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+set(out x)
+string(APPEND out)
+if(NOT out STREQUAL "x")
+ message(FATAL_ERROR "\"string(APPEND out)\" set out to \"${out}\"")
+endif()
+
+
+set(out)
+string(APPEND out a)
+if(NOT out STREQUAL "a")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+set(out "")
+string(APPEND out a)
+if(NOT out STREQUAL "a")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+set(out x)
+string(APPEND out a)
+if(NOT out STREQUAL "xa")
+ message(FATAL_ERROR "\"string(APPEND out a)\" set out to \"${out}\"")
+endif()
+
+
+set(out x)
+string(APPEND out a "b")
+if(NOT out STREQUAL "xab")
+ message(FATAL_ERROR "\"string(APPEND out a \"b\")\" set out to \"${out}\"")
+endif()
+
+set(b)
+set(out x)
+string(APPEND out ${b})
+if(NOT out STREQUAL "x")
+ message(FATAL_ERROR "\"string(APPEND out \${b})\" set out to \"${out}\"")
+endif()
+
+set(b b)
+set(out x)
+string(APPEND out a "${b}" [[
+${c}]])
+if(NOT out STREQUAL "xab\${c}")
+ message(FATAL_ERROR "\"string(APPEND out a \"\${b}\" [[\${c}]])\" set out to \"${out}\"")
+endif()
diff --git a/Tests/RunCMake/string/AppendNoArgs-result.txt b/Tests/RunCMake/string/AppendNoArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/string/AppendNoArgs-stderr.txt b/Tests/RunCMake/string/AppendNoArgs-stderr.txt
new file mode 100644
index 0000000..75ad427
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at AppendNoArgs.cmake:1 \(string\):
+ string sub-command APPEND requires at least one argument.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/string/AppendNoArgs.cmake b/Tests/RunCMake/string/AppendNoArgs.cmake
new file mode 100644
index 0000000..f54fb77
--- /dev/null
+++ b/Tests/RunCMake/string/AppendNoArgs.cmake
@@ -0,0 +1 @@
+string(APPEND)
diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake
index 89f7ea5..8067d9d 100644
--- a/Tests/RunCMake/string/RunCMakeTest.cmake
+++ b/Tests/RunCMake/string/RunCMakeTest.cmake
@@ -1,5 +1,8 @@
include(RunCMake)
+run_cmake(Append)
+run_cmake(AppendNoArgs)
+
run_cmake(Concat)
run_cmake(ConcatNoArgs)