Пример #1
0
static void
test_deinit_vfs ()
{
    free_codepages_list ();
    str_uninit_strings ();
    vfs_shut ();
}
Пример #2
0
END_TEST
/* --------------------------------------------------------------------------------------------- */
#define ETALON_STR "/path/to/file.ext/test1://#enc:KOI8-R"
START_TEST (test_vfs_path_encoding_at_end)
{
    vfs_path_t *vpath;
    char *result;
    const vfs_path_element_t *element;

    mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
    load_codepages_list ();

    vpath = vfs_path_from_str_flags ("/path/to/file.ext#test1:/#enc:KOI8-R", VPF_USE_DEPRECATED_PARSER);
    result = vfs_path_to_str(vpath);

    element = vfs_path_get_by_index(vpath, -1);
    fail_unless(*element->path == '\0', "element->path should be empty, but actual value is '%s'",element->path);
    fail_unless(element->encoding != NULL && strcmp(element->encoding, "KOI8-R") == 0,
     "element->encoding should be 'KOI8-R', but actual value is '%s'",element->encoding);

    fail_unless( result != NULL && strcmp(result, ETALON_STR) ==0,
    "\nactual: %s\netalon: %s", result , ETALON_STR );

    g_free(result);
    vfs_path_free(vpath);

    free_codepages_list ();
}
Пример #3
0
void
done_setup (void)
{
    size_t i;

    g_free (clipboard_store_path);
    g_free (clipboard_paste_path);
    g_free (global_profile_name);
    g_free (mc_global.tty.color_terminal_string);
    g_free (mc_global.tty.term_color_string);
    g_free (mc_global.tty.setup_color_string);
    g_free (profile_name);
    g_free (panels_profile_name);
    mc_config_deinit (mc_main_config);
    mc_config_deinit (mc_panels_config);

    g_free (user_recent_timeformat);
    g_free (user_old_timeformat);

    for (i = 0; str_options[i].opt_name != NULL; i++)
        g_free (*str_options[i].opt_addr);

    done_hotlist ();
    done_panelize ();
    /*    directory_history_free (); */

#ifdef HAVE_CHARSET
    g_free (autodetect_codeset);
    free_codepages_list ();
#endif

#ifdef HAVE_ASPELL
    g_free (spell_language);
#endif /* HAVE_ASPELL */
}
Пример #4
0
/* @After */
static void
teardown (void)
{
#ifdef HAVE_CHARSET
    free_codepages_list ();
#endif /* HAVE_CHARSET */

    vfs_shut ();
    str_uninit_strings ();
}
Пример #5
0
END_TEST
/* --------------------------------------------------------------------------------------------- */

#define encoding_check( input , etalon ) \
{ \
    vfs_path_t *vpath; \
    char *result; \
\
    vpath = vfs_path_from_str_flags (input, VPF_USE_DEPRECATED_PARSER); \
    result = vfs_path_to_str(vpath); \
    fail_unless( result != NULL && strcmp(result, etalon) ==0, \
    "\ninput : %s\nactual: %s\netalon: %s", input, result , etalon ); \
\
    g_free(result); \
    vfs_path_free(vpath); \
}

START_TEST (test_vfs_path_from_to_string_encoding)
{
    mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
    load_codepages_list ();

    encoding_check (
        "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
        "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    encoding_check (
        "/#test1/bla-bla1/#enc:IBM866/some/path/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
        "/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    encoding_check (
        "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/#enc:KOI8-R/some/path#test3/111/22/33",
        "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    encoding_check (
        "/#test1/bla-bla1/some/path/#test2/bla-bla2/#enc:IBM866/some/#enc:KOI8-R/path#test3/111/22/33",
        "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    encoding_check (
        "/#test1/bla-bla1/some/path/#test2/#enc:IBM866/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
        "/test1://bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    encoding_check (
        "/#test1/bla-bla1/some/path/#enc:IBM866/#test2/bla-bla2/#enc:KOI8-R/some/path#test3/111/22/33",
        "/test1://#enc:IBM866/bla-bla1/some/path/test2://#enc:KOI8-R/bla-bla2/some/path/test3://111/22/33"
    );

    free_codepages_list ();
}