Esempio n. 1
0
/* *INDENT-OFF* */
START_PARAMETRIZED_TEST (test_path_to_str_flags, test_path_to_str_flags_ds)
/* *INDENT-ON* */
{
    /* given */
    vfs_path_t *vpath;
    char *str_path;

    test_init_vfs ("UTF-8");

    test_subclass1.flags = VFS_S_REMOTE;
    vfs_s_init_class (&vfs_test_ops1, &test_subclass1);
    vfs_test_ops1.name = "testfs1";
    vfs_test_ops1.flags = VFSF_NOLINKS;
    vfs_test_ops1.prefix = "test1";
    vfs_register_class (&vfs_test_ops1);

    /* when */

    vpath = vfs_path_from_str_flags (data->input_path, data->input_from_str_flags);
    str_path = vfs_path_to_str_flags (vpath, 0, data->input_to_str_flags);

    /* then */
    mctest_assert_str_eq (str_path, data->expected_path);

    g_free (str_path);
    vfs_path_free (vpath);
    test_deinit_vfs ();
}
Esempio n. 2
0
END_TEST

/* --------------------------------------------------------------------------------------------- */

START_TEST(test_encode_info_at_start)
{
    vfs_path_t *vpath;
    char *actual;
    const vfs_path_element_t *vpath_element;

    test_init_vfs("UTF-8");

    vpath = vfs_path_from_str ("#enc:KOI8-R/bla-bla/some/path");
    actual = vfs_path_to_str (vpath);

    fail_unless (strcmp ("/#enc:KOI8-R/bla-bla/some/path", actual) == 0, "\nactual=%s\n", actual);

    vpath_element = vfs_path_get_by_index (vpath, -1);

    fail_unless (strcmp ("/bla-bla/some/path", vpath_element->path) == 0, "\nvpath_element->path=%s\n", vpath_element->path);

    g_free (actual);
    vfs_path_free (vpath);

    test_deinit_vfs();
}
Esempio n. 3
0
END_TEST

/* --------------------------------------------------------------------------------------------- */

START_TEST (test_path_recode_base_koi8r)
{
    vfs_path_t *vpath;
    char *result;
    const vfs_path_element_t *element;

    test_init_vfs("KOI8-R");

    path_recode_one_check("/я┌п╣я│я┌п╬п╡я▀п╧/п©я┐я┌я▄", "/я┌п╣я│я┌п╬п╡я▀п╧/п©я┐я┌я▄", "/я┌п╣я│я┌п╬п╡я▀п╧/п©я┐я┌я▄");

    path_recode_one_check("/#enc:UTF-8/тестовый/путь", "/я┌п╣я│я┌п╬п╡я▀п╧/п©я┐я┌я▄", "/#enc:UTF-8/тестовый/путь");

    test_deinit_vfs();
}
Esempio n. 4
0
/* *INDENT-OFF* */
START_PARAMETRIZED_TEST (test_path_recode, test_path_recode_ds)
/* *INDENT-ON* */
{
    /* given */
    vfs_path_t *vpath;
    char *result;
    const vfs_path_element_t *element;

    test_init_vfs (data->input_codepage);

    /* when */
    vpath = vfs_path_from_str (data->input_path);
    element = vfs_path_get_by_index (vpath, -1);
    result = vfs_path_to_str (vpath);

    /* then */
    mctest_assert_str_eq (element->path, data->expected_element_path);
    mctest_assert_str_eq (result, data->expected_recoded_path);

    g_free (result);
    vfs_path_free (vpath);
    test_deinit_vfs ();
}