vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake
nicole mazzuca 0e1dc12185
[rollup] Rollup PR 2021-07-16 (#19001)
* [rollup:2021-07-16 1/7] PR #18201 (@JackBoosY)

[vcpkg-cmake] Add check for unused cmake variables

* [rollup:2021-07-16 2/7] PR #18397 (@strega-nil)

[vcpkg_list] add new function

* [rollup:2021-07-16 3/7] PR #18782 (@strega-nil)

[scripts-audit] vcpkg_build_ninja

* [rollup:2021-07-16 4/7] PR #18784 (@strega-nil)

[scripts-audit] vcpkg_minimum_required

* [rollup:2021-07-16 5/7] PR #18785 (@strega-nil)

[scripts-audit] vcpkg_replace_string

* [rollup:2021-07-16 6/7] PR #18786 (@strega-nil)

[scripts-audit] windows scripts

* [rollup:2021-07-16 7/7] PR #18945 (@strega-nil)

[many ports] remove deprecated vcpkg_check_features call [1/5]

Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
Co-authored-by: PhoebeHui <20694052+PhoebeHui@users.noreply.github.com>
2021-07-20 10:24:58 -07:00

64 lines
1.6 KiB
CMake

# these both set `args` in the top level
function(check_function_args start)
z_vcpkg_function_arguments(out "${start}")
set(args "${out}" PARENT_SCOPE)
endfunction()
function(check_all_function_args)
z_vcpkg_function_arguments(out)
set(args "${out}" PARENT_SCOPE)
endfunction()
unit_test_ensure_fatal_error([[check_function_args(-1)]])
unit_test_ensure_fatal_error([[check_function_args(3)]])
unit_test_ensure_fatal_error([[check_function_args(notanumber)]])
unit_test_check_variable_equal(
[[check_all_function_args()]]
args ""
)
unit_test_check_variable_equal(
[[check_all_function_args("")]]
args ""
)
unit_test_check_variable_equal(
[[check_all_function_args("" "")]]
args ";"
)
unit_test_check_variable_equal(
[[check_all_function_args("" "" "" "")]]
args ";;;"
)
unit_test_check_variable_equal(
[[check_all_function_args(a b c)]]
args "a;b;c"
)
unit_test_check_variable_equal(
[[check_function_args(2 a b c)]]
args "b;c"
)
unit_test_check_variable_equal(
[[check_function_args(3 a b c)]]
args "c"
)
unit_test_check_variable_equal(
[=[check_all_function_args("a;b" [[c\;d]] e)]=]
args [[a\;b;c\\;d;e]]
)
unit_test_check_variable_equal(
[=[check_all_function_args("a;b" [[c\;d]] [[e\\;f]])]=]
args [[a\;b;c\\;d;e\\\;f]]
)
unit_test_check_variable_equal(
[=[check_function_args(2 "a;b" [[c\;d]] e)]=]
args [[c\\;d;e]]
)
unit_test_check_variable_equal(
[=[check_function_args(3 "a;b" [[c\;d]] e)]=]
args "e"
)
unit_test_check_variable_equal(
[=[check_function_args(4 "a;b" [[c\;d]] e)]=]
args ""
)