mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 10:04:32 +03:00
Ticket #2768 ('make check' failed)
tests/.../do_panel_cd.c: fix test when 'HOME' contains trailing slashes. Steps to reproduce: $ HOME=${HOME}/ make check Running suite(s): /src/filemanager cwd=/subvolumes/var_tmp/paludis/app-misc-mc-9999/temp mc_config_get_home_dir ()=/subvolumes/var_tmp/paludis/app-misc-mc-9999/temp/ 0%: Checks: 1, Failures: 1, Errors: 0 do_panel_cd.c:86:F:Core:test_do_panel_cd_empty_mean_home:0: Assertion 'ret' failed The patch adds home dir path normalization. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
This commit is contained in:
parent
a8d317406b
commit
41d093afaf
@ -59,6 +59,7 @@ teardown (void)
|
|||||||
START_TEST (test_do_panel_cd_empty_mean_home)
|
START_TEST (test_do_panel_cd_empty_mean_home)
|
||||||
{
|
{
|
||||||
char *cwd;
|
char *cwd;
|
||||||
|
char *home_wd;
|
||||||
struct WPanel *panel;
|
struct WPanel *panel;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
vfs_path_t *empty_path;
|
vfs_path_t *empty_path;
|
||||||
@ -71,21 +72,25 @@ START_TEST (test_do_panel_cd_empty_mean_home)
|
|||||||
panel->sort_info.sort_field = g_new0(panel_field_t,1);
|
panel->sort_info.sort_field = g_new0(panel_field_t,1);
|
||||||
|
|
||||||
empty_path = vfs_path_from_str (mc_config_get_home_dir());
|
empty_path = vfs_path_from_str (mc_config_get_home_dir());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* normalize path to handle HOME with trailing slashes:
|
||||||
|
* HOME=/home/slyfox///////// ./do_panel_cd
|
||||||
|
*/
|
||||||
|
home_wd = vfs_path_to_str (empty_path);
|
||||||
ret = do_panel_cd (panel, empty_path, cd_parse_command);
|
ret = do_panel_cd (panel, empty_path, cd_parse_command);
|
||||||
vfs_path_free (empty_path);
|
vfs_path_free (empty_path);
|
||||||
|
|
||||||
fail_unless(ret);
|
fail_unless(ret);
|
||||||
cwd = vfs_path_to_str (panel->cwd_vpath);
|
cwd = vfs_path_to_str (panel->cwd_vpath);
|
||||||
|
|
||||||
ret = strcmp(cwd, mc_config_get_home_dir ()) == 0;
|
printf ("mc_config_get_home_dir ()=%s\n", mc_config_get_home_dir ());
|
||||||
if (!ret)
|
printf ("cwd=%s\n", cwd);
|
||||||
{
|
printf ("home_wd=%s\n", home_wd);
|
||||||
printf ("cwd=%s\n", cwd);
|
fail_unless(strcmp(cwd, home_wd) == 0);
|
||||||
printf ("mc_config_get_home_dir ()=%s\n", mc_config_get_home_dir ());
|
|
||||||
}
|
|
||||||
fail_unless(ret);
|
|
||||||
|
|
||||||
|
|
||||||
|
g_free (cwd);
|
||||||
|
g_free (home_wd);
|
||||||
vfs_path_free (panel->cwd_vpath);
|
vfs_path_free (panel->cwd_vpath);
|
||||||
vfs_path_free (panel->lwd_vpath);
|
vfs_path_free (panel->lwd_vpath);
|
||||||
g_free ((gpointer) panel->sort_info.sort_field);
|
g_free ((gpointer) panel->sort_info.sort_field);
|
||||||
|
Loading…
Reference in New Issue
Block a user