diff options
author | Dimitar Yordanov <dimitar.yordanov@sap.com> | 2016-02-21 18:38:16 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-02-24 15:07:30 (GMT) |
commit | 430251245e1d6bff24db128491d8c5b3e1bb8357 (patch) | |
tree | d5a384822c1958fb6b1b91f7272fe0490f68e1e4 /Tests | |
parent | 2039bf40e47c795ab1e57821b44b8a15c5c80775 (diff) | |
download | CMake-430251245e1d6bff24db128491d8c5b3e1bb8357.zip CMake-430251245e1d6bff24db128491d8c5b3e1bb8357.tar.gz CMake-430251245e1d6bff24db128491d8c5b3e1bb8357.tar.bz2 |
cmake_parse_arguments: Additional regression tests
Add regression tests for the arguments handling in
cmake_parse_arguments. The tests were run also against cmake 3.4.1
maint branch to verify that there are no regressions.
Signed-off-by: Dimitar Yordanov <dimitar.yordanov@sap.com>
Signed-off-by: Matthias Maennich <matthias.maennich@sap.com>
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake | 20 | ||||
-rw-r--r-- | Tests/RunCMake/cmake_parse_arguments/Initialization.cmake | 9 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake index 72c82ab..028bfaf 100644 --- a/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/CornerCases.cmake @@ -29,6 +29,26 @@ macro(foo) endmacro() foo(FOO foo) +TEST(_FOO1_FOO foo) +TEST(_FOO2_FOO foo) +# Make sure a list is split +foo(FOO "foo;bar") TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") TEST(_FOO2_FOO foo) +TEST(_FOO2_UNPARSED_ARGUMENTS "bar") + +# Do not split if argn is quoted +foo(FOO "foo\\;bar") +TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") +TEST(_FOO2_FOO foo;bar) +TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED") + +# Do not split if argn is quoted +foo(FOO "foo\\\\;bar") +TEST(_FOO1_FOO foo) +TEST(_FOO1_UNPARSED_ARGUMENTS "bar") +TEST(_FOO2_FOO foo;bar) +TEST(_FOO2_UNPARSED_ARGUMENTS "UNDEFINED") diff --git a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake index 462f923..b4199ea 100644 --- a/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/Initialization.cmake @@ -25,6 +25,9 @@ TEST(pref_OPT1 TRUE) cmake_parse_arguments(pref "OPT1;OPT2" "" "" OPT1 OPT2) TEST(pref_OPT1 TRUE) TEST(pref_OPT2 TRUE) +cmake_parse_arguments(pref "OPT1;OPT2" "" "" "OPT1;OPT2") +TEST(pref_OPT1 TRUE) +TEST(pref_OPT2 TRUE) cmake_parse_arguments(pref "OPT1;OPT2" "" "") TEST(pref_OPT1 FALSE) TEST(pref_OPT2 FALSE) @@ -44,6 +47,9 @@ TEST(pref_SINGLE1 foo) cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" SINGLE1 foo SINGLE2 bar) TEST(pref_SINGLE1 foo) TEST(pref_SINGLE2 bar) +cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "" "SINGLE1;foo;SINGLE2;bar") +TEST(pref_SINGLE1 foo) +TEST(pref_SINGLE2 bar) cmake_parse_arguments(pref "" "SINGLE1;SINGLE2" "") TEST(pref_SINGLE1 UNDEFINED) TEST(pref_SINGLE2 UNDEFINED) @@ -63,6 +69,9 @@ TEST(pref_MULTI1 foo) cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" MULTI1 foo bar MULTI2 bar foo) TEST(pref_MULTI1 foo bar) TEST(pref_MULTI2 bar foo) +cmake_parse_arguments(pref "" "" "MULTI1;MULTI2" "MULTI1;foo;bar;MULTI2;bar;foo") +TEST(pref_MULTI1 foo bar) +TEST(pref_MULTI2 bar foo) cmake_parse_arguments(pref "" "" "MULTI1;MULTI2") TEST(pref_MULTI1 UNDEFINED) TEST(pref_MULTI2 UNDEFINED) |