Ticket #4179: mc-4179-libcheck-fail_unless-deprecated.patch

File mc-4179-libcheck-fail_unless-deprecated.patch, 10.1 KB (added by and, 21 months 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  
    3232/* --------------------------------------------------------------------------------------------- */ 
    3333#define test_helper_check_valid_data( a, b, c, d, e, f ) \ 
    3434{ \ 
    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 ); \ 
    3838} 
    3939 
    4040#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) 
    130130    actual_result = parse_integer (data->haystack, &invalid); 
    131131 
    132132    /* then */ 
    133     fail_unless (invalid == data->invalid && actual_result == data->expected_result, 
     133    ck_assert_msg (invalid == data->invalid && actual_result == data->expected_result, 
    134134                 "actial ( %" PRIuMAX ") not equal to\nexpected (%" PRIuMAX ")", 
    135135                 actual_result, data->expected_result); 
    136136} 
  • 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) 
    245245#define VERIFY_SIGACTION__IS_RESTORED(oldact_idx, act_idx) { \ 
    246246    struct sigaction *_oldact = (struct sigaction *) g_ptr_array_index(sigaction_oldact__captured, oldact_idx); \ 
    247247    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, \ 
    249249        "sigaction(): oldact[%d] should be equals to act[%d]", oldact_idx, act_idx); \ 
    250250} 
    251251 
    execvp__deinit (void) 
    264264    VERIFY_SIGACTION__ACT_IGNORED(g_ptr_array_index(sigaction_act__captured, 1)); \ 
    265265    { \ 
    266266        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, \ 
    268268            "The 'act' in third call to sigaction() should be equals to startup_handler"); \ 
    269269    } \ 
    270270\ 
    execvp__deinit (void) 
    272272    VERIFY_SIGACTION__IS_RESTORED (1, 4); \ 
    273273    VERIFY_SIGACTION__IS_RESTORED (2, 5); \ 
    274274\ 
    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, \ 
    276276        "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, \ 
    278278        "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, \ 
    280280        "oldact in sixth call to sigaction() should be NULL"); \ 
    281281} 
    282282 
  • 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) 
    7878    env_tmpdir = g_getenv ("MC_TMPDIR"); 
    7979 
    8080    /* 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), 
    8282                 "\nNo such directory: %s\n", tmpdir); 
    8383    mctest_assert_str_eq (env_tmpdir, tmpdir); 
    8484} 
    START_TEST (test_mc_mkstemps) 
    105105    /* then */ 
    106106    close (fd); 
    107107    mctest_assert_int_ne (fd, -1); 
    108     fail_unless (g_file_test 
     108    ck_assert_msg (g_file_test 
    109109                 (vfs_path_as_str (pname_vpath), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), 
    110110                 "\nNo such file: %s\n", vfs_path_as_str (pname_vpath)); 
    111111    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, 
    113113                 "\nstart of %s should be equal to %s\n", vfs_path_as_str (pname_vpath), 
    114114                 begin_pname); 
    115115    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) 
    115115    widget_init (w0, 5, 5, 10, 10, widget_callback, NULL); 
    116116    group_add_widget (g, w0); 
    117117 
    118     fail_unless (w0->id == 7, "last id (%d) != 7", ref); 
     118    ck_assert_msg (w0->id == 7, "last id (%d) != 7", ref); 
    119119 
    120120    send_message (g, NULL, MSG_INIT, 0, NULL); 
    121121 
    122     fail_unless (ref == 8, "ref (%d) != 8", ref); 
     122    ck_assert_msg (ref == 8, "ref (%d) != 8", ref); 
    123123 
    124124    widget_destroy (WIDGET (g)); 
    125125 
    126     fail_unless (ref == 0, "ref (%d) != 0", ref); 
     126    ck_assert_msg (ref == 0, "ref (%d) != 0", ref); 
    127127} 
    128128/* *INDENT-OFF* */ 
    129129END_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) 
    7373 
    7474    w0 = WIDGET (g); 
    7575 
    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"); 
    8585 
    8686    send_message (g, NULL, MSG_INIT, 0, NULL); 
    8787    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) 
    7575                               tmp_vpath), TRUE); 
    7676    } 
    7777    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, 
    7979                 "\nFunction mc_getlocalcopy() shouldn't be called!"); 
    8080 
    8181    vfs_path_free (filename_vpath); 
    START_TEST (the_file_is_remote_but_empty) 
    109109    mctest_assert_int_eq (vfs_path_equal 
    110110                          (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), 
    111111                           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, 
    113113                 "\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, 
    115115                 "\nFunction mc_getlocalcopy() shouldn't be called!"); 
    116116 
    117117    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) 
    7575#define check_examine_cd(input, etalon) \ 
    7676{ \ 
    7777    result = examine_cd (input); \ 
    78     fail_unless (strcmp (result->str, etalon) == 0, \ 
     78    ck_assert_msg (strcmp (result->str, etalon) == 0, \ 
    7979    "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result->str, etalon); \ 
    8080    g_string_free (result, TRUE); \ 
    8181}