summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-03-13 17:34:06 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-03-13 17:34:06 (GMT)
commitedf200a50b7f5857a6230239917024bca6748060 (patch)
treed35f5fd53e3426d54e17aabb680b4db8e5672cc1 /Tests
parent0707e0d422d2333c7907071774336481947d4354 (diff)
parent1823ab4d76d8efe79bed85328a3f8c74c7d625bd (diff)
downloadCMake-edf200a50b7f5857a6230239917024bca6748060.zip
CMake-edf200a50b7f5857a6230239917024bca6748060.tar.gz
CMake-edf200a50b7f5857a6230239917024bca6748060.tar.bz2
Merge topic 'ExternalData-escape-semicolons'
1823ab4 ExternalData: Preserve escaped semicolons during argument expansion
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Module/ExternalData/CMakeLists.txt1
-rw-r--r--Tests/Module/ExternalData/Data1Check.cmake10
-rw-r--r--Tests/RunCMake/ExternalData/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon1-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon1.cmake14
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon2-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon2.cmake14
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon3-stdout.txt1
-rw-r--r--Tests/RunCMake/ExternalData/Semicolon3.cmake12
9 files changed, 57 insertions, 0 deletions
diff --git a/Tests/Module/ExternalData/CMakeLists.txt b/Tests/Module/ExternalData/CMakeLists.txt
index a379dca..8312dca 100644
--- a/Tests/Module/ExternalData/CMakeLists.txt
+++ b/Tests/Module/ExternalData/CMakeLists.txt
@@ -35,6 +35,7 @@ ExternalData_Add_Test(Data1
-D Paired=DATA{PairedA.dat,PairedB.dat}
-D Meta=DATA{MetaTop.dat,REGEX:Meta[ABC].dat}
-D Directory=DATA{Directory/,A.dat,REGEX:[BC].dat}
+ -D "Semicolons=DATA{Data.dat}\\;DATA{Data.dat}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/Data1Check.cmake
)
ExternalData_Add_Target(Data1)
diff --git a/Tests/Module/ExternalData/Data1Check.cmake b/Tests/Module/ExternalData/Data1Check.cmake
index f40b76c..5770245 100644
--- a/Tests/Module/ExternalData/Data1Check.cmake
+++ b/Tests/Module/ExternalData/Data1Check.cmake
@@ -56,3 +56,13 @@ foreach(n A B C)
message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!")
endif()
endforeach()
+list(LENGTH Semicolons len)
+if("${len}" EQUAL 2)
+ foreach(file ${Semicolons})
+ if(NOT EXISTS "${file}")
+ message(SEND_ERROR "Input file:\n ${file}\ndoes not exist!")
+ endif()
+ endforeach()
+else()
+ message(SEND_ERROR "Semicolons value:\n ${Semicolons}\nis not a list of length 2.")
+endif()
diff --git a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
index 5ee46c9..ceb2ecf 100644
--- a/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalData/RunCMakeTest.cmake
@@ -21,4 +21,7 @@ run_cmake(NormalData2)
run_cmake(NormalData3)
run_cmake(NormalDataSub1)
run_cmake(NotUnderRoot)
+run_cmake(Semicolon1)
+run_cmake(Semicolon2)
+run_cmake(Semicolon3)
run_cmake(SubDirectory1)
diff --git a/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt
new file mode 100644
index 0000000..361baeb
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon1-stdout.txt
@@ -0,0 +1 @@
+-- Data arguments correctly transformed!
diff --git a/Tests/RunCMake/ExternalData/Semicolon1.cmake b/Tests/RunCMake/ExternalData/Semicolon1.cmake
new file mode 100644
index 0000000..c832860
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon1.cmake
@@ -0,0 +1,14 @@
+include(ExternalData)
+set(ExternalData_URL_TEMPLATES
+ "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)"
+ )
+set(input Data.txt)
+set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt)
+ExternalData_Expand_Arguments(Data args DATA{${input}} "a\\;b" "c;d" DATA{${input}})
+set(expect "${output};a\\;b;c;d;${output}")
+if("x${args}" STREQUAL "x${expect}")
+ message(STATUS "Data arguments correctly transformed!")
+else()
+ message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n"
+ "but we expected:\n ${expect}")
+endif()
diff --git a/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt
new file mode 100644
index 0000000..361baeb
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon2-stdout.txt
@@ -0,0 +1 @@
+-- Data arguments correctly transformed!
diff --git a/Tests/RunCMake/ExternalData/Semicolon2.cmake b/Tests/RunCMake/ExternalData/Semicolon2.cmake
new file mode 100644
index 0000000..1a1ae5f
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon2.cmake
@@ -0,0 +1,14 @@
+include(ExternalData)
+set(ExternalData_URL_TEMPLATES
+ "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)"
+ )
+set(input Data.txt)
+set(output ${CMAKE_CURRENT_BINARY_DIR}/Data.txt)
+ExternalData_Expand_Arguments(Data args "DATA{${input}};a\\;b;c;d;DATA{${input}}")
+set(expect "${output};a\\;b;c;d;${output}")
+if("x${args}" STREQUAL "x${expect}")
+ message(STATUS "Data arguments correctly transformed!")
+else()
+ message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n"
+ "but we expected:\n ${expect}")
+endif()
diff --git a/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt b/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt
new file mode 100644
index 0000000..ca4a360
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon3-stdout.txt
@@ -0,0 +1 @@
+-- Data arguments correctly not transformed!
diff --git a/Tests/RunCMake/ExternalData/Semicolon3.cmake b/Tests/RunCMake/ExternalData/Semicolon3.cmake
new file mode 100644
index 0000000..2ae99da
--- /dev/null
+++ b/Tests/RunCMake/ExternalData/Semicolon3.cmake
@@ -0,0 +1,12 @@
+include(ExternalData)
+set(ExternalData_URL_TEMPLATES
+ "file:///${CMAKE_CURRENT_SOURCE_DIR}/%(algo)/%(hash)"
+ )
+set(input "DATA{a;b}")
+ExternalData_Expand_Arguments(Data args "${input}")
+if("x${args}" STREQUAL "x${input}")
+ message(STATUS "Data arguments correctly not transformed!")
+else()
+ message(FATAL_ERROR "Data arguments transformed to:\n ${args}\n"
+ "but we expected:\n ${input}")
+endif()