aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlanscut <wp_scut@163.com>2024-06-19 10:43:55 +0800
committerAlan Wang <wp_scut@163.com>2024-06-19 10:58:01 +0800
commit424ce4ce9668f288fb4ab665775546d3ed709e96 (patch)
treeb4b4f1382054c7962eec1b9bf511f41282315cbc
parent324973008ced4ea03d1626a00915d0399ecbd9db (diff)
downloadcjson-424ce4ce9668f288fb4ab665775546d3ed709e96.tar.gz
cjson-424ce4ce9668f288fb4ab665775546d3ed709e96.zip
Revert "feat: add tests for #842" to fix test failures
This reverts commit 5b502cdbfb21fbe5f6cf9ffbd2b96e4281a741e6. Related to #860
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/misc_tests.c18
2 files changed, 0 insertions, 19 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 9e8962f..c759221 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -62,7 +62,6 @@ if(ENABLE_CJSON_TEST)
option(ENABLE_VALGRIND OFF "Enable the valgrind memory checker for the tests.")
if (ENABLE_VALGRIND)
- add_compile_definitions(ENABLE_VALGRIND)
find_program(MEMORYCHECK_COMMAND valgrind)
if ("${MEMORYCHECK_COMMAND}" MATCHES "MEMORYCHECK_COMMAND-NOTFOUND")
message(WARNING "Valgrind couldn't be found.")
diff --git a/tests/misc_tests.c b/tests/misc_tests.c
index 94dd91a..ba3e003 100644
--- a/tests/misc_tests.c
+++ b/tests/misc_tests.c
@@ -732,23 +732,6 @@ static void cjson_set_bool_value_must_not_break_objects(void)
cJSON_Delete(sobj);
}
-static void deallocated_pointers_should_be_set_to_null(void)
-{
- /* deallocated pointers should be set to null */
- /* however, valgrind on linux reports when attempting to access a freed memory, we have to skip it */
-#ifndef ENABLE_VALGRIND
- cJSON *string = cJSON_CreateString("item");
- cJSON *root = cJSON_CreateObject();
-
- cJSON_Delete(string);
- free(string->valuestring);
-
- cJSON_AddObjectToObject(root, "object");
- cJSON_Delete(root->child);
- free(root->child->string);
-#endif
-}
-
int CJSON_CDECL main(void)
{
UNITY_BEGIN();
@@ -779,7 +762,6 @@ int CJSON_CDECL main(void)
RUN_TEST(cjson_delete_item_from_array_should_not_broken_list_structure);
RUN_TEST(cjson_set_valuestring_to_object_should_not_leak_memory);
RUN_TEST(cjson_set_bool_value_must_not_break_objects);
- RUN_TEST(deallocated_pointers_should_be_set_to_null);
return UNITY_END();
}