separgs: Migrate tests to RunCMake tests

This commit is contained in:
Christian Pfeiffer 2017-04-26 20:26:47 +02:00
parent 41b84b2220
commit 81841426fc
9 changed files with 40 additions and 26 deletions

View File

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

View File

@ -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()

View File

@ -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

View File

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

View File

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

View File

@ -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()

View File

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

View File

@ -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()

View File

@ -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()