Browse Source

separgs: Migrate tests to RunCMake tests

Christian Pfeiffer 8 years ago
parent
commit
81841426fc

+ 0 - 1
Tests/CMakeTests/CMakeLists.txt

@@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "")
 AddCMakeTest(Version "")
 AddCMakeTest(Message "")
 AddCMakeTest(File "")
-AddCMakeTest(SeparateArguments "")
 AddCMakeTest(ImplicitLinkInfo "")
 AddCMakeTest(ModuleNotices "")
 AddCMakeTest(GetProperty "")

+ 0 - 25
Tests/CMakeTests/SeparateArgumentsTest.cmake.in

@@ -1,25 +0,0 @@
-set(old_out "a b  c")
-separate_arguments(old_out)
-set(old_exp "a;b;;c")
-
-set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
-set(unix_exp "a;b c;d e;\;; '\";';\"")
-separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}")
-
-set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
-set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
-separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}")
-
-foreach(mode old unix windows)
-  if(NOT "${${mode}_out}" STREQUAL "${${mode}_exp}")
-    message(FATAL_ERROR "separate_arguments ${mode}-style failed.  "
-      "Expected\n  [${${mode}_exp}]\nbut got\n  [${${mode}_out}]\n")
-  endif()
-endforeach()
-
-set(nothing)
-separate_arguments(nothing)
-if(DEFINED nothing)
-  message(FATAL_ERROR "separate_arguments null-case failed: "
-    "nothing=[${nothing}]")
-endif()

+ 1 - 0
Tests/RunCMake/CMakeLists.txt

@@ -216,6 +216,7 @@ add_RunCMake_test(list)
 add_RunCMake_test(message)
 add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
 add_RunCMake_test(return)
+add_RunCMake_test(separate_arguments)
 add_RunCMake_test(set_property)
 add_RunCMake_test(string)
 foreach(var

+ 3 - 0
Tests/RunCMake/separate_arguments/CMakeLists.txt

@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)

+ 6 - 0
Tests/RunCMake/separate_arguments/EmptyCommand.cmake

@@ -0,0 +1,6 @@
+set(nothing)
+separate_arguments(nothing)
+if(DEFINED nothing)
+  message(FATAL_ERROR "separate_arguments null-case failed: "
+    "nothing=[${nothing}]")
+endif()

+ 8 - 0
Tests/RunCMake/separate_arguments/PlainCommand.cmake

@@ -0,0 +1,8 @@
+set(old_out "a b  c")
+separate_arguments(old_out)
+set(old_exp "a;b;;c")
+
+if(NOT "${old_out}" STREQUAL "${old_exp}")
+  message(FATAL_ERROR "separate_arguments old-style failed.  "
+    "Expected\n  [${old_exp}]\nbut got\n  [${old_out}]\n")
+endif()

+ 6 - 0
Tests/RunCMake/separate_arguments/RunCMakeTest.cmake

@@ -0,0 +1,6 @@
+include(RunCMake)
+
+run_cmake(EmptyCommand)
+run_cmake(PlainCommand)
+run_cmake(UnixCommand)
+run_cmake(WindowsCommand)

+ 8 - 0
Tests/RunCMake/separate_arguments/UnixCommand.cmake

@@ -0,0 +1,8 @@
+set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
+set(unix_exp "a;b c;d e;\;; '\";';\"")
+separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}")
+
+if(NOT "${unix_out}" STREQUAL "${unix_exp}")
+  message(FATAL_ERROR "separate_arguments unix-style failed.  "
+    "Expected\n  [${unix_exp}]\nbut got\n  [${unix_out}]\n")
+endif()

+ 8 - 0
Tests/RunCMake/separate_arguments/WindowsCommand.cmake

@@ -0,0 +1,8 @@
+set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
+set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
+separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}")
+
+if(NOT "${windows_out}" STREQUAL "${windows_exp}")
+  message(FATAL_ERROR "separate_arguments windows-style failed.  "
+    "Expected\n  [${windows_exp}]\nbut got\n  [${windows_out}]\n")
+endif()