Ticket #4179: mc-4179-libcheck-fail_unless-deprecated.patch
File mc-4179-libcheck-fail_unless-deprecated.patch, 10.1 KB (added by and, 4 years ago) |
---|
-
tests/lib/search/regex_replace_esc_seq.c
From 1e8ebe86fc5a46395257f37ae9713bb87f3cd065 Mon Sep 17 00:00:00 2001 From: Andreas Mohr <and@gmx.li> Date: Mon, 28 Dec 2020 16:52:04 +0000 Subject: [PATCH] libcheck: replace deprecated fail_unless() function libcheck fail_unless() is deprecated since 0.10.0 also fix -Wformat-extra-args warnings Signed-off-by: Andreas Mohr <and@gmx.li> --- tests/lib/search/regex_replace_esc_seq.c | 6 +++--- tests/lib/strutil/parse_integer.c | 2 +- tests/lib/utilunix__my_system-common.c | 10 +++++----- tests/lib/vfs/tempdir.c | 6 +++--- tests/lib/widget/group_init_destroy.c | 6 +++--- tests/lib/widget/widget_find_by_id.c | 18 +++++++++--------- tests/src/execute__execute_with_vfs_arg.c | 6 +++--- tests/src/filemanager/examine_cd.c | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/lib/search/regex_replace_esc_seq.c b/tests/lib/search/regex_replace_esc_seq.c index 2a6090dbc..c3521ce7f 100644
a b 32 32 /* --------------------------------------------------------------------------------------------- */ 33 33 #define test_helper_check_valid_data( a, b, c, d, e, f ) \ 34 34 { \ 35 fail_unless( a == b, "ret_value != %s", (b) ? "TRUE": "FALSE" ); \36 fail_unless( c == d, "skip_len(%d) != %d", c, d ); \37 if (f!=0) fail_unless( e == f, "ret(%d) != %d", e, f ); \35 ck_assert_msg( a == b, "ret_value != %s", (b) ? "TRUE": "FALSE" ); \ 36 ck_assert_msg( c == d, "skip_len(%d) != %d", c, d ); \ 37 if (f!=0) ck_assert_msg( e == f, "ret(%d) != %d", e, f ); \ 38 38 } 39 39 40 40 #define test_helper_handle_esc_seq( pos, r, skip, flag ) \ -
tests/lib/strutil/parse_integer.c
diff --git a/tests/lib/strutil/parse_integer.c b/tests/lib/strutil/parse_integer.c index f3e5ba357..04b0f7322 100644
a b START_PARAMETRIZED_TEST (parse_integer_test, parse_integer_test_ds) 130 130 actual_result = parse_integer (data->haystack, &invalid); 131 131 132 132 /* then */ 133 fail_unless(invalid == data->invalid && actual_result == data->expected_result,133 ck_assert_msg (invalid == data->invalid && actual_result == data->expected_result, 134 134 "actial ( %" PRIuMAX ") not equal to\nexpected (%" PRIuMAX ")", 135 135 actual_result, data->expected_result); 136 136 } -
tests/lib/utilunix__my_system-common.c
diff --git a/tests/lib/utilunix__my_system-common.c b/tests/lib/utilunix__my_system-common.c index 0ce748899..4cca23127 100644
a b execvp__deinit (void) 245 245 #define VERIFY_SIGACTION__IS_RESTORED(oldact_idx, act_idx) { \ 246 246 struct sigaction *_oldact = (struct sigaction *) g_ptr_array_index(sigaction_oldact__captured, oldact_idx); \ 247 247 struct sigaction *_act = (struct sigaction *) g_ptr_array_index(sigaction_act__captured, act_idx); \ 248 fail_unless(memcmp(_oldact, _act, sizeof(struct sigaction)) == 0, \248 ck_assert_msg (memcmp(_oldact, _act, sizeof(struct sigaction)) == 0, \ 249 249 "sigaction(): oldact[%d] should be equals to act[%d]", oldact_idx, act_idx); \ 250 250 } 251 251 … … execvp__deinit (void) 264 264 VERIFY_SIGACTION__ACT_IGNORED(g_ptr_array_index(sigaction_act__captured, 1)); \ 265 265 { \ 266 266 struct sigaction *_act = g_ptr_array_index(sigaction_act__captured, 2); \ 267 fail_unless(memcmp (_act, &startup_handler, sizeof(struct sigaction)) == 0, \267 ck_assert_msg (memcmp (_act, &startup_handler, sizeof(struct sigaction)) == 0, \ 268 268 "The 'act' in third call to sigaction() should be equals to startup_handler"); \ 269 269 } \ 270 270 \ … … execvp__deinit (void) 272 272 VERIFY_SIGACTION__IS_RESTORED (1, 4); \ 273 273 VERIFY_SIGACTION__IS_RESTORED (2, 5); \ 274 274 \ 275 fail_unless(g_ptr_array_index(sigaction_oldact__captured, 3) == NULL, \275 ck_assert_msg (g_ptr_array_index(sigaction_oldact__captured, 3) == NULL, \ 276 276 "oldact in fourth call to sigaction() should be NULL"); \ 277 fail_unless(g_ptr_array_index(sigaction_oldact__captured, 4) == NULL, \277 ck_assert_msg (g_ptr_array_index(sigaction_oldact__captured, 4) == NULL, \ 278 278 "oldact in fifth call to sigaction() should be NULL"); \ 279 fail_unless(g_ptr_array_index(sigaction_oldact__captured, 5) == NULL, \279 ck_assert_msg (g_ptr_array_index(sigaction_oldact__captured, 5) == NULL, \ 280 280 "oldact in sixth call to sigaction() should be NULL"); \ 281 281 } 282 282 -
tests/lib/vfs/tempdir.c
diff --git a/tests/lib/vfs/tempdir.c b/tests/lib/vfs/tempdir.c index 8c5f3b359..5324572f7 100644
a b START_TEST (test_mc_tmpdir) 78 78 env_tmpdir = g_getenv ("MC_TMPDIR"); 79 79 80 80 /* then */ 81 fail_unless(g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR),81 ck_assert_msg (g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR), 82 82 "\nNo such directory: %s\n", tmpdir); 83 83 mctest_assert_str_eq (env_tmpdir, tmpdir); 84 84 } … … START_TEST (test_mc_mkstemps) 105 105 /* then */ 106 106 close (fd); 107 107 mctest_assert_int_ne (fd, -1); 108 fail_unless(g_file_test108 ck_assert_msg (g_file_test 109 109 (vfs_path_as_str (pname_vpath), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), 110 110 "\nNo such file: %s\n", vfs_path_as_str (pname_vpath)); 111 111 unlink (vfs_path_as_str (pname_vpath)); 112 fail_unless(strncmp (vfs_path_as_str (pname_vpath), begin_pname, strlen (begin_pname)) == 0,112 ck_assert_msg (strncmp (vfs_path_as_str (pname_vpath), begin_pname, strlen (begin_pname)) == 0, 113 113 "\nstart of %s should be equal to %s\n", vfs_path_as_str (pname_vpath), 114 114 begin_pname); 115 115 vfs_path_free (pname_vpath); -
tests/lib/widget/group_init_destroy.c
diff --git a/tests/lib/widget/group_init_destroy.c b/tests/lib/widget/group_init_destroy.c index 56fbec41e..9e3ed6fd9 100644
a b START_TEST (test_group_init_deinit) 115 115 widget_init (w0, 5, 5, 10, 10, widget_callback, NULL); 116 116 group_add_widget (g, w0); 117 117 118 fail_unless(w0->id == 7, "last id (%d) != 7", ref);118 ck_assert_msg (w0->id == 7, "last id (%d) != 7", ref); 119 119 120 120 send_message (g, NULL, MSG_INIT, 0, NULL); 121 121 122 fail_unless(ref == 8, "ref (%d) != 8", ref);122 ck_assert_msg (ref == 8, "ref (%d) != 8", ref); 123 123 124 124 widget_destroy (WIDGET (g)); 125 125 126 fail_unless(ref == 0, "ref (%d) != 0", ref);126 ck_assert_msg (ref == 0, "ref (%d) != 0", ref); 127 127 } 128 128 /* *INDENT-OFF* */ 129 129 END_TEST -
tests/lib/widget/widget_find_by_id.c
diff --git a/tests/lib/widget/widget_find_by_id.c b/tests/lib/widget/widget_find_by_id.c index ddb528db9..832831008 100644
a b START_TEST (test_widget_find_by_id) 73 73 74 74 w0 = WIDGET (g); 75 75 76 fail_unless(widget_find_by_id (w0, 0) != NULL, "Not found ID=0");77 fail_unless(widget_find_by_id (w0, 1) != NULL, "Not found ID=1");78 fail_unless(widget_find_by_id (w0, 2) != NULL, "Not found ID=2");79 fail_unless(widget_find_by_id (w0, 3) != NULL, "Not found ID=3");80 fail_unless(widget_find_by_id (w0, 4) != NULL, "Not found ID=4");81 fail_unless(widget_find_by_id (w0, 5) != NULL, "Not found ID=5");82 fail_unless(widget_find_by_id (w0, 6) != NULL, "Not found ID=6");83 fail_unless(widget_find_by_id (w0, 7) != NULL, "Not found ID=7");84 fail_unless(widget_find_by_id (w0, 8) == NULL, "Found ID=8");76 ck_assert_msg (widget_find_by_id (w0, 0) != NULL, "Not found ID=0"); 77 ck_assert_msg (widget_find_by_id (w0, 1) != NULL, "Not found ID=1"); 78 ck_assert_msg (widget_find_by_id (w0, 2) != NULL, "Not found ID=2"); 79 ck_assert_msg (widget_find_by_id (w0, 3) != NULL, "Not found ID=3"); 80 ck_assert_msg (widget_find_by_id (w0, 4) != NULL, "Not found ID=4"); 81 ck_assert_msg (widget_find_by_id (w0, 5) != NULL, "Not found ID=5"); 82 ck_assert_msg (widget_find_by_id (w0, 6) != NULL, "Not found ID=6"); 83 ck_assert_msg (widget_find_by_id (w0, 7) != NULL, "Not found ID=7"); 84 ck_assert_msg (widget_find_by_id (w0, 8) == NULL, "Found ID=8"); 85 85 86 86 send_message (g, NULL, MSG_INIT, 0, NULL); 87 87 widget_destroy (w0); -
tests/src/execute__execute_with_vfs_arg.c
diff --git a/tests/src/execute__execute_with_vfs_arg.c b/tests/src/execute__execute_with_vfs_arg.c index 84f64b8a5..244d6d983 100644
a b START_PARAMETRIZED_TEST (the_file_is_local, the_file_is_local_ds) 75 75 tmp_vpath), TRUE); 76 76 } 77 77 mctest_assert_int_eq (do_execute__flags__captured, EXECUTE_INTERNAL); 78 fail_unless(mc_getlocalcopy__pathname_vpath__captured == NULL,78 ck_assert_msg (mc_getlocalcopy__pathname_vpath__captured == NULL, 79 79 "\nFunction mc_getlocalcopy() shouldn't be called!"); 80 80 81 81 vfs_path_free (filename_vpath); … … START_TEST (the_file_is_remote_but_empty) 109 109 mctest_assert_int_eq (vfs_path_equal 110 110 (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), 111 111 vfs_get_raw_current_dir ()), TRUE); 112 fail_unless(g_ptr_array_index (vfs_file_is_local__vpath__captured, 1) == NULL,112 ck_assert_msg (g_ptr_array_index (vfs_file_is_local__vpath__captured, 1) == NULL, 113 113 "\nParameter for second call to vfs_file_is_local() should be NULL!"); 114 fail_unless(mc_getlocalcopy__pathname_vpath__captured == NULL,114 ck_assert_msg (mc_getlocalcopy__pathname_vpath__captured == NULL, 115 115 "\nFunction mc_getlocalcopy() shouldn't be called!"); 116 116 117 117 vfs_path_free (filename_vpath); -
tests/src/filemanager/examine_cd.c
diff --git a/tests/src/filemanager/examine_cd.c b/tests/src/filemanager/examine_cd.c index 31cdb7555..34dde0dfd 100644
a b teardown (void) 75 75 #define check_examine_cd(input, etalon) \ 76 76 { \ 77 77 result = examine_cd (input); \ 78 fail_unless(strcmp (result->str, etalon) == 0, \78 ck_assert_msg (strcmp (result->str, etalon) == 0, \ 79 79 "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result->str, etalon); \ 80 80 g_string_free (result, TRUE); \ 81 81 }