diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2018-02-11 13:20:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-02-16 15:04:47 (GMT) |
commit | 689eeb67cb87a9ed1d91a4971806488d00e68f42 (patch) | |
tree | 403880ec3c332705d11c5293940e143fa1a4aa9c /Tests | |
parent | e24cda008e3ea1cbb22d17d29c5c39999facb4b7 (diff) | |
download | CMake-689eeb67cb87a9ed1d91a4971806488d00e68f42.zip CMake-689eeb67cb87a9ed1d91a4971806488d00e68f42.tar.gz CMake-689eeb67cb87a9ed1d91a4971806488d00e68f42.tar.bz2 |
string: Add JOIN subcommand
This is just like CONCAT but accepts a glue string to put between
each value. `JOIN ""` is equivalent to `CONCAT`.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/string/Join.cmake | 16 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoArgs-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoArgs-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoArgs.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoVar-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoVar-stderr.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/string/JoinNoVar.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/string/RunCMakeTest.cmake | 4 |
8 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/string/Join.cmake b/Tests/RunCMake/string/Join.cmake new file mode 100644 index 0000000..081f1e4 --- /dev/null +++ b/Tests/RunCMake/string/Join.cmake @@ -0,0 +1,16 @@ +string(JOIN % out) +if(NOT out STREQUAL "") + message(FATAL_ERROR "\"string(JOIN % out)\" set out to \"${out}\"") +endif() +string(JOIN % out a) +if(NOT out STREQUAL "a") + message(FATAL_ERROR "\"string(JOIN % out a)\" set out to \"${out}\"") +endif() +string(JOIN % out a "b") +if(NOT out STREQUAL "a%b") + message(FATAL_ERROR "\"string(JOIN % out a \"b\")\" set out to \"${out}\"") +endif() +string(JOIN :: out a "b") +if(NOT out STREQUAL "a::b") + message(FATAL_ERROR "\"string(JOIN :: out a \"b\")\" set out to \"${out}\"") +endif() diff --git a/Tests/RunCMake/string/JoinNoArgs-result.txt b/Tests/RunCMake/string/JoinNoArgs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JoinNoArgs-stderr.txt b/Tests/RunCMake/string/JoinNoArgs-stderr.txt new file mode 100644 index 0000000..d9dcec3 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JoinNoArgs.cmake:1 \(string\): + string sub-command JOIN requires at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/JoinNoArgs.cmake b/Tests/RunCMake/string/JoinNoArgs.cmake new file mode 100644 index 0000000..35ba4d9 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoArgs.cmake @@ -0,0 +1 @@ +string(JOIN) diff --git a/Tests/RunCMake/string/JoinNoVar-result.txt b/Tests/RunCMake/string/JoinNoVar-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/string/JoinNoVar-stderr.txt b/Tests/RunCMake/string/JoinNoVar-stderr.txt new file mode 100644 index 0000000..90701a9 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at JoinNoVar.cmake:1 \(string\): + string sub-command JOIN requires at least two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/string/JoinNoVar.cmake b/Tests/RunCMake/string/JoinNoVar.cmake new file mode 100644 index 0000000..35f7b92 --- /dev/null +++ b/Tests/RunCMake/string/JoinNoVar.cmake @@ -0,0 +1 @@ +string(JOIN ";") diff --git a/Tests/RunCMake/string/RunCMakeTest.cmake b/Tests/RunCMake/string/RunCMakeTest.cmake index 513d1e3..211337a 100644 --- a/Tests/RunCMake/string/RunCMakeTest.cmake +++ b/Tests/RunCMake/string/RunCMakeTest.cmake @@ -9,6 +9,10 @@ run_cmake(PrependNoArgs) run_cmake(Concat) run_cmake(ConcatNoArgs) +run_cmake(Join) +run_cmake(JoinNoArgs) +run_cmake(JoinNoVar) + run_cmake(Timestamp) run_cmake(TimestampEmpty) run_cmake(TimestampInvalid) |