json-c/1f8b64f62c76cb23a8eb041fdde341db604aae75.patch

78 lines
1.9 KiB
Diff
Raw Normal View History

From 1f8b64f62c76cb23a8eb041fdde341db604aae75 Mon Sep 17 00:00:00 2001
From: Alexandru Ardelean <ardeleanalex@gmail.com>
Date: Fri, 16 Apr 2021 09:32:07 +0300
Subject: [PATCH] tests: CMakeLists.txt: move test names to variable
The intent is to be able to disable some features that get built into the
library. When we do that, we also need to disable some tests.
It's easier when adjusting a variable that contains the list of test names,
versus modifying the list in the foreach() statement.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
---
tests/CMakeLists.txt | 50 +++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 24 deletions(-)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0c5c26e910..cccb5dfc70 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,30 +12,32 @@ target_link_libraries(test2Formatted PRIVATE ${PROJECT_NAME})
include_directories(PUBLIC ${CMAKE_SOURCE_DIR})
-foreach(TESTNAME
- test1
- test2
- test4
- testReplaceExisting
- test_cast
- test_charcase
- test_compare
- test_deep_copy
- test_double_serializer
- test_float
- test_int_add
- test_json_pointer
- test_locale
- test_null
- test_parse
- test_parse_int64
- test_printbuf
- test_set_serializer
- test_set_value
- test_strerror
- test_util_file
- test_visit
- test_object_iterator)
+set(ALL_TEST_NAMES
+ test1
+ test2
+ test4
+ testReplaceExisting
+ test_cast
+ test_charcase
+ test_compare
+ test_deep_copy
+ test_double_serializer
+ test_float
+ test_int_add
+ test_json_pointer
+ test_locale
+ test_null
+ test_parse
+ test_parse_int64
+ test_printbuf
+ test_set_serializer
+ test_set_value
+ test_strerror
+ test_util_file
+ test_visit
+ test_object_iterator)
+
+foreach(TESTNAME ${ALL_TEST_NAMES})
add_executable(${TESTNAME} ${TESTNAME}.c)
if(${TESTNAME} STREQUAL test_strerror OR ${TESTNAME} STREQUAL test_util_file)