From 5f99213a5e804cabb3545c693ac0e7da2c5db9b4 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Sat, 19 Jan 2013 15:05:19 +0300 Subject: [PATCH 01/35] Ticket #2944: Prepare for release mc-4.8.8 Code indentation in tests. Signed-off-by: Slava Zanko --- tests/lib/library_independ.c | 6 +- tests/lib/mc_build_filename.c | 33 +-- tests/lib/mcconfig/config_string.c | 92 ++++--- tests/lib/mcconfig/user_configs_path.c | 22 +- tests/lib/name_quote.c | 21 +- .../search/regex_process_escape_sequence.c | 30 ++- tests/lib/search/regex_replace_esc_seq.c | 54 ++-- tests/lib/serialize.c | 152 +++++++----- tests/lib/vfs/canonicalize_pathname.c | 12 +- tests/lib/vfs/current_dir.c | 7 +- tests/lib/vfs/path_cmp.c | 18 +- tests/lib/vfs/path_len.c | 10 +- tests/lib/vfs/path_manipulations.c | 91 ++++--- tests/lib/vfs/path_recode.c | 86 +++++-- tests/lib/vfs/path_serialize.c | 30 ++- tests/lib/vfs/relative_cd.c | 20 +- tests/lib/vfs/tempdir.c | 42 ++-- tests/lib/vfs/vfs_parse_ls_lga.c | 114 +++++---- tests/lib/vfs/vfs_path_string_convert.c | 231 ++++++++++-------- tests/lib/vfs/vfs_prefix_to_class.c | 48 ++-- tests/lib/vfs/vfs_s_get_path.c | 44 ++-- tests/lib/vfs/vfs_split.c | 178 ++++++++++---- tests/lib/x_basename.c | 6 +- tests/src/filemanager/examine_cd.c | 6 +- .../exec_get_export_variables_ext.c | 21 +- 25 files changed, 846 insertions(+), 528 deletions(-) diff --git a/tests/lib/library_independ.c b/tests/lib/library_independ.c index 47a13dd57..1d4d0cd3a 100644 --- a/tests/lib/library_independ.c +++ b/tests/lib/library_independ.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/library_independ" @@ -33,10 +33,14 @@ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_library_independ) +/* *INDENT-ON* */ { } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/mc_build_filename.c b/tests/lib/mc_build_filename.c index 342dc4b06..43b8d5a2e 100644 --- a/tests/lib/mc_build_filename.c +++ b/tests/lib/mc_build_filename.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib" @@ -55,37 +55,42 @@ teardown (void) g_free (result); \ } +/* *INDENT-OFF* */ START_TEST (test_mc_build_filename) +/* *INDENT-ON* */ { char *result; - check_mc_build_filename(("test", "path", NULL), "test/path"); + check_mc_build_filename (("test", "path", NULL), "test/path"); - check_mc_build_filename(("/test", "path/", NULL), "/test/path"); + check_mc_build_filename (("/test", "path/", NULL), "/test/path"); - check_mc_build_filename(("/test", "pa/th", NULL), "/test/pa/th"); + check_mc_build_filename (("/test", "pa/th", NULL), "/test/pa/th"); - check_mc_build_filename(("/test", "#vfsprefix:", "path ", NULL), "/test/#vfsprefix:/path "); + check_mc_build_filename (("/test", "#vfsprefix:", "path ", NULL), "/test/#vfsprefix:/path "); - check_mc_build_filename(("/test", "vfsprefix://", "path ", NULL), "/test/vfsprefix://path "); + check_mc_build_filename (("/test", "vfsprefix://", "path ", NULL), "/test/vfsprefix://path "); - check_mc_build_filename(("/test", "vfs/../prefix:///", "p\\///ath", NULL), "/test/prefix://p\\/ath"); + check_mc_build_filename (("/test", "vfs/../prefix:///", "p\\///ath", NULL), + "/test/prefix://p\\/ath"); - check_mc_build_filename(("/test", "path", "..", "/test", "path/", NULL), "/test/test/path"); + check_mc_build_filename (("/test", "path", "..", "/test", "path/", NULL), "/test/test/path"); - check_mc_build_filename(("", "path", NULL), "path"); + check_mc_build_filename (("", "path", NULL), "path"); - check_mc_build_filename(("", "/path", NULL), "path"); + check_mc_build_filename (("", "/path", NULL), "path"); - check_mc_build_filename(("path", "", NULL), "path"); + check_mc_build_filename (("path", "", NULL), "path"); - check_mc_build_filename(("/path", "", NULL), "/path"); + check_mc_build_filename (("/path", "", NULL), "/path"); - check_mc_build_filename(("pa", "", "th", NULL), "pa/th"); + check_mc_build_filename (("pa", "", "th", NULL), "pa/th"); - check_mc_build_filename(("/pa", "", "/th", NULL), "/pa/th"); + check_mc_build_filename (("/pa", "", "/th", NULL), "/pa/th"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/mcconfig/config_string.c b/tests/lib/mcconfig/config_string.c index 1349d42ab..4e4617f24 100644 --- a/tests/lib/mcconfig/config_string.c +++ b/tests/lib/mcconfig/config_string.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/mcconfig" @@ -41,7 +41,7 @@ static void setup (void) { - str_init_strings("KOI8-R"); + str_init_strings ("KOI8-R"); vfs_init (); init_localfs (); } @@ -50,8 +50,9 @@ static void teardown (void) { vfs_shut (); - str_uninit_strings(); + str_uninit_strings (); } + /* --------------------------------------------------------------------------------------------- */ #define fail_unless_strcmp( etalon ) \ fail_unless( \ @@ -59,20 +60,22 @@ teardown (void) "Actial value '%s' doesn't equal to etalon '%s'", actual_value, etalon \ ) +/* *INDENT-OFF* */ START_TEST (create_ini_file) +/* *INDENT-ON* */ { mc_config_t *mc_config; GError *error = NULL; char *actual_value; char *ini_filename = NULL; - ini_filename = g_build_filename(WORKDIR, "test-create_ini_file.ini",NULL); - unlink(ini_filename); + ini_filename = g_build_filename (WORKDIR, "test-create_ini_file.ini", NULL); + unlink (ini_filename); mc_config = mc_config_init (ini_filename, FALSE); if (mc_config == NULL) { - fail("unable to create mc_congif_t object!"); + fail ("unable to create mc_congif_t object!"); return; } @@ -81,68 +84,75 @@ START_TEST (create_ini_file) mc_config_set_string (mc_config, "test-group1", "test-param3", " \tsome value2\n\nf\b\005fff "); mc_config_set_string_raw (mc_config, "test-group2", "test-param1", " some value "); - mc_config_set_string_raw (mc_config, "test-group2", "test-param2", " koi8-r: "); - mc_config_set_string_raw (mc_config, "test-group2", "test-param3", " \tsome value2\n\nf\b\005fff "); + mc_config_set_string_raw (mc_config, "test-group2", "test-param2", + " koi8-r: "); + mc_config_set_string_raw (mc_config, "test-group2", "test-param3", + " \tsome value2\n\nf\b\005fff "); if (!mc_config_save_file (mc_config, &error)) { - fail("Unable to save config file: %s",error->message); - g_error_free(error); + fail ("Unable to save config file: %s", error->message); + g_error_free (error); } mc_config_deinit (mc_config); mc_config = mc_config_init (ini_filename, FALSE); - actual_value = mc_config_get_string(mc_config, "group-not-exists", "param-not_exists", NULL); - fail_unless(actual_value == NULL, "return value for nonexistent ini-parameters isn't NULL (default value)!"); + actual_value = mc_config_get_string (mc_config, "group-not-exists", "param-not_exists", NULL); + fail_unless (actual_value == NULL, + "return value for nonexistent ini-parameters isn't NULL (default value)!"); - actual_value = mc_config_get_string(mc_config, "test-group1", "test-param1", "not-exists"); - fail_unless_strcmp(" some value "); - g_free(actual_value); + actual_value = mc_config_get_string (mc_config, "test-group1", "test-param1", "not-exists"); + fail_unless_strcmp (" some value "); + g_free (actual_value); - actual_value = mc_config_get_string(mc_config, "test-group1", "test-param2", "not-exists"); - fail_unless_strcmp(" \tkoi8-r: "); - g_free(actual_value); + actual_value = mc_config_get_string (mc_config, "test-group1", "test-param2", "not-exists"); + fail_unless_strcmp (" \tkoi8-r: "); + g_free (actual_value); - actual_value = mc_config_get_string(mc_config, "test-group1", "test-param3", "not-exists"); - fail_unless_strcmp(" \tsome value2\n\nf\b\005fff "); - g_free(actual_value); + actual_value = mc_config_get_string (mc_config, "test-group1", "test-param3", "not-exists"); + fail_unless_strcmp (" \tsome value2\n\nf\b\005fff "); + g_free (actual_value); - actual_value = mc_config_get_string_raw( mc_config, "test-group2", "test-param1", "not-exists"); - fail_unless_strcmp(" some value "); - g_free(actual_value); + actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param1", "not-exists"); + fail_unless_strcmp (" some value "); + g_free (actual_value); - actual_value = mc_config_get_string_raw( mc_config, "test-group2", "test-param2", "not-exists"); - fail_unless_strcmp("not-exists"); - g_free(actual_value); + actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param2", "not-exists"); + fail_unless_strcmp ("not-exists"); + g_free (actual_value); - actual_value = mc_config_get_string_raw( mc_config, "test-group2", "test-param3", "not-exists"); - fail_unless_strcmp(" \tsome value2\n\nf\b\005fff "); - g_free(actual_value); + actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param3", "not-exists"); + fail_unless_strcmp (" \tsome value2\n\nf\b\005fff "); + g_free (actual_value); mc_config_deinit (mc_config); - g_free(ini_filename); + g_free (ini_filename); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (emulate__learn_save) +/* *INDENT-ON* */ { mc_config_t *mc_config; char *actual_value, *esc_str; char *ini_filename = NULL; GError *error = NULL; - ini_filename = g_build_filename(WORKDIR, "test-emulate__learn_save.ini",NULL); - unlink(ini_filename); + ini_filename = g_build_filename (WORKDIR, "test-emulate__learn_save.ini", NULL); + unlink (ini_filename); mc_config = mc_config_init (ini_filename, FALSE); if (mc_config == NULL) { - fail("unable to create mc_congif_t object!"); + fail ("unable to create mc_congif_t object!"); return; } @@ -152,21 +162,23 @@ START_TEST (emulate__learn_save) if (!mc_config_save_file (mc_config, &error)) { - fail("Unable to save config file: %s",error->message); - g_error_free(error); + fail ("Unable to save config file: %s", error->message); + g_error_free (error); } mc_config_deinit (mc_config); mc_config = mc_config_init (ini_filename, FALSE); - actual_value = mc_config_get_string_raw( mc_config, "test-group1", "test-param1", "not-exists"); - fail_unless_strcmp("T\\;E\\X\\;T-FOR-\\T\\;E\\;S\\TI\\;N'G"); - g_free(actual_value); + actual_value = mc_config_get_string_raw (mc_config, "test-group1", "test-param1", "not-exists"); + fail_unless_strcmp ("T\\;E\\X\\;T-FOR-\\T\\;E\\;S\\TI\\;N'G"); + g_free (actual_value); mc_config_deinit (mc_config); - g_free(ini_filename); + g_free (ini_filename); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/mcconfig/user_configs_path.c b/tests/lib/mcconfig/user_configs_path.c index a1f9e77c0..f25b510c7 100644 --- a/tests/lib/mcconfig/user_configs_path.c +++ b/tests/lib/mcconfig/user_configs_path.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/mcconfig" #include @@ -40,13 +40,13 @@ #define HOME_DIR "/home/testuser" #ifdef MC_HOMEDIR_XDG -# define CONF_MAIN HOME_DIR PATH_SEP_STR ".config" -# define CONF_DATA HOME_DIR PATH_SEP_STR ".local" PATH_SEP_STR "share" -# define CONF_CACHE HOME_DIR PATH_SEP_STR ".cache" +#define CONF_MAIN HOME_DIR PATH_SEP_STR ".config" +#define CONF_DATA HOME_DIR PATH_SEP_STR ".local" PATH_SEP_STR "share" +#define CONF_CACHE HOME_DIR PATH_SEP_STR ".cache" #else -# define CONF_MAIN HOME_DIR -# define CONF_DATA CONF_MAIN -# define CONF_CACHE CONF_MAIN +#define CONF_MAIN HOME_DIR +#define CONF_DATA CONF_MAIN +#define CONF_CACHE CONF_MAIN #endif @@ -59,7 +59,7 @@ setup (void) g_setenv ("XDG_DATA_HOME", CONF_DATA, TRUE); g_setenv ("XDG_CACHE_HOME", CONF_CACHE, TRUE); #endif - str_init_strings("UTF-8"); + str_init_strings ("UTF-8"); vfs_init (); init_localfs (); } @@ -68,7 +68,7 @@ static void teardown (void) { vfs_shut (); - str_uninit_strings(); + str_uninit_strings (); } #define path_fail_unless(conf_dir, conf_name) {\ @@ -77,7 +77,9 @@ teardown (void) g_free (result); \ } /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (user_configs_path_test) +/* *INDENT-ON* */ { char *result; @@ -110,7 +112,9 @@ START_TEST (user_configs_path_test) path_fail_unless (CONF_CACHE, EDIT_BLOCK_FILE); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/name_quote.c b/tests/lib/name_quote.c index 869200f85..091d4a203 100644 --- a/tests/lib/name_quote.c +++ b/tests/lib/name_quote.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/util" @@ -32,6 +32,7 @@ #include "lib/global.h" #include "lib/util.h" +/* --------------------------------------------------------------------------------------------- */ static void setup (void) @@ -45,6 +46,7 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ static const struct data_source1_struct { gboolean input_quote_percent; @@ -56,8 +58,11 @@ static const struct data_source1_struct { TRUE, "%%", "%%%%"}, { FALSE, "%%", "%%"}, }; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ START_TEST (quote_percent_test) +/* *INDENT-ON* */ { /* given */ char *actual_string; @@ -71,10 +76,13 @@ START_TEST (quote_percent_test) g_free (actual_string); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ static const struct data_source2_struct { const char *input_string; @@ -92,8 +100,11 @@ static const struct data_source2_struct {"~", "\\~"}, {"blabla~", "blabla~"}, }; +/* *INDENT-ON* */ +/* *INDENT-OFF* */ START_TEST (name_quote_test) +/* *INDENT-ON* */ { /* given */ char *actual_string; @@ -107,7 +118,9 @@ START_TEST (name_quote_test) g_free (actual_string); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -123,9 +136,11 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, quote_percent_test, 0, sizeof(data_source1)/sizeof(data_source1[0])); + tcase_add_loop_test (tc_core, quote_percent_test, 0, + sizeof (data_source1) / sizeof (data_source1[0])); - tcase_add_loop_test (tc_core, name_quote_test, 0, sizeof(data_source2)/sizeof(data_source2[0])); + tcase_add_loop_test (tc_core, name_quote_test, 0, + sizeof (data_source2) / sizeof (data_source2[0])); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/search/regex_process_escape_sequence.c b/tests/lib/search/regex_process_escape_sequence.c index 921acf2ba..7bb478eea 100644 --- a/tests/lib/search/regex_process_escape_sequence.c +++ b/tests/lib/search/regex_process_escape_sequence.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/search/regex" @@ -29,7 +29,7 @@ #include -#include "regex.c" /* for testing static functions*/ +#include "regex.c" /* for testing static functions */ /* --------------------------------------------------------------------------------------------- */ #define test_helper_valid_data(from, etalon, dest_str, replace_flags, utf) { \ @@ -41,25 +41,29 @@ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_regex_process_escape_sequence_valid) +/* *INDENT-ON* */ { GString *dest_str; replace_transform_type_t replace_flags = REPLACE_T_NO_TRANSFORM; - test_helper_valid_data("{101}", "A", dest_str, replace_flags, FALSE); - test_helper_valid_data("x42", "B", dest_str, replace_flags, FALSE); - test_helper_valid_data("x{444}", "D", dest_str, replace_flags, FALSE); - test_helper_valid_data("x{444}", "ф", dest_str, replace_flags, TRUE); + test_helper_valid_data ("{101}", "A", dest_str, replace_flags, FALSE); + test_helper_valid_data ("x42", "B", dest_str, replace_flags, FALSE); + test_helper_valid_data ("x{444}", "D", dest_str, replace_flags, FALSE); + test_helper_valid_data ("x{444}", "ф", dest_str, replace_flags, TRUE); - test_helper_valid_data("n", "\n", dest_str, replace_flags, FALSE); - test_helper_valid_data("t", "\t", dest_str, replace_flags, FALSE); - test_helper_valid_data("v", "\v", dest_str, replace_flags, FALSE); - test_helper_valid_data("b", "\b", dest_str, replace_flags, FALSE); - test_helper_valid_data("r", "\r", dest_str, replace_flags, FALSE); - test_helper_valid_data("f", "\f", dest_str, replace_flags, FALSE); - test_helper_valid_data("a", "\a", dest_str, replace_flags, FALSE); + test_helper_valid_data ("n", "\n", dest_str, replace_flags, FALSE); + test_helper_valid_data ("t", "\t", dest_str, replace_flags, FALSE); + test_helper_valid_data ("v", "\v", dest_str, replace_flags, FALSE); + test_helper_valid_data ("b", "\b", dest_str, replace_flags, FALSE); + test_helper_valid_data ("r", "\r", dest_str, replace_flags, FALSE); + test_helper_valid_data ("f", "\f", dest_str, replace_flags, FALSE); + test_helper_valid_data ("a", "\a", dest_str, replace_flags, FALSE); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/search/regex_replace_esc_seq.c b/tests/lib/search/regex_replace_esc_seq.c index 8326cb6a0..05790cf4f 100644 --- a/tests/lib/search/regex_replace_esc_seq.c +++ b/tests/lib/search/regex_replace_esc_seq.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/search/regex" @@ -29,7 +29,7 @@ #include -#include "regex.c" /* for testing static functions*/ +#include "regex.c" /* for testing static functions */ /* --------------------------------------------------------------------------------------------- */ #define test_helper_check_valid_data( a, b, c, d, e, f ) \ @@ -51,50 +51,60 @@ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_regex_replace_esc_seq_prepare_valid) +/* *INDENT-ON* */ { GString *replace_str; gsize skip_len; int ret; - replace_str = g_string_new("bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a"); + replace_str = + g_string_new + ("bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a"); - test_helper_handle_esc_seq( 7, FALSE, 6, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\{123} */ - test_helper_handle_esc_seq( 20, FALSE, 4, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\xab */ - test_helper_handle_esc_seq( 36, FALSE, 11, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\x{456abcd} */ - test_helper_handle_esc_seq( 54, FALSE, 2, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\xtre */ - test_helper_handle_esc_seq( 59, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\n */ - test_helper_handle_esc_seq( 61, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\t */ - test_helper_handle_esc_seq( 63, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\v */ - test_helper_handle_esc_seq( 65, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\b */ - test_helper_handle_esc_seq( 67, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\r */ - test_helper_handle_esc_seq( 69, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\f */ - test_helper_handle_esc_seq( 71, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ ); /* \\a */ + test_helper_handle_esc_seq (7, FALSE, 6, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\{123} */ + test_helper_handle_esc_seq (20, FALSE, 4, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\xab */ + test_helper_handle_esc_seq (36, FALSE, 11, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\x{456abcd} */ + test_helper_handle_esc_seq (54, FALSE, 2, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\xtre */ + test_helper_handle_esc_seq (59, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\n */ + test_helper_handle_esc_seq (61, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\t */ + test_helper_handle_esc_seq (63, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\v */ + test_helper_handle_esc_seq (65, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\b */ + test_helper_handle_esc_seq (67, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\r */ + test_helper_handle_esc_seq (69, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\f */ + test_helper_handle_esc_seq (71, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\a */ - g_string_free(replace_str, TRUE); + g_string_free (replace_str, TRUE); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_regex_replace_esc_seq_prepare_invalid) +/* *INDENT-ON* */ { GString *replace_str; gsize skip_len; int ret; - replace_str = g_string_new("\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre"); + replace_str = g_string_new ("\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre"); - test_helper_handle_esc_seq( 0, TRUE, 5, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\{123 */ - test_helper_handle_esc_seq( 6, TRUE, 3, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\x{qwerty} */ - test_helper_handle_esc_seq( 17, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\12} */ - test_helper_handle_esc_seq( 22, TRUE, 7, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\x{456a-bcd} */ - test_helper_handle_esc_seq( 41, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL ); /* \\satre */ + test_helper_handle_esc_seq (0, TRUE, 5, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\{123 */ + test_helper_handle_esc_seq (6, TRUE, 3, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\x{qwerty} */ + test_helper_handle_esc_seq (17, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\12} */ + test_helper_handle_esc_seq (22, TRUE, 7, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\x{456a-bcd} */ + test_helper_handle_esc_seq (41, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\satre */ - g_string_free(replace_str, TRUE); + g_string_free (replace_str, TRUE); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/serialize.c b/tests/lib/serialize.c index 5bcf68ce7..bdaca2e30 100644 --- a/tests/lib/serialize.c +++ b/tests/lib/serialize.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib" @@ -62,47 +62,63 @@ teardown (void) } \ } +/* *INDENT-OFF* */ START_TEST (test_serialize_deserialize_str) +/* *INDENT-ON* */ { GError *error = NULL; char *actual; - actual = mc_serialize_str('s', "some test string", &error); + actual = mc_serialize_str ('s', "some test string", &error); if (actual == NULL) { - fail("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, error->message); - g_clear_error(&error); + fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, + error->message); + g_clear_error (&error); return; } - fail_unless (strcmp(actual,"s16:some test string") == 0, "Actual value(%s) doesn't equal to etalon(s16:some test string)", actual); - g_free(actual); + fail_unless (strcmp (actual, "s16:some test string") == 0, + "Actual value(%s) doesn't equal to etalon(s16:some test string)", actual); + g_free (actual); - actual = mc_deserialize_str('s', NULL, &error); - deserialize_check_incorrect( -1, "mc_serialize_str(): Input data is NULL or empty." ); + actual = mc_deserialize_str ('s', NULL, &error); + deserialize_check_incorrect (-1, "mc_serialize_str(): Input data is NULL or empty."); - actual = mc_deserialize_str('s', "incorrect string", &error); - deserialize_check_incorrect( -2, "mc_serialize_str(): String prefix doesn't equal to 's'" ); + actual = mc_deserialize_str ('s', "incorrect string", &error); + deserialize_check_incorrect (-2, "mc_serialize_str(): String prefix doesn't equal to 's'"); - actual = mc_deserialize_str('s', "s12345string without delimiter", &error); - deserialize_check_incorrect( -3, "mc_serialize_str(): Length delimiter ':' doesn't exists" ); + actual = mc_deserialize_str ('s', "s12345string without delimiter", &error); + deserialize_check_incorrect (-3, "mc_serialize_str(): Length delimiter ':' doesn't exists"); - actual = mc_deserialize_str('s', "s1234567890123456789012345678901234567890123456789012345678901234567890:too big number", &error); - deserialize_check_incorrect( -3, "mc_serialize_str(): Too big string length" ); + actual = + mc_deserialize_str ('s', + "s1234567890123456789012345678901234567890123456789012345678901234567890:too big number", + &error); + deserialize_check_incorrect (-3, "mc_serialize_str(): Too big string length"); - actual = mc_deserialize_str('s', "s500:actual string length less that specified length", &error); - deserialize_check_incorrect( -3, "mc_serialize_str(): Specified data length (500) is greater than actual data length (47)" ); + actual = + mc_deserialize_str ('s', "s500:actual string length less that specified length", &error); + deserialize_check_incorrect (-3, + "mc_serialize_str(): Specified data length (500) is greater than actual data length (47)"); - actual = mc_deserialize_str('s', "s10:actual string length great that specified length", &error); - fail_unless (actual != NULL && strcmp(actual, "actual str") == 0, "actual (%s) doesn't equal to etalon(actual str)", actual); - g_free(actual); + actual = + mc_deserialize_str ('s', "s10:actual string length great that specified length", &error); + fail_unless (actual != NULL + && strcmp (actual, "actual str") == 0, + "actual (%s) doesn't equal to etalon(actual str)", actual); + g_free (actual); - actual = mc_deserialize_str('s', "s21:The right test string", &error); - fail_unless (actual != NULL && strcmp(actual, "The right test string") == 0, "actual (%s) doesn't equal to etalon(The right test string)", actual); - g_free(actual); + actual = mc_deserialize_str ('s', "s21:The right test string", &error); + fail_unless (actual != NULL + && strcmp (actual, "The right test string") == 0, + "actual (%s) doesn't equal to etalon(The right test string)", actual); + g_free (actual); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -111,7 +127,9 @@ END_TEST "g6:group3p6:param1v11:::bla-bla::p6:param2v31:bla-:p1:w:v2:12:g3:123:bla-bla\n" \ "g6:group4p6:param1v5:falsep6:param2v6:654321" +/* *INDENT-OFF* */ START_TEST (test_serialize_config) +/* *INDENT-ON* */ { mc_config_t *test_data; GError *error = NULL; @@ -136,15 +154,19 @@ START_TEST (test_serialize_config) if (actual == NULL) { - fail("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, error->message); - g_clear_error(&error); + fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, + error->message); + g_clear_error (&error); return; } - fail_unless(strcmp(actual, etalon_str) == 0, "Not equal:\nactual (%s)\netalon (%s)", actual, etalon_str); - g_free(actual); + fail_unless (strcmp (actual, etalon_str) == 0, "Not equal:\nactual (%s)\netalon (%s)", actual, + etalon_str); + g_free (actual); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -164,72 +186,82 @@ END_TEST } \ } +/* *INDENT-OFF* */ START_TEST (test_deserialize_config) +/* *INDENT-ON* */ { mc_config_t *actual; GError *error = NULL; char *actual_value; actual = mc_deserialize_config ("g123error in group name", &error); - deserialize_check_incorrect( -3, - "mc_deserialize_config() at 1: mc_serialize_str(): Length delimiter ':' doesn't exists"); + deserialize_check_incorrect (-3, + "mc_deserialize_config() at 1: mc_serialize_str(): Length delimiter ':' doesn't exists"); actual = mc_deserialize_config ("p6:param1v10:some valuep6:param2v11:some value ", &error); - deserialize_check_incorrect( -2, - "mc_deserialize_config() at 1: mc_serialize_str(): String prefix doesn't equal to 'g'"); + deserialize_check_incorrect (-2, + "mc_deserialize_config() at 1: mc_serialize_str(): String prefix doesn't equal to 'g'"); actual = mc_deserialize_config ("g6:group1v10:some valuep6:param2v11:some value ", &error); - deserialize_check_incorrect( -2, - "mc_deserialize_config() at 10: mc_serialize_str(): String prefix doesn't equal to 'p'"); + deserialize_check_incorrect (-2, + "mc_deserialize_config() at 10: mc_serialize_str(): String prefix doesn't equal to 'p'"); actual = mc_deserialize_config ("g6:group1p6000:param2v11:some value ", &error); - deserialize_check_incorrect( -3, - "mc_deserialize_config() at 10: mc_serialize_str(): Specified data length (6000) is greater than actual data length (21)"); + deserialize_check_incorrect (-3, + "mc_deserialize_config() at 10: mc_serialize_str(): Specified data length (6000) is greater than actual data length (21)"); actual = mc_deserialize_config (etalon_str, &error); if (actual == NULL) { - fail("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, error->message); - g_clear_error(&error); + fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, + error->message); + g_clear_error (&error); return; } - actual_value = mc_config_get_string_raw(actual, "group1", "param1", ""); - fail_unless( strcmp(actual_value, "some value") == 0, - "group1->param1(%s) should be equal to 'some value'", actual_value); - g_free(actual_value); + actual_value = mc_config_get_string_raw (actual, "group1", "param1", ""); + fail_unless (strcmp (actual_value, "some value") == 0, + "group1->param1(%s) should be equal to 'some value'", actual_value); + g_free (actual_value); - actual_value = mc_config_get_string(actual, "group1", "param2", ""); - fail_unless( strcmp(actual_value, "some value ") == 0, - "group1->param2(%s) should be equal to 'some value '", actual_value); - g_free(actual_value); + actual_value = mc_config_get_string (actual, "group1", "param2", ""); + fail_unless (strcmp (actual_value, "some value ") == 0, + "group1->param2(%s) should be equal to 'some value '", actual_value); + g_free (actual_value); - fail_unless( mc_config_get_bool(actual, "group2", "param1", FALSE) == TRUE, - "group2->param1(FALSE) should be equal to TRUE"); + fail_unless (mc_config_get_bool (actual, "group2", "param1", FALSE) == TRUE, + "group2->param1(FALSE) should be equal to TRUE"); - fail_unless( mc_config_get_int(actual, "group2", "param2", 0) == 123456, - "group2->param2(%d) should be equal to 123456", mc_config_get_int(actual, "group2", "param2", 0)); + fail_unless (mc_config_get_int (actual, "group2", "param2", 0) == 123456, + "group2->param2(%d) should be equal to 123456", mc_config_get_int (actual, + "group2", + "param2", 0)); - actual_value = mc_config_get_string_raw(actual, "group3", "param1", ""); - fail_unless( strcmp(actual_value, "::bla-bla::") == 0, - "group3->param1(%s) should be equal to '::bla-bla::'", actual_value); - g_free(actual_value); + actual_value = mc_config_get_string_raw (actual, "group3", "param1", ""); + fail_unless (strcmp (actual_value, "::bla-bla::") == 0, + "group3->param1(%s) should be equal to '::bla-bla::'", actual_value); + g_free (actual_value); - actual_value = mc_config_get_string(actual, "group3", "param2", ""); - fail_unless( strcmp(actual_value, "bla-:p1:w:v2:12:g3:123:bla-bla\n") == 0, - "group3->param2(%s) should be equal to 'bla-:p1:w:v2:12:g3:123:bla-bla\n'", actual_value); - g_free(actual_value); + actual_value = mc_config_get_string (actual, "group3", "param2", ""); + fail_unless (strcmp (actual_value, "bla-:p1:w:v2:12:g3:123:bla-bla\n") == 0, + "group3->param2(%s) should be equal to 'bla-:p1:w:v2:12:g3:123:bla-bla\n'", + actual_value); + g_free (actual_value); - fail_unless( mc_config_get_bool(actual, "group4", "param1", TRUE) == FALSE, - "group4->param1(TRUE) should be equal to FALSE"); + fail_unless (mc_config_get_bool (actual, "group4", "param1", TRUE) == FALSE, + "group4->param1(TRUE) should be equal to FALSE"); - fail_unless( mc_config_get_int(actual, "group4", "param2", 0) == 654321, - "group4->param2(%d) should be equal to 654321", mc_config_get_int(actual, "group4", "param2", 0)); + fail_unless (mc_config_get_int (actual, "group4", "param2", 0) == 654321, + "group4->param2(%d) should be equal to 654321", mc_config_get_int (actual, + "group4", + "param2", 0)); mc_config_deinit (actual); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/canonicalize_pathname.c b/tests/lib/vfs/canonicalize_pathname.c index 4d221443a..fc2e83686 100644 --- a/tests/lib/vfs/canonicalize_pathname.c +++ b/tests/lib/vfs/canonicalize_pathname.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -65,7 +65,9 @@ teardown (void) g_free(path); \ } +/* *INDENT-OFF* */ START_TEST (test_canonicalize_path) +/* *INDENT-ON* */ { char *path; static struct vfs_s_subclass test_subclass; @@ -95,10 +97,12 @@ START_TEST (test_canonicalize_path) check_canonicalize ("some_server/..", "."); /* Collapse "/.." with the previous part of path */ - check_canonicalize ("/some_server/ww/some_server/../ww/../some_server/..//ww/some_server/ww", "/some_server/ww/ww/some_server/ww"); + check_canonicalize ("/some_server/ww/some_server/../ww/../some_server/..//ww/some_server/ww", + "/some_server/ww/ww/some_server/ww"); /* URI style */ - check_canonicalize ("/some_server/ww/ftp://user:pass@host.net/path/", "/some_server/ww/ftp://user:pass@host.net/path"); + check_canonicalize ("/some_server/ww/ftp://user:pass@host.net/path/", + "/some_server/ww/ftp://user:pass@host.net/path"); check_canonicalize ("/some_server/ww/ftp://user:pass@host.net/path/../../", "/some_server/ww"); @@ -106,7 +110,9 @@ START_TEST (test_canonicalize_path) check_canonicalize ("ftp://user/../../", ".."); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/current_dir.c b/tests/lib/vfs/current_dir.c index f96147715..7dec19fb4 100644 --- a/tests/lib/vfs/current_dir.c +++ b/tests/lib/vfs/current_dir.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -77,7 +77,9 @@ test_chdir (const vfs_path_t * vpath) "\n expected(%s) doesn't equal \nto actual(%s)", etalon, buffer); \ g_free (buffer); +/* *INDENT-OFF* */ START_TEST (set_up_current_dir_url) +/* *INDENT-ON* */ { vfs_path_t *vpath; static struct vfs_s_subclass test_subclass; @@ -113,8 +115,9 @@ START_TEST (set_up_current_dir_url) cd_and_check ("..", "/"); } - +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/path_cmp.c b/tests/lib/vfs/path_cmp.c index fdedab41c..a4136ae89 100644 --- a/tests/lib/vfs/path_cmp.c +++ b/tests/lib/vfs/path_cmp.c @@ -3,7 +3,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -18,7 +18,7 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -74,12 +74,14 @@ teardown (void) input1, input2, #etalon_condition, result); \ } +/* *INDENT-OFF* */ START_TEST (test_path_compare) +/* *INDENT-ON* */ { vfs_path_t *vpath1, *vpath2; int result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", ==0); + path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", == 0); #ifdef HAVE_CHARSET path_cmp_one_check ("/#enc:KOI8-R/тестовый/путь", "/тестовый/путь", <0); @@ -90,7 +92,9 @@ START_TEST (test_path_compare) path_cmp_one_check ("/тестовый/путь", NULL, -1); path_cmp_one_check (NULL, NULL, -1); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ #undef path_cmp_one_check @@ -105,24 +109,28 @@ END_TEST input1, input2, #etalon_condition, result); \ } +/* *INDENT-OFF* */ START_TEST (test_path_compare_len) +/* *INDENT-ON* */ { vfs_path_t *vpath1, *vpath2; int result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", 10, ==0); + path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", 10, == 0); path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 10, <0); path_cmp_one_check ("/тестовый/путь", "/тест/овый/путь", 10, >0); - path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 9, ==0); + path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 9, == 0); path_cmp_one_check (NULL, "/тестовый/путь", 0, <0); path_cmp_one_check ("/тестовый/путь", NULL, 0, <0); path_cmp_one_check (NULL, NULL, 0, <0); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/path_len.c b/tests/lib/vfs/path_len.c index 888f85d9a..2e53486dd 100644 --- a/tests/lib/vfs/path_len.c +++ b/tests/lib/vfs/path_len.c @@ -3,7 +3,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -18,7 +18,7 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -72,18 +72,22 @@ teardown (void) input, etalon, result); \ } +/* *INDENT-OFF* */ START_TEST (test_path_length) +/* *INDENT-ON* */ { vfs_path_t *vpath; size_t result; path_len_one_check ("/тестовый/путь", 26); #ifdef HAVE_CHARSET - path_len_one_check ("/#enc:KOI8-R/тестовый/путь", 38); + path_len_one_check ("/#enc:KOI8-R/тестовый/путь", 38); #endif path_len_one_check (NULL, 0); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/path_manipulations.c b/tests/lib/vfs/path_manipulations.c index 1dce032d9..ad014a9f4 100644 --- a/tests/lib/vfs/path_manipulations.c +++ b/tests/lib/vfs/path_manipulations.c @@ -3,7 +3,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -18,7 +18,7 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -89,56 +89,60 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_path_tokens_count) +/* *INDENT-ON* */ { size_t tokens_count; vfs_path_t *vpath; vpath = vfs_path_from_str ("/"); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 0, "actual: %zu; expected: 0\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str ("/path"); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 1, "actual: %zu; expected: 1\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str ("/path1/path2/path3"); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str_flags ("test3://path1/path2/path3/path4", VPF_NO_CANON); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 4, "actual: %zu; expected: 4\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str_flags ("path1/path2/path3", VPF_NO_CANON); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str ("/path1/path2/path3/"); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); vfs_path_free (vpath); vpath = vfs_path_from_str ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"); - tokens_count = vfs_path_tokens_count(vpath); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 5, "actual: %zu; expected: 5\n", tokens_count); vfs_path_free (vpath); #ifdef HAVE_CHARSET - vpath = vfs_path_from_str ( - "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33" - ); - tokens_count = vfs_path_tokens_count(vpath); + vpath = + vfs_path_from_str + ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"); + tokens_count = vfs_path_tokens_count (vpath); fail_unless (tokens_count == 11, "actual: %zu; expected: 11\n", tokens_count); vfs_path_free (vpath); #endif } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -160,16 +164,18 @@ END_TEST vfs_path_free (vpath); \ } +/* *INDENT-OFF* */ START_TEST (test_vfs_path_tokens_get) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *path_tokens; /* Invalid start position */ - check_invalid_token_str ("/" , 2, 1); + check_invalid_token_str ("/", 2, 1); /* Invalid negative position */ - check_invalid_token_str ("/path" , -3, 1); + check_invalid_token_str ("/path", -3, 1); /* Count of tokens is zero. Count should be autocorrected */ check_token_str ("/path", 0, 0, "path"); @@ -182,7 +188,8 @@ START_TEST (test_vfs_path_tokens_get) #ifdef HAVE_CHARSET /* get 'path2/path3' by 1,2 from LOCAL VFS with encoding */ - check_token_str ("test3://path1/path2/test3://#enc:KOI8-R/path3/path4", 1, 2, "path2/test3://#enc:KOI8-R/path3"); + check_token_str ("test3://path1/path2/test3://#enc:KOI8-R/path3/path4", 1, 2, + "path2/test3://#enc:KOI8-R/path3"); /* get 'path2/path3' by 1,2 with encoding */ check_token_str ("#enc:KOI8-R/path1/path2/path3/path4", 1, 2, "#enc:KOI8-R/path2/path3"); @@ -192,17 +199,19 @@ START_TEST (test_vfs_path_tokens_get) check_token_str ("test2://path1/path2/path3/path4", 1, 2, "test2://path2/path3"); /* get 'path2/path3' by 1,2 throught non-LOCAL VFS */ - check_token_str ("/path1/path2/test1://user:pass@some.host:12345/path3/path4", 1, 2, "path2/test1://user:pass@some.host:12345/path3"); + check_token_str ("/path1/path2/test1://user:pass@some.host:12345/path3/path4", 1, 2, + "path2/test1://user:pass@some.host:12345/path3"); /* get 'path2/path3' by 1,2 from LOCAL VFS */ /* TODO: currently this test don't passed. Probably broken string URI parser */ -/* check_token_str ("test3://path1/path2/test2://test3://path3/path4", 1, 2, "path2/path3"); */ + /* check_token_str ("test3://path1/path2/test2://test3://path3/path4", 1, 2, "path2/path3"); */ /* get 'path2/path3' by 1,2 where path2 it's LOCAL VFS */ check_token_str ("test3://path1/path2/test2://path3/path4", 1, 2, "path2/test2://path3"); /* get 'path2/path3' by 1,2 where path3 it's LOCAL VFS */ - check_token_str ("test2://path1/path2/test3://path3/path4", 1, 2, "test2://path2/test3://path3"); + check_token_str ("test2://path1/path2/test3://path3/path4", 1, 2, + "test2://path2/test3://path3"); /* get 'path4' by -1,1 */ check_token_str ("/path1/path2/path3/path4", -1, 1, "path4"); @@ -211,71 +220,87 @@ START_TEST (test_vfs_path_tokens_get) check_token_str ("/path1/path2/path3/path4", -3, 0, "path2/path3/path4"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_path_append_vpath) +/* *INDENT-ON* */ { vfs_path_t *vpath1, *vpath2, *vpath3; #ifdef HAVE_CHARSET - vpath1 = vfs_path_from_str("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"); + vpath1 = + vfs_path_from_str + ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"); #else - vpath1 = vfs_path_from_str("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"); + vpath1 = + vfs_path_from_str + ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"); #endif - vpath2 = vfs_path_from_str("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"); + vpath2 = vfs_path_from_str ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"); vpath3 = vfs_path_append_vpath_new (vpath1, vpath2, NULL); - fail_unless (vfs_path_elements_count(vpath3) == 6, - "\nvpath elements count should be %d, actial is %d\n", - 6, - vfs_path_elements_count(vpath3) - ); + fail_unless (vfs_path_elements_count (vpath3) == 6, + "\nvpath elements count should be %d, actial is %d\n", + 6, vfs_path_elements_count (vpath3)); vfs_path_free (vpath1); vfs_path_free (vpath2); vfs_path_free (vpath3); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_path_relative) +/* *INDENT-ON* */ { vfs_path_t *vpath, *copy_vpath; char *path_str; - vpath = vfs_path_from_str_flags("../bla-bla", VPF_NO_CANON); + vpath = vfs_path_from_str_flags ("../bla-bla", VPF_NO_CANON); fail_unless (vpath->relative, "relative flag fail!\n"); path_str = vfs_path_to_str (vpath); - fail_unless (strcmp(path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); + fail_unless (strcmp (path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); g_free (path_str); path_str = (char *) vfs_path_get_last_path_str (vpath); - fail_unless (strcmp(path_str, "../bla-bla") == 0, "relative fail!\nactual: element->path=[%s]\n", path_str); + fail_unless (strcmp (path_str, "../bla-bla") == 0, + "relative fail!\nactual: element->path=[%s]\n", path_str); copy_vpath = vfs_path_clone (vpath); path_str = vfs_path_to_str (copy_vpath); - fail_unless (strcmp(path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); + fail_unless (strcmp (path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); g_free (path_str); vfs_path_free (copy_vpath); vfs_path_free (vpath); - vpath = vfs_path_from_str_flags ("../path/test1://user:pass@some.host:12345/bla-bla/some/path/", VPF_NO_CANON); + vpath = + vfs_path_from_str_flags ("../path/test1://user:pass@some.host:12345/bla-bla/some/path/", + VPF_NO_CANON); path_str = vfs_path_to_str (vpath); - fail_unless (strcmp(path_str, "../path/test1://user:pass@some.host:12345/bla-bla/some/path/") == 0, "relative fail!\nactual: [%s]\n", path_str); + fail_unless (strcmp (path_str, "../path/test1://user:pass@some.host:12345/bla-bla/some/path/") + == 0, "relative fail!\nactual: [%s]\n", path_str); g_free (path_str); vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/path_recode.c b/tests/lib/vfs/path_recode.c index 31f11fb28..b39dfa1a0 100644 --- a/tests/lib/vfs/path_recode.c +++ b/tests/lib/vfs/path_recode.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -60,7 +60,8 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ -static void test_init_vfs(const char *encoding) +static void +test_init_vfs (const char *encoding) { str_init_strings (encoding); @@ -76,7 +77,8 @@ static void test_init_vfs(const char *encoding) /* --------------------------------------------------------------------------------------------- */ -static void test_deinit_vfs() +static void +test_deinit_vfs () { free_codepages_list (); str_uninit_strings (); @@ -95,51 +97,64 @@ static void test_deinit_vfs() vfs_path_free (vpath);\ } +/* *INDENT-OFF* */ START_TEST (test_path_recode_base_utf8) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *result; const vfs_path_element_t *element; - test_init_vfs("UTF-8"); + test_init_vfs ("UTF-8"); - path_recode_one_check("//", "//", "//"); + path_recode_one_check ("//", "//", "//"); - path_recode_one_check("/#enc:KOI8-R/тестовый/путь", "//", "/#enc:KOI8-R/тестовый/путь"); + path_recode_one_check ("/#enc:KOI8-R/тестовый/путь", "//", + "/#enc:KOI8-R/тестовый/путь"); - test_deinit_vfs(); + test_deinit_vfs (); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_path_recode_base_koi8r) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *result; const vfs_path_element_t *element; - test_init_vfs("KOI8-R"); + test_init_vfs ("KOI8-R"); - path_recode_one_check("/тестовый/путь", "/тестовый/путь", "/тестовый/путь"); + path_recode_one_check ("/тестовый/путь", "/тестовый/путь", + "/тестовый/путь"); - path_recode_one_check("/#enc:UTF-8//", "/тестовый/путь", "/#enc:UTF-8//"); + path_recode_one_check ("/#enc:UTF-8//", "/тестовый/путь", + "/#enc:UTF-8//"); - test_deinit_vfs(); + test_deinit_vfs (); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ struct vfs_s_subclass test_subclass1; struct vfs_class vfs_test_ops1; +/* *INDENT-OFF* */ START_TEST(test_path_to_str_flags) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *str_path; - test_init_vfs("UTF-8"); + test_init_vfs ("UTF-8"); test_subclass1.flags = VFS_S_REMOTE; vfs_s_init_class (&vfs_test_ops1, &test_subclass1); @@ -154,17 +169,21 @@ START_TEST(test_path_to_str_flags) g_free (str_path); vfs_path_free (vpath); - vpath = vfs_path_from_str ("/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь"); + vpath = + vfs_path_from_str ("/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь"); str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); - fail_unless (strcmp ("/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) + == 0, "\nstr=%s\n", str_path); g_free (str_path); str_path = vfs_path_to_str_flags (vpath, 0, VPF_RECODE); - fail_unless (strcmp ("/test1://user:passwd@host.name//", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("/test1://user:passwd@host.name//", str_path) == 0, + "\nstr=%s\n", str_path); g_free (str_path); str_path = vfs_path_to_str_flags (vpath, 0, VPF_RECODE | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", + str_path); g_free (str_path); vfs_path_free (vpath); @@ -175,34 +194,46 @@ START_TEST(test_path_to_str_flags) g_free (str_path); vfs_path_free (vpath); - vpath = vfs_path_build_filename (mc_config_get_home_dir (), "test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", NULL); + vpath = + vfs_path_build_filename (mc_config_get_home_dir (), + "test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + NULL); str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("~/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("~/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) + == 0, "\nstr=%s\n", str_path); g_free (str_path); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); - fail_unless (strcmp ("~/test1://user@host.name/тестовый/путь", str_path) == 0, "\nstr=%s\n", str_path); + str_path = + vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); + fail_unless (strcmp ("~/test1://user@host.name/тестовый/путь", str_path) == 0, + "\nstr=%s\n", str_path); g_free (str_path); str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_RECODE); - fail_unless (strcmp ("~/test1://user:passwd@host.name//", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("~/test1://user:passwd@host.name//", str_path) == 0, + "\nstr=%s\n", str_path); g_free (str_path); str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_RECODE | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("~/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", str_path); + fail_unless (strcmp ("~/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", + str_path); g_free (str_path); vfs_path_free (vpath); - test_deinit_vfs(); + test_deinit_vfs (); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST(test_encode_info_at_start) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *actual; const vfs_path_element_t *vpath_element; - test_init_vfs("UTF-8"); + test_init_vfs ("UTF-8"); vpath = vfs_path_from_str ("#enc:KOI8-R/bla-bla/some/path"); actual = vfs_path_to_str (vpath); @@ -211,14 +242,17 @@ START_TEST(test_encode_info_at_start) 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); + 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(); + test_deinit_vfs (); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/path_serialize.c b/tests/lib/vfs/path_serialize.c index 9f2fffbcf..0c992b8ba 100644 --- a/tests/lib/vfs/path_serialize.c +++ b/tests/lib/vfs/path_serialize.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -141,7 +141,9 @@ teardown (void) "p10:vfs_prefixv5:test3" #endif +/* *INDENT-OFF* */ START_TEST (test_path_serialize_deserialize) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *serialized_vpath; @@ -153,36 +155,38 @@ START_TEST (test_path_serialize_deserialize) if (serialized_vpath == NULL) { - fail ("serialized_vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, error->message); + fail ("serialized_vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, + error->message); g_clear_error (&error); return; } - fail_unless ( - strcmp (serialized_vpath, ETALON_SERIALIZED_PATH ) == 0, - "\nserialized_vpath (%s)\nnot equal to etalon (%s)", serialized_vpath, ETALON_SERIALIZED_PATH - ); + fail_unless (strcmp (serialized_vpath, ETALON_SERIALIZED_PATH) == 0, + "\nserialized_vpath (%s)\nnot equal to etalon (%s)", serialized_vpath, + ETALON_SERIALIZED_PATH); vpath = vfs_path_deserialize (serialized_vpath, &error); g_free (serialized_vpath); if (vpath == NULL) { - fail ("vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, error->message); + fail ("vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, + error->message); g_clear_error (&error); return; } serialized_vpath = vfs_path_to_str (vpath); - fail_unless ( - strcmp (serialized_vpath, ETALON_PATH_URL_STR) == 0, - "\ndeserialized path (%s)\nnot equal to etalon (%s)", serialized_vpath, ETALON_PATH_URL_STR - ); - vfs_path_free(vpath); - g_free(serialized_vpath); + fail_unless (strcmp (serialized_vpath, ETALON_PATH_URL_STR) == 0, + "\ndeserialized path (%s)\nnot equal to etalon (%s)", serialized_vpath, + ETALON_PATH_URL_STR); + vfs_path_free (vpath); + g_free (serialized_vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/relative_cd.c b/tests/lib/vfs/relative_cd.c index 7e6101da2..a391a00c6 100644 --- a/tests/lib/vfs/relative_cd.c +++ b/tests/lib/vfs/relative_cd.c @@ -3,7 +3,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -18,7 +18,7 @@ You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -81,25 +81,31 @@ test_chdir (const vfs_path_t * vpath) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_relative_cd) +/* *INDENT-ON* */ { vfs_path_t *vpath; vpath = vfs_path_from_str ("/test1://user:pass@some.host:12345/path/to/dir"); - fail_if (mc_chdir(vpath) == -1); + fail_if (mc_chdir (vpath) == -1); vfs_path_free (vpath); vpath = vfs_path_from_str_flags ("some-non-exists-dir", VPF_NO_CANON); - fail_if (mc_chdir(vpath) == -1); + fail_if (mc_chdir (vpath) == -1); vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ /* Relative to panel_correct_path_to_show() */ +/* *INDENT-OFF* */ START_TEST (test_vpath_to_str_filter) +/* *INDENT-ON* */ { vfs_path_t *vpath, *last_vpath; char *filtered_path; @@ -115,14 +121,16 @@ START_TEST (test_vpath_to_str_filter) vfs_path_add_element (last_vpath, path_element); filtered_path = vfs_path_to_str_flags (last_vpath, 0, - VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); + VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); vfs_path_free (last_vpath); - fail_unless (strcmp("test1://some.host/dir", filtered_path) == 0, "actual: %s", filtered_path); + fail_unless (strcmp ("test1://some.host/dir", filtered_path) == 0, "actual: %s", filtered_path); g_free (filtered_path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/tempdir.c b/tests/lib/vfs/tempdir.c index 2a23d973a..7bd025863 100644 --- a/tests/lib/vfs/tempdir.c +++ b/tests/lib/vfs/tempdir.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -65,26 +65,30 @@ teardown (void) } /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_mc_tmpdir) +/* *INDENT-ON* */ { const char *tmpdir; const char *env_tmpdir; - tmpdir = mc_tmpdir(); - fail_unless ( - g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR), - "\nNo such directory: %s\n", tmpdir - ); + tmpdir = mc_tmpdir (); + fail_unless (g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR), + "\nNo such directory: %s\n", tmpdir); env_tmpdir = g_getenv ("MC_TMPDIR"); - fail_unless ( - strcmp (env_tmpdir, tmpdir) == 0, - "\nenv_tmpdir=%s\n tmpdir=%s\n", env_tmpdir, tmpdir - ); + fail_unless (strcmp (env_tmpdir, tmpdir) == 0, + "\nenv_tmpdir=%s\n tmpdir=%s\n", env_tmpdir, tmpdir); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ +/* --------------------------------------------------------------------------------------------- */ + +/* *INDENT-OFF* */ START_TEST (test_mc_mkstemps) +/* *INDENT-ON* */ { vfs_path_t *pname_vpath = NULL; char *pname; @@ -100,20 +104,18 @@ START_TEST (test_mc_mkstemps) vfs_path_free (pname_vpath); close (fd); - fail_unless ( - g_file_test (pname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), - "\nNo such file: %s\n", pname - ); - unlink(pname); + fail_unless (g_file_test (pname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), + "\nNo such file: %s\n", pname); + unlink (pname); - begin_pname = g_build_filename (mc_tmpdir(), "mctest-", NULL); - fail_unless ( - strncmp(pname, begin_pname, strlen(begin_pname)) == 0, - "\nstart of %s should be equal to %s\n", pname, begin_pname - ); + begin_pname = g_build_filename (mc_tmpdir (), "mctest-", NULL); + fail_unless (strncmp (pname, begin_pname, strlen (begin_pname)) == 0, + "\nstart of %s should be equal to %s\n", pname, begin_pname); g_free (pname); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c index da6aad0e7..9998c948c 100644 --- a/tests/lib/vfs/vfs_parse_ls_lga.c +++ b/tests/lib/vfs/vfs_parse_ls_lga.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -94,8 +94,8 @@ message (int flags, const char *title, const char *text, ...) va_start (ap, text); p = g_strdup_vprintf (text, ap); va_end (ap); - printf("message(): %s\n", p); - g_free(p); + printf ("message(): %s\n", p); + g_free (p); } /* --------------------------------------------------------------------------------------------- */ @@ -127,8 +127,10 @@ message (int flags, const char *title, const char *text, ...) */\ } -static void check_vfs_parse_ls_lga_call(const char *input_data, int etalon_result, -const char *etalon_filename, const char *etalon_linkname, struct stat etalon_stat, size_t *filepos) +static void +check_vfs_parse_ls_lga_call (const char *input_data, int etalon_result, + const char *etalon_filename, const char *etalon_linkname, + struct stat etalon_stat, size_t * filepos) { static struct stat test_stat; char *filename = NULL; @@ -138,20 +140,25 @@ const char *etalon_filename, const char *etalon_linkname, struct stat etalon_sta result = vfs_parse_ls_lga (input_data, &test_stat, &filename, &linkname, filepos); fail_if (result != etalon_result, - "\nactual result: %d\netalon result: %d\n", result, etalon_result); + "\nactual result: %d\netalon result: %d\n", result, etalon_result); - fail_unless((filename != NULL && etalon_filename != NULL && strcmp(filename, etalon_filename) == 0) - || (filename == NULL && etalon_filename == filename), - "\nactual filename '%s'\netalon filename '%s'", filename, etalon_filename); + fail_unless ((filename != NULL && etalon_filename != NULL + && strcmp (filename, etalon_filename) == 0) || (filename == NULL + && etalon_filename == filename), + "\nactual filename '%s'\netalon filename '%s'", filename, etalon_filename); - fail_unless((linkname != NULL && etalon_linkname != NULL && strcmp(linkname, etalon_linkname) == 0) - || (linkname == NULL && etalon_linkname == linkname), - "\nactual linkname '%s'\netalon linkname '%s'", linkname, etalon_linkname); + fail_unless ((linkname != NULL && etalon_linkname != NULL + && strcmp (linkname, etalon_linkname) == 0) || (linkname == NULL + && etalon_linkname == linkname), + "\nactual linkname '%s'\netalon linkname '%s'", linkname, etalon_linkname); - check_stat_struct(etalon_stat, test_stat, input_data); + check_stat_struct (etalon_stat, test_stat, input_data); } +/* *INDENT-OFF* */ START_TEST (test_vfs_parse_ls_lga) +/* *INDENT-ON* */ + { size_t filepos = 0; @@ -171,13 +178,11 @@ START_TEST (test_vfs_parse_ls_lga) etalon_stat.st_mtime = 1308838140; etalon_stat.st_ctime = 1308838140; - vfs_parse_ls_lga_init(); + vfs_parse_ls_lga_init (); - check_vfs_parse_ls_lga_call( - "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", - 1, "build_root", NULL, etalon_stat, - NULL - ); + check_vfs_parse_ls_lga_call + ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", 1, "build_root", + NULL, etalon_stat, NULL); etalon_stat.st_dev = 0; etalon_stat.st_ino = 0; @@ -193,11 +198,9 @@ START_TEST (test_vfs_parse_ls_lga) etalon_stat.st_mtime = 1268431200; etalon_stat.st_ctime = 1268431200; - check_vfs_parse_ls_lga_call( - "lrwxrwxrwx 1 500 500 11 Mar 13 2010 COPYING -> doc/COPYING", - 1, "COPYING", "doc/COPYING", etalon_stat, - NULL - ); + check_vfs_parse_ls_lga_call + ("lrwxrwxrwx 1 500 500 11 Mar 13 2010 COPYING -> doc/COPYING", 1, + "COPYING", "doc/COPYING", etalon_stat, NULL); etalon_stat.st_dev = 0; etalon_stat.st_ino = 0; @@ -213,11 +216,8 @@ START_TEST (test_vfs_parse_ls_lga) etalon_stat.st_mtime = 1308838140; etalon_stat.st_ctime = 1308838140; - check_vfs_parse_ls_lga_call( - "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", - 1, "..", NULL, etalon_stat, - &filepos - ); + check_vfs_parse_ls_lga_call ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", + 1, "..", NULL, etalon_stat, &filepos); etalon_stat.st_dev = 0; @@ -234,27 +234,30 @@ START_TEST (test_vfs_parse_ls_lga) etalon_stat.st_mtime = 1308838140; etalon_stat.st_ctime = 1308838140; - check_vfs_parse_ls_lga_call( - "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", - 1, "build_root", NULL, etalon_stat, - &filepos - ); + check_vfs_parse_ls_lga_call + ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", 1, "build_root", + NULL, etalon_stat, &filepos); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_parse_ls_lga_reorder) +/* *INDENT-ON* */ { size_t filepos = 0; struct vfs_s_entry *ent1, *ent2, *ent3; - vfs_parse_ls_lga_init(); + vfs_parse_ls_lga_init (); ent1 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1", - &ent1->ino->st, &ent1->name, &ent1->ino->linkname, &filepos)) + if (!vfs_parse_ls_lga + ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1", &ent1->ino->st, + &ent1->name, &ent1->ino->linkname, &filepos)) { fail ("An error occured while parse ls output"); return; @@ -264,8 +267,8 @@ START_TEST (test_vfs_parse_ls_lga_reorder) ent2 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2", - &ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos)) + if (!vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2", + &ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos)) { fail ("An error occured while parse ls output"); return; @@ -274,8 +277,8 @@ START_TEST (test_vfs_parse_ls_lga_reorder) vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent2); ent3 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (! vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", - &ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos)) + if (!vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", + &ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos)) { fail ("An error occured while parse ls output"); return; @@ -285,10 +288,14 @@ START_TEST (test_vfs_parse_ls_lga_reorder) vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ()); - fail_unless(strcmp(ent1->name, " build_root1") == 0, "\nactual '%s'\nnot equal to '%s'\n", ent1->name, " build_root1"); - fail_unless(strcmp(ent2->name, " build_root2") == 0, "\nactual '%s'\nnot equal to '%s'\n", ent2->name, " build_root2"); + fail_unless (strcmp (ent1->name, " build_root1") == 0, "\nactual '%s'\nnot equal to '%s'\n", + ent1->name, " build_root1"); + fail_unless (strcmp (ent2->name, " build_root2") == 0, "\nactual '%s'\nnot equal to '%s'\n", + ent2->name, " build_root2"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ #define parce_one_line(ent_index, ls_output) {\ @@ -310,26 +317,31 @@ END_TEST );\ } +/* *INDENT-OFF* */ START_TEST (test_vfs_parse_ls_lga_unaligned) +/* *INDENT-ON* */ { size_t filepos = 0; struct vfs_s_entry *ent[4]; - vfs_parse_ls_lga_init(); + vfs_parse_ls_lga_init (); - parce_one_line(0, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1"); - parce_one_line(1, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2"); - parce_one_line(2, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 .."); - parce_one_line(3, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root 0"); + parce_one_line (0, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1"); + parce_one_line (1, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2"); + parce_one_line (2, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 .."); + parce_one_line (3, + "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root 0"); vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ()); - fail_unless_ent(0, "build_root1"); - fail_unless_ent(1, " build_root2"); - fail_unless_ent(3, " build_root 0"); + fail_unless_ent (0, "build_root1"); + fail_unless_ent (1, " build_root2"); + fail_unless_ent (3, " build_root 0"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/vfs_path_string_convert.c b/tests/lib/vfs/vfs_path_string_convert.c index 5016b6b56..d86a8a08b 100644 --- a/tests/lib/vfs/vfs_path_string_convert.c +++ b/tests/lib/vfs/vfs_path_string_convert.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -37,7 +37,7 @@ #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" -#include "lib/vfs/path.c" /* for testing static methods */ +#include "lib/vfs/path.c" /* for testing static methods */ #include "src/vfs/local/local.c" @@ -85,7 +85,9 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ #define ETALON_PATH_STR "/#test1/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33" #define ETALON_PATH_URL_STR "/test1://bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33" +/* *INDENT-OFF* */ START_TEST (test_vfs_path_from_to_string) +/* *INDENT-ON* */ { vfs_path_t *vpath; size_t vpath_len; @@ -93,20 +95,25 @@ START_TEST (test_vfs_path_from_to_string) vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); - vpath_len = vfs_path_elements_count(vpath); - fail_unless(vpath_len == 4, "vpath length should be 4 (actial: %d)",vpath_len); + vpath_len = vfs_path_elements_count (vpath); + fail_unless (vpath_len == 4, "vpath length should be 4 (actial: %d)", vpath_len); - result = vfs_path_to_str(vpath); - fail_unless(strcmp(ETALON_PATH_URL_STR, result) == 0, "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free(result); + result = vfs_path_to_str (vpath); + fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, + "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); + g_free (result); - vfs_path_free(vpath); + vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_path_from_to_string2) +/* *INDENT-ON* */ { vfs_path_t *vpath; size_t vpath_len; @@ -115,89 +122,91 @@ START_TEST (test_vfs_path_from_to_string2) vpath = vfs_path_from_str ("/"); - vpath_len = vfs_path_elements_count(vpath); - fail_unless(vpath_len == 1, "vpath length should be 1 (actial: %d)",vpath_len); + vpath_len = vfs_path_elements_count (vpath); + fail_unless (vpath_len == 1, "vpath length should be 1 (actial: %d)", vpath_len); - result = vfs_path_to_str(vpath); - fail_unless(strcmp("/", result) == 0, "expected(%s) doesn't equal to actual(%s)", "/", result); - g_free(result); + result = vfs_path_to_str (vpath); + fail_unless (strcmp ("/", result) == 0, "expected(%s) doesn't equal to actual(%s)", "/", + result); + g_free (result); path_element = vfs_path_get_by_index (vpath, -1); - fail_unless(strcmp("/", path_element->path) == 0, "expected(%s) doesn't equal to actual(%s)", "/", path_element->path); + fail_unless (strcmp ("/", path_element->path) == 0, "expected(%s) doesn't equal to actual(%s)", + "/", path_element->path); - fail_unless(path_element->class == &vfs_local_ops , "actual vfs-class doesn't equal to localfs"); + fail_unless (path_element->class == &vfs_local_ops, + "actual vfs-class doesn't equal to localfs"); - vfs_path_free(vpath); + vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_path_from_to_partial_string_by_class) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *result; vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); - result = vfs_path_to_str_elements_count(vpath, -1); - fail_unless( - strcmp("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, -1); + fail_unless (strcmp ("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, + "expected(%s) doesn't equal to actual(%s)", + "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, -2); - fail_unless( - strcmp("/test1://bla-bla/some/path/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, -2); + fail_unless (strcmp ("/test1://bla-bla/some/path/", result) == 0, + "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, -3); - fail_unless( - strcmp("/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, -3); + fail_unless (strcmp ("/", result) == 0, + "expected(%s) doesn't equal to actual(%s)", "/", result); + g_free (result); - /* index out of bound*/ - result = vfs_path_to_str_elements_count(vpath, -4); - fail_unless( - strcmp("", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "", result); - g_free(result); + /* index out of bound */ + result = vfs_path_to_str_elements_count (vpath, -4); + fail_unless (strcmp ("", result) == 0, "expected(%s) doesn't equal to actual(%s)", "", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, 1); - fail_unless( - strcmp("/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, 1); + fail_unless (strcmp ("/", result) == 0, + "expected(%s) doesn't equal to actual(%s)", "/", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, 2); - fail_unless( - strcmp("/test1://bla-bla/some/path/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, 2); + fail_unless (strcmp ("/test1://bla-bla/some/path/", result) == 0, + "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, 3); - fail_unless( - strcmp("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, 3); + fail_unless (strcmp ("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, + "expected(%s) doesn't equal to actual(%s)", + "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); + g_free (result); - result = vfs_path_to_str_elements_count(vpath, 4); - fail_unless( - strcmp(ETALON_PATH_URL_STR, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free(result); + result = vfs_path_to_str_elements_count (vpath, 4); + fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, + "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); + g_free (result); - /* index out of bound*/ - result = vfs_path_to_str_elements_count(vpath, 5); - fail_unless( - strcmp(ETALON_PATH_URL_STR, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free(result); + /* index out of bound */ + result = vfs_path_to_str_elements_count (vpath, 5); + fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, + "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); + g_free (result); - vfs_path_free(vpath); + vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ + /* --------------------------------------------------------------------------------------------- */ #ifdef HAVE_CHARSET #define encoding_check( input , etalon ) \ @@ -214,48 +223,49 @@ END_TEST vfs_path_free(vpath); \ } +/* *INDENT-OFF* */ START_TEST (test_vfs_path_from_to_string_encoding) +/* *INDENT-ON* */ { 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/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/#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/#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/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/#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" - ); + 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 (); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ + /* --------------------------------------------------------------------------------------------- */ #define ETALON_STR "/path/to/file.ext/test1://#enc:KOI8-R" +/* *INDENT-OFF* */ START_TEST (test_vfs_path_encoding_at_end) +/* *INDENT-ON* */ { vfs_path_t *vpath; char *result; @@ -264,46 +274,57 @@ START_TEST (test_vfs_path_encoding_at_end) 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); + 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); + 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 ); + fail_unless (result != NULL && strcmp (result, ETALON_STR) == 0, + "\nactual: %s\netalon: %s", result, ETALON_STR); - g_free(result); - vfs_path_free(vpath); + g_free (result); + vfs_path_free (vpath); free_codepages_list (); } +/* *INDENT-OFF* */ END_TEST -#endif /* HAVE_CHARSET */ +/* *INDENT-ON* */ +#endif /* HAVE_CHARSET */ /* --------------------------------------------------------------------------------------------- */ #undef ETALON_PATH_STR #define ETALON_PATH_STR "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33" +/* *INDENT-OFF* */ START_TEST (test_vfs_path_from_to_string_uri) +/* *INDENT-ON* */ { vfs_path_t *vpath; size_t vpath_len; char *result; vpath = vfs_path_from_str (ETALON_PATH_STR); - vpath_len = vfs_path_elements_count(vpath); - fail_unless(vpath_len == 4, "vpath length should be 4 (actial: %d)",vpath_len); + vpath_len = vfs_path_elements_count (vpath); + fail_unless (vpath_len == 4, "vpath length should be 4 (actial: %d)", vpath_len); - result = vfs_path_to_str(vpath); - fail_unless(strcmp(ETALON_PATH_STR, result) == 0, "\nexpected(%s)\ndoesn't equal to actual(%s)", ETALON_PATH_STR, result); - g_free(result); + result = vfs_path_to_str (vpath); + fail_unless (strcmp (ETALON_PATH_STR, result) == 0, + "\nexpected(%s)\ndoesn't equal to actual(%s)", ETALON_PATH_STR, result); + g_free (result); - vfs_path_free(vpath); + vfs_path_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/vfs_prefix_to_class.c b/tests/lib/vfs/vfs_prefix_to_class.c index b7eb098b0..59dedb066 100644 --- a/tests/lib/vfs/vfs_prefix_to_class.c +++ b/tests/lib/vfs/vfs_prefix_to_class.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -32,7 +32,7 @@ #include "lib/global.h" #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" -#include "lib/vfs/vfs.c" /* for testing static methods */ +#include "lib/vfs/vfs.c" /* for testing static methods */ #include "src/vfs/local/local.c" @@ -45,12 +45,9 @@ test_which (struct vfs_class *me, const char *path) { (void) me; - if ( - (strcmp(path, "test_1:") == 0) || - (strcmp(path, "test_2:") == 0) || - (strcmp(path, "test_3:") == 0) || - (strcmp(path, "test_4:") == 0) - ) + if ((strcmp (path, "test_1:") == 0) || + (strcmp (path, "test_2:") == 0) || + (strcmp (path, "test_3:") == 0) || (strcmp (path, "test_4:") == 0)) return 1; return -1; } @@ -95,28 +92,45 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_prefix_to_class_valid) +/* *INDENT-ON* */ { - fail_unless(vfs_prefix_to_class((char *) "test_1:") == &vfs_test_ops1, "'test_1:' doesn't transform to vfs_test_ops1"); - fail_unless(vfs_prefix_to_class((char *) "test_2:") == &vfs_test_ops1, "'test_2:' doesn't transform to vfs_test_ops1"); - fail_unless(vfs_prefix_to_class((char *) "test_3:") == &vfs_test_ops1, "'test_3:' doesn't transform to vfs_test_ops1"); - fail_unless(vfs_prefix_to_class((char *) "test_4:") == &vfs_test_ops1, "'test_4:' doesn't transform to vfs_test_ops1"); + fail_unless (vfs_prefix_to_class ((char *) "test_1:") == &vfs_test_ops1, + "'test_1:' doesn't transform to vfs_test_ops1"); + fail_unless (vfs_prefix_to_class ((char *) "test_2:") == &vfs_test_ops1, + "'test_2:' doesn't transform to vfs_test_ops1"); + fail_unless (vfs_prefix_to_class ((char *) "test_3:") == &vfs_test_ops1, + "'test_3:' doesn't transform to vfs_test_ops1"); + fail_unless (vfs_prefix_to_class ((char *) "test_4:") == &vfs_test_ops1, + "'test_4:' doesn't transform to vfs_test_ops1"); - fail_unless(vfs_prefix_to_class((char *) "test2:") == &vfs_test_ops2, "'test2:' doesn't transform to vfs_test_ops2"); + fail_unless (vfs_prefix_to_class ((char *) "test2:") == &vfs_test_ops2, + "'test2:' doesn't transform to vfs_test_ops2"); - fail_unless(vfs_prefix_to_class((char *) "test3:") == &vfs_test_ops3, "'test3:' doesn't transform to vfs_test_ops3"); + fail_unless (vfs_prefix_to_class ((char *) "test3:") == &vfs_test_ops3, + "'test3:' doesn't transform to vfs_test_ops3"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_prefix_to_class_invalid) +/* *INDENT-ON* */ { - fail_unless(vfs_prefix_to_class((char *) "test1:") == NULL, "'test1:' doesn't transform to NULL"); - fail_unless(vfs_prefix_to_class((char *) "test_5:") == NULL, "'test_5:' doesn't transform to NULL"); - fail_unless(vfs_prefix_to_class((char *) "test4:") == NULL, "'test4:' doesn't transform to NULL"); + fail_unless (vfs_prefix_to_class ((char *) "test1:") == NULL, + "'test1:' doesn't transform to NULL"); + fail_unless (vfs_prefix_to_class ((char *) "test_5:") == NULL, + "'test_5:' doesn't transform to NULL"); + fail_unless (vfs_prefix_to_class ((char *) "test4:") == NULL, + "'test4:' doesn't transform to NULL"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/vfs_s_get_path.c b/tests/lib/vfs/vfs_s_get_path.c index 9f894b8e7..e3f270daf 100644 --- a/tests/lib/vfs/vfs_s_get_path.c +++ b/tests/lib/vfs/vfs_s_get_path.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -31,7 +31,7 @@ #include "lib/global.h" #include "lib/strutil.h" -#include "lib/vfs/direntry.c" /* for testing static methods */ +#include "lib/vfs/direntry.c" /* for testing static methods */ #include "src/vfs/local/local.c" @@ -44,25 +44,27 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; static int -test1_mock_open_archive(struct vfs_s_super *super, const vfs_path_t *vpath, const vfs_path_element_t *vpath_element) +test1_mock_open_archive (struct vfs_s_super *super, const vfs_path_t * vpath, + const vfs_path_element_t * vpath_element) { struct vfs_s_inode *root; char *spath = vfs_path_to_str (vpath); - fail_unless(strcmp("/" ETALON_VFS_URL_NAME ARCH_NAME, spath) == 0, - "etalon(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, spath); + fail_unless (strcmp ("/" ETALON_VFS_URL_NAME ARCH_NAME, spath) == 0, + "etalon(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, + spath); super->name = g_strdup (spath); super->data = g_new (char *, 1); root = vfs_s_new_inode (vpath_element->class, super, NULL); super->root = root; - g_free(spath); + g_free (spath); return 0; } static int -test1_mock_archive_same (const vfs_path_element_t *vpath_element, struct vfs_s_super *super, - const vfs_path_t *vpath, void *cookie) +test1_mock_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *super, + const vfs_path_t * vpath, void *cookie) { const vfs_path_element_t *path_element; @@ -70,8 +72,8 @@ test1_mock_archive_same (const vfs_path_element_t *vpath_element, struct vfs_s_s (void) super; (void) cookie; - path_element = vfs_path_get_by_index(vpath, -1); - if (strcmp(ARCH_NAME, path_element->path) != 0) + path_element = vfs_path_get_by_index (vpath, -1); + if (strcmp (ARCH_NAME, path_element->path) != 0) return 0; return 1; } @@ -120,31 +122,37 @@ teardown (void) void vfs_die (const char *m) { - printf("VFS_DIE: '%s'\n", m); + printf ("VFS_DIE: '%s'\n", m); } /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_s_get_path) +/* *INDENT-ON* */ { struct vfs_s_super *archive; const char *result; - vfs_path_t *vpath = vfs_path_from_str_flags ("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH, - VPF_USE_DEPRECATED_PARSER); + vfs_path_t *vpath = + vfs_path_from_str_flags ("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH, + VPF_USE_DEPRECATED_PARSER); result = vfs_s_get_path (vpath, &archive, 0); - fail_unless(strcmp(ETALON_PATH, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH, result); + fail_unless (strcmp (ETALON_PATH, result) == 0, + "expected(%s) doesn't equal to actual(%s)", ETALON_PATH, result); - fail_unless(strcmp("/" ETALON_VFS_URL_NAME ARCH_NAME,archive->name) == 0, - "expected(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, archive->name); + fail_unless (strcmp ("/" ETALON_VFS_URL_NAME ARCH_NAME, archive->name) == 0, + "expected(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, + archive->name); - g_free(vpath); + g_free (vpath); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/vfs/vfs_split.c b/tests/lib/vfs/vfs_split.c index b780a74f8..ab6d9f30b 100644 --- a/tests/lib/vfs/vfs_split.c +++ b/tests/lib/vfs/vfs_split.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib/vfs" @@ -32,7 +32,7 @@ #include "lib/global.h" #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" -#include "lib/vfs/path.c" /* for testing static methods */ +#include "lib/vfs/path.c" /* for testing static methods */ #include "src/vfs/local/local.c" @@ -79,164 +79,236 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_split) +/* *INDENT-ON* */ { char *path; const char *local, *op, *etalon_path, *etalon_local, *etalon_op; struct vfs_class *result; - path = g_strdup("#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/#test3:/qqq/www/eee.rr"); + path = g_strdup ("#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/#test3:/qqq/www/eee.rr"); etalon_path = "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/"; etalon_local = "qqq/www/eee.rr"; etalon_op = "test3:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, &vfs_test_ops3); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, + &vfs_test_ops3); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); etalon_path = "#test1:/bla-bla/some/path/"; etalon_local = "bla-bla/some/path2/"; etalon_op = "test2:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, &vfs_test_ops2); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, + &vfs_test_ops2); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); etalon_path = ""; etalon_local = "bla-bla/some/path/"; etalon_op = "test1:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, &vfs_test_ops2); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, + &vfs_test_ops2); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); - g_free(path); + g_free (path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_split_with_local) +/* *INDENT-ON* */ { char *path; const char *local, *op, *etalon_path, *etalon_local, *etalon_op; struct vfs_class *result; - path = g_strdup("/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2#test3:/qqq/www/eee.rr"); + path = + g_strdup + ("/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2#test3:/qqq/www/eee.rr"); etalon_path = "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2"; etalon_local = "qqq/www/eee.rr"; etalon_op = "test3:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, &vfs_test_ops3); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, + &vfs_test_ops3); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); etalon_path = "/local/path/#test1:/bla-bla/some/path/"; etalon_local = "bla-bla/some/path2"; etalon_op = "test2:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, &vfs_test_ops2); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, + &vfs_test_ops2); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); etalon_path = "/local/path/"; etalon_local = "bla-bla/some/path/"; etalon_op = "test1:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, &vfs_test_ops2); - fail_unless(strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, + &vfs_test_ops2); + fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", + local, etalon_local); + fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); + fail_unless (result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); - g_free(path); + g_free (path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_split_url) +/* *INDENT-ON* */ { char *path; const char *local, *op, *etalon_path, *etalon_local, *etalon_op; struct vfs_class *result; - path = g_strdup("#test2:username:passwd@somehost.net/bla-bla/some/path2"); + path = g_strdup ("#test2:username:passwd@somehost.net/bla-bla/some/path2"); etalon_path = ""; etalon_local = "bla-bla/some/path2"; etalon_op = "test2:username:passwd@somehost.net"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, &vfs_test_ops2); - fail_unless(path != NULL && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(local != NULL && strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(op != NULL && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, + &vfs_test_ops2); + fail_unless (path != NULL + && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (local != NULL + && strcmp (local, etalon_local) == 0, + "parsed local path('%s') doesn't match to '%s'", local, etalon_local); + fail_unless (op != NULL + && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); - g_free(path); + g_free (path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_split_url_with_semi) +/* *INDENT-ON* */ { char *path; const char *local, *op, *etalon_path, *etalon_local, *etalon_op; struct vfs_class *result; - path = g_strdup("/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2"); + path = + g_strdup + ("/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2"); etalon_path = "/local/path/#test1:/bla-bla/some/path/"; etalon_local = "bla-bla/some/path2"; etalon_op = "test2:username:p!a@s#s$w%d@somehost.net"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, &vfs_test_ops2); - fail_unless(path != NULL && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(local != NULL && strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(op != NULL && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, + &vfs_test_ops2); + fail_unless (path != NULL + && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (local != NULL + && strcmp (local, etalon_local) == 0, + "parsed local path('%s') doesn't match to '%s'", local, etalon_local); + fail_unless (op != NULL + && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); - g_free(path); + g_free (path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (test_vfs_split_with_semi_in_path) +/* *INDENT-ON* */ { char *path; const char *local, *op, *etalon_path, *etalon_local, *etalon_op; struct vfs_class *result; - path = g_strdup("#test2:/bl#a-bl#a/so#me/pa#th2"); + path = g_strdup ("#test2:/bl#a-bl#a/so#me/pa#th2"); etalon_path = ""; etalon_local = "bl#a-bl#a/so#me/pa#th2"; etalon_op = "test2:"; result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless(result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, &vfs_test_ops2); - fail_unless(path != NULL && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, etalon_path); - fail_unless(local != NULL && strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless(op != NULL && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, etalon_op); + fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, + &vfs_test_ops2); + fail_unless (path != NULL + && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, + etalon_path); + fail_unless (local != NULL + && strcmp (local, etalon_local) == 0, + "parsed local path('%s') doesn't match to '%s'", local, etalon_local); + fail_unless (op != NULL + && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, + etalon_op); - g_free(path); + g_free (path); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/x_basename.c b/tests/lib/x_basename.c index bf8e14c4d..1435bfc97 100644 --- a/tests/lib/x_basename.c +++ b/tests/lib/x_basename.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/lib" @@ -54,7 +54,9 @@ teardown (void) "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result, etalon); \ } +/* *INDENT-OFF* */ START_TEST (test_x_basename) +/* *INDENT-ON* */ { const char *result; check_x_basename ("/test/path/test2/path2", "path2"); @@ -72,7 +74,9 @@ START_TEST (test_x_basename) check_x_basename ("/test/path/test2/path2/vfsprefix:///", "/"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/src/filemanager/examine_cd.c b/tests/src/filemanager/examine_cd.c index 0ebf1ca2e..7da927f7b 100644 --- a/tests/src/filemanager/examine_cd.c +++ b/tests/src/filemanager/examine_cd.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/src/filemanager" @@ -129,7 +129,9 @@ teardown (void) g_free (result); \ } +/* *INDENT-OFF* */ START_TEST (test_examine_cd) +/* *INDENT-ON* */ { char *result; @@ -156,7 +158,9 @@ START_TEST (test_examine_cd) check_examine_cd ("/test/path/\\${AAA}test2", "/test/path/${AAA}test2"); check_examine_cd ("/test/path/test1\\${AAA}test2", "/test/path/test1${AAA}test2"); } +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/src/filemanager/exec_get_export_variables_ext.c b/tests/src/filemanager/exec_get_export_variables_ext.c index 31bd2c02b..c95e70b73 100644 --- a/tests/src/filemanager/exec_get_export_variables_ext.c +++ b/tests/src/filemanager/exec_get_export_variables_ext.c @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "/src/filemanager" @@ -52,8 +52,8 @@ setup (void) vfs_setup_work_dir (); mc_global.mc_run_mode = MC_RUN_FULL; - current_panel = g_new0(struct WPanel, 1); - current_panel->cwd_vpath = vfs_path_from_str("/home"); + current_panel = g_new0 (struct WPanel, 1); + current_panel->cwd_vpath = vfs_path_from_str ("/home"); current_panel->dir.list = g_new0 (file_entry, MIN_FILES); current_panel->dir.size = MIN_FILES; } @@ -67,23 +67,25 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* *INDENT-OFF* */ START_TEST (sanitize_variables) +/* *INDENT-ON* */ { /* given */ - vfs_path_t * filename_vpath; + vfs_path_t *filename_vpath; char *actual_string; const char *expected_string; current_panel->selected = 0; - current_panel->dir.list[0].fname = (char*) "selected file.txt"; - current_panel->dir.list[1].fname = (char*) "tagged file1.txt"; + current_panel->dir.list[0].fname = (char *) "selected file.txt"; + current_panel->dir.list[1].fname = (char *) "tagged file1.txt"; current_panel->dir.list[1].f.marked = TRUE; - current_panel->dir.list[2].fname = (char*) "tagged file2.txt"; + current_panel->dir.list[2].fname = (char *) "tagged file2.txt"; current_panel->dir.list[2].f.marked = TRUE; current_panel->count = 3; /* when */ - filename_vpath = vfs_path_from_str("/tmp/blabla.txt"); + filename_vpath = vfs_path_from_str ("/tmp/blabla.txt"); actual_string = exec_get_export_variables (filename_vpath); vfs_path_free (filename_vpath); @@ -104,8 +106,9 @@ export MC_EXT_ONLYTAGGED\n"; g_free (actual_string); } - +/* *INDENT-OFF* */ END_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ From c521ca12d57de42f3063f01fb9d5cece00ac85a5 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 19 Jan 2013 20:13:27 +0400 Subject: [PATCH 02/35] Don't close the file progress dialog after press on "Skip" button. Signed-off-by: Andrew Borodin --- src/filemanager/filegui.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index fe31578da..a5993fb57 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -629,7 +629,7 @@ place_progress_buttons (WDialog * h, gboolean suspended) /* --------------------------------------------------------------------------------------------- */ static int -progress_start_stop (WButton * button, int action) +progress_button_callback (WButton * button, int action) { (void) button; (void) action; @@ -769,13 +769,13 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, progress_buttons[0].w = WIDGET (button_new (y, 0, progress_buttons[0].action, progress_buttons[0].flags, progress_buttons[0].text, - NULL)); + progress_button_callback)); if (progress_buttons[0].len == -1) progress_buttons[0].len = button_get_len (BUTTON (progress_buttons[0].w)); progress_buttons[1].w = WIDGET (button_new (y, 0, progress_buttons[1].action, progress_buttons[1].flags, progress_buttons[1].text, - progress_start_stop)); + progress_button_callback)); if (progress_buttons[1].len == -1) progress_buttons[1].len = button_get_len (BUTTON (progress_buttons[1].w)); @@ -784,7 +784,8 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, /* create and destroy button to get it length */ progress_buttons[2].w = WIDGET (button_new (y, 0, progress_buttons[2].action, progress_buttons[2].flags, - progress_buttons[2].text, progress_start_stop)); + progress_buttons[2].text, + progress_button_callback)); progress_buttons[2].len = button_get_len (BUTTON (progress_buttons[2].w)); send_message (progress_buttons[2].w, NULL, MSG_DESTROY, 0, NULL); g_free (progress_buttons[2].w); From bbf84a02e4afd75fd57bce4d5137d643d8a044a9 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 19 Jan 2013 20:22:57 +0400 Subject: [PATCH 03/35] (check_progress_buttons): redraw file progress dialog ...after step from "Suspend" state to "Skip" one. Signed-off-by: Andrew Borodin --- src/filemanager/filegui.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index a5993fb57..ea40a79f0 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -666,6 +666,12 @@ check_progress_buttons (FileOpContext * ctx) switch (ui->op_dlg->ret_value) { case FILE_SKIP: + if (ctx->suspended) + { + /* redraw dialog in case of Skip after Suspend */ + place_progress_buttons (ui->op_dlg, FALSE); + dlg_redraw (ui->op_dlg); + } ctx->suspended = FALSE; return FILE_SKIP; case B_CANCEL: From 0e3550594f28df54a09b21c1270dfb569ab26108 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Sat, 19 Jan 2013 16:42:26 +0300 Subject: [PATCH 04/35] Create tests/mctest.h with useful inline macros Signed-off-by: Slava Zanko --- tests/Makefile.am | 2 + tests/lib/library_independ.c | 10 +-- tests/lib/mc_build_filename.c | 9 +- tests/lib/mcconfig/config_string.c | 9 +- tests/lib/mcconfig/user_configs_path.c | 8 +- tests/lib/name_quote.c | 44 +++++----- .../search/regex_process_escape_sequence.c | 8 +- tests/lib/search/regex_replace_esc_seq.c | 8 +- tests/lib/serialize.c | 9 +- tests/lib/vfs/canonicalize_pathname.c | 9 +- tests/lib/vfs/current_dir.c | 8 +- tests/lib/vfs/path_cmp.c | 9 +- tests/lib/vfs/path_len.c | 9 +- tests/lib/vfs/path_manipulations.c | 9 +- tests/lib/vfs/path_recode.c | 10 +-- tests/lib/vfs/path_serialize.c | 10 +-- tests/lib/vfs/relative_cd.c | 9 +- tests/lib/vfs/tempdir.c | 10 +-- tests/lib/vfs/vfs_parse_ls_lga.c | 8 +- tests/lib/vfs/vfs_path_string_convert.c | 10 +-- tests/lib/vfs/vfs_prefix_to_class.c | 9 +- tests/lib/vfs/vfs_s_get_path.c | 9 +- tests/lib/vfs/vfs_split.c | 9 +- tests/lib/x_basename.c | 85 +++++++++++++------ tests/mctest.h | 77 +++++++++++++++++ tests/src/filemanager/do_cd_command.c | 23 ++--- tests/src/filemanager/examine_cd.c | 8 +- .../exec_get_export_variables_ext.c | 11 +-- 28 files changed, 240 insertions(+), 199 deletions(-) create mode 100644 tests/mctest.h diff --git a/tests/Makefile.am b/tests/Makefile.am index 45996340f..fc1637130 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1 +1,3 @@ SUBDIRS = lib src + +EXTRA_DIST = mctest.h diff --git a/tests/lib/library_independ.c b/tests/lib/library_independ.c index 1d4d0cd3a..7a491ec4e 100644 --- a/tests/lib/library_independ.c +++ b/tests/lib/library_independ.c @@ -1,11 +1,11 @@ /* libmc - check if library is independ to $(topsrc)/src directory - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "lib/library_independ" -#include - -#include - -#include "lib/global.h" +#include "tests/mctest.h" /* --------------------------------------------------------------------------------------------- */ diff --git a/tests/lib/mc_build_filename.c b/tests/lib/mc_build_filename.c index 43b8d5a2e..1df0162fc 100644 --- a/tests/lib/mc_build_filename.c +++ b/tests/lib/mc_build_filename.c @@ -1,11 +1,11 @@ /* lib/vfs - mc_build_filename() function testing - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,13 +25,10 @@ #define TEST_SUITE_NAME "/lib" -#include - -#include +#include "tests/mctest.h" #include -#include "lib/global.h" #include "lib/strutil.h" #include "lib/util.h" diff --git a/tests/lib/mcconfig/config_string.c b/tests/lib/mcconfig/config_string.c index 4e4617f24..6c9fd2c2f 100644 --- a/tests/lib/mcconfig/config_string.c +++ b/tests/lib/mcconfig/config_string.c @@ -1,11 +1,11 @@ /* libmc - check mcconfig submodule. read and write config files - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "lib/mcconfig" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/mcconfig.h" #include "lib/strutil.h" #include "lib/strescape.h" diff --git a/tests/lib/mcconfig/user_configs_path.c b/tests/lib/mcconfig/user_configs_path.c index f25b510c7..b06b2488e 100644 --- a/tests/lib/mcconfig/user_configs_path.c +++ b/tests/lib/mcconfig/user_configs_path.c @@ -1,11 +1,11 @@ /* libmc - check mcconfig submodule. Get full paths to user's config files. - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -24,10 +24,8 @@ */ #define TEST_SUITE_NAME "lib/mcconfig" -#include -#include -#include "lib/global.h" +#include "tests/mctest.h" #include "lib/strutil.h" #include "lib/strescape.h" diff --git a/tests/lib/name_quote.c b/tests/lib/name_quote.c index 091d4a203..8fde62985 100644 --- a/tests/lib/name_quote.c +++ b/tests/lib/name_quote.c @@ -1,11 +1,11 @@ /* lib/vfs - Quote file names - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,20 +25,19 @@ #define TEST_SUITE_NAME "/lib/util" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/util.h" /* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { } +/* @After */ static void teardown (void) { @@ -46,8 +45,9 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("data_source1") */ /* *INDENT-OFF* */ -static const struct data_source1_struct +static const struct data_source1 { gboolean input_quote_percent; const char *input_string; @@ -60,30 +60,31 @@ static const struct data_source1_struct }; /* *INDENT-ON* */ +/* @Test(dataSource = "data_source1") */ /* *INDENT-OFF* */ -START_TEST (quote_percent_test) +START_PARAMETRIZED_TEST (quote_percent_test, data_source1) /* *INDENT-ON* */ { /* given */ char *actual_string; - const struct data_source1_struct test_data = data_source1[_i]; /* when */ - actual_string = name_quote (test_data.input_string, test_data.input_quote_percent); + actual_string = name_quote (data->input_string, data->input_quote_percent); /* then */ - g_assert_cmpstr (actual_string, ==, test_data.expected_string); + mctest_assert_str_eq (actual_string, data->expected_string); g_free (actual_string); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("data_source2") */ /* *INDENT-OFF* */ -static const struct data_source2_struct +static const struct data_source2 { const char *input_string; @@ -102,24 +103,24 @@ static const struct data_source2_struct }; /* *INDENT-ON* */ +/* @Test(dataSource = "data_source2") */ /* *INDENT-OFF* */ -START_TEST (name_quote_test) +START_PARAMETRIZED_TEST (name_quote_test, data_source2) /* *INDENT-ON* */ { /* given */ char *actual_string; - const struct data_source2_struct test_data = data_source2[_i]; /* when */ - actual_string = name_quote (test_data.input_string, FALSE); + actual_string = name_quote (data->input_string, FALSE); /* then */ - g_assert_cmpstr (actual_string, ==, test_data.expected_string); + mctest_assert_str_eq (actual_string, data->expected_string); g_free (actual_string); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -136,11 +137,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, quote_percent_test, 0, - sizeof (data_source1) / sizeof (data_source1[0])); - - tcase_add_loop_test (tc_core, name_quote_test, 0, - sizeof (data_source2) / sizeof (data_source2[0])); + mctest_add_parameterized_test (tc_core, quote_percent_test, data_source1); + mctest_add_parameterized_test (tc_core, name_quote_test, data_source2); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/search/regex_process_escape_sequence.c b/tests/lib/search/regex_process_escape_sequence.c index 7bb478eea..2b5a0a2ac 100644 --- a/tests/lib/search/regex_process_escape_sequence.c +++ b/tests/lib/search/regex_process_escape_sequence.c @@ -1,11 +1,11 @@ /* libmc - checks for processing esc sequences in replace string - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,9 +25,7 @@ #define TEST_SUITE_NAME "lib/search/regex" -#include - -#include +#include "tests/mctest.h" #include "regex.c" /* for testing static functions */ diff --git a/tests/lib/search/regex_replace_esc_seq.c b/tests/lib/search/regex_replace_esc_seq.c index 05790cf4f..b8c17db06 100644 --- a/tests/lib/search/regex_replace_esc_seq.c +++ b/tests/lib/search/regex_replace_esc_seq.c @@ -1,11 +1,11 @@ /* libmc - checks for processing esc sequences in replace string - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,9 +25,7 @@ #define TEST_SUITE_NAME "lib/search/regex" -#include - -#include +#include "tests/mctest.h" #include "regex.c" /* for testing static functions */ diff --git a/tests/lib/serialize.c b/tests/lib/serialize.c index bdaca2e30..fc30366aa 100644 --- a/tests/lib/serialize.c +++ b/tests/lib/serialize.c @@ -1,11 +1,11 @@ /* lib/vfs - common serialize/deserialize functions - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/serialize.h" diff --git a/tests/lib/vfs/canonicalize_pathname.c b/tests/lib/vfs/canonicalize_pathname.c index fc2e83686..434b491a9 100644 --- a/tests/lib/vfs/canonicalize_pathname.c +++ b/tests/lib/vfs/canonicalize_pathname.c @@ -1,11 +1,11 @@ /* lib - canonicalize path - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/util.h" #include "lib/vfs/xdirentry.h" diff --git a/tests/lib/vfs/current_dir.c b/tests/lib/vfs/current_dir.c index 7dec19fb4..fe35203d0 100644 --- a/tests/lib/vfs/current_dir.c +++ b/tests/lib/vfs/current_dir.c @@ -1,11 +1,11 @@ /* lib/vfs - manipulate with current directory - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,9 +25,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include +#include "tests/mctest.h" #include "lib/global.h" #include "lib/strutil.h" diff --git a/tests/lib/vfs/path_cmp.c b/tests/lib/vfs/path_cmp.c index a4136ae89..1cd1540da 100644 --- a/tests/lib/vfs/path_cmp.c +++ b/tests/lib/vfs/path_cmp.c @@ -1,9 +1,10 @@ /* lib/vfs - vfs_path_t compare functions - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2013 + The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -22,9 +23,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifdef HAVE_CHARSET #include "lib/charsets.h" diff --git a/tests/lib/vfs/path_len.c b/tests/lib/vfs/path_len.c index 2e53486dd..db47808fc 100644 --- a/tests/lib/vfs/path_len.c +++ b/tests/lib/vfs/path_len.c @@ -1,9 +1,10 @@ /* lib/vfs - vfs_path_t compare functions - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2013 + The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -22,9 +23,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifdef HAVE_CHARSET #include "lib/charsets.h" diff --git a/tests/lib/vfs/path_manipulations.c b/tests/lib/vfs/path_manipulations.c index ad014a9f4..cb5e31446 100644 --- a/tests/lib/vfs/path_manipulations.c +++ b/tests/lib/vfs/path_manipulations.c @@ -1,9 +1,10 @@ /* lib/vfs - test vfs_path_t manipulation functions - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2013 + The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -22,9 +23,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifdef HAVE_CHARSET #include "lib/charsets.h" diff --git a/tests/lib/vfs/path_recode.c b/tests/lib/vfs/path_recode.c index b39dfa1a0..6d4a31548 100644 --- a/tests/lib/vfs/path_recode.c +++ b/tests/lib/vfs/path_recode.c @@ -1,11 +1,11 @@ /* lib/vfs - vfs_path_t charset recode functions - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include - -#include "lib/global.c" +#include "tests/mctest.h" #include "lib/charsets.h" diff --git a/tests/lib/vfs/path_serialize.c b/tests/lib/vfs/path_serialize.c index 0c992b8ba..02c5adde6 100644 --- a/tests/lib/vfs/path_serialize.c +++ b/tests/lib/vfs/path_serialize.c @@ -1,11 +1,11 @@ /* lib/vfs - vfs_path_t serialize/deserialize functions - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifdef HAVE_CHARSET #include "lib/charsets.h" diff --git a/tests/lib/vfs/relative_cd.c b/tests/lib/vfs/relative_cd.c index a391a00c6..7728d14ba 100644 --- a/tests/lib/vfs/relative_cd.c +++ b/tests/lib/vfs/relative_cd.c @@ -1,9 +1,10 @@ /* lib/vfs - test vfs_path_t manipulation functions - Copyright (C) 2011 Free Software Foundation, Inc. + Copyright (C) 2011, 2013 + The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License @@ -22,9 +23,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include "lib/global.c" +#include "tests/mctest.h" #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" diff --git a/tests/lib/vfs/tempdir.c b/tests/lib/vfs/tempdir.c index 7bd025863..abf37c613 100644 --- a/tests/lib/vfs/tempdir.c +++ b/tests/lib/vfs/tempdir.c @@ -1,11 +1,11 @@ /* lib/vfs - manipulations with temp files and dirs - Copyright (C) 2012 + Copyright (C) 2012, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2012 + Slava Zanko , 2012, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifndef HAVE_CHARSET #define HAVE_CHARSET 1 diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c index 9998c948c..c33549327 100644 --- a/tests/lib/vfs/vfs_parse_ls_lga.c +++ b/tests/lib/vfs/vfs_parse_ls_lga.c @@ -1,11 +1,11 @@ /* lib/vfs - test vfs_parse_ls_lga() functionality - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,12 +25,10 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include +#include "tests/mctest.h" -#include #include -#include "lib/global.h" #include "lib/vfs/utilvfs.h" #include "lib/vfs/xdirentry.h" #include "lib/strutil.h" diff --git a/tests/lib/vfs/vfs_path_string_convert.c b/tests/lib/vfs/vfs_path_string_convert.c index d86a8a08b..4f4c672a4 100644 --- a/tests/lib/vfs/vfs_path_string_convert.c +++ b/tests/lib/vfs/vfs_path_string_convert.c @@ -1,11 +1,11 @@ /* lib/vfs - get vfs_path_t from string - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include - -#include - -#include "lib/global.c" +#include "tests/mctest.h" #ifdef HAVE_CHARSET #include "lib/charsets.h" diff --git a/tests/lib/vfs/vfs_prefix_to_class.c b/tests/lib/vfs/vfs_prefix_to_class.c index 59dedb066..c6520b757 100644 --- a/tests/lib/vfs/vfs_prefix_to_class.c +++ b/tests/lib/vfs/vfs_prefix_to_class.c @@ -1,11 +1,11 @@ /* lib/vfs - test vfs_prefix_to_class() functionality - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" #include "lib/vfs/vfs.c" /* for testing static methods */ diff --git a/tests/lib/vfs/vfs_s_get_path.c b/tests/lib/vfs/vfs_s_get_path.c index e3f270daf..6a2071d5c 100644 --- a/tests/lib/vfs/vfs_s_get_path.c +++ b/tests/lib/vfs/vfs_s_get_path.c @@ -1,11 +1,11 @@ /* lib/vfs - test vfs_s_get_path() function - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/vfs/direntry.c" /* for testing static methods */ diff --git a/tests/lib/vfs/vfs_split.c b/tests/lib/vfs/vfs_split.c index ab6d9f30b..db17eff80 100644 --- a/tests/lib/vfs/vfs_split.c +++ b/tests/lib/vfs/vfs_split.c @@ -1,11 +1,11 @@ /* lib/vfs - test vfs_split() functionality - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib/vfs" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/vfs/xdirentry.h" #include "lib/vfs/path.c" /* for testing static methods */ diff --git a/tests/lib/x_basename.c b/tests/lib/x_basename.c index 1435bfc97..867b94c88 100644 --- a/tests/lib/x_basename.c +++ b/tests/lib/x_basename.c @@ -1,11 +1,11 @@ /* lib/vfs - x_basename() function testing - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,57 +25,86 @@ #define TEST_SUITE_NAME "/lib" -#include - -#include +#include "tests/mctest.h" #include -#include "lib/global.h" #include "lib/strutil.h" #include "lib/util.h" +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { } /* --------------------------------------------------------------------------------------------- */ -#define check_x_basename( input, etalon ) \ -{ \ - result = x_basename ( input ); \ - fail_unless(strcmp(result, etalon) == 0, \ - "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result, etalon); \ -} +/* @DataSource("test_x_basename_ds") */ /* *INDENT-OFF* */ -START_TEST (test_x_basename) +static const struct test_x_basename_ds +{ + const char *input_value; + const char *expected_result; +} test_x_basename_ds[] = +{ + { + "/test/path/test2/path2", + "path2" + }, + { + "/test/path/test2/path2#vfsprefix", + "path2#vfsprefix" + }, + { + "/test/path/test2/path2/vfsprefix://", + "path2/vfsprefix://" + }, + { + "/test/path/test2/path2/vfsprefix://subdir", + "subdir" + }, + { + "/test/path/test2/path2/vfsprefix://subdir/", + "subdir/" + }, + { + "/test/path/test2/path2/vfsprefix://subdir/subdir2", + "subdir2" + }, + { + "/test/path/test2/path2/vfsprefix:///", + "/" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_x_basename_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_x_basename, test_x_basename_ds) /* *INDENT-ON* */ { - const char *result; - check_x_basename ("/test/path/test2/path2", "path2"); + /* given */ + const char *actual_result; - check_x_basename ("/test/path/test2/path2#vfsprefix", "path2#vfsprefix"); + /* when */ + actual_result = x_basename (data->input_value); - check_x_basename ("/test/path/test2/path2/vfsprefix://", "path2/vfsprefix://"); - - - check_x_basename ("/test/path/test2/path2/vfsprefix://subdir", "subdir"); - - check_x_basename ("/test/path/test2/path2/vfsprefix://subdir/", "subdir/"); - - check_x_basename ("/test/path/test2/path2/vfsprefix://subdir/subdir2", "subdir2"); - - check_x_basename ("/test/path/test2/path2/vfsprefix:///", "/"); + /* then */ + mctest_assert_str_eq (actual_result, data->expected_result); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -92,7 +121,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_x_basename); + mctest_add_parameterized_test (tc_core, test_x_basename, test_x_basename_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/mctest.h b/tests/mctest.h new file mode 100644 index 000000000..4699acfe8 --- /dev/null +++ b/tests/mctest.h @@ -0,0 +1,77 @@ +#ifndef MC__TEST +#define MC__TEST + +#include +#include + +#include "lib/global.h" + +/*** typedefs(not structures) and defined constants **********************************************/ + +#define mctest_add_parameterized_test(tc_core, test_func, test_data_source) {\ + tcase_add_loop_test (tc_core, test_func, 0, \ + sizeof (test_data_source) / sizeof (test_data_source[0])); \ +} + +#define mctest_assert_str_eq(actual_result, etalon_result) { \ + g_assert_cmpstr (actual_result, ==, etalon_result); \ +} + +#define mctest_assert_int_eq(actual_result, etalon_result) { \ + ck_assert_int_eq (actual_result, etalon_result); \ +} + +#define mctest_assert_int_ne(actual_result, etalon_result) { \ + ck_assert_int_ne (actual_result, etalon_result); \ +} + +#define mctest_assert_ptr_eq(actual_pointer, etalon_pointer) { \ + fail_unless ( actual_pointer == etalon_pointer, \ + "%s(%p) pointer should be equal to %s(%p)\n", \ + #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \ + );\ +} + +#define mctest_assert_ptr_ne(actual_pointer, etalon_pointer) { \ + fail_unless ( actual_pointer != etalon_pointer, \ + "%s(%p) pointer should not be equal to %s(%p)\n", \ + #actual_pointer, actual_pointer, #etalon_pointer , etalon_pointer \ + );\ +} + +#define mctest_assert_null(actual_pointer) { \ + fail_unless( \ + (void *) actual_pointer == NULL, \ + "%s(%p) variable should be NULL", #actual_pointer, actual_pointer \ + ); \ +} + +#define mctest_assert_not_null(actual_pointer) { \ + fail_if( \ + (void *) actual_pointer == NULL, \ + "%s(nil) variable should not be NULL", #actual_pointer \ + ); \ +} + +/** + * Define header for a parameterized test. + * Declare 'data' variable for access to the parameters in current iteration + */ +#define START_PARAMETRIZED_TEST(name_test, struct_name) START_TEST (name_test) { const struct struct_name *data = &struct_name[_i]; + +/** + * Define footer for a parameterized test. + */ +#define END_PARAMETRIZED_TEST } END_TEST + +/*** enums ***************************************************************************************/ + +/*** structures declarations (and typedefs of structures)*****************************************/ + +/*** global variables defined in .c file *********************************************************/ + +/*** declarations of public functions ************************************************************/ + +/*** inline functions ****************************************************************************/ + +#endif /* MC__TEST */ diff --git a/tests/src/filemanager/do_cd_command.c b/tests/src/filemanager/do_cd_command.c index defbc92c4..433fe3865 100644 --- a/tests/src/filemanager/do_cd_command.c +++ b/tests/src/filemanager/do_cd_command.c @@ -1,11 +1,11 @@ /* src/filemanager - tests for do_cd_command() function - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2011 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/src/filemanager" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "src/vfs/local/local.c" #include "src/filemanager/command.c" @@ -128,11 +125,10 @@ static const struct test_empty_mean_home_ds /* @Test(dataSource = "test_empty_mean_home_ds") */ /* *INDENT-OFF* */ -START_TEST (test_empty_mean_home) +START_PARAMETRIZED_TEST (test_empty_mean_home, test_empty_mean_home_ds) /* *INDENT-ON* */ { /* given */ - get_current_type__return_value = view_listing; do_cd__return_value = TRUE; mc_config_get_home_dir__return_value = "/home/test"; @@ -141,7 +137,7 @@ START_TEST (test_empty_mean_home) { char *input_command; - input_command = g_strdup (test_empty_mean_home_ds[_i].command); + input_command = g_strdup (data->command); do_cd_command (input_command); g_free (input_command); } @@ -150,13 +146,13 @@ START_TEST (test_empty_mean_home) char *actual_path; actual_path = vfs_path_to_str (do_cd__new_dir_vpath__captured); - g_assert_cmpstr (mc_config_get_home_dir__return_value, ==, actual_path); + mctest_assert_str_eq (mc_config_get_home_dir__return_value, actual_path); g_free (actual_path); } - ck_assert_int_eq (do_cd__cd_type__captured, cd_parse_command); + mctest_assert_int_eq (do_cd__cd_type__captured, cd_parse_command); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -173,8 +169,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, test_empty_mean_home, 0, - sizeof (test_empty_mean_home_ds) / sizeof (test_empty_mean_home_ds[0])); + mctest_add_parameterized_test (tc_core, test_empty_mean_home, test_empty_mean_home_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/src/filemanager/examine_cd.c b/tests/src/filemanager/examine_cd.c index 7da927f7b..ee769b9a6 100644 --- a/tests/src/filemanager/examine_cd.c +++ b/tests/src/filemanager/examine_cd.c @@ -1,11 +1,12 @@ /* src/filemanager - examine_cd() function testing - Copyright (C) 2012 + Copyright (C) 2012, 2013 The Free Software Foundation, Inc. Written by: Andrew Borodin , 2012 + Slava Zanko , 2013 This file is part of the Midnight Commander. @@ -25,13 +26,10 @@ #define TEST_SUITE_NAME "/src/filemanager" -#include - -#include +#include "tests/mctest.h" #include -#include "lib/global.h" #include "lib/vfs/path.h" #include "src/filemanager/layout.h" #include "src/filemanager/midnight.h" diff --git a/tests/src/filemanager/exec_get_export_variables_ext.c b/tests/src/filemanager/exec_get_export_variables_ext.c index c95e70b73..086c7fa3b 100644 --- a/tests/src/filemanager/exec_get_export_variables_ext.c +++ b/tests/src/filemanager/exec_get_export_variables_ext.c @@ -1,11 +1,11 @@ /* src/filemanager - filemanager functions - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: - Slava Zanko , 2012 + Slava Zanko , 2011, 2013 This file is part of the Midnight Commander. @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/src/filemanager" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "src/vfs/local/local.c" #include "src/filemanager/midnight.c" @@ -102,7 +99,7 @@ export MC_EXT_SELECTED\n\ MC_EXT_ONLYTAGGED=\"tagged\\ file1.txt tagged\\ file2.txt \"\n\ export MC_EXT_ONLYTAGGED\n"; - g_assert_cmpstr (actual_string, ==, expected_string); + mctest_assert_str_eq (actual_string, expected_string); g_free (actual_string); } From 61fb6e33b3e3835ad334c24465d09253e64b982e Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Sat, 19 Jan 2013 18:56:40 +0300 Subject: [PATCH 05/35] Code refactoring in tests. Signed-off-by: Slava Zanko --- tests/lib/mc_build_filename.c | 107 ++++--- tests/lib/name_quote.c | 2 +- tests/lib/serialize.c | 374 ++++++++++++++--------- tests/lib/vfs/tempdir.c | 37 ++- tests/lib/vfs/vfs_parse_ls_lga.c | 326 ++++++++++---------- tests/lib/vfs/vfs_path_string_convert.c | 385 ++++++++++++------------ tests/lib/vfs/vfs_prefix_to_class.c | 99 +++--- tests/lib/vfs/vfs_s_get_path.c | 28 +- tests/lib/vfs/vfs_split.c | 340 +++++++-------------- 9 files changed, 894 insertions(+), 804 deletions(-) diff --git a/tests/lib/mc_build_filename.c b/tests/lib/mc_build_filename.c index 1df0162fc..c701634c8 100644 --- a/tests/lib/mc_build_filename.c +++ b/tests/lib/mc_build_filename.c @@ -32,61 +32,100 @@ #include "lib/strutil.h" #include "lib/util.h" +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { } /* --------------------------------------------------------------------------------------------- */ -#define check_mc_build_filename( inargs, etalon ) \ -{ \ - result = mc_build_filename inargs; \ - fail_unless( strcmp (result, etalon) == 0, \ - "\nactial (%s) not equal to\netalon (%s)", result, etalon); \ - g_free (result); \ + +static char * +run_mc_build_filename (int iteration) +{ + switch (iteration) + { + case 0: + return mc_build_filename ("test", "path", NULL); + case 1: + return mc_build_filename ("/test", "path/", NULL); + case 2: + return mc_build_filename ("/test", "pa/th", NULL); + case 3: + return mc_build_filename ("/test", "#vfsprefix:", "path ", NULL); + case 4: + return mc_build_filename ("/test", "vfsprefix://", "path ", NULL); + case 5: + return mc_build_filename ("/test", "vfs/../prefix:///", "p\\///ath", NULL); + case 6: + return mc_build_filename ("/test", "path", "..", "/test", "path/", NULL); + case 7: + return mc_build_filename ("", "path", NULL); + case 8: + return mc_build_filename ("", "/path", NULL); + case 9: + return mc_build_filename ("path", "", NULL); + case 10: + return mc_build_filename ("/path", "", NULL); + case 11: + return mc_build_filename ("pa", "", "th", NULL); + case 12: + return mc_build_filename ("/pa", "", "/th", NULL); + } + return NULL; } +/* @DataSource("test_mc_build_filename_ds") */ /* *INDENT-OFF* */ -START_TEST (test_mc_build_filename) +static const struct test_mc_build_filename_ds +{ + const char *expected_result; +} test_mc_build_filename_ds[] = +{ + {"test/path"}, + {"/test/path"}, + {"/test/pa/th"}, + {"/test/#vfsprefix:/path "}, + {"/test/vfsprefix://path "}, + {"/test/prefix://p\\/ath"}, + {"/test/test/path"}, + {"path"}, + {"path"}, + {"path"}, + {"/path"}, + {"pa/th"}, + {"/pa/th"}, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_mc_build_filename_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_mc_build_filename, test_mc_build_filename_ds) /* *INDENT-ON* */ { - char *result; + /* given */ + char *actual_result; - check_mc_build_filename (("test", "path", NULL), "test/path"); + /* when */ + actual_result = run_mc_build_filename (_i); - check_mc_build_filename (("/test", "path/", NULL), "/test/path"); + /* then */ + mctest_assert_str_eq (actual_result, data->expected_result); - check_mc_build_filename (("/test", "pa/th", NULL), "/test/pa/th"); - - check_mc_build_filename (("/test", "#vfsprefix:", "path ", NULL), "/test/#vfsprefix:/path "); - - check_mc_build_filename (("/test", "vfsprefix://", "path ", NULL), "/test/vfsprefix://path "); - - check_mc_build_filename (("/test", "vfs/../prefix:///", "p\\///ath", NULL), - "/test/prefix://p\\/ath"); - - check_mc_build_filename (("/test", "path", "..", "/test", "path/", NULL), "/test/test/path"); - - check_mc_build_filename (("", "path", NULL), "path"); - - check_mc_build_filename (("", "/path", NULL), "path"); - - check_mc_build_filename (("path", "", NULL), "path"); - - check_mc_build_filename (("/path", "", NULL), "/path"); - - check_mc_build_filename (("pa", "", "th", NULL), "pa/th"); - - check_mc_build_filename (("/pa", "", "/th", NULL), "/pa/th"); + g_free (actual_result); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -103,7 +142,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_mc_build_filename); + mctest_add_parameterized_test (tc_core, test_mc_build_filename, test_mc_build_filename_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/name_quote.c b/tests/lib/name_quote.c index 8fde62985..421cc3c69 100644 --- a/tests/lib/name_quote.c +++ b/tests/lib/name_quote.c @@ -143,7 +143,7 @@ main (void) suite_add_tcase (s, tc_core); sr = srunner_create (s); - srunner_set_log (sr, "serialize.log"); + srunner_set_log (sr, "name_quote.log"); srunner_run_all (sr, CK_NORMAL); number_failed = srunner_ntests_failed (sr); srunner_free (sr); diff --git a/tests/lib/serialize.c b/tests/lib/serialize.c index fc30366aa..9dc35c80f 100644 --- a/tests/lib/serialize.c +++ b/tests/lib/serialize.c @@ -30,107 +30,199 @@ #include "lib/strutil.h" #include "lib/serialize.h" +static GError *error = NULL; +static const char *deserialize_input_value1 = + "g6:group1p6:param1v10:some valuep6:param2v11:some value " + "g6:group2p6:param1v4:truep6:param2v6:123456" + "g6:group3p6:param1v11:::bla-bla::p6:param2v31:bla-:p1:w:v2:12:g3:123:bla-bla\n" + "g6:group4p6:param1v5:falsep6:param2v6:654321"; + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { str_init_strings (NULL); + error = NULL; } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { + g_clear_error (&error); str_uninit_strings (); } /* --------------------------------------------------------------------------------------------- */ -#define deserialize_check_incorrect( etalon_code, etalon_str ) { \ - if (actual != NULL) \ - { \ - fail("actual value is '%s', but should be NULL", actual); \ - g_free(actual); \ - } \ - else \ - { \ - fail_unless (error->code == etalon_code && strcmp(error->message, etalon_str) == 0, \ - "\nerror code is %d (should be %d);\nerror message is '%s' (should be '%s')", \ - error->code, etalon_code, error->message, etalon_str); \ - g_clear_error(&error); \ - } \ -} +/* @DataSource("test_serialize_ds") */ /* *INDENT-OFF* */ -START_TEST (test_serialize_deserialize_str) +static const struct test_serialize_ds +{ + const char input_char_prefix; + const char *input_string; + const char *expected_result; +} test_serialize_ds[] = +{ + { + 's', + "some test string", + "s16:some test string" + }, + { + 'a', + "some test test test string", + "a26:some test test test string" + }, +}; +/* *INDENT-ON* */ +/* @Test(dataSource = "test_serialize_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_serialize, test_serialize_ds) /* *INDENT-ON* */ { - GError *error = NULL; - char *actual; + /* given */ + char *actual_result; + /* when */ + actual_result = mc_serialize_str (data->input_char_prefix, data->input_string, &error); - actual = mc_serialize_str ('s', "some test string", &error); + /* then */ + mctest_assert_str_eq (actual_result, data->expected_result); - if (actual == NULL) - { - fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, - error->message); - g_clear_error (&error); - return; - } - fail_unless (strcmp (actual, "s16:some test string") == 0, - "Actual value(%s) doesn't equal to etalon(s16:some test string)", actual); - g_free (actual); + g_free (actual_result); - actual = mc_deserialize_str ('s', NULL, &error); - deserialize_check_incorrect (-1, "mc_serialize_str(): Input data is NULL or empty."); - - actual = mc_deserialize_str ('s', "incorrect string", &error); - deserialize_check_incorrect (-2, "mc_serialize_str(): String prefix doesn't equal to 's'"); - - actual = mc_deserialize_str ('s', "s12345string without delimiter", &error); - deserialize_check_incorrect (-3, "mc_serialize_str(): Length delimiter ':' doesn't exists"); - - actual = - mc_deserialize_str ('s', - "s1234567890123456789012345678901234567890123456789012345678901234567890:too big number", - &error); - deserialize_check_incorrect (-3, "mc_serialize_str(): Too big string length"); - - actual = - mc_deserialize_str ('s', "s500:actual string length less that specified length", &error); - deserialize_check_incorrect (-3, - "mc_serialize_str(): Specified data length (500) is greater than actual data length (47)"); - - actual = - mc_deserialize_str ('s', "s10:actual string length great that specified length", &error); - fail_unless (actual != NULL - && strcmp (actual, "actual str") == 0, - "actual (%s) doesn't equal to etalon(actual str)", actual); - g_free (actual); - - actual = mc_deserialize_str ('s', "s21:The right test string", &error); - fail_unless (actual != NULL - && strcmp (actual, "The right test string") == 0, - "actual (%s) doesn't equal to etalon(The right test string)", actual); - g_free (actual); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ -#define etalon_str "g6:group1p6:param1v10:some valuep6:param2v11:some value " \ - "g6:group2p6:param1v4:truep6:param2v6:123456" \ - "g6:group3p6:param1v11:::bla-bla::p6:param2v31:bla-:p1:w:v2:12:g3:123:bla-bla\n" \ - "g6:group4p6:param1v5:falsep6:param2v6:654321" +/* @DataSource("test_deserialize_incorrect_ds") */ +/* *INDENT-OFF* */ +static const struct test_deserialize_incorrect_ds +{ + const char input_char_prefix; + const char *input_string; + const int expected_error_code; + const char *expected_error_string; +} test_deserialize_incorrect_ds[] = +{ + { + 's', + NULL, + -1, + "mc_serialize_str(): Input data is NULL or empty." + }, + { + 's', + "incorrect string", + -2, + "mc_serialize_str(): String prefix doesn't equal to 's'" + }, + { + 's', + "s12345string without delimiter", + -3, + "mc_serialize_str(): Length delimiter ':' doesn't exists" + }, + { + 's', + "s1234567890123456789012345678901234567890123456789012345678901234567890:too big number", + -3, + "mc_serialize_str(): Too big string length" + }, + { + 's', + "s500:actual string length less that specified length", + -3, + "mc_serialize_str(): Specified data length (500) is greater than actual data length (47)" + }, +}; +/* *INDENT-ON* */ +/* @Test(dataSource = "test_deserialize_incorrect_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_deserialize_incorrect, test_deserialize_incorrect_ds) +/* *INDENT-ON* */ +{ + /* given */ + char *actual_result; + + /* when */ + actual_result = mc_deserialize_str (data->input_char_prefix, data->input_string, &error); + + /* then */ + mctest_assert_null (actual_result); + + mctest_assert_int_eq (error->code, data->expected_error_code); + mctest_assert_str_eq (error->message, data->expected_error_string); +} +/* *INDENT-OFF* */ +END_PARAMETRIZED_TEST +/* *INDENT-ON* */ + +/* --------------------------------------------------------------------------------------------- */ + +/* @DataSource("test_deserialize_ds") */ +/* *INDENT-OFF* */ +static const struct test_deserialize_ds +{ + const char input_char_prefix; + const char *input_string; + const char *expected_result; +} test_deserialize_ds[] = +{ + { + 's', + "s10:actual string length great that specified length", + "actual str" + }, + { + 'r', + "r21:The right test string", + "The right test string" + }, +}; +/* *INDENT-ON* */ +/* @Test(dataSource = "test_deserialize_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_deserialize, test_deserialize_ds) +/* *INDENT-ON* */ +{ + /* given */ + char *actual_result; + + /* when */ + actual_result = mc_deserialize_str (data->input_char_prefix, data->input_string, &error); + + /* then */ + mctest_assert_str_eq (actual_result, data->expected_result); + + g_free (actual_result); +} +/* *INDENT-OFF* */ +END_PARAMETRIZED_TEST +/* *INDENT-ON* */ + +/* --------------------------------------------------------------------------------------------- */ /* *INDENT-OFF* */ START_TEST (test_serialize_config) /* *INDENT-ON* */ { + /* given */ mc_config_t *test_data; - GError *error = NULL; char *actual; + const char *expected_result = "g6:group1p6:param1v10:some valuep6:param2v11:some value " + "g6:group2p6:param1v4:truep6:param2v6:123456" + "g6:group3p6:param1v11:::bla-bla::p6:param2v31:bla-:p1:w:v2:12:g3:123:bla-bla\n" + "g6:group4p6:param1v5:falsep6:param2v6:654321"; test_data = mc_config_init (NULL, FALSE); @@ -146,19 +238,14 @@ START_TEST (test_serialize_config) mc_config_set_bool (test_data, "group4", "param1", FALSE); mc_config_set_int (test_data, "group4", "param2", 654321); + /* when */ actual = mc_serialize_config (test_data, &error); mc_config_deinit (test_data); - if (actual == NULL) - { - fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, - error->message); - g_clear_error (&error); - return; - } + /* then */ + mctest_assert_not_null (actual); + mctest_assert_str_eq (actual, expected_result); - fail_unless (strcmp (actual, etalon_str) == 0, "Not equal:\nactual (%s)\netalon (%s)", actual, - etalon_str); g_free (actual); } /* *INDENT-OFF* */ @@ -166,93 +253,97 @@ END_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_deserialize_config_incorrect_ds") */ +/* *INDENT-OFF* */ +static const struct test_deserialize_config_incorrect_ds +{ + const char *input_string; + const int expected_error_code; + const char *expected_error_string; +} test_deserialize_config_incorrect_ds[] = +{ + { + "g123error in group name", + -3, + "mc_deserialize_config() at 1: mc_serialize_str(): Length delimiter ':' doesn't exists" + }, + { + "p6:param1v10:some valuep6:param2v11:some value ", + -2, + "mc_deserialize_config() at 1: mc_serialize_str(): String prefix doesn't equal to 'g'" + }, + { + "g6:group1v10:some valuep6:param2v11:some value ", + -2, + "mc_deserialize_config() at 10: mc_serialize_str(): String prefix doesn't equal to 'p'" + }, + { + "g6:group1p6000:param2v11:some value ", + -3, + "mc_deserialize_config() at 10: mc_serialize_str(): Specified data length (6000) is greater than actual data length (21)" + }, +}; +/* *INDENT-ON* */ +/* @Test(dataSource = "test_deserialize_config_incorrect_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_deserialize_config_incorrect, test_deserialize_config_incorrect_ds) +/* *INDENT-ON* */ +{ + /* given */ + mc_config_t *actual_result; -#undef deserialize_check_incorrect -#define deserialize_check_incorrect( etalon_code, etalon_str ) { \ - if (actual != NULL) \ - { \ - fail("actual value but should be NULL", actual); \ - mc_config_deinit(actual); \ - } \ - else \ - { \ - fail_unless (error->code == etalon_code && strcmp(error->message, etalon_str) == 0, \ - "\nerror code is %d (should be %d);\nerror message is '%s' (should be '%s')", \ - error->code, etalon_code, error->message, etalon_str); \ - g_clear_error(&error); \ - } \ + /* when */ + actual_result = mc_deserialize_config (data->input_string, &error); + + /* then */ + mctest_assert_null (actual_result); + + mctest_assert_int_eq (error->code, data->expected_error_code); + mctest_assert_str_eq (error->message, data->expected_error_string); } +/* *INDENT-OFF* */ +END_PARAMETRIZED_TEST +/* *INDENT-ON* */ + +/* --------------------------------------------------------------------------------------------- */ /* *INDENT-OFF* */ START_TEST (test_deserialize_config) /* *INDENT-ON* */ { + /* given */ mc_config_t *actual; - GError *error = NULL; char *actual_value; - actual = mc_deserialize_config ("g123error in group name", &error); - deserialize_check_incorrect (-3, - "mc_deserialize_config() at 1: mc_serialize_str(): Length delimiter ':' doesn't exists"); + /* when */ + actual = mc_deserialize_config (deserialize_input_value1, &error); - actual = mc_deserialize_config ("p6:param1v10:some valuep6:param2v11:some value ", &error); - deserialize_check_incorrect (-2, - "mc_deserialize_config() at 1: mc_serialize_str(): String prefix doesn't equal to 'g'"); - - actual = mc_deserialize_config ("g6:group1v10:some valuep6:param2v11:some value ", &error); - deserialize_check_incorrect (-2, - "mc_deserialize_config() at 10: mc_serialize_str(): String prefix doesn't equal to 'p'"); - - actual = mc_deserialize_config ("g6:group1p6000:param2v11:some value ", &error); - deserialize_check_incorrect (-3, - "mc_deserialize_config() at 10: mc_serialize_str(): Specified data length (6000) is greater than actual data length (21)"); - - actual = mc_deserialize_config (etalon_str, &error); - - if (actual == NULL) - { - fail ("actual value is NULL!\nError code is '%d'; error message is '%s'", error->code, - error->message); - g_clear_error (&error); - return; - } + /* then */ + mctest_assert_not_null (actual); actual_value = mc_config_get_string_raw (actual, "group1", "param1", ""); - fail_unless (strcmp (actual_value, "some value") == 0, - "group1->param1(%s) should be equal to 'some value'", actual_value); + mctest_assert_str_eq (actual_value, "some value"); g_free (actual_value); actual_value = mc_config_get_string (actual, "group1", "param2", ""); - fail_unless (strcmp (actual_value, "some value ") == 0, - "group1->param2(%s) should be equal to 'some value '", actual_value); + mctest_assert_str_eq (actual_value, "some value "); g_free (actual_value); - fail_unless (mc_config_get_bool (actual, "group2", "param1", FALSE) == TRUE, - "group2->param1(FALSE) should be equal to TRUE"); + mctest_assert_int_eq (mc_config_get_bool (actual, "group2", "param1", FALSE), TRUE); - fail_unless (mc_config_get_int (actual, "group2", "param2", 0) == 123456, - "group2->param2(%d) should be equal to 123456", mc_config_get_int (actual, - "group2", - "param2", 0)); + mctest_assert_int_eq (mc_config_get_int (actual, "group2", "param2", 0), 123456); actual_value = mc_config_get_string_raw (actual, "group3", "param1", ""); - fail_unless (strcmp (actual_value, "::bla-bla::") == 0, - "group3->param1(%s) should be equal to '::bla-bla::'", actual_value); + mctest_assert_str_eq (actual_value, "::bla-bla::"); g_free (actual_value); actual_value = mc_config_get_string (actual, "group3", "param2", ""); - fail_unless (strcmp (actual_value, "bla-:p1:w:v2:12:g3:123:bla-bla\n") == 0, - "group3->param2(%s) should be equal to 'bla-:p1:w:v2:12:g3:123:bla-bla\n'", - actual_value); + mctest_assert_str_eq (actual_value, "bla-:p1:w:v2:12:g3:123:bla-bla\n"); g_free (actual_value); - fail_unless (mc_config_get_bool (actual, "group4", "param1", TRUE) == FALSE, - "group4->param1(TRUE) should be equal to FALSE"); + mctest_assert_int_eq (mc_config_get_bool (actual, "group4", "param1", TRUE), FALSE); - fail_unless (mc_config_get_int (actual, "group4", "param2", 0) == 654321, - "group4->param2(%d) should be equal to 654321", mc_config_get_int (actual, - "group4", - "param2", 0)); + mctest_assert_int_eq (mc_config_get_int (actual, "group4", "param2", 0), 654321); mc_config_deinit (actual); } @@ -260,6 +351,7 @@ START_TEST (test_deserialize_config) END_TEST /* *INDENT-ON* */ +#undef input_value /* --------------------------------------------------------------------------------------------- */ int @@ -274,8 +366,18 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_serialize_deserialize_str); + mctest_add_parameterized_test (tc_core, test_serialize, test_serialize_ds); + + mctest_add_parameterized_test (tc_core, test_deserialize_incorrect, + test_deserialize_incorrect_ds); + + mctest_add_parameterized_test (tc_core, test_deserialize, test_deserialize_ds); + tcase_add_test (tc_core, test_serialize_config); + + mctest_add_parameterized_test (tc_core, test_deserialize_config_incorrect, + test_deserialize_config_incorrect_ds); + tcase_add_test (tc_core, test_deserialize_config); /* *********************************** */ diff --git a/tests/lib/vfs/tempdir.c b/tests/lib/vfs/tempdir.c index abf37c613..77f17689b 100644 --- a/tests/lib/vfs/tempdir.c +++ b/tests/lib/vfs/tempdir.c @@ -43,6 +43,9 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -53,6 +56,9 @@ setup (void) vfs_setup_work_dir (); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -61,20 +67,24 @@ teardown (void) } /* --------------------------------------------------------------------------------------------- */ + +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_mc_tmpdir) /* *INDENT-ON* */ { + /* given */ const char *tmpdir; const char *env_tmpdir; + /* when */ tmpdir = mc_tmpdir (); + env_tmpdir = g_getenv ("MC_TMPDIR"); + + /* then */ fail_unless (g_file_test (tmpdir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR), "\nNo such directory: %s\n", tmpdir); - - env_tmpdir = g_getenv ("MC_TMPDIR"); - fail_unless (strcmp (env_tmpdir, tmpdir) == 0, - "\nenv_tmpdir=%s\n tmpdir=%s\n", env_tmpdir, tmpdir); + mctest_assert_str_eq (env_tmpdir, tmpdir); } /* *INDENT-OFF* */ END_TEST @@ -82,29 +92,30 @@ END_TEST /* --------------------------------------------------------------------------------------------- */ +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_mc_mkstemps) /* *INDENT-ON* */ { + /* given */ vfs_path_t *pname_vpath = NULL; - char *pname; + char *pname = NULL; char *begin_pname; int fd; + /* when */ fd = mc_mkstemps (&pname_vpath, "mctest-", NULL); - if (fd == -1) - { - fail ("\nerror creating temp file!\n"); - } - pname = vfs_path_to_str (pname_vpath); + if (fd != -1) + pname = vfs_path_to_str (pname_vpath); + begin_pname = g_build_filename (mc_tmpdir (), "mctest-", NULL); + + /* then */ vfs_path_free (pname_vpath); close (fd); - + mctest_assert_int_ne (fd, -1); fail_unless (g_file_test (pname, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR), "\nNo such file: %s\n", pname); unlink (pname); - - begin_pname = g_build_filename (mc_tmpdir (), "mctest-", NULL); fail_unless (strncmp (pname, begin_pname, strlen (begin_pname)) == 0, "\nstart of %s should be equal to %s\n", pname, begin_pname); g_free (pname); diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c index c33549327..6501e8a2f 100644 --- a/tests/lib/vfs/vfs_parse_ls_lga.c +++ b/tests/lib/vfs/vfs_parse_ls_lga.c @@ -45,7 +45,9 @@ static struct vfs_s_super *vfs_test_super; void message (int flags, const char *title, const char *text, ...); +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { @@ -71,6 +73,9 @@ setup (void) vfs_root_entry = vfs_s_new_entry (&vfs_test_ops1, "/", vfs_root_inode); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -79,7 +84,9 @@ teardown (void) str_uninit_strings (); } +/* --------------------------------------------------------------------------------------------- */ +/* @Mock */ void message (int flags, const char *title, const char *text, ...) { @@ -98,198 +105,211 @@ message (int flags, const char *title, const char *text, ...) /* --------------------------------------------------------------------------------------------- */ -#define check_one_stat_field(etalon_stat, test_stat, field, format, input_str)\ -{\ - fail_unless(etalon_stat.field == test_stat.field,\ - "\ninput string: %s\netalon."#field" = " format "\nactual."#field" = " format "\n",\ - input_str, etalon_stat.field, test_stat.field);\ -} - -#define check_stat_struct(etalon_stat, test_stat, input_str)\ -{\ - check_one_stat_field(etalon_stat, test_stat, st_dev, "%zu", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_ino, "%zu", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_ino, "%zu", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_mode, "%04x", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_uid, "%u", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_gid, "%u", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_rdev, "%zu", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_size, "%zd", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_blksize, "%zu", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_blocks, "%zd", input_str);\ -\ -/* FIXME: these commented checks are related to time zone! \ - check_one_stat_field(etalon_stat, test_stat, st_atime, "%zd", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_mtime, "%zd", input_str);\ - check_one_stat_field(etalon_stat, test_stat, st_ctime, "%zd", input_str);\ -*/\ -} - static void -check_vfs_parse_ls_lga_call (const char *input_data, int etalon_result, - const char *etalon_filename, const char *etalon_linkname, - struct stat etalon_stat, size_t * filepos) +fill_stat_struct (struct stat *etalon_stat, int iterator) { - static struct stat test_stat; - char *filename = NULL; - char *linkname = NULL; - gboolean result; - - result = vfs_parse_ls_lga (input_data, &test_stat, &filename, &linkname, filepos); - - fail_if (result != etalon_result, - "\nactual result: %d\netalon result: %d\n", result, etalon_result); - - fail_unless ((filename != NULL && etalon_filename != NULL - && strcmp (filename, etalon_filename) == 0) || (filename == NULL - && etalon_filename == filename), - "\nactual filename '%s'\netalon filename '%s'", filename, etalon_filename); - - fail_unless ((linkname != NULL && etalon_linkname != NULL - && strcmp (linkname, etalon_linkname) == 0) || (linkname == NULL - && etalon_linkname == linkname), - "\nactual linkname '%s'\netalon linkname '%s'", linkname, etalon_linkname); - - check_stat_struct (etalon_stat, test_stat, input_data); + switch (iterator) + { + case 0: + etalon_stat->st_dev = 0; + etalon_stat->st_ino = 0; + etalon_stat->st_mode = 0x41fd; + etalon_stat->st_nlink = 10; + etalon_stat->st_uid = 500; + etalon_stat->st_gid = 500; + etalon_stat->st_rdev = 0; + etalon_stat->st_size = 4096; + etalon_stat->st_blksize = 512; + etalon_stat->st_blocks = 8; + etalon_stat->st_atime = 1308838140; + etalon_stat->st_mtime = 1308838140; + etalon_stat->st_ctime = 1308838140; + break; + case 1: + etalon_stat->st_dev = 0; + etalon_stat->st_ino = 0; + etalon_stat->st_mode = 0xa1ff; + etalon_stat->st_nlink = 10; + etalon_stat->st_uid = 500; + etalon_stat->st_gid = 500; + etalon_stat->st_rdev = 0; + etalon_stat->st_size = 11; + etalon_stat->st_blksize = 512; + etalon_stat->st_blocks = 1; + etalon_stat->st_atime = 1268431200; + etalon_stat->st_mtime = 1268431200; + etalon_stat->st_ctime = 1268431200; + break; + case 2: + etalon_stat->st_dev = 0; + etalon_stat->st_ino = 0; + etalon_stat->st_mode = 0x41fd; + etalon_stat->st_nlink = 10; + etalon_stat->st_uid = 500; + etalon_stat->st_gid = 500; + etalon_stat->st_rdev = 0; + etalon_stat->st_size = 4096; + etalon_stat->st_blksize = 512; + etalon_stat->st_blocks = 8; + etalon_stat->st_atime = 1308838140; + etalon_stat->st_mtime = 1308838140; + etalon_stat->st_ctime = 1308838140; + break; + case 3: + etalon_stat->st_dev = 0; + etalon_stat->st_ino = 0; + etalon_stat->st_mode = 0x41fd; + etalon_stat->st_nlink = 10; + etalon_stat->st_uid = 500; + etalon_stat->st_gid = 500; + etalon_stat->st_rdev = 0; + etalon_stat->st_size = 4096; + etalon_stat->st_blksize = 512; + etalon_stat->st_blocks = 8; + etalon_stat->st_atime = 1308838140; + etalon_stat->st_mtime = 1308838140; + etalon_stat->st_ctime = 1308838140; + break; + } } +/* --------------------------------------------------------------------------------------------- */ + +/* @DataSource("test_vfs_parse_ls_lga_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_parse_ls_lga) +static const struct test_vfs_parse_ls_lga_ds +{ + const char *input_string; + int expected_result; + const char *expected_filename; + const char *expected_linkname; + const size_t expected_filepos; +} test_vfs_parse_ls_lga_ds[] = +{ + { /* 0. */ + "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", + 1, + "build_root", + NULL, + 0 + }, + { /* 1. */ + "lrwxrwxrwx 1 500 500 11 Mar 13 2010 COPYING -> doc/COPYING", + 1, + "COPYING", + "doc/COPYING", + 0 + }, + { /* 2. */ + "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", + 1, + "..", + NULL, + 0 + }, + { /* 3. */ + "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", + 1, + "build_root", + NULL, + 0 + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_parse_ls_lga_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_parse_ls_lga, test_vfs_parse_ls_lga_ds) /* *INDENT-ON* */ { + /* given */ size_t filepos = 0; - struct stat etalon_stat; - - etalon_stat.st_dev = 0; - etalon_stat.st_ino = 0; - etalon_stat.st_mode = 0x41fd; - etalon_stat.st_nlink = 10; - etalon_stat.st_uid = 500; - etalon_stat.st_gid = 500; - etalon_stat.st_rdev = 0; - etalon_stat.st_size = 4096; - etalon_stat.st_blksize = 512; - etalon_stat.st_blocks = 8; - etalon_stat.st_atime = 1308838140; - etalon_stat.st_mtime = 1308838140; - etalon_stat.st_ctime = 1308838140; + static struct stat test_stat; + char *filename = NULL; + char *linkname = NULL; + gboolean actual_result; vfs_parse_ls_lga_init (); - check_vfs_parse_ls_lga_call - ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", 1, "build_root", - NULL, etalon_stat, NULL); + etalon_stat.st_blocks = 0; + etalon_stat.st_size = 0; + etalon_stat.st_mode = 0; + fill_stat_struct (&etalon_stat, _i); - etalon_stat.st_dev = 0; - etalon_stat.st_ino = 0; - etalon_stat.st_mode = 0xa1ff; - etalon_stat.st_nlink = 10; - etalon_stat.st_uid = 500; - etalon_stat.st_gid = 500; - etalon_stat.st_rdev = 0; - etalon_stat.st_size = 11; - etalon_stat.st_blksize = 512; - etalon_stat.st_blocks = 1; - etalon_stat.st_atime = 1268431200; - etalon_stat.st_mtime = 1268431200; - etalon_stat.st_ctime = 1268431200; + /* when */ + actual_result = + vfs_parse_ls_lga (data->input_string, &test_stat, &filename, &linkname, &filepos); - check_vfs_parse_ls_lga_call - ("lrwxrwxrwx 1 500 500 11 Mar 13 2010 COPYING -> doc/COPYING", 1, - "COPYING", "doc/COPYING", etalon_stat, NULL); + /* then */ + mctest_assert_int_eq (actual_result, data->expected_result); - etalon_stat.st_dev = 0; - etalon_stat.st_ino = 0; - etalon_stat.st_mode = 0x41fd; - etalon_stat.st_nlink = 10; - etalon_stat.st_uid = 500; - etalon_stat.st_gid = 500; - etalon_stat.st_rdev = 0; - etalon_stat.st_size = 4096; - etalon_stat.st_blksize = 512; - etalon_stat.st_blocks = 8; - etalon_stat.st_atime = 1308838140; - etalon_stat.st_mtime = 1308838140; - etalon_stat.st_ctime = 1308838140; + mctest_assert_str_eq (filename, data->expected_filename); + mctest_assert_str_eq (linkname, data->expected_linkname); - check_vfs_parse_ls_lga_call ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", - 1, "..", NULL, etalon_stat, &filepos); - - - etalon_stat.st_dev = 0; - etalon_stat.st_ino = 0; - etalon_stat.st_mode = 0x41fd; - etalon_stat.st_nlink = 10; - etalon_stat.st_uid = 500; - etalon_stat.st_gid = 500; - etalon_stat.st_rdev = 0; - etalon_stat.st_size = 4096; - etalon_stat.st_blksize = 512; - etalon_stat.st_blocks = 8; - etalon_stat.st_atime = 1308838140; - etalon_stat.st_mtime = 1308838140; - etalon_stat.st_ctime = 1308838140; - - check_vfs_parse_ls_lga_call - ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root", 1, "build_root", - NULL, etalon_stat, &filepos); + mctest_assert_int_eq (etalon_stat.st_dev, test_stat.st_dev); + mctest_assert_int_eq (etalon_stat.st_ino, test_stat.st_ino); + mctest_assert_int_eq (etalon_stat.st_mode, test_stat.st_mode); + mctest_assert_int_eq (etalon_stat.st_uid, test_stat.st_uid); + mctest_assert_int_eq (etalon_stat.st_gid, test_stat.st_gid); + mctest_assert_int_eq (etalon_stat.st_rdev, test_stat.st_rdev); + mctest_assert_int_eq (etalon_stat.st_size, test_stat.st_size); + mctest_assert_int_eq (etalon_stat.st_blksize, test_stat.st_blksize); + mctest_assert_int_eq (etalon_stat.st_blocks, test_stat.st_blocks); + /* FIXME: these commented checks are related to time zone! + mctest_assert_int_eq (etalon_stat.st_atime, test_stat.st_atime); + mctest_assert_int_eq (etalon_stat.st_mtime, test_stat.st_mtime); + mctest_assert_int_eq (etalon_stat.st_ctime, test_stat.st_ctime); + */ } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_vfs_parse_ls_lga_reorder) /* *INDENT-ON* */ { + /* given */ size_t filepos = 0; struct vfs_s_entry *ent1, *ent2, *ent3; vfs_parse_ls_lga_init (); + /* init ent1 */ ent1 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (!vfs_parse_ls_lga + vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root1", &ent1->ino->st, - &ent1->name, &ent1->ino->linkname, &filepos)) - { - fail ("An error occured while parse ls output"); - return; - } + &ent1->name, &ent1->ino->linkname, &filepos); vfs_s_store_filename_leading_spaces (ent1, filepos); vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent1); + /* init ent2 */ ent2 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (!vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2", - &ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos)) - { - fail ("An error occured while parse ls output"); - return; - } + vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root2", + &ent2->ino->st, &ent2->name, &ent2->ino->linkname, &filepos); vfs_s_store_filename_leading_spaces (ent2, filepos); vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent2); + /* init ent3 */ ent3 = vfs_s_generate_entry (&vfs_test_ops1, NULL, vfs_root_inode, 0); - if (!vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", - &ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos)) - { - fail ("An error occured while parse ls output"); - return; - } + vfs_parse_ls_lga ("drwxrwxr-x 10 500 500 4096 Jun 23 17:09 ..", + &ent3->ino->st, &ent3->name, &ent3->ino->linkname, &filepos); vfs_s_store_filename_leading_spaces (ent3, filepos); vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent3); + /* when */ vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ()); - fail_unless (strcmp (ent1->name, " build_root1") == 0, "\nactual '%s'\nnot equal to '%s'\n", - ent1->name, " build_root1"); - fail_unless (strcmp (ent2->name, " build_root2") == 0, "\nactual '%s'\nnot equal to '%s'\n", - ent2->name, " build_root2"); + /* then */ + mctest_assert_str_eq (ent1->name, " build_root1"); + mctest_assert_str_eq (ent2->name, " build_root2"); } /* *INDENT-OFF* */ END_TEST @@ -308,17 +328,13 @@ END_TEST vfs_s_insert_entry (&vfs_test_ops1, vfs_root_inode, ent[ent_index]);\ \ } -#define fail_unless_ent(ent_index, etalon_str){\ - fail_unless(\ - strcmp(ent[ent_index]->name, etalon_str) == 0,\ - "\nactual '%s'\nnot equal to '%s'\n", ent[ent_index]->name, etalon_str\ - );\ -} +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_vfs_parse_ls_lga_unaligned) /* *INDENT-ON* */ { + /* given */ size_t filepos = 0; struct vfs_s_entry *ent[4]; @@ -330,12 +346,14 @@ START_TEST (test_vfs_parse_ls_lga_unaligned) parce_one_line (3, "drwxrwxr-x 10 500 500 4096 Jun 23 17:09 build_root 0"); + /* when */ vfs_s_normalize_filename_leading_spaces (vfs_root_inode, vfs_parse_ls_lga_get_final_spaces ()); - fail_unless_ent (0, "build_root1"); - fail_unless_ent (1, " build_root2"); - fail_unless_ent (3, " build_root 0"); - + /* then */ + mctest_assert_str_eq (ent[0]->name, "build_root1"); + mctest_assert_str_eq (ent[0]->name, "build_root1"); + mctest_assert_str_eq (ent[1]->name, " build_root2"); + mctest_assert_str_eq (ent[3]->name, " build_root 0"); } /* *INDENT-OFF* */ END_TEST @@ -355,7 +373,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_vfs_parse_ls_lga); + mctest_add_parameterized_test (tc_core, test_vfs_parse_ls_lga, test_vfs_parse_ls_lga_ds); tcase_add_test (tc_core, test_vfs_parse_ls_lga_reorder); tcase_add_test (tc_core, test_vfs_parse_ls_lga_unaligned); /* *********************************** */ diff --git a/tests/lib/vfs/vfs_path_string_convert.c b/tests/lib/vfs/vfs_path_string_convert.c index 4f4c672a4..a27e11f49 100644 --- a/tests/lib/vfs/vfs_path_string_convert.c +++ b/tests/lib/vfs/vfs_path_string_convert.c @@ -40,17 +40,21 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +#define ETALON_PATH_STR "/#test1/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33" +#define ETALON_PATH_URL_STR "/test1://bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33" + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { - str_init_strings (NULL); vfs_init (); init_localfs (); vfs_setup_work_dir (); - vfs_s_init_class (&vfs_test_ops1, &test_subclass1); vfs_test_ops1.name = "testfs1"; @@ -69,226 +73,248 @@ setup (void) vfs_test_ops3.prefix = "test3"; vfs_register_class (&vfs_test_ops3); +#ifdef HAVE_CHARSET + mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR; + load_codepages_list (); +#endif /* HAVE_CHARSET */ } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { +#ifdef HAVE_CHARSET + free_codepages_list (); +#endif /* HAVE_CHARSET */ + vfs_shut (); str_uninit_strings (); } /* --------------------------------------------------------------------------------------------- */ -#define ETALON_PATH_STR "/#test1/bla-bla/some/path/#test2/bla-bla/some/path#test3/111/22/33" -#define ETALON_PATH_URL_STR "/test1://bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33" +/* @DataSource("test_from_to_string_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_from_to_string) +static const struct test_from_to_string_ds +{ + const char *input_string; + const char *expected_result; + const char *expected_element_path; + const size_t expected_elements_count; + struct vfs_class *expected_vfs_class; +} test_from_to_string_ds[] = +{ + { /* 0. */ + ETALON_PATH_STR, + ETALON_PATH_URL_STR, + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 1. */ + "/", + "/", + "/", + 1, + &vfs_local_ops + }, + { /* 2. */ + "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33", + "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33", + "111/22/33", + 4, + &vfs_test_ops3 + }, +#ifdef HAVE_CHARSET + { /* 3. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 4. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 5. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 6. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 7. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, + { /* 8. */ + "/#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", + "111/22/33", + 4, + &vfs_test_ops3 + }, +#endif /* HAVE_CHARSET */ +}; +/* *INDENT-ON* */ + +/* @Test */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_from_to_string, test_from_to_string_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; size_t vpath_len; - char *result; - vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); - - - vpath_len = vfs_path_elements_count (vpath); - fail_unless (vpath_len == 4, "vpath length should be 4 (actial: %d)", vpath_len); - - result = vfs_path_to_str (vpath); - fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free (result); - - vfs_path_free (vpath); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_vfs_path_from_to_string2) -/* *INDENT-ON* */ -{ - vfs_path_t *vpath; - size_t vpath_len; - char *result; const vfs_path_element_t *path_element; + char *actual_result; - vpath = vfs_path_from_str ("/"); + vpath = vfs_path_from_str_flags (data->input_string, VPF_USE_DEPRECATED_PARSER); + /* when */ vpath_len = vfs_path_elements_count (vpath); - fail_unless (vpath_len == 1, "vpath length should be 1 (actial: %d)", vpath_len); - - result = vfs_path_to_str (vpath); - fail_unless (strcmp ("/", result) == 0, "expected(%s) doesn't equal to actual(%s)", "/", - result); - g_free (result); + actual_result = vfs_path_to_str (vpath); path_element = vfs_path_get_by_index (vpath, -1); - fail_unless (strcmp ("/", path_element->path) == 0, "expected(%s) doesn't equal to actual(%s)", - "/", path_element->path); - fail_unless (path_element->class == &vfs_local_ops, - "actual vfs-class doesn't equal to localfs"); + /* then */ + mctest_assert_int_eq (vpath_len, data->expected_elements_count); + mctest_assert_str_eq (actual_result, data->expected_result); + mctest_assert_ptr_eq (path_element->class, data->expected_vfs_class); + mctest_assert_str_eq (path_element->path, data->expected_element_path); + g_free (actual_result); vfs_path_free (vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ + +/* @DataSource("test_partial_string_by_index_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_from_to_partial_string_by_class) +static const struct test_partial_string_by_index_ds +{ + const char *input_string; + const off_t element_index; + const char *expected_result; +} test_partial_string_by_index_ds[] = +{ + { /* 0. */ + ETALON_PATH_STR, + -1, + "/test1://bla-bla/some/path/test2://bla-bla/some/path" + }, + { /* 1. */ + ETALON_PATH_STR, + -2, + "/test1://bla-bla/some/path/" + }, + { /* 2. */ + ETALON_PATH_STR, + -3, + "/" + }, + { /* 3. Index out of bound */ + ETALON_PATH_STR, + -4, + "" + }, + { /* 4. */ + ETALON_PATH_STR, + 1, + "/" + }, + { /* 5. */ + ETALON_PATH_STR, + 2, + "/test1://bla-bla/some/path/" + }, + { /* 6. */ + ETALON_PATH_STR, + 3, + "/test1://bla-bla/some/path/test2://bla-bla/some/path" + }, + { /* 6. */ + ETALON_PATH_STR, + 4, + ETALON_PATH_URL_STR + }, + { /* 7. Index out of bound */ + ETALON_PATH_STR, + 5, + ETALON_PATH_URL_STR + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_partial_string_by_index_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_partial_string_by_index, test_partial_string_by_index_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; - char *result; - vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); + char *actual_result; + vpath = vfs_path_from_str_flags (data->input_string, VPF_USE_DEPRECATED_PARSER); + /* when */ + actual_result = vfs_path_to_str_elements_count (vpath, data->element_index); - result = vfs_path_to_str_elements_count (vpath, -1); - fail_unless (strcmp ("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, - "expected(%s) doesn't equal to actual(%s)", - "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); - g_free (result); - - result = vfs_path_to_str_elements_count (vpath, -2); - fail_unless (strcmp ("/test1://bla-bla/some/path/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); - g_free (result); - - result = vfs_path_to_str_elements_count (vpath, -3); - fail_unless (strcmp ("/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/", result); - g_free (result); - - /* index out of bound */ - result = vfs_path_to_str_elements_count (vpath, -4); - fail_unless (strcmp ("", result) == 0, "expected(%s) doesn't equal to actual(%s)", "", result); - g_free (result); - - - result = vfs_path_to_str_elements_count (vpath, 1); - fail_unless (strcmp ("/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/", result); - g_free (result); - - result = vfs_path_to_str_elements_count (vpath, 2); - fail_unless (strcmp ("/test1://bla-bla/some/path/", result) == 0, - "expected(%s) doesn't equal to actual(%s)", "/test1://bla-bla/some/path/", result); - g_free (result); - - result = vfs_path_to_str_elements_count (vpath, 3); - fail_unless (strcmp ("/test1://bla-bla/some/path/test2://bla-bla/some/path", result) == 0, - "expected(%s) doesn't equal to actual(%s)", - "/test1://bla-bla/some/path/test2://bla-bla/some/path", result); - g_free (result); - - result = vfs_path_to_str_elements_count (vpath, 4); - fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free (result); - - /* index out of bound */ - result = vfs_path_to_str_elements_count (vpath, 5); - fail_unless (strcmp (ETALON_PATH_URL_STR, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH_URL_STR, result); - g_free (result); + /* then */ + mctest_assert_str_eq (actual_result, data->expected_result); + g_free (actual_result); vfs_path_free (vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ #ifdef HAVE_CHARSET -#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); \ -} - -/* *INDENT-OFF* */ -START_TEST (test_vfs_path_from_to_string_encoding) -/* *INDENT-ON* */ -{ - 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 (); -} - -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - /* --------------------------------------------------------------------------------------------- */ + #define ETALON_STR "/path/to/file.ext/test1://#enc:KOI8-R" +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_vfs_path_encoding_at_end) /* *INDENT-ON* */ { + /* given */ 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); + + /* when */ 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); + /* then */ + mctest_assert_str_eq (element->path, ""); + mctest_assert_not_null (element->encoding); + mctest_assert_str_eq (result, ETALON_STR); g_free (result); vfs_path_free (vpath); - - free_codepages_list (); } /* *INDENT-OFF* */ @@ -297,33 +323,6 @@ END_TEST #endif /* HAVE_CHARSET */ /* --------------------------------------------------------------------------------------------- */ -#undef ETALON_PATH_STR -#define ETALON_PATH_STR "/test1://bla-bla/some/path/test2://user:passwd@some.host:1234/bla-bla/some/path/test3://111/22/33" -/* *INDENT-OFF* */ -START_TEST (test_vfs_path_from_to_string_uri) -/* *INDENT-ON* */ -{ - vfs_path_t *vpath; - size_t vpath_len; - char *result; - vpath = vfs_path_from_str (ETALON_PATH_STR); - - vpath_len = vfs_path_elements_count (vpath); - fail_unless (vpath_len == 4, "vpath length should be 4 (actial: %d)", vpath_len); - - result = vfs_path_to_str (vpath); - fail_unless (strcmp (ETALON_PATH_STR, result) == 0, - "\nexpected(%s)\ndoesn't equal to actual(%s)", ETALON_PATH_STR, result); - g_free (result); - - vfs_path_free (vpath); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - int main (void) { @@ -336,14 +335,12 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_vfs_path_from_to_string); - tcase_add_test (tc_core, test_vfs_path_from_to_string2); - tcase_add_test (tc_core, test_vfs_path_from_to_partial_string_by_class); + mctest_add_parameterized_test (tc_core, test_from_to_string, test_from_to_string_ds); + mctest_add_parameterized_test (tc_core, test_partial_string_by_index, + test_partial_string_by_index_ds); #ifdef HAVE_CHARSET - tcase_add_test (tc_core, test_vfs_path_from_to_string_encoding); tcase_add_test (tc_core, test_vfs_path_encoding_at_end); #endif - tcase_add_test (tc_core, test_vfs_path_from_to_string_uri); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/vfs_prefix_to_class.c b/tests/lib/vfs/vfs_prefix_to_class.c index c6520b757..29f0fbb7f 100644 --- a/tests/lib/vfs/vfs_prefix_to_class.c +++ b/tests/lib/vfs/vfs_prefix_to_class.c @@ -36,6 +36,7 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ static int test_which (struct vfs_class *me, const char *path) @@ -49,17 +50,18 @@ test_which (struct vfs_class *me, const char *path) return -1; } +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { - str_init_strings (NULL); vfs_init (); init_localfs (); vfs_setup_work_dir (); - test_subclass1.flags = VFS_S_REMOTE; vfs_s_init_class (&vfs_test_ops1, &test_subclass1); vfs_test_ops1.name = "testfs1"; @@ -80,6 +82,9 @@ setup (void) } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -89,44 +94,69 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_vfs_prefix_to_class_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_prefix_to_class_valid) +static const struct test_vfs_prefix_to_class_ds +{ + const char *input_string; + const struct vfs_class *expected_result; +} test_vfs_prefix_to_class_ds[] = +{ + { /* 0 */ + "test_1:", + &vfs_test_ops1 + }, + { /* 1 */ + "test_2:", + &vfs_test_ops1 + }, + { /* 2 */ + "test_3:", + &vfs_test_ops1 + }, + { /* 3 */ + "test_4:", + &vfs_test_ops1 + }, + { /* 4 */ + "test2:", + &vfs_test_ops2 + }, + { /* 5 */ + "test3:", + &vfs_test_ops3 + }, + { + "test1:", + NULL + }, + { /* 6 */ + "test_5:", + NULL + }, + { /* 7 */ + "test4:", + NULL + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_prefix_to_class_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_prefix_to_class, test_vfs_prefix_to_class_ds) /* *INDENT-ON* */ { - fail_unless (vfs_prefix_to_class ((char *) "test_1:") == &vfs_test_ops1, - "'test_1:' doesn't transform to vfs_test_ops1"); - fail_unless (vfs_prefix_to_class ((char *) "test_2:") == &vfs_test_ops1, - "'test_2:' doesn't transform to vfs_test_ops1"); - fail_unless (vfs_prefix_to_class ((char *) "test_3:") == &vfs_test_ops1, - "'test_3:' doesn't transform to vfs_test_ops1"); - fail_unless (vfs_prefix_to_class ((char *) "test_4:") == &vfs_test_ops1, - "'test_4:' doesn't transform to vfs_test_ops1"); + /* given */ + struct vfs_class *actual_result; - fail_unless (vfs_prefix_to_class ((char *) "test2:") == &vfs_test_ops2, - "'test2:' doesn't transform to vfs_test_ops2"); + /* when */ + actual_result = vfs_prefix_to_class ((char *) data->input_string); - fail_unless (vfs_prefix_to_class ((char *) "test3:") == &vfs_test_ops3, - "'test3:' doesn't transform to vfs_test_ops3"); + /* then */ + mctest_assert_ptr_eq (actual_result, data->expected_result); } /* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_vfs_prefix_to_class_invalid) -/* *INDENT-ON* */ -{ - fail_unless (vfs_prefix_to_class ((char *) "test1:") == NULL, - "'test1:' doesn't transform to NULL"); - fail_unless (vfs_prefix_to_class ((char *) "test_5:") == NULL, - "'test_5:' doesn't transform to NULL"); - fail_unless (vfs_prefix_to_class ((char *) "test4:") == NULL, - "'test4:' doesn't transform to NULL"); -} -/* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -143,8 +173,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_vfs_prefix_to_class_valid); - tcase_add_test (tc_core, test_vfs_prefix_to_class_invalid); + mctest_add_parameterized_test (tc_core, test_vfs_prefix_to_class, test_vfs_prefix_to_class_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/vfs_s_get_path.c b/tests/lib/vfs/vfs_s_get_path.c index 6a2071d5c..a907b7c12 100644 --- a/tests/lib/vfs/vfs_s_get_path.c +++ b/tests/lib/vfs/vfs_s_get_path.c @@ -40,6 +40,8 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ + static int test1_mock_open_archive (struct vfs_s_super *super, const vfs_path_t * vpath, const vfs_path_element_t * vpath_element) @@ -47,9 +49,7 @@ test1_mock_open_archive (struct vfs_s_super *super, const vfs_path_t * vpath, struct vfs_s_inode *root; char *spath = vfs_path_to_str (vpath); - fail_unless (strcmp ("/" ETALON_VFS_URL_NAME ARCH_NAME, spath) == 0, - "etalon(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, - spath); + mctest_assert_str_eq (spath, "/" ETALON_VFS_URL_NAME ARCH_NAME); super->name = g_strdup (spath); super->data = g_new (char *, 1); @@ -59,6 +59,8 @@ test1_mock_open_archive (struct vfs_s_super *super, const vfs_path_t * vpath, return 0; } +/* --------------------------------------------------------------------------------------------- */ + static int test1_mock_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *super, const vfs_path_t * vpath, void *cookie) @@ -75,6 +77,9 @@ test1_mock_archive_same (const vfs_path_element_t * vpath_element, struct vfs_s_ return 1; } +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -108,6 +113,9 @@ setup (void) vfs_register_class (&vfs_test_ops3); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -124,25 +132,25 @@ vfs_die (const char *m) /* --------------------------------------------------------------------------------------------- */ +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_vfs_s_get_path) /* *INDENT-ON* */ { + /* given */ struct vfs_s_super *archive; - const char *result; + + /* when */ vfs_path_t *vpath = vfs_path_from_str_flags ("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH, VPF_USE_DEPRECATED_PARSER); result = vfs_s_get_path (vpath, &archive, 0); - fail_unless (strcmp (ETALON_PATH, result) == 0, - "expected(%s) doesn't equal to actual(%s)", ETALON_PATH, result); - - fail_unless (strcmp ("/" ETALON_VFS_URL_NAME ARCH_NAME, archive->name) == 0, - "expected(%s) doesn't equal to actual(%s)", "/" ETALON_VFS_URL_NAME ARCH_NAME, - archive->name); + /* then */ + mctest_assert_str_eq (result, ETALON_PATH); + mctest_assert_str_eq (archive->name, "/" ETALON_VFS_URL_NAME ARCH_NAME); g_free (vpath); diff --git a/tests/lib/vfs/vfs_split.c b/tests/lib/vfs/vfs_split.c index db17eff80..549d6dbb7 100644 --- a/tests/lib/vfs/vfs_split.c +++ b/tests/lib/vfs/vfs_split.c @@ -36,10 +36,12 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { - str_init_strings (NULL); vfs_init (); @@ -64,9 +66,11 @@ setup (void) vfs_test_ops3.name = "testfs3"; vfs_test_ops3.prefix = "test3:"; vfs_register_class (&vfs_test_ops3); - } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -76,235 +80,121 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_vfs_split_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_split) +static const struct test_vfs_split_ds +{ + const char *input_string; + const char *expected_path; + const char *expected_local; + const char *expected_op; + const struct vfs_class *expected_result; +} test_vfs_split_ds[] = +{ + { /* 0. */ + "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/#test3:/qqq/www/eee.rr", + "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/", + "qqq/www/eee.rr", + "test3:", + &vfs_test_ops3 + }, + { /* 1. */ + "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/", + "#test1:/bla-bla/some/path/", + "bla-bla/some/path2/", + "test2:", + &vfs_test_ops2 + }, + { /* 2. */ + "#test1:/bla-bla/some/path/", + "", + "bla-bla/some/path/", + "test1:", + &vfs_test_ops1 + }, + { /* 3. */ + "", + "", + NULL, + NULL, + NULL + }, + { /* 4. split with local */ + "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2#test3:/qqq/www/eee.rr", + "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2", + "qqq/www/eee.rr", + "test3:", + &vfs_test_ops3 + }, + { /* 5. split with local */ + "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2", + "/local/path/#test1:/bla-bla/some/path/", + "bla-bla/some/path2", + "test2:", + &vfs_test_ops2, + }, + { /* 6. split with local */ + "/local/path/#test1:/bla-bla/some/path/", + "/local/path/", + "bla-bla/some/path/", + "test1:", + &vfs_test_ops1 + }, + { /* 7. split with local */ + "/local/path/", + "/local/path/", + NULL, + NULL, + NULL + }, + { /* 8. split with URL */ + "#test2:username:passwd@somehost.net/bla-bla/some/path2", + "", + "bla-bla/some/path2", + "test2:username:passwd@somehost.net", + &vfs_test_ops2 + }, + { /* 9. split URL with semi */ + "/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2", + "/local/path/#test1:/bla-bla/some/path/", + "bla-bla/some/path2", + "test2:username:p!a@s#s$w%d@somehost.net", + &vfs_test_ops2 + }, + { /* 10. split with semi in path */ + "#test2:/bl#a-bl#a/so#me/pa#th2", + "", + "bl#a-bl#a/so#me/pa#th2", + "test2:", + &vfs_test_ops2 + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_split_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_split, test_vfs_split_ds) /* *INDENT-ON* */ { + /* given */ + const char *local = NULL, *op = NULL; + struct vfs_class *actual_result; char *path; - const char *local, *op, *etalon_path, *etalon_local, *etalon_op; - struct vfs_class *result; - path = g_strdup ("#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/#test3:/qqq/www/eee.rr"); + path = g_strdup (data->input_string); - etalon_path = "#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2/"; - etalon_local = "qqq/www/eee.rr"; - etalon_op = "test3:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, - &vfs_test_ops3); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - etalon_path = "#test1:/bla-bla/some/path/"; - etalon_local = "bla-bla/some/path2/"; - etalon_op = "test2:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, - &vfs_test_ops2); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - etalon_path = ""; - etalon_local = "bla-bla/some/path/"; - etalon_op = "test1:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, - &vfs_test_ops2); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); + /* when */ + actual_result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); + /* then */ + mctest_assert_ptr_eq (actual_result, data->expected_result); + mctest_assert_str_eq (path, data->expected_path); + mctest_assert_str_eq (local, data->expected_local); + mctest_assert_str_eq (op, data->expected_op); g_free (path); } /* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_vfs_split_with_local) -/* *INDENT-ON* */ -{ - char *path; - const char *local, *op, *etalon_path, *etalon_local, *etalon_op; - struct vfs_class *result; - - path = - g_strdup - ("/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2#test3:/qqq/www/eee.rr"); - - etalon_path = "/local/path/#test1:/bla-bla/some/path/#test2:/bla-bla/some/path2"; - etalon_local = "qqq/www/eee.rr"; - etalon_op = "test3:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops3, "Result(%p) doesn't match to vfs_test_ops3(%p)", result, - &vfs_test_ops3); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - etalon_path = "/local/path/#test1:/bla-bla/some/path/"; - etalon_local = "bla-bla/some/path2"; - etalon_op = "test2:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, - &vfs_test_ops2); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - etalon_path = "/local/path/"; - etalon_local = "bla-bla/some/path/"; - etalon_op = "test1:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops1, "Result(%p) doesn't match to vfs_test_ops1(%p)", result, - &vfs_test_ops2); - fail_unless (strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (strcmp (local, etalon_local) == 0, "parsed local path('%s') doesn't match to '%s'", - local, etalon_local); - fail_unless (strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == NULL, "Result(%p) doesn't match to vfs_test_ops1(NULL)", result); - - g_free (path); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ -/* *INDENT-OFF* */ -START_TEST (test_vfs_split_url) -/* *INDENT-ON* */ -{ - char *path; - const char *local, *op, *etalon_path, *etalon_local, *etalon_op; - struct vfs_class *result; - - path = g_strdup ("#test2:username:passwd@somehost.net/bla-bla/some/path2"); - - etalon_path = ""; - etalon_local = "bla-bla/some/path2"; - etalon_op = "test2:username:passwd@somehost.net"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, - &vfs_test_ops2); - fail_unless (path != NULL - && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (local != NULL - && strcmp (local, etalon_local) == 0, - "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless (op != NULL - && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - g_free (path); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_vfs_split_url_with_semi) -/* *INDENT-ON* */ -{ - char *path; - const char *local, *op, *etalon_path, *etalon_local, *etalon_op; - struct vfs_class *result; - - - path = - g_strdup - ("/local/path/#test1:/bla-bla/some/path/#test2:username:p!a@s#s$w%d@somehost.net/bla-bla/some/path2"); - - etalon_path = "/local/path/#test1:/bla-bla/some/path/"; - etalon_local = "bla-bla/some/path2"; - etalon_op = "test2:username:p!a@s#s$w%d@somehost.net"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, - &vfs_test_ops2); - fail_unless (path != NULL - && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (local != NULL - && strcmp (local, etalon_local) == 0, - "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless (op != NULL - && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - g_free (path); - -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_vfs_split_with_semi_in_path) -/* *INDENT-ON* */ -{ - char *path; - const char *local, *op, *etalon_path, *etalon_local, *etalon_op; - struct vfs_class *result; - - path = g_strdup ("#test2:/bl#a-bl#a/so#me/pa#th2"); - - etalon_path = ""; - etalon_local = "bl#a-bl#a/so#me/pa#th2"; - etalon_op = "test2:"; - result = _vfs_split_with_semi_skip_count (path, &local, &op, 0); - fail_unless (result == &vfs_test_ops2, "Result(%p) doesn't match to vfs_test_ops2(%p)", result, - &vfs_test_ops2); - fail_unless (path != NULL - && strcmp (path, etalon_path) == 0, "path('%s') doesn't match to '%s'", path, - etalon_path); - fail_unless (local != NULL - && strcmp (local, etalon_local) == 0, - "parsed local path('%s') doesn't match to '%s'", local, etalon_local); - fail_unless (op != NULL - && strcmp (op, etalon_op) == 0, "parsed VFS name ('%s') doesn't match to '%s'", op, - etalon_op); - - g_free (path); -} -/* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -321,17 +211,13 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_vfs_split); - tcase_add_test (tc_core, test_vfs_split_with_local); - tcase_add_test (tc_core, test_vfs_split_url); - tcase_add_test (tc_core, test_vfs_split_url_with_semi); - tcase_add_test (tc_core, test_vfs_split_with_semi_in_path); + mctest_add_parameterized_test (tc_core, test_vfs_split, test_vfs_split_ds); /* *********************************** */ suite_add_tcase (s, tc_core); sr = srunner_create (s); srunner_set_log (sr, "vfs_split.log"); - srunner_run_all (sr, CK_NORMAL); + srunner_run_all (sr, CK_NOFORK); number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? 0 : 1; From 907b7cce5d9224e451d8bd80242cd2e03b9a8207 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 21 Jan 2013 16:43:54 +0400 Subject: [PATCH 06/35] doc/man/ru/mc.1.in: fix formatting. Signed-off-by: Andrew Borodin --- doc/man/ru/mc.1.in | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index 607e9402f..bc4573863 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -349,8 +349,8 @@ S\-<символ> означает, что нужно держать в нажа .br .PP Параметры в трёх первых случаях могут содержать абсолютный путь к файлу -клавиатурных команд либо просто название схемы привязки (с расширением -\&.keymap либо без него). В данном случае поиск файла клавиатурных команд +клавиатурных команд либо просто название схемы привязки (с расширением .keymap +либо без него). В данном случае поиск файла клавиатурных команд будет происходить по следующим каталогам (до первого нахождения): .IP .br @@ -2901,11 +2901,11 @@ subshell, в файле Когда эта опция включена, можно использовать символы замены (wildcards) '*' и '?' в маске источника. Они обрабатываются аналогично тому, как это делается в shell. В маске приемника разрешается использовать только '*' -и \&'\\<цифра>'. Первый символ '*' в маске приемника соответствует первой +и '\\<цифра>'. Первый символ '*' в маске приемника соответствует первой группе символов замены в маске источника, второй символ '*' соответствует -второй группе и т.д. Аналогично, символ замены \&'\\1' соответствует первой -группе символов замены в маске источника, символ \&'\\2' \- второй группе -и т. д. до \&'\\9'. Символ \&'\\0' соответствует целому имени файла\-источника. +второй группе и т. д. Аналогично, символ замены '\\1' соответствует первой +группе символов замены в маске источника, символ '\\2' \- второй группе +и т. д. до '\\9'. Символ '\\0' соответствует целому имени файла\-источника. .PP Два примера: .PP @@ -2921,9 +2921,8 @@ subshell, в файле .I "Образцы в стиле shell" выключена, MC не осуществляет автоматической группировки. Для указания групп символов в маске источника, которые будут соответствовать символам -замены в маске приемника, вы должны в этом случае использовать скобки -\&'\\(...\\)'. Этот способ более гибкий, но требует больше усилий при -вводе. +замены в маске приемника, вы должны в этом случае использовать скобки '\\(...\\)'. +Этот способ более гибкий, но требует больше усилий при вводе. .PP Два примера: .PP @@ -2947,8 +2946,7 @@ subshell, в файле вплоть до следующего вхождения '\\E' или '\\U', появления символа '\\L' или конца имени файла. .PP -Применение '\\u' и '\\l' обеспечивает более широкие возможности, чем -\&'\\U' и '\\L'. +Применение '\\u' и '\\l' обеспечивает более широкие возможности, чем '\\U' и '\\L'. .PP Например, если маска источника есть '*' (опция .I "Образцы в стиле shell" From 3ecfeb04dae4d62b7d185f00414ab2cc9c6683a2 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 16 Jan 2013 10:37:37 +0400 Subject: [PATCH 07/35] Get rid of g_return_* macros in file operation routines ...since they produce warnings about non-created UI and clutter screen up. Signed-off-by: Andrew Borodin --- src/filemanager/filegui.c | 44 +++++++++++++++++-------------------- src/filemanager/fileopctx.c | 12 +++++----- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index ea40a79f0..6b4e12917 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -649,7 +649,8 @@ check_progress_buttons (FileOpContext * ctx) Gpm_Event event; FileOpContextUI *ui; - g_return_val_if_fail (ctx->ui != NULL, FILE_CONT); + if (ctx == NULL || ctx->ui == NULL) + return FILE_CONT; ui = ctx->ui; @@ -702,8 +703,8 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, int dlg_width = 58, dlg_height = 17; int y = 2, x = 3; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui == NULL); + if (ctx == NULL || ctx->ui != NULL) + return; #ifdef ENABLE_NLS if (progress_buttons[0].len == -1) @@ -715,7 +716,6 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, } #endif - ctx->dialog_type = dialog_type; ctx->recursive_result = RECURSIVE_YES; ctx->ui = g_new0 (FileOpContextUI, 1); @@ -829,9 +829,7 @@ file_op_context_create_ui (FileOpContext * ctx, gboolean with_eta, void file_op_context_destroy_ui (FileOpContext * ctx) { - g_return_if_fail (ctx != NULL); - - if (ctx->ui != NULL) + if (ctx != NULL && ctx->ui != NULL) { FileOpContextUI *ui = (FileOpContextUI *) ctx->ui; @@ -856,12 +854,9 @@ file_progress_show (FileOpContext * ctx, off_t done, off_t total, char buffer2[BUF_TINY]; char buffer3[BUF_TINY]; - if (!verbose) + if (!verbose || ctx == NULL || ctx->ui == NULL) return; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); - ui = ctx->ui; if (total == 0) @@ -903,8 +898,8 @@ file_progress_show_count (FileOpContext * ctx, size_t done, size_t total) char buffer[BUF_TINY]; FileOpContextUI *ui; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); + if (ctx == NULL || ctx->ui == NULL) + return; ui = ctx->ui; if (ctx->progress_totals_computed) @@ -927,8 +922,8 @@ file_progress_show_total (FileOpTotalContext * tctx, FileOpContext * ctx, uintma struct timeval tv_current; FileOpContextUI *ui; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); + if (ctx == NULL || ctx->ui == NULL) + return; ui = ctx->ui; @@ -995,8 +990,8 @@ file_progress_show_source (FileOpContext * ctx, const vfs_path_t * s_vpath) { FileOpContextUI *ui; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); + if (ctx == NULL || ctx->ui == NULL) + return; ui = ctx->ui; @@ -1023,8 +1018,8 @@ file_progress_show_target (FileOpContext * ctx, const vfs_path_t * s_vpath) { FileOpContextUI *ui; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); + if (ctx == NULL || ctx->ui == NULL) + return; ui = ctx->ui; @@ -1051,8 +1046,8 @@ file_progress_show_deleting (FileOpContext * ctx, const char *s) { FileOpContextUI *ui; - g_return_if_fail (ctx != NULL); - g_return_if_fail (ctx->ui != NULL); + if (ctx == NULL || ctx->ui == NULL) + return; ui = ctx->ui; label_set_text (ui->file_label[0], _("Deleting")); @@ -1068,8 +1063,8 @@ file_progress_real_query_replace (FileOpContext * ctx, { FileOpContextUI *ui; - g_return_val_if_fail (ctx != NULL, FILE_CONT); - g_return_val_if_fail (ctx->ui != NULL, FILE_CONT); + if (ctx == NULL || ctx->ui == NULL) + return FILE_CONT; ui = ctx->ui; @@ -1132,7 +1127,8 @@ file_mask_dialog (FileOpContext * ctx, FileOperation operation, char *dest_dir, *tmp; char *def_text_secure; - g_return_val_if_fail (ctx != NULL, NULL); + if (ctx == NULL) + return NULL; /* unselect checkbox if target filesystem don't support attributes */ ctx->op_preserve = filegui__check_attrs_on_fs (def_text); diff --git a/src/filemanager/fileopctx.c b/src/filemanager/fileopctx.c index 9a2be4992..ad7292d1f 100644 --- a/src/filemanager/fileopctx.c +++ b/src/filemanager/fileopctx.c @@ -98,12 +98,12 @@ file_op_context_new (FileOperation op) void file_op_context_destroy (FileOpContext * ctx) { - g_return_if_fail (ctx != NULL); - - file_op_context_destroy_ui (ctx); - mc_search_free (ctx->search_handle); - /** \todo FIXME: do we need to free ctx->dest_mask? */ - g_free (ctx); + if (ctx != NULL) + { + file_op_context_destroy_ui (ctx); + mc_search_free (ctx->search_handle); + g_free (ctx); + } } /* --------------------------------------------------------------------------------------------- */ From 8454f12f8f33e3f79e357d5ff4dabe2bf630caba Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 23 Jan 2013 15:49:37 +0400 Subject: [PATCH 08/35] Ticket #2954: fix typo: occured -> occurred. Signed-off-by: Andrew Borodin --- lib/mcconfig/paths.c | 2 +- src/editor/editwidget.c | 2 +- src/vfs/sftpfs/config_parcer.c | 2 +- src/vfs/sftpfs/connection.c | 2 +- tests/lib/vfs/vfs_parse_ls_lga.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mcconfig/paths.c b/lib/mcconfig/paths.c index d022498cb..916bff9ae 100644 --- a/lib/mcconfig/paths.c +++ b/lib/mcconfig/paths.c @@ -217,7 +217,7 @@ mc_config_copy (const char *old_name, const char *new_name, GError ** error) g_propagate_error (error, g_error_new (MC_ERROR, 0, _ - ("An error occured while migrating user settings: %s"), + ("An error occurred while migrating user settings: %s"), unix_error_string (errno))); return; } diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index 4ed136fd0..f71e4c271 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -1039,7 +1039,7 @@ edit_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da * * @param file_vpath file object * @param line line number - * @return TRUE if no errors was occured, FALSE otherwise + * @return TRUE if no errors was occurred, FALSE otherwise */ gboolean diff --git a/src/vfs/sftpfs/config_parcer.c b/src/vfs/sftpfs/config_parcer.c index c2ce1b55b..76a4af983 100644 --- a/src/vfs/sftpfs/config_parcer.c +++ b/src/vfs/sftpfs/config_parcer.c @@ -219,7 +219,7 @@ sftpfs_fill_config_entity_from_config (FILE * ssh_config_handler, if (errno != 0) { g_set_error (error, MC_ERROR, errno, - _("sftp: an error occured while reading %s: %s"), SFTPFS_SSH_CONFIG, + _("sftp: an error occurred while reading %s: %s"), SFTPFS_SSH_CONFIG, strerror (errno)); mc_search_free (host_regexp); return FALSE; diff --git a/src/vfs/sftpfs/connection.c b/src/vfs/sftpfs/connection.c index 1df88279f..358d36fb9 100644 --- a/src/vfs/sftpfs/connection.c +++ b/src/vfs/sftpfs/connection.c @@ -60,7 +60,7 @@ * * @param super connection data * @param error pointer to the error handler - * @return socket descriptor number, -1 if any error was occured + * @return socket descriptor number, -1 if any error was occurred */ static int diff --git a/tests/lib/vfs/vfs_parse_ls_lga.c b/tests/lib/vfs/vfs_parse_ls_lga.c index 6501e8a2f..e5f911a85 100644 --- a/tests/lib/vfs/vfs_parse_ls_lga.c +++ b/tests/lib/vfs/vfs_parse_ls_lga.c @@ -321,7 +321,7 @@ END_TEST if (! vfs_parse_ls_lga (ls_output,\ &ent[ent_index]->ino->st, &ent[ent_index]->name, &ent[ent_index]->ino->linkname, &filepos))\ {\ - fail ("An error occured while parse ls output");\ + fail ("An error occurred while parse ls output");\ return;\ }\ vfs_s_store_filename_leading_spaces (ent[ent_index], filepos);\ From c984447f8e663d2672f8524a99b4ad7a895c05f5 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Mon, 28 Jan 2013 16:20:42 +0300 Subject: [PATCH 09/35] Rename vfs_path_cmp() to vfs_path_equals() Signed-off-by: Slava Zanko --- lib/vfs/path.c | 20 ++++++++++---------- lib/vfs/path.h | 4 ++-- src/editor/editcmd.c | 2 +- src/filemanager/cmd.c | 2 +- src/filemanager/panel.c | 2 +- src/filemanager/panelize.c | 2 +- src/filemanager/tree.c | 18 +++++++++--------- src/filemanager/treestore.c | 8 ++++---- tests/lib/vfs/path_cmp.c | 36 +++++++++++++++++++----------------- 9 files changed, 48 insertions(+), 46 deletions(-) diff --git a/lib/vfs/path.c b/lib/vfs/path.c index 9e49b1698..a5b61bfa0 100644 --- a/lib/vfs/path.c +++ b/lib/vfs/path.c @@ -1532,20 +1532,20 @@ vfs_path_element_build_pretty_path_str (const vfs_path_element_t * element) * @return integer value like to strcmp. */ -int -vfs_path_cmp (const vfs_path_t * vpath1, const vfs_path_t * vpath2) +gboolean +vfs_path_equal (const vfs_path_t * vpath1, const vfs_path_t * vpath2) { char *path1; char *path2; - int ret_val; + gboolean ret_val; if (vpath1 == NULL || vpath2 == NULL) - return -1; + return FALSE; path1 = vfs_path_to_str (vpath1); path2 = vfs_path_to_str (vpath2); - ret_val = strcmp (path1, path2); + ret_val = strcmp (path1, path2) == 0; g_free (path1); g_free (path2); @@ -1564,20 +1564,20 @@ vfs_path_cmp (const vfs_path_t * vpath1, const vfs_path_t * vpath2) * @return integer value like to strcmp. */ -int -vfs_path_ncmp (const vfs_path_t * vpath1, const vfs_path_t * vpath2, size_t len) +gboolean +vfs_path_equal_len (const vfs_path_t * vpath1, const vfs_path_t * vpath2, size_t len) { char *path1; char *path2; - int ret_val; + gboolean ret_val; if (vpath1 == NULL || vpath2 == NULL) - return -1; + return FALSE; path1 = vfs_path_to_str (vpath1); path2 = vfs_path_to_str (vpath2); - ret_val = strncmp (path1, path2, len); + ret_val = strncmp (path1, path2, len) == 0; g_free (path1); g_free (path2); diff --git a/lib/vfs/path.h b/lib/vfs/path.h index 2f962ebad..c45ec1e85 100644 --- a/lib/vfs/path.h +++ b/lib/vfs/path.h @@ -92,8 +92,8 @@ char *vfs_path_build_url_params_str (const vfs_path_element_t * element, gboolea char *vfs_path_element_build_pretty_path_str (const vfs_path_element_t * element); size_t vfs_path_len (const vfs_path_t * vpath); -int vfs_path_cmp (const vfs_path_t * vpath1, const vfs_path_t * vpath2); -int vfs_path_ncmp (const vfs_path_t * vpath1, const vfs_path_t * vpath2, size_t len); +gboolean vfs_path_equal (const vfs_path_t * vpath1, const vfs_path_t * vpath2); +gboolean vfs_path_equal_len (const vfs_path_t * vpath1, const vfs_path_t * vpath2, size_t len); vfs_path_t *vfs_path_to_absolute (const vfs_path_t * vpath); /*** inline functions ****************************************************************************/ diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 0b7c70ae4..70a308d83 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -1663,7 +1663,7 @@ edit_save_as_cmd (WEdit * edit) { int rv; - if (vfs_path_cmp (edit->filename_vpath, exp_vpath) != 0) + if (!vfs_path_equal (edit->filename_vpath, exp_vpath)) { int file; struct stat sb; diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c index fb937ff1e..d54736629 100644 --- a/src/filemanager/cmd.c +++ b/src/filemanager/cmd.c @@ -1044,7 +1044,7 @@ reread_cmd (void) panel_update_flags_t flag = UP_ONLY_CURRENT; if (get_current_type () == view_listing && get_other_type () == view_listing && - vfs_path_cmp (current_panel->cwd_vpath, other_panel->cwd_vpath) == 0) + vfs_path_equal (current_panel->cwd_vpath, other_panel->cwd_vpath)) flag = UP_OPTIMIZE; update_panels (UP_RELOAD | flag, UP_KEEPSEL); diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index 6c0532d65..86fd21fdf 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -4812,7 +4812,7 @@ do_cd (const vfs_path_t * new_dir_vpath, enum cd_enum exact) size_t new_vpath_len; new_vpath_len = vfs_path_len (new_dir_vpath); - if (vfs_path_ncmp (new_dir_vpath, panelized_panel.root_vpath, new_vpath_len) == 0) + if (vfs_path_equal_len (new_dir_vpath, panelized_panel.root_vpath, new_vpath_len)) _new_dir_vpath = panelized_panel.root_vpath; } diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c index 5c39a7dc5..e99e7f9f0 100644 --- a/src/filemanager/panelize.c +++ b/src/filemanager/panelize.c @@ -418,7 +418,7 @@ do_panelize_cd (struct WPanel *panel) panel->count = panelized_panel.count; panel->is_panelized = TRUE; - panelized_same = (vfs_path_cmp (panelized_panel.root_vpath, panel->cwd_vpath) == 0); + panelized_same = (vfs_path_equal (panelized_panel.root_vpath, panel->cwd_vpath)); for (i = 0; i < panelized_panel.count; i++) { diff --git a/src/filemanager/tree.c b/src/filemanager/tree.c index 628e12070..bba6a12cc 100644 --- a/src/filemanager/tree.c +++ b/src/filemanager/tree.c @@ -314,13 +314,13 @@ show_tree (WTree * tree) if (current->sublevel < tree->selected_ptr->sublevel) { - if (vfs_path_cmp (current->name, tree->selected_ptr->name) == 0) + if (vfs_path_equal (current->name, tree->selected_ptr->name)) i++; } else if (current->sublevel == tree->selected_ptr->sublevel) { for (j = strlen (current_name) - 1; current_name[j] != PATH_SEP; j--); - if (vfs_path_ncmp (current->name, tree->selected_ptr->name, j) == 0) + if (vfs_path_equal_len (current->name, tree->selected_ptr->name, j)) i++; } else @@ -328,8 +328,8 @@ show_tree (WTree * tree) if (current->sublevel == tree->selected_ptr->sublevel + 1 && vfs_path_len (tree->selected_ptr->name) > 1) { - if (vfs_path_ncmp (current->name, tree->selected_ptr->name, - vfs_path_len (tree->selected_ptr->name)) == 0) + if (vfs_path_equal_len (current->name, tree->selected_ptr->name, + vfs_path_len (tree->selected_ptr->name))) i++; } } @@ -406,8 +406,8 @@ show_tree (WTree * tree) { if (current->sublevel < tree->selected_ptr->sublevel) { - if (vfs_path_ncmp (current->name, tree->selected_ptr->name, - vfs_path_len (current->name)) == 0) + if (vfs_path_equal_len (current->name, tree->selected_ptr->name, + vfs_path_len (current->name))) break; } else if (current->sublevel == tree->selected_ptr->sublevel) @@ -418,14 +418,14 @@ show_tree (WTree * tree) for (j = strlen (current_name) - 1; current_name[j] != PATH_SEP; j--) ; g_free (current_name); - if (vfs_path_ncmp (current->name, tree->selected_ptr->name, j) == 0) + if (vfs_path_equal_len (current->name, tree->selected_ptr->name, j)) break; } else if (current->sublevel == tree->selected_ptr->sublevel + 1 && vfs_path_len (tree->selected_ptr->name) > 1) { - if (vfs_path_ncmp (current->name, tree->selected_ptr->name, - vfs_path_len (tree->selected_ptr->name)) == 0) + if (vfs_path_equal_len (current->name, tree->selected_ptr->name, + vfs_path_len (tree->selected_ptr->name))) break; } current = current->next; diff --git a/src/filemanager/treestore.c b/src/filemanager/treestore.c index 15942ff00..e3e512d08 100644 --- a/src/filemanager/treestore.c +++ b/src/filemanager/treestore.c @@ -727,7 +727,7 @@ tree_store_remove_entry (const vfs_path_t * name_vpath) len = vfs_path_len (base->name); current = base->next; - while (current != NULL && vfs_path_ncmp (current->name, base->name, len) == 0) + while (current != NULL && vfs_path_equal_len (current->name, base->name, len)) { char *current_name; gboolean ok; @@ -794,7 +794,7 @@ tree_store_mark_checked (const char *subname) len = vfs_path_len (base->name); base->mark = 0; current = base->next; - while (current != NULL && vfs_path_ncmp (current->name, base->name, len) == 0) + while (current != NULL && vfs_path_equal_len (current->name, base->name, len)) { gboolean ok; @@ -851,7 +851,7 @@ tree_store_start_check (const vfs_path_t * vpath) len = vfs_path_len (ts.check_name); current = ts.check_start; - while (current != NULL && vfs_path_ncmp (current->name, ts.check_name, len) == 0) + while (current != NULL && vfs_path_equal_len (current->name, ts.check_name, len)) { char *current_name; gboolean ok; @@ -887,7 +887,7 @@ tree_store_end_check (void) len = vfs_path_len (ts.check_name); current = ts.check_start; - while (current != NULL && vfs_path_ncmp (current->name, ts.check_name, len) == 0) + while (current != NULL && vfs_path_equal_len (current->name, ts.check_name, len)) { char *current_name; gboolean ok; diff --git a/tests/lib/vfs/path_cmp.c b/tests/lib/vfs/path_cmp.c index 1cd1540da..b110b4c47 100644 --- a/tests/lib/vfs/path_cmp.c +++ b/tests/lib/vfs/path_cmp.c @@ -66,10 +66,10 @@ teardown (void) #define path_cmp_one_check(input1, input2, etalon_condition) {\ vpath1 = vfs_path_from_str (input1);\ vpath2 = vfs_path_from_str (input2);\ - result = vfs_path_cmp (vpath1, vpath2);\ + result = vfs_path_equal (vpath1, vpath2);\ vfs_path_free (vpath1); \ vfs_path_free (vpath2); \ - fail_unless ( result etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ + fail_unless ( result == etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ input1, input2, #etalon_condition, result); \ } @@ -80,16 +80,18 @@ START_TEST (test_path_compare) vfs_path_t *vpath1, *vpath2; int result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", == 0); + path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", TRUE); #ifdef HAVE_CHARSET - path_cmp_one_check ("/#enc:KOI8-R/тестовый/путь", "/тестовый/путь", <0); - path_cmp_one_check ("/тестовый/путь", "/#enc:KOI8-R/тестовый/путь", >0); + path_cmp_one_check ("/#enc:KOI8-R/тестовый/путь", "/тестовый/путь", + FALSE); + path_cmp_one_check ("/тестовый/путь", "/#enc:KOI8-R/тестовый/путь", + FALSE); #endif - path_cmp_one_check (NULL, "/тестовый/путь", -1); - path_cmp_one_check ("/тестовый/путь", NULL, -1); - path_cmp_one_check (NULL, NULL, -1); + path_cmp_one_check (NULL, "/тестовый/путь", FALSE); + path_cmp_one_check ("/тестовый/путь", NULL, FALSE); + path_cmp_one_check (NULL, NULL, FALSE); } /* *INDENT-OFF* */ END_TEST @@ -101,10 +103,10 @@ END_TEST #define path_cmp_one_check(input1, input2, len, etalon_condition) {\ vpath1 = vfs_path_from_str (input1);\ vpath2 = vfs_path_from_str (input2);\ - result = vfs_path_ncmp (vpath1, vpath2, len);\ + result = vfs_path_equal_len (vpath1, vpath2, len);\ vfs_path_free (vpath1); \ vfs_path_free (vpath2); \ - fail_unless ( result etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ + fail_unless ( result == etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ input1, input2, #etalon_condition, result); \ } @@ -115,17 +117,17 @@ START_TEST (test_path_compare_len) vfs_path_t *vpath1, *vpath2; int result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", 10, == 0); + path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", 10, TRUE); - path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 10, <0); + path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 10, FALSE); - path_cmp_one_check ("/тестовый/путь", "/тест/овый/путь", 10, >0); + path_cmp_one_check ("/тестовый/путь", "/тест/овый/путь", 10, FALSE); - path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 9, == 0); + path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 9, TRUE); - path_cmp_one_check (NULL, "/тестовый/путь", 0, <0); - path_cmp_one_check ("/тестовый/путь", NULL, 0, <0); - path_cmp_one_check (NULL, NULL, 0, <0); + path_cmp_one_check (NULL, "/тестовый/путь", 0, FALSE); + path_cmp_one_check ("/тестовый/путь", NULL, 0, FALSE); + path_cmp_one_check (NULL, NULL, 0, FALSE); } /* *INDENT-OFF* */ END_TEST From 063d5a134fe7a75d1d8f41e6d5a6bf3272efeed5 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Mon, 28 Jan 2013 15:18:15 +0000 Subject: [PATCH 10/35] Code refactoring in tests. Signed-off-by: Slava Zanko --- tests/lib/mcconfig/config_string.c | 230 ++++---- tests/lib/mcconfig/user_configs_path.c | 165 ++++-- .../search/regex_process_escape_sequence.c | 119 ++++- tests/lib/search/regex_replace_esc_seq.c | 191 +++++-- tests/lib/vfs/canonicalize_pathname.c | 129 +++-- tests/lib/vfs/current_dir.c | 175 +++++-- tests/lib/vfs/path_cmp.c | 190 +++++-- tests/lib/vfs/path_len.c | 68 ++- tests/lib/vfs/path_manipulations.c | 491 ++++++++++++------ tests/lib/vfs/path_recode.c | 284 +++++----- tests/lib/vfs/path_serialize.c | 63 ++- tests/lib/vfs/relative_cd.c | 112 +++- 12 files changed, 1513 insertions(+), 704 deletions(-) diff --git a/tests/lib/mcconfig/config_string.c b/tests/lib/mcconfig/config_string.c index 6c9fd2c2f..0b03e2e00 100644 --- a/tests/lib/mcconfig/config_string.c +++ b/tests/lib/mcconfig/config_string.c @@ -33,145 +33,201 @@ #include "lib/vfs/vfs.h" #include "src/vfs/local/local.c" +static mc_config_t *mc_config; +static char *ini_filename; +/* --------------------------------------------------------------------------------------------- */ +static void +config_object__init (void) +{ + ini_filename = g_build_filename (WORKDIR, "config_string.ini", NULL); + unlink (ini_filename); + + mc_config = mc_config_init (ini_filename, FALSE); +} + +/* --------------------------------------------------------------------------------------------- */ + +static void +config_object__reopen (void) +{ + GError *error = NULL; + + if (!mc_config_save_file (mc_config, &error)) + { + fail ("Unable to save config file: %s", error->message); + g_error_free (error); + } + + mc_config_deinit (mc_config); + mc_config = mc_config_init (ini_filename, FALSE); +} + +/* --------------------------------------------------------------------------------------------- */ + +static void +config_object__deinit (void) +{ + mc_config_deinit (mc_config); + g_free (ini_filename); +} + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { str_init_strings ("KOI8-R"); vfs_init (); init_localfs (); + + config_object__init (); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { + config_object__deinit (); + vfs_shut (); str_uninit_strings (); } /* --------------------------------------------------------------------------------------------- */ -#define fail_unless_strcmp( etalon ) \ - fail_unless( \ - strcmp(actual_value, etalon) == 0, \ - "Actial value '%s' doesn't equal to etalon '%s'", actual_value, etalon \ - ) +/* @DataSource("test_create_ini_file_ds") */ /* *INDENT-OFF* */ -START_TEST (create_ini_file) +static const struct test_create_ini_file_ds +{ + const char *input_group; + const char *input_param; + const char *input_default_value; + const char *expected_value; + const char *expected_raw_value; +} test_create_ini_file_ds[] = +{ + { /* 0. */ + "group-not-exists", + "param-not_exists", + NULL, + NULL, + "" /* it's a bug: should be NULL. Will be fixed in another branch */ + }, + { /* 1. */ + "test-group1", + "test-param1", + "not-exists", + " some value ", + " some value " + }, + { /* 2. */ + "test-group1", + "test-param2", + "not-exists", + " \tkoi8-r: ", + " \tkoi8-r: \320\242\320\265\321\201\321\202\320\276\320\262\320\276\320\265 \320\267\320\275\320\260\321\207\320\265\320\275\320\270\320\265 " + }, + { /* 3. */ + "test-group1", + "test-param3", + "not-exists", + " \tsome value2\n\nf\b\005fff ", + " \tsome value2\n\nf\b\005fff " + }, + { /* 4. */ + "test-group2", + "test-param1", + "not-exists", + " some value ", + " some value " + }, + { /* 5. */ + "test-group2", + "test-param2", + "not-exists", + "not-exists", + "not-exists" + }, + { /* 6. */ + "test-group2", + "test-param3", + "not-exists", + " \tsome value2\n\nf\b\005fff ", + " \tsome value2\n\nf\b\005fff " + }, + +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_create_ini_file_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_create_ini_file_paths, test_create_ini_file_ds) /* *INDENT-ON* */ { - mc_config_t *mc_config; - GError *error = NULL; - char *actual_value; - char *ini_filename = NULL; - - ini_filename = g_build_filename (WORKDIR, "test-create_ini_file.ini", NULL); - unlink (ini_filename); - - mc_config = mc_config_init (ini_filename, FALSE); - if (mc_config == NULL) - { - fail ("unable to create mc_congif_t object!"); - return; - } + /* given */ + char *actual_value, *actual_raw_value; mc_config_set_string (mc_config, "test-group1", "test-param1", " some value "); mc_config_set_string (mc_config, "test-group1", "test-param2", " \tkoi8-r: "); mc_config_set_string (mc_config, "test-group1", "test-param3", " \tsome value2\n\nf\b\005fff "); - mc_config_set_string_raw (mc_config, "test-group2", "test-param1", " some value "); mc_config_set_string_raw (mc_config, "test-group2", "test-param2", " koi8-r: "); mc_config_set_string_raw (mc_config, "test-group2", "test-param3", " \tsome value2\n\nf\b\005fff "); - if (!mc_config_save_file (mc_config, &error)) - { - fail ("Unable to save config file: %s", error->message); - g_error_free (error); - } + config_object__reopen (); - mc_config_deinit (mc_config); - mc_config = mc_config_init (ini_filename, FALSE); + /* when */ + actual_value = + mc_config_get_string (mc_config, data->input_group, data->input_param, + data->input_default_value); + actual_raw_value = + mc_config_get_string_raw (mc_config, data->input_group, data->input_param, + data->input_default_value); - actual_value = mc_config_get_string (mc_config, "group-not-exists", "param-not_exists", NULL); - fail_unless (actual_value == NULL, - "return value for nonexistent ini-parameters isn't NULL (default value)!"); + /* then */ + mctest_assert_str_eq (actual_value, data->expected_value); + mctest_assert_str_eq (actual_raw_value, data->expected_raw_value); - actual_value = mc_config_get_string (mc_config, "test-group1", "test-param1", "not-exists"); - fail_unless_strcmp (" some value "); g_free (actual_value); - - actual_value = mc_config_get_string (mc_config, "test-group1", "test-param2", "not-exists"); - fail_unless_strcmp (" \tkoi8-r: "); - g_free (actual_value); - - actual_value = mc_config_get_string (mc_config, "test-group1", "test-param3", "not-exists"); - fail_unless_strcmp (" \tsome value2\n\nf\b\005fff "); - g_free (actual_value); - - - actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param1", "not-exists"); - fail_unless_strcmp (" some value "); - g_free (actual_value); - - actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param2", "not-exists"); - fail_unless_strcmp ("not-exists"); - g_free (actual_value); - - actual_value = mc_config_get_string_raw (mc_config, "test-group2", "test-param3", "not-exists"); - fail_unless_strcmp (" \tsome value2\n\nf\b\005fff "); - g_free (actual_value); - - mc_config_deinit (mc_config); - g_free (ini_filename); - + g_free (actual_raw_value); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @Test(group='Integration') */ /* *INDENT-OFF* */ START_TEST (emulate__learn_save) /* *INDENT-ON* */ { - mc_config_t *mc_config; - char *actual_value, *esc_str; - char *ini_filename = NULL; - GError *error = NULL; + /* given */ + char *actual_value; - ini_filename = g_build_filename (WORKDIR, "test-emulate__learn_save.ini", NULL); - unlink (ini_filename); - - mc_config = mc_config_init (ini_filename, FALSE); - if (mc_config == NULL) { - fail ("unable to create mc_congif_t object!"); - return; + char *esc_str; + + esc_str = strutils_escape ("T;E\\X;T-FOR-\\T;E;S\\TI;N'G", -1, ";", TRUE); + mc_config_set_string_raw (mc_config, "test-group1", "test-param1", esc_str); + g_free (esc_str); } - esc_str = strutils_escape ("T;E\\X;T-FOR-\\T;E;S\\TI;N'G", -1, ";", TRUE); - mc_config_set_string_raw (mc_config, "test-group1", "test-param1", esc_str); - g_free (esc_str); - - if (!mc_config_save_file (mc_config, &error)) - { - fail ("Unable to save config file: %s", error->message); - g_error_free (error); - } - - mc_config_deinit (mc_config); - mc_config = mc_config_init (ini_filename, FALSE); + config_object__reopen (); + /* when */ actual_value = mc_config_get_string_raw (mc_config, "test-group1", "test-param1", "not-exists"); - fail_unless_strcmp ("T\\;E\\X\\;T-FOR-\\T\\;E\\;S\\TI\\;N'G"); - g_free (actual_value); - mc_config_deinit (mc_config); - g_free (ini_filename); + /* then */ + mctest_assert_str_eq (actual_value, "T\\;E\\X\\;T-FOR-\\T\\;E\\;S\\TI\\;N'G"); + g_free (actual_value); } /* *INDENT-OFF* */ END_TEST @@ -191,7 +247,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, create_ini_file); + mctest_add_parameterized_test (tc_core, test_create_ini_file_paths, test_create_ini_file_ds); tcase_add_test (tc_core, emulate__learn_save); /* *********************************** */ diff --git a/tests/lib/mcconfig/user_configs_path.c b/tests/lib/mcconfig/user_configs_path.c index b06b2488e..1bc58326e 100644 --- a/tests/lib/mcconfig/user_configs_path.c +++ b/tests/lib/mcconfig/user_configs_path.c @@ -47,7 +47,9 @@ #define CONF_CACHE CONF_MAIN #endif +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { @@ -62,6 +64,9 @@ setup (void) init_localfs (); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -69,49 +74,139 @@ teardown (void) str_uninit_strings (); } -#define path_fail_unless(conf_dir, conf_name) {\ - result = mc_config_get_full_path (conf_name); \ - fail_unless (strcmp( conf_dir PATH_SEP_STR MC_USERCONF_DIR PATH_SEP_STR conf_name, result) == 0); \ - g_free (result); \ -} /* --------------------------------------------------------------------------------------------- */ + +/* @DataSource("test_user_config_paths_ds") */ /* *INDENT-OFF* */ -START_TEST (user_configs_path_test) +static const struct test_user_config_paths_ds +{ + const char *input_base_dir; + const char *input_file_name; +} test_user_config_paths_ds[] = +{ + { /* 0. */ + CONF_MAIN, + MC_CONFIG_FILE + }, + { /* 0. */ + CONF_MAIN, + MC_FHL_INI_FILE + }, + { /* 0. */ + CONF_MAIN, + MC_HOTLIST_FILE + }, + { /* 0. */ + CONF_MAIN, + GLOBAL_KEYMAP_FILE + }, + { /* 0. */ + CONF_MAIN, + MC_USERMENU_FILE + }, + { /* 0. */ + CONF_MAIN, + EDIT_SYNTAX_FILE + }, + { /* 0. */ + CONF_MAIN, + EDIT_HOME_MENU + }, + { /* 0. */ + CONF_MAIN, + EDIT_DIR PATH_SEP_STR "edit.indent.rc" + }, + { /* 0. */ + CONF_MAIN, + EDIT_DIR PATH_SEP_STR "edit.spell.rc" + }, + { /* 0. */ + CONF_MAIN, + MC_PANELS_FILE + }, + { /* 0. */ + CONF_MAIN, + MC_FILEBIND_FILE + }, + { /* 0. */ + CONF_DATA, + MC_SKINS_SUBDIR + }, + { /* 0. */ + CONF_DATA, + FISH_PREFIX + }, + { /* 0. */ + CONF_DATA, + "bashrc" + }, + { /* 0. */ + CONF_DATA, + "inputrc" + }, + { /* 0. */ + CONF_DATA, + MC_EXTFS_DIR + }, + { /* 0. */ + CONF_DATA, + MC_HISTORY_FILE + }, + { /* 0. */ + CONF_DATA, + MC_FILEPOS_FILE + }, + { /* 0. */ + CONF_DATA, + EDIT_CLIP_FILE + }, + { /* 0. */ + CONF_DATA, + MC_MACRO_FILE + }, + { /* 0. */ + CONF_CACHE, + "mc.log" + }, + { /* 0. */ + CONF_CACHE, + MC_TREESTORE_FILE + }, + { /* 0. */ + CONF_CACHE, + EDIT_TEMP_FILE + }, + { /* 0. */ + CONF_CACHE, + EDIT_BLOCK_FILE + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_user_config_paths_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_user_config_paths, test_user_config_paths_ds) /* *INDENT-ON* */ { - char *result; + /* given */ + char *actual_result; - path_fail_unless (CONF_MAIN, MC_CONFIG_FILE); + /* when */ + actual_result = mc_config_get_full_path (data->input_file_name); - path_fail_unless (CONF_MAIN, MC_FHL_INI_FILE); - path_fail_unless (CONF_MAIN, MC_HOTLIST_FILE); - path_fail_unless (CONF_MAIN, GLOBAL_KEYMAP_FILE); - path_fail_unless (CONF_MAIN, MC_USERMENU_FILE); - path_fail_unless (CONF_MAIN, EDIT_SYNTAX_FILE); - path_fail_unless (CONF_MAIN, EDIT_HOME_MENU); - path_fail_unless (CONF_MAIN, EDIT_DIR PATH_SEP_STR "edit.indent.rc"); - path_fail_unless (CONF_MAIN, EDIT_DIR PATH_SEP_STR "edit.spell.rc"); - path_fail_unless (CONF_MAIN, MC_PANELS_FILE); - path_fail_unless (CONF_MAIN, MC_FILEBIND_FILE); - - path_fail_unless (CONF_DATA, MC_SKINS_SUBDIR); - path_fail_unless (CONF_DATA, FISH_PREFIX); - path_fail_unless (CONF_DATA, "bashrc"); - path_fail_unless (CONF_DATA, "inputrc"); - path_fail_unless (CONF_DATA, MC_EXTFS_DIR); - path_fail_unless (CONF_DATA, MC_HISTORY_FILE); - path_fail_unless (CONF_DATA, MC_FILEPOS_FILE); - path_fail_unless (CONF_DATA, EDIT_CLIP_FILE); - path_fail_unless (CONF_DATA, MC_MACRO_FILE); - - path_fail_unless (CONF_CACHE, "mc.log"); - path_fail_unless (CONF_CACHE, MC_TREESTORE_FILE); - path_fail_unless (CONF_CACHE, EDIT_TEMP_FILE); - path_fail_unless (CONF_CACHE, EDIT_BLOCK_FILE); + /* then */ + { + char *expected_file_path; + expected_file_path = + g_build_filename (data->input_base_dir, MC_USERCONF_DIR, data->input_file_name, NULL); + mctest_assert_str_eq (actual_result, expected_file_path); + g_free (expected_file_path); + } + g_free (actual_result); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -128,7 +223,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, user_configs_path_test); + mctest_add_parameterized_test (tc_core, test_user_config_paths, test_user_config_paths_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/search/regex_process_escape_sequence.c b/tests/lib/search/regex_process_escape_sequence.c index 2b5a0a2ac..b77b6ef1b 100644 --- a/tests/lib/search/regex_process_escape_sequence.c +++ b/tests/lib/search/regex_process_escape_sequence.c @@ -29,38 +29,110 @@ #include "regex.c" /* for testing static functions */ -/* --------------------------------------------------------------------------------------------- */ -#define test_helper_valid_data(from, etalon, dest_str, replace_flags, utf) { \ - dest_str = g_string_new(""); \ - mc_search_regex__process_escape_sequence (dest_str, from, -1, &replace_flags, utf); \ - fail_if (strcmp(dest_str->str, etalon), "dest_str(%s) != %s", dest_str->str, etalon); \ - g_string_free(dest_str, TRUE); \ -} - /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_regex_process_escape_sequence_ds") */ /* *INDENT-OFF* */ -START_TEST (test_regex_process_escape_sequence_valid) +static const struct test_regex_process_escape_sequence_ds +{ + const char *input_from; + const replace_transform_type_t input_initial_flags; + const gboolean input_use_utf; + const char *expected_string; +} test_regex_process_escape_sequence_ds[] = +{ + { /* 0. */ + "{101}", + REPLACE_T_NO_TRANSFORM, + FALSE, + "A" + }, + { /* 1. */ + "x42", + REPLACE_T_NO_TRANSFORM, + FALSE, + "B" + }, + { /* 2. */ + "x{444}", + REPLACE_T_NO_TRANSFORM, + FALSE, + "D" + }, + { /* 3. */ + "x{444}", + REPLACE_T_NO_TRANSFORM, + TRUE, + "ф" + }, + { /* 4. */ + "n", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\n" + }, + { /* 5. */ + "t", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\t" + }, + { /* 6. */ + "v", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\v" + }, + { /* 7. */ + "b", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\b" + }, + { /* 8. */ + "r", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\r" + }, + { /* 9. */ + "f", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\f" + }, + { /* 10. */ + "a", + REPLACE_T_NO_TRANSFORM, + FALSE, + "\a" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_regex_process_escape_sequence_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_regex_process_escape_sequence, test_regex_process_escape_sequence_ds) /* *INDENT-ON* */ { - GString *dest_str; + /* given */ + GString *actual_string; replace_transform_type_t replace_flags = REPLACE_T_NO_TRANSFORM; - test_helper_valid_data ("{101}", "A", dest_str, replace_flags, FALSE); - test_helper_valid_data ("x42", "B", dest_str, replace_flags, FALSE); - test_helper_valid_data ("x{444}", "D", dest_str, replace_flags, FALSE); - test_helper_valid_data ("x{444}", "ф", dest_str, replace_flags, TRUE); + replace_flags = data->input_initial_flags; + actual_string = g_string_new (""); - test_helper_valid_data ("n", "\n", dest_str, replace_flags, FALSE); - test_helper_valid_data ("t", "\t", dest_str, replace_flags, FALSE); - test_helper_valid_data ("v", "\v", dest_str, replace_flags, FALSE); - test_helper_valid_data ("b", "\b", dest_str, replace_flags, FALSE); - test_helper_valid_data ("r", "\r", dest_str, replace_flags, FALSE); - test_helper_valid_data ("f", "\f", dest_str, replace_flags, FALSE); - test_helper_valid_data ("a", "\a", dest_str, replace_flags, FALSE); + /* when */ + mc_search_regex__process_escape_sequence (actual_string, data->input_from, -1, &replace_flags, + data->input_use_utf); + + /* then */ + mctest_assert_str_eq (actual_string->str, data->expected_string); + + g_string_free (actual_string, TRUE); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -75,7 +147,8 @@ main (void) SRunner *sr; /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_regex_process_escape_sequence_valid); + mctest_add_parameterized_test (tc_core, test_regex_process_escape_sequence, + test_regex_process_escape_sequence_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/search/regex_replace_esc_seq.c b/tests/lib/search/regex_replace_esc_seq.c index b8c17db06..38e01bcc6 100644 --- a/tests/lib/search/regex_replace_esc_seq.c +++ b/tests/lib/search/regex_replace_esc_seq.c @@ -49,59 +49,160 @@ /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_regex_replace_esc_seq_prepare_ds") */ /* *INDENT-OFF* */ -START_TEST (test_regex_replace_esc_seq_prepare_valid) +static const struct test_regex_replace_esc_seq_prepare_ds +{ + const char *input_string; + const size_t input_pos; + + const gboolean expected_result; + const gsize expected_skipped_len; + const int expected_flags; +} test_regex_replace_esc_seq_prepare_ds[] = +{ + { /* 0. \\{123} */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 7, + FALSE, + 6, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 1. \\xab */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 20, + FALSE, + 4, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 2. \\x{456abcd} */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 36, + FALSE, + 11, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 3. \\xtre */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 54, + FALSE, + 2, + REPLACE_PREPARE_T_NOTHING_SPECIAL + }, + { /* 4. \\n */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 59, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 5. \\t */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 61, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 6. \\v */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 63, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 7. \\b */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 65, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 8. \\r */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 67, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 9. \\f */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 69, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 10. \\a */ + "bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a", + 71, + FALSE, + 2, + REPLACE_PREPARE_T_ESCAPE_SEQ + }, + { /* 11. \\{123 */ + "\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre", + 0, + TRUE, + 5, + REPLACE_PREPARE_T_NOTHING_SPECIAL + }, + { /* 12. \\x{qwerty} */ + "\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre", + 6, + TRUE, + 3, + REPLACE_PREPARE_T_NOTHING_SPECIAL + }, + { /* 13. \\12} */ + "\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre", + 17, + TRUE, + 0, + 0 + }, + { /* 14. \\x{456a-bcd} */ + "\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre", + 22, + TRUE, + 7, + REPLACE_PREPARE_T_NOTHING_SPECIAL + }, + { /* 15. \\satre */ + "\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre", + 41, + TRUE, + 0, + 0 + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_regex_replace_esc_seq_prepare_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_regex_replace_esc_seq_prepare, test_regex_replace_esc_seq_prepare_ds) /* *INDENT-ON* */ { + /* given */ GString *replace_str; - gsize skip_len; - int ret; + gsize actual_skipped_len = 0; + int actual_flags = 0; + gboolean actual_result; - replace_str = - g_string_new - ("bla-bla\\{123}bla-bla\\xabc234 bla-bla\\x{456abcd}bla-bla\\xtre\\n\\t\\v\\b\\r\\f\\a"); + replace_str = g_string_new (data->input_string); - test_helper_handle_esc_seq (7, FALSE, 6, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\{123} */ - test_helper_handle_esc_seq (20, FALSE, 4, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\xab */ - test_helper_handle_esc_seq (36, FALSE, 11, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\x{456abcd} */ - test_helper_handle_esc_seq (54, FALSE, 2, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\xtre */ - test_helper_handle_esc_seq (59, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\n */ - test_helper_handle_esc_seq (61, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\t */ - test_helper_handle_esc_seq (63, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\v */ - test_helper_handle_esc_seq (65, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\b */ - test_helper_handle_esc_seq (67, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\r */ - test_helper_handle_esc_seq (69, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\f */ - test_helper_handle_esc_seq (71, FALSE, 2, REPLACE_PREPARE_T_ESCAPE_SEQ); /* \\a */ + /* when */ + actual_result = + mc_search_regex__replace_handle_esc_seq (replace_str, data->input_pos, &actual_skipped_len, + &actual_flags); + + /* then */ + mctest_assert_int_eq (actual_result, data->expected_result); + mctest_assert_int_eq (actual_skipped_len, data->expected_skipped_len); + mctest_assert_int_eq (actual_flags, data->expected_flags); g_string_free (replace_str, TRUE); } /* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - -/* *INDENT-OFF* */ -START_TEST (test_regex_replace_esc_seq_prepare_invalid) -/* *INDENT-ON* */ -{ - - GString *replace_str; - gsize skip_len; - int ret; - - replace_str = g_string_new ("\\{123 \\x{qwerty} \\12} \\x{456a-bcd}bla-bla\\satre"); - - test_helper_handle_esc_seq (0, TRUE, 5, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\{123 */ - test_helper_handle_esc_seq (6, TRUE, 3, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\x{qwerty} */ - test_helper_handle_esc_seq (17, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\12} */ - test_helper_handle_esc_seq (22, TRUE, 7, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\x{456a-bcd} */ - test_helper_handle_esc_seq (41, TRUE, 0, REPLACE_PREPARE_T_NOTHING_SPECIAL); /* \\satre */ - - g_string_free (replace_str, TRUE); -} -/* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -116,8 +217,8 @@ main (void) SRunner *sr; /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_regex_replace_esc_seq_prepare_valid); - tcase_add_test (tc_core, test_regex_replace_esc_seq_prepare_invalid); + mctest_add_parameterized_test (tc_core, test_regex_replace_esc_seq_prepare, + test_regex_replace_esc_seq_prepare_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/canonicalize_pathname.c b/tests/lib/vfs/canonicalize_pathname.c index 434b491a9..47d006508 100644 --- a/tests/lib/vfs/canonicalize_pathname.c +++ b/tests/lib/vfs/canonicalize_pathname.c @@ -33,6 +33,12 @@ #include "src/vfs/local/local.c" +static struct vfs_s_subclass test_subclass; +static struct vfs_class vfs_test_ops; + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -41,8 +47,19 @@ setup (void) vfs_init (); init_localfs (); vfs_setup_work_dir (); + + vfs_s_init_class (&vfs_test_ops, &test_subclass); + + vfs_test_ops.name = "testfs"; + vfs_test_ops.flags = VFSF_NOLINKS; + vfs_test_ops.prefix = "ftp"; + test_subclass.flags = VFS_S_REMOTE; + vfs_register_class (&vfs_test_ops); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -52,63 +69,75 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ -#define check_canonicalize( input, etalon ) { \ - path = g_strdup(input); \ - canonicalize_pathname (path); \ - fail_unless ( \ - strcmp(path, etalon) == 0, \ - "\nactual value (%s)\nnot equal to etalon (%s)", path, etalon \ - ); \ - g_free(path); \ -} - +/* @DataSource("test_canonicalize_path_ds") */ /* *INDENT-OFF* */ -START_TEST (test_canonicalize_path) +static const struct test_canonicalize_path_ds +{ + const char *input_path; + const char *expected_path; +} test_canonicalize_path_ds[] = +{ + { /* 0. UNC path */ + "//some_server/ww", + "//some_server/ww" + }, + { /* 1. join slashes */ + "///some_server/////////ww", + "/some_server/ww" + }, + { /* 2. Collapse "/./" -> "/" */ + "//some_server//.///////ww/./././.", + "//some_server/ww" + }, + {/* 3. Remove leading "./" */ + "./some_server/ww", + "some_server/ww" + }, + { /* 4. some/.. -> . */ + "some_server/..", + "." + }, + { /* 5. Collapse "/.." with the previous part of path */ + "/some_server/ww/some_server/../ww/../some_server/..//ww/some_server/ww", + "/some_server/ww/ww/some_server/ww" + }, + { /* 6. URI style */ + "/some_server/ww/ftp://user:pass@host.net/path/", + "/some_server/ww/ftp://user:pass@host.net/path" + }, + { /* 7. */ + "/some_server/ww/ftp://user:pass@host.net/path/../../", + "/some_server/ww" + }, + { /* 8. */ + "ftp://user:pass@host.net/path/../../", + "." + }, + { /* 9. */ + "ftp://user/../../", + ".." + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_canonicalize_path_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_canonicalize_path, test_canonicalize_path_ds) /* *INDENT-ON* */ { - char *path; - static struct vfs_s_subclass test_subclass; - static struct vfs_class vfs_test_ops; + /* given */ + char *actual_path; - vfs_s_init_class (&vfs_test_ops, &test_subclass); + actual_path = g_strdup (data->input_path); - vfs_test_ops.name = "testfs"; - vfs_test_ops.flags = VFSF_NOLINKS; - vfs_test_ops.prefix = "ftp"; - test_subclass.flags = VFS_S_REMOTE; - vfs_register_class (&vfs_test_ops); + /* when */ + canonicalize_pathname (actual_path); - /* UNC path */ - check_canonicalize ("//some_server/ww", "//some_server/ww"); - - /* join slashes */ - check_canonicalize ("///some_server/////////ww", "/some_server/ww"); - - /* Collapse "/./" -> "/" */ - check_canonicalize ("//some_server//.///////ww/./././.", "//some_server/ww"); - - /* Remove leading "./" */ - check_canonicalize ("./some_server/ww", "some_server/ww"); - - /* some/.. -> . */ - check_canonicalize ("some_server/..", "."); - - /* Collapse "/.." with the previous part of path */ - check_canonicalize ("/some_server/ww/some_server/../ww/../some_server/..//ww/some_server/ww", - "/some_server/ww/ww/some_server/ww"); - - /* URI style */ - check_canonicalize ("/some_server/ww/ftp://user:pass@host.net/path/", - "/some_server/ww/ftp://user:pass@host.net/path"); - - check_canonicalize ("/some_server/ww/ftp://user:pass@host.net/path/../../", "/some_server/ww"); - - check_canonicalize ("ftp://user:pass@host.net/path/../../", "."); - - check_canonicalize ("ftp://user/../../", ".."); + /* then */ + mctest_assert_str_eq (actual_path, data->expected_path) g_free (actual_path); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -125,7 +154,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_canonicalize_path); + mctest_add_parameterized_test (tc_core, test_canonicalize_path, test_canonicalize_path_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/current_dir.c b/tests/lib/vfs/current_dir.c index fe35203d0..4f2bd9d01 100644 --- a/tests/lib/vfs/current_dir.c +++ b/tests/lib/vfs/current_dir.c @@ -33,6 +33,23 @@ #include "src/vfs/local/local.c" +static struct vfs_s_subclass test_subclass; +static struct vfs_class vfs_test_ops; + +/* --------------------------------------------------------------------------------------------- */ + +/* @Mock */ +static int +test_chdir (const vfs_path_t * vpath) +{ + (void) vpath; + + return 0; +} + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -41,8 +58,18 @@ setup (void) vfs_init (); init_localfs (); vfs_setup_work_dir (); + + vfs_s_init_class (&vfs_test_ops, &test_subclass); + + vfs_test_ops.name = "testfs"; + vfs_test_ops.prefix = "test"; + vfs_test_ops.chdir = test_chdir; + } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -50,71 +77,117 @@ teardown (void) str_uninit_strings (); } -static int -test_chdir (const vfs_path_t * vpath) -{ -#if 0 - char *path = vfs_path_to_str (vpath); - printf ("test_chdir: %s\n", path); - g_free (path); -#else - (void) vpath; -#endif - return 0; -} - /* --------------------------------------------------------------------------------------------- */ -#define cd_and_check( cd_dir, etalon ) \ - vpath = vfs_path_from_str (cd_dir); \ - mc_chdir(vpath); \ - vfs_path_free (vpath); \ - buffer = _vfs_get_cwd (); \ - fail_unless( \ - strcmp(etalon, buffer) == 0, \ - "\n expected(%s) doesn't equal \nto actual(%s)", etalon, buffer); \ - g_free (buffer); - +/* @DataSource("test_cd_ds") */ /* *INDENT-OFF* */ -START_TEST (set_up_current_dir_url) +static const struct test_cd_ds +{ + const char *input_initial_path; + const char *input_cd_path; + const vfs_class_flags_t input_class_flags; + const vfs_subclass_flags_t input_subclass_flags; + + const char *expected_cd_path; +} test_cd_ds[] = +{ + { /* 0. */ + "/", + "/dev/some.file/test://", + VFSF_NOLINKS, + 0, + "/dev/some.file/test://" + }, + { /* 1. */ + "/", + "/dev/some.file/test://bla-bla", + VFSF_NOLINKS, + 0, + "/dev/some.file/test://bla-bla" + }, + { /* 2. */ + "/dev/some.file/test://bla-bla", + "..", + VFSF_NOLINKS, + 0, + "/dev/some.file/test://" + }, + { /* 3. */ + "/dev/some.file/test://", + "..", + VFSF_NOLINKS, + 0, + "/dev" + }, + { /* 4. */ + "/dev", + "..", + VFSF_NOLINKS, + 0, + "/" + }, + { /* 5. */ + "/", + "..", + VFSF_NOLINKS, + 0, + "/" + }, + { /* 6. */ + "/", + "/test://user:pass@host.net/path", + VFSF_NOLINKS, + VFS_S_REMOTE, + "/test://user:pass@host.net/path" + }, + { /* 7. */ + "/test://user:pass@host.net/path", + "..", + VFSF_NOLINKS, + VFS_S_REMOTE, + "/test://user:pass@host.net/" + }, + { /* 8. */ + "/test://user:pass@host.net/", + "..", + VFSF_NOLINKS, + VFS_S_REMOTE, + "/" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_cd_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_cd, test_cd_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; - static struct vfs_s_subclass test_subclass; - static struct vfs_class vfs_test_ops; - char *buffer; - vfs_s_init_class (&vfs_test_ops, &test_subclass); - - vfs_test_ops.name = "testfs"; - vfs_test_ops.flags = VFSF_NOLINKS; - vfs_test_ops.prefix = "test"; - vfs_test_ops.chdir = test_chdir; + vfs_test_ops.flags = data->input_class_flags; + test_subclass.flags = data->input_subclass_flags; vfs_register_class (&vfs_test_ops); + vfs_set_raw_current_dir (vfs_path_from_str (data->input_initial_path)); - cd_and_check ("/dev/some.file/test://", "/dev/some.file/test://"); + vpath = vfs_path_from_str (data->input_cd_path); - cd_and_check ("/dev/some.file/test://bla-bla", "/dev/some.file/test://bla-bla"); + /* when */ + mc_chdir (vpath); - cd_and_check ("..", "/dev/some.file/test://"); - - cd_and_check ("..", "/dev"); - - cd_and_check ("..", "/"); - - cd_and_check ("..", "/"); - - test_subclass.flags = VFS_S_REMOTE; - - cd_and_check ("/test://user:pass@host.net/path", "/test://user:pass@host.net/path"); - cd_and_check ("..", "/test://user:pass@host.net/"); - - cd_and_check ("..", "/"); + /* then */ + { + char *actual_cd_path; + actual_cd_path = _vfs_get_cwd (); + mctest_assert_str_eq (actual_cd_path, data->expected_cd_path); + g_free (actual_cd_path); + } + vfs_path_free (vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -131,7 +204,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, set_up_current_dir_url); + mctest_add_parameterized_test (tc_core, test_cd, test_cd_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/path_cmp.c b/tests/lib/vfs/path_cmp.c index b110b4c47..a330265e9 100644 --- a/tests/lib/vfs/path_cmp.c +++ b/tests/lib/vfs/path_cmp.c @@ -35,7 +35,9 @@ #include "src/vfs/local/local.c" +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { @@ -51,6 +53,9 @@ setup (void) #endif } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -63,74 +68,167 @@ teardown (void) } /* --------------------------------------------------------------------------------------------- */ -#define path_cmp_one_check(input1, input2, etalon_condition) {\ - vpath1 = vfs_path_from_str (input1);\ - vpath2 = vfs_path_from_str (input2);\ - result = vfs_path_equal (vpath1, vpath2);\ - vfs_path_free (vpath1); \ - vfs_path_free (vpath2); \ - fail_unless ( result == etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ - input1, input2, #etalon_condition, result); \ -} +/* @DataSource("test_path_equal_ds") */ /* *INDENT-OFF* */ -START_TEST (test_path_compare) +static const struct test_path_equal_ds +{ + const char *input_path1; + const char *input_path2; + const gboolean expected_result; +} test_path_equal_ds[] = +{ + { /* 0. */ + NULL, + NULL, + FALSE + }, + { /* 1. */ + NULL, + "/test/path", + FALSE + }, + { /* 2. */ + "/test/path", + NULL, + FALSE + }, + { /* 3. */ + "/test/path", + "/test/path", + TRUE + }, +#ifdef HAVE_CHARSET + { /* 4. */ + "/#enc:KOI8-R/тестовый/путь", + "/тестовый/путь", + FALSE + }, + { /* 5. */ + "/тестовый/путь", + "/#enc:KOI8-R/тестовый/путь", + FALSE + }, + { /* 6. */ + "/#enc:KOI8-R/тестовый/путь", + "/#enc:KOI8-R/тестовый/путь", + TRUE + }, +#endif +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_path_equal_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_path_equal, test_path_equal_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath1, *vpath2; - int result; + gboolean actual_result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", TRUE); + vpath1 = vfs_path_from_str (data->input_path1); + vpath2 = vfs_path_from_str (data->input_path2); -#ifdef HAVE_CHARSET - path_cmp_one_check ("/#enc:KOI8-R/тестовый/путь", "/тестовый/путь", - FALSE); - path_cmp_one_check ("/тестовый/путь", "/#enc:KOI8-R/тестовый/путь", - FALSE); -#endif + /* when */ + actual_result = vfs_path_equal (vpath1, vpath2); - path_cmp_one_check (NULL, "/тестовый/путь", FALSE); - path_cmp_one_check ("/тестовый/путь", NULL, FALSE); - path_cmp_one_check (NULL, NULL, FALSE); + /* then */ + mctest_assert_int_eq (actual_result, data->expected_result); + + vfs_path_free (vpath1); + vfs_path_free (vpath2); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ -#undef path_cmp_one_check - -#define path_cmp_one_check(input1, input2, len, etalon_condition) {\ - vpath1 = vfs_path_from_str (input1);\ - vpath2 = vfs_path_from_str (input2);\ - result = vfs_path_equal_len (vpath1, vpath2, len);\ - vfs_path_free (vpath1); \ - vfs_path_free (vpath2); \ - fail_unless ( result == etalon_condition, "\ninput1: %s\ninput2: %s\nexpected: %d\nactual: %d\n",\ - input1, input2, #etalon_condition, result); \ -} +/* @DataSource("test_path_equal_len_ds") */ /* *INDENT-OFF* */ -START_TEST (test_path_compare_len) +static const struct test_path_equal_len_ds +{ + const char *input_path1; + const char *input_path2; + const size_t input_length; + const gboolean expected_result; +} test_path_equal_len_ds[] = +{ + { /* 0. */ + NULL, + NULL, + 0, + FALSE + }, + { /* 1. */ + NULL, + NULL, + 100, + FALSE + }, + { /* 2. */ + NULL, + "/тестовый/путь", + 10, + FALSE + }, + { /* 3. */ + "/тестовый/путь", + NULL, + 10, + FALSE + }, + { /* 4. */ + "/тестовый/путь", + "/тестовый/путь", + 10, + TRUE + }, + { /* 5. */ + "/тест/овый/путь", + "/тестовый/путь", + 8, + TRUE + }, + { /* 6. */ + "/тест/овый/путь", + "/тестовый/путь", + 10, + FALSE + }, + { /* 7. */ + "/тестовый/путь", + "/тест/овый/путь", + 10, + FALSE + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_path_equal_len_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_path_equal_len, test_path_equal_len_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath1, *vpath2; - int result; + gboolean actual_result; - path_cmp_one_check ("/тестовый/путь", "/тестовый/путь", 10, TRUE); + vpath1 = vfs_path_from_str (data->input_path1); + vpath2 = vfs_path_from_str (data->input_path2); - path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 10, FALSE); + /* when */ + actual_result = vfs_path_equal_len (vpath1, vpath2, data->input_length); - path_cmp_one_check ("/тестовый/путь", "/тест/овый/путь", 10, FALSE); + /* then */ + mctest_assert_int_eq (actual_result, data->expected_result); - path_cmp_one_check ("/тест/овый/путь", "/тестовый/путь", 9, TRUE); - - path_cmp_one_check (NULL, "/тестовый/путь", 0, FALSE); - path_cmp_one_check ("/тестовый/путь", NULL, 0, FALSE); - path_cmp_one_check (NULL, NULL, 0, FALSE); + vfs_path_free (vpath1); + vfs_path_free (vpath2); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -147,8 +245,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_path_compare); - tcase_add_test (tc_core, test_path_compare_len); + mctest_add_parameterized_test (tc_core, test_path_equal, test_path_equal_ds); + mctest_add_parameterized_test (tc_core, test_path_equal_len, test_path_equal_len_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/path_len.c b/tests/lib/vfs/path_len.c index db47808fc..f1f8ab7bf 100644 --- a/tests/lib/vfs/path_len.c +++ b/tests/lib/vfs/path_len.c @@ -1,4 +1,4 @@ -/* lib/vfs - vfs_path_t compare functions +/* lib/vfs - tests for vfspath_len() function. Copyright (C) 2011, 2013 The Free Software Foundation, Inc. @@ -35,7 +35,9 @@ #include "src/vfs/local/local.c" +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { @@ -51,6 +53,9 @@ setup (void) #endif } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -63,29 +68,56 @@ teardown (void) } /* --------------------------------------------------------------------------------------------- */ -#define path_len_one_check(input,etalon) {\ - vpath = vfs_path_from_str (input);\ - result = vfs_path_len (vpath);\ - vfs_path_free (vpath); \ - fail_unless ( result == etalon, "\ninput: %s\nexpected: %d\nactual: %d\n",\ - input, etalon, result); \ -} - +/* @DataSource("test_path_length_ds") */ /* *INDENT-OFF* */ -START_TEST (test_path_length) +static const struct test_path_length_ds +{ + const char *input_path; + const size_t expected_length; +} test_path_length_ds[] = +{ + { /* 0. */ + NULL, + 0 + }, + { /* 1. */ + "/", + 1 + }, + { /* 2. */ + "/тестовый/путь", + 26 + }, +#ifdef HAVE_CHARSET + { /* 3. */ + "/#enc:KOI8-R/тестовый/путь", + 38 + }, +#endif /* HAVE_CHARSET */ +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_path_length_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_path_length, test_path_length_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; - size_t result; + size_t actual_length; - path_len_one_check ("/тестовый/путь", 26); -#ifdef HAVE_CHARSET - path_len_one_check ("/#enc:KOI8-R/тестовый/путь", 38); -#endif - path_len_one_check (NULL, 0); + vpath = vfs_path_from_str (data->input_path); + + /* when */ + actual_length = vfs_path_len (vpath); + + /* then */ + mctest_assert_int_eq (actual_length, data->expected_length); + + vfs_path_free (vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -102,7 +134,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_path_length); + mctest_add_parameterized_test (tc_core, test_path_length, test_path_length_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/path_manipulations.c b/tests/lib/vfs/path_manipulations.c index cb5e31446..fd2882916 100644 --- a/tests/lib/vfs/path_manipulations.c +++ b/tests/lib/vfs/path_manipulations.c @@ -39,17 +39,11 @@ struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ + static void -setup (void) +init_test_classes (void) { - - str_init_strings (NULL); - - vfs_init (); - init_localfs (); - vfs_setup_work_dir (); - - test_subclass1.flags = VFS_S_REMOTE; vfs_s_init_class (&vfs_test_ops1, &test_subclass1); @@ -68,6 +62,22 @@ setup (void) vfs_test_ops3.prefix = "test3"; vfs_test_ops3.flags = VFSF_LOCAL; vfs_register_class (&vfs_test_ops3); +} + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ +static void +setup (void) +{ + + str_init_strings (NULL); + + vfs_init (); + init_localfs (); + vfs_setup_work_dir (); + + init_test_classes (); mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR; #ifdef HAVE_CHARSET @@ -75,6 +85,9 @@ setup (void) #endif } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -88,217 +101,361 @@ teardown (void) /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_vfs_path_tokens_count_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_tokens_count) +static const struct test_vfs_path_tokens_count_ds +{ + const char *input_path; + const vfs_path_flag_t input_flags; + const size_t expected_token_count; +} test_vfs_path_tokens_count_ds[] = +{ + { /* 0. */ + "/", + VPF_NONE, + 0 + }, + { /* 1. */ + "/path", + VPF_NONE, + 1 + }, + { /* 2. */ + "/path1/path2/path3", + VPF_NONE, + 3 + }, + { /* 3. */ + "test3://path1/path2/path3/path4", + VPF_NO_CANON, + 4 + }, + { /* 4. */ + "path1/path2/path3", + VPF_NO_CANON, + 3 + }, + { /* 5. */ + "/path1/path2/path3/", + VPF_NONE, + 3 + }, + { /* 6. */ + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/", + VPF_NONE, + 5 + }, +#ifdef HAVE_CHARSET + { /* 7. */ + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/" + "test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33", + VPF_NONE, + 11 + }, +#endif +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_path_tokens_count_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_path_tokens_count, test_vfs_path_tokens_count_ds) /* *INDENT-ON* */ { + /* given */ size_t tokens_count; vfs_path_t *vpath; - vpath = vfs_path_from_str ("/"); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 0, "actual: %zu; expected: 0\n", tokens_count); - vfs_path_free (vpath); + vpath = vfs_path_from_str_flags (data->input_path, data->input_flags); - vpath = vfs_path_from_str ("/path"); + /* when */ tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 1, "actual: %zu; expected: 1\n", tokens_count); - vfs_path_free (vpath); - vpath = vfs_path_from_str ("/path1/path2/path3"); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); - vfs_path_free (vpath); + /* then */ + mctest_assert_int_eq (tokens_count, data->expected_token_count); - vpath = vfs_path_from_str_flags ("test3://path1/path2/path3/path4", VPF_NO_CANON); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 4, "actual: %zu; expected: 4\n", tokens_count); vfs_path_free (vpath); - - vpath = vfs_path_from_str_flags ("path1/path2/path3", VPF_NO_CANON); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); - vfs_path_free (vpath); - - vpath = vfs_path_from_str ("/path1/path2/path3/"); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 3, "actual: %zu; expected: 3\n", tokens_count); - vfs_path_free (vpath); - - vpath = vfs_path_from_str ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 5, "actual: %zu; expected: 5\n", tokens_count); - vfs_path_free (vpath); - -#ifdef HAVE_CHARSET - vpath = - vfs_path_from_str - ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"); - tokens_count = vfs_path_tokens_count (vpath); - fail_unless (tokens_count == 11, "actual: %zu; expected: 11\n", tokens_count); - vfs_path_free (vpath); -#endif } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ -#define check_invalid_token_str(input, start, length) { \ - vpath = vfs_path_from_str (input); \ - path_tokens = vfs_path_tokens_get(vpath, start, length); \ - fail_unless (path_tokens == NULL, "path_tokens should be NULL!\n"); \ - g_free (path_tokens); \ - vfs_path_free (vpath); \ -} - -#define check_token_str(input, start, length, etalon) { \ - vpath = vfs_path_from_str_flags (input, VPF_NO_CANON); \ - path_tokens = vfs_path_tokens_get(vpath, start, length); \ - fail_unless (path_tokens != NULL, "path_tokens shouldn't equal to NULL!\n"); \ - if (path_tokens != NULL) \ - fail_unless (strcmp(path_tokens, etalon) == 0, "\nactual: '%s'\netalon: '%s'", path_tokens, etalon); \ - g_free (path_tokens); \ - vfs_path_free (vpath); \ -} - +/* @DataSource("test_vfs_path_tokens_get_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_tokens_get) +static const struct test_vfs_path_tokens_get_ds +{ + const char *input_path; + const ssize_t input_start_position; + const ssize_t input_length; + + const char *expected_path; +} test_vfs_path_tokens_get_ds[] = +{ + { /* 0. Invalid start position */ + "/", + 2, + 1, + NULL + }, + { /* 1. Invalid negative position */ + "/path", + -3, + 1, + NULL + }, + { /* 2. Count of tokens is zero. Count should be autocorrected */ + "/path", + 0, + 0, + "path" + }, + { /* 3. get 'path2/path3' by 1,2 */ + "/path1/path2/path3/path4", + 1, + 2, + "path2/path3" + }, + { /* 4. get 'path2/path3' by 1,2 from LOCAL VFS */ + "test3://path1/path2/path3/path4", + 1, + 2, + "path2/path3" + }, + { /* 5. get 'path2/path3' by 1,2 from non-LOCAL VFS */ + "test2://path1/path2/path3/path4", + 1, + 2, + "test2://path2/path3" + }, + { /* 6. get 'path2/path3' by 1,2 throught non-LOCAL VFS */ + "/path1/path2/test1://user:pass@some.host:12345/path3/path4", + 1, + 2, + "path2/test1://user:pass@some.host:12345/path3" + }, + { /* 7. get 'path2/path3' by 1,2 where path2 it's LOCAL VFS */ + "test3://path1/path2/test2://path3/path4", + 1, + 2, + "path2/test2://path3" + }, + { /* 8. get 'path2/path3' by 1,2 where path3 it's LOCAL VFS */ + "test2://path1/path2/test3://path3/path4", + 1, + 2, + "test2://path2/test3://path3" + }, + { /* 9. get 'path4' by -1,1 */ + "/path1/path2/path3/path4", + -1, + 1, + "path4" + }, + { /* 10. get 'path2/path3/path4' by -3,0 */ + "/path1/path2/path3/path4", + -3, + 0, + "path2/path3/path4" + }, +#ifdef HAVE_CHARSET + { /* 11. get 'path2/path3' by 1,2 from LOCAL VFS with encoding */ + "test3://path1/path2/test3://#enc:KOI8-R/path3/path4", + 1, + 2, + "path2/test3://#enc:KOI8-R/path3" + }, + { /* 12. get 'path2/path3' by 1,2 with encoding */ + "#enc:KOI8-R/path1/path2/path3/path4", + 1, + 2, + "#enc:KOI8-R/path2/path3" + }, +#endif +/* TODO: currently this test don't passed. Probably broken string URI parser + { *//* 13. get 'path2/path3' by 1,2 from LOCAL VFS *//* + + "test3://path1/path2/test2://test3://path3/path4", + 1, + 2, + "path2/path3" + }, +*/ +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_path_tokens_get_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_path_tokens_get, test_vfs_path_tokens_get_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; - char *path_tokens; + char *actual_path; - /* Invalid start position */ - check_invalid_token_str ("/", 2, 1); + vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON); - /* Invalid negative position */ - check_invalid_token_str ("/path", -3, 1); + /* when */ + actual_path = vfs_path_tokens_get (vpath, data->input_start_position, data->input_length); - /* Count of tokens is zero. Count should be autocorrected */ - check_token_str ("/path", 0, 0, "path"); - - /* get 'path2/path3' by 1,2 */ - check_token_str ("/path1/path2/path3/path4", 1, 2, "path2/path3"); - - /* get 'path2/path3' by 1,2 from LOCAL VFS */ - check_token_str ("test3://path1/path2/path3/path4", 1, 2, "path2/path3"); - -#ifdef HAVE_CHARSET - /* get 'path2/path3' by 1,2 from LOCAL VFS with encoding */ - check_token_str ("test3://path1/path2/test3://#enc:KOI8-R/path3/path4", 1, 2, - "path2/test3://#enc:KOI8-R/path3"); - - /* get 'path2/path3' by 1,2 with encoding */ - check_token_str ("#enc:KOI8-R/path1/path2/path3/path4", 1, 2, "#enc:KOI8-R/path2/path3"); -#endif - - /* get 'path2/path3' by 1,2 from non-LOCAL VFS */ - check_token_str ("test2://path1/path2/path3/path4", 1, 2, "test2://path2/path3"); - - /* get 'path2/path3' by 1,2 throught non-LOCAL VFS */ - check_token_str ("/path1/path2/test1://user:pass@some.host:12345/path3/path4", 1, 2, - "path2/test1://user:pass@some.host:12345/path3"); - - /* get 'path2/path3' by 1,2 from LOCAL VFS */ - /* TODO: currently this test don't passed. Probably broken string URI parser */ - /* check_token_str ("test3://path1/path2/test2://test3://path3/path4", 1, 2, "path2/path3"); */ - - /* get 'path2/path3' by 1,2 where path2 it's LOCAL VFS */ - check_token_str ("test3://path1/path2/test2://path3/path4", 1, 2, "path2/test2://path3"); - - /* get 'path2/path3' by 1,2 where path3 it's LOCAL VFS */ - check_token_str ("test2://path1/path2/test3://path3/path4", 1, 2, - "test2://path2/test3://path3"); - - /* get 'path4' by -1,1 */ - check_token_str ("/path1/path2/path3/path4", -1, 1, "path4"); - - /* get 'path2/path3/path4' by -3,0 */ - check_token_str ("/path1/path2/path3/path4", -3, 0, "path2/path3/path4"); + /* then */ + mctest_assert_str_eq (actual_path, data->expected_path); + g_free (actual_path); + vfs_path_free (vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_vfs_path_append_vpath_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_append_vpath) +static const struct test_vfs_path_append_vpath_ds +{ + const char *input_path1; + const char *input_path2; + const size_t expected_element_count; + const char *expected_path; +} test_vfs_path_append_vpath_ds[] = +{ + { /* 0. */ + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33", + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/", + 6, + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33" + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path", + }, +#ifdef HAVE_CHARSET + { /* 1. */ + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33", + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/", + 6, + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33" + "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path", + }, +#endif /* HAVE_CHARSET */ +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_path_append_vpath_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_path_append_vpath, test_vfs_path_append_vpath_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath1, *vpath2, *vpath3; -#ifdef HAVE_CHARSET - vpath1 = - vfs_path_from_str - ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33"); -#else - vpath1 = - vfs_path_from_str - ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://bla-bla/some/path/test3://111/22/33"); -#endif - vpath2 = vfs_path_from_str ("/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/"); + vpath1 = vfs_path_from_str (data->input_path1); + vpath2 = vfs_path_from_str (data->input_path2); + /* when */ vpath3 = vfs_path_append_vpath_new (vpath1, vpath2, NULL); - fail_unless (vfs_path_elements_count (vpath3) == 6, - "\nvpath elements count should be %d, actial is %d\n", - 6, vfs_path_elements_count (vpath3)); + /* then */ + { + char *path; + mctest_assert_int_eq (vfs_path_elements_count (vpath3), data->expected_element_count); + path = vfs_path_to_str (vpath3); + mctest_assert_str_eq (path, data->expected_path); + g_free (path); + } + vfs_path_free (vpath1); vfs_path_free (vpath2); vfs_path_free (vpath3); - } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ +/* @DataSource("test_vfs_path_relative_ds") */ /* *INDENT-OFF* */ -START_TEST (test_vfs_path_relative) +static const struct test_vfs_path_relative_ds +{ + const char *input_path; + const char *expected_path; + const char *expected_last_path_in_element; +} test_vfs_path_relative_ds[] = +{ + { /* 0. */ + "../bla-bla", + "../bla-bla", + "../bla-bla" + }, + { /* 1. */ + "../path/test1://user:pass@some.host:12345/bla-bla/some/path/", + "../path/test1://user:pass@some.host:12345/bla-bla/some/path/", + "bla-bla/some/path/" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_vfs_path_relative_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_path_relative, test_vfs_path_relative_ds) /* *INDENT-ON* */ { - vfs_path_t *vpath, *copy_vpath; - char *path_str; + /* given */ + vfs_path_t *vpath; - vpath = vfs_path_from_str_flags ("../bla-bla", VPF_NO_CANON); - fail_unless (vpath->relative, "relative flag fail!\n"); + /* when */ - path_str = vfs_path_to_str (vpath); + vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON); - fail_unless (strcmp (path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); - g_free (path_str); + /* then */ + mctest_assert_int_eq (vpath->relative, TRUE); + mctest_assert_str_eq (vfs_path_get_last_path_str (vpath), data->expected_last_path_in_element); - path_str = (char *) vfs_path_get_last_path_str (vpath); - fail_unless (strcmp (path_str, "../bla-bla") == 0, - "relative fail!\nactual: element->path=[%s]\n", path_str); + { + char *path_str; - copy_vpath = vfs_path_clone (vpath); - - path_str = vfs_path_to_str (copy_vpath); - - fail_unless (strcmp (path_str, "../bla-bla") == 0, "relative fail!\nactual: [%s]\n", path_str); - g_free (path_str); - - vfs_path_free (copy_vpath); + path_str = vfs_path_to_str (vpath); + mctest_assert_str_eq (path_str, data->expected_path); + g_free (path_str); + } vfs_path_free (vpath); - - vpath = - vfs_path_from_str_flags ("../path/test1://user:pass@some.host:12345/bla-bla/some/path/", - VPF_NO_CANON); - path_str = vfs_path_to_str (vpath); - fail_unless (strcmp (path_str, "../path/test1://user:pass@some.host:12345/bla-bla/some/path/") - == 0, "relative fail!\nactual: [%s]\n", path_str); - g_free (path_str); - vfs_path_free (vpath); - } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST +/* *INDENT-ON* */ + +/* --------------------------------------------------------------------------------------------- */ + +/* @Test(dataSource = "test_vfs_path_relative_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_vfs_path_relative_clone, test_vfs_path_relative_ds) +/* *INDENT-ON* */ +{ + /* given */ + vfs_path_t *vpath, *cloned_vpath; + + vpath = vfs_path_from_str_flags (data->input_path, VPF_NO_CANON); + + /* when */ + + cloned_vpath = vfs_path_clone (vpath); + + /* then */ + mctest_assert_int_eq (cloned_vpath->relative, TRUE); + mctest_assert_str_eq (vfs_path_get_last_path_str (cloned_vpath), + data->expected_last_path_in_element); + + { + char *path_str; + + path_str = vfs_path_to_str (cloned_vpath); + mctest_assert_str_eq (path_str, data->expected_path); + g_free (path_str); + } + vfs_path_free (vpath); + vfs_path_free (cloned_vpath); +} +/* *INDENT-OFF* */ +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -315,10 +472,14 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_vfs_path_tokens_count); - tcase_add_test (tc_core, test_vfs_path_tokens_get); - tcase_add_test (tc_core, test_vfs_path_append_vpath); - tcase_add_test (tc_core, test_vfs_path_relative); + mctest_add_parameterized_test (tc_core, test_vfs_path_tokens_count, + test_vfs_path_tokens_count_ds); + mctest_add_parameterized_test (tc_core, test_vfs_path_tokens_get, test_vfs_path_tokens_get_ds); + mctest_add_parameterized_test (tc_core, test_vfs_path_append_vpath, + test_vfs_path_append_vpath_ds); + mctest_add_parameterized_test (tc_core, test_vfs_path_relative, test_vfs_path_relative_ds); + mctest_add_parameterized_test (tc_core, test_vfs_path_relative_clone, + test_vfs_path_relative_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/path_recode.c b/tests/lib/vfs/path_recode.c index 6d4a31548..7c1589bb4 100644 --- a/tests/lib/vfs/path_recode.c +++ b/tests/lib/vfs/path_recode.c @@ -37,18 +37,26 @@ const char *mc_config_get_home_dir (void); +/* --------------------------------------------------------------------------------------------- */ + +/* @Mock */ const char * mc_config_get_home_dir (void) { return "/mock/home"; } +/* --------------------------------------------------------------------------------------------- */ +/* @Before */ static void setup (void) { } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -83,70 +91,158 @@ test_deinit_vfs () /* --------------------------------------------------------------------------------------------- */ -#define path_recode_one_check(input, etalon1, etalon2) {\ - vpath = vfs_path_from_str (input);\ - element = vfs_path_get_by_index(vpath, -1);\ - fail_unless ( strcmp (element->path, etalon1) == 0, "expected: %s\nactual: %s\n", etalon1, element->path);\ - result = vfs_path_to_str(vpath);\ - fail_unless ( strcmp (result, etalon2) == 0, "\nexpected: %s\nactual: %s\n", etalon2, result);\ - g_free(result);\ - vfs_path_free (vpath);\ -} - +/* @DataSource("test_path_recode_ds") */ /* *INDENT-OFF* */ -START_TEST (test_path_recode_base_utf8) +static const struct test_path_recode_ds +{ + const char *input_codepage; + const char *input_path; + const char *expected_element_path; + const char *expected_recoded_path; +} test_path_recode_ds[] = +{ + { /* 0. */ + "UTF-8", + "//", + "//", + "//" + }, + { /* 1. */ + "UTF-8", + "/#enc:KOI8-R/тестовый/путь", + "//", + "/#enc:KOI8-R/тестовый/путь" + }, + { /* 2. */ + "KOI8-R", + "/тестовый/путь", + "/тестовый/путь", + "/тестовый/путь" + }, + { /* 3. */ + "KOI8-R", + "/#enc:UTF-8//", + "/тестовый/путь", + "/#enc:UTF-8//" + }, + { /* 4. Test encode info at start */ + "UTF-8", + "#enc:KOI8-R/bla-bla/some/path", + "/bla-bla/some/path", + "/#enc:KOI8-R/bla-bla/some/path" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_path_recode_ds") */ +/* *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 ("UTF-8"); + test_init_vfs (data->input_codepage); - path_recode_one_check ("//", "//", "//"); + /* when */ + vpath = vfs_path_from_str (data->input_path); + element = vfs_path_get_by_index (vpath, -1); + result = vfs_path_to_str (vpath); - path_recode_one_check ("/#enc:KOI8-R/тестовый/путь", "//", - "/#enc:KOI8-R/тестовый/путь"); + /* 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 (); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ + /* --------------------------------------------------------------------------------------------- */ +static struct vfs_s_subclass test_subclass1; +static struct vfs_class vfs_test_ops1; + + +/* @DataSource("test_path_to_str_flags_ds") */ /* *INDENT-OFF* */ -START_TEST (test_path_recode_base_koi8r) +static const struct test_path_to_str_flags_ds +{ + const char *input_path; + const vfs_path_flag_t input_from_str_flags; + const vfs_path_flag_t input_to_str_flags; + const char *expected_path; +} test_path_to_str_flags_ds[] = +{ + { /* 0. */ + "test1://user:passwd@127.0.0.1", + VPF_NO_CANON, + VPF_STRIP_PASSWORD, + "test1://user@127.0.0.1/" + }, + { /* 1. */ + "/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_STRIP_PASSWORD, + "/test1://user@host.name/#enc:KOI8-R/тестовый/путь" + }, + { /* 2. */ + "/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_RECODE, + "/test1://user:passwd@host.name//" + }, + { /* 3. */ + "/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_RECODE | VPF_STRIP_PASSWORD, + "/test1://user@host.name//" + }, + { /* 4. */ + "/mock/home/test/dir", + VPF_NONE, + VPF_STRIP_HOME, + "~/test/dir" + }, + { /* 5. */ + "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_STRIP_HOME | VPF_STRIP_PASSWORD, + "~/test1://user@host.name/#enc:KOI8-R/тестовый/путь" + }, + { /* 6. */ + "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET, + "~/test1://user@host.name/тестовый/путь" + }, + { /* 7. */ + "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_STRIP_HOME | VPF_RECODE, + "~/test1://user:passwd@host.name//" + }, + { /* 8. */ + "/mock/home/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", + VPF_NONE, + VPF_STRIP_HOME | VPF_RECODE | VPF_STRIP_PASSWORD, + "~/test1://user@host.name//" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_path_to_str_flags_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_path_to_str_flags, test_path_to_str_flags_ds) /* *INDENT-ON* */ { - 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 (); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ -struct vfs_s_subclass test_subclass1; -struct vfs_class vfs_test_ops1; - -/* *INDENT-OFF* */ -START_TEST(test_path_to_str_flags) -/* *INDENT-ON* */ -{ - + /* given */ vfs_path_t *vpath; char *str_path; @@ -159,100 +255,24 @@ START_TEST(test_path_to_str_flags) vfs_test_ops1.prefix = "test1"; vfs_register_class (&vfs_test_ops1); - vpath = vfs_path_from_str_flags ("test1://user:passwd@127.0.0.1", VPF_NO_CANON); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); - fail_unless (strcmp ("test1://user@127.0.0.1/", str_path) == 0, "\nstr=%s\n", str_path); + /* 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); - - vpath = - vfs_path_from_str ("/test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь"); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_PASSWORD); - fail_unless (strcmp ("/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) - == 0, "\nstr=%s\n", str_path); - g_free (str_path); - - str_path = vfs_path_to_str_flags (vpath, 0, VPF_RECODE); - fail_unless (strcmp ("/test1://user:passwd@host.name//", str_path) == 0, - "\nstr=%s\n", str_path); - g_free (str_path); - - str_path = vfs_path_to_str_flags (vpath, 0, VPF_RECODE | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", - str_path); - g_free (str_path); - - vfs_path_free (vpath); - - vpath = vfs_path_build_filename (mc_config_get_home_dir (), "test", "dir", NULL); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME); - fail_unless (strcmp ("~/test/dir", str_path) == 0, "\nstr=%s\n", str_path); - g_free (str_path); - vfs_path_free (vpath); - - vpath = - vfs_path_build_filename (mc_config_get_home_dir (), - "test1://user:passwd@host.name/#enc:KOI8-R/тестовый/путь", - NULL); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("~/test1://user@host.name/#enc:KOI8-R/тестовый/путь", str_path) - == 0, "\nstr=%s\n", str_path); - g_free (str_path); - str_path = - vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); - fail_unless (strcmp ("~/test1://user@host.name/тестовый/путь", str_path) == 0, - "\nstr=%s\n", str_path); - g_free (str_path); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_RECODE); - fail_unless (strcmp ("~/test1://user:passwd@host.name//", str_path) == 0, - "\nstr=%s\n", str_path); - g_free (str_path); - str_path = vfs_path_to_str_flags (vpath, 0, VPF_STRIP_HOME | VPF_RECODE | VPF_STRIP_PASSWORD); - fail_unless (strcmp ("~/test1://user@host.name//", str_path) == 0, "\nstr=%s\n", - str_path); - g_free (str_path); - vfs_path_free (vpath); - test_deinit_vfs (); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ -/* *INDENT-OFF* */ -START_TEST(test_encode_info_at_start) -/* *INDENT-ON* */ -{ - 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 (); -} -/* *INDENT-OFF* */ -END_TEST -/* *INDENT-ON* */ - -/* --------------------------------------------------------------------------------------------- */ - - int main (void) { @@ -265,10 +285,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_path_recode_base_utf8); - tcase_add_test (tc_core, test_path_recode_base_koi8r); - tcase_add_test (tc_core, test_path_to_str_flags); - tcase_add_test (tc_core, test_encode_info_at_start); + mctest_add_parameterized_test (tc_core, test_path_recode, test_path_recode_ds); + mctest_add_parameterized_test (tc_core, test_path_to_str_flags, test_path_to_str_flags_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/path_serialize.c b/tests/lib/vfs/path_serialize.c index 02c5adde6..f53cb13f9 100644 --- a/tests/lib/vfs/path_serialize.c +++ b/tests/lib/vfs/path_serialize.c @@ -37,10 +37,12 @@ #include "src/vfs/local/local.c" - struct vfs_s_subclass test_subclass1, test_subclass2, test_subclass3; struct vfs_class vfs_test_ops1, vfs_test_ops2, vfs_test_ops3; +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -76,6 +78,9 @@ setup (void) #endif } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { @@ -88,6 +93,7 @@ teardown (void) } /* --------------------------------------------------------------------------------------------- */ + #ifdef HAVE_CHARSET #define ETALON_PATH_STR "/local/path/#test1:user:pass@some.host:12345/bla-bla/some/path/#test2/#enc:KOI8-R/bla-bla/some/path#test3/111/22/33" #define ETALON_PATH_URL_STR "/local/path/test1://user:pass@some.host:12345/bla-bla/some/path/test2://#enc:KOI8-R/bla-bla/some/path/test3://111/22/33" @@ -138,46 +144,48 @@ teardown (void) #endif /* *INDENT-OFF* */ -START_TEST (test_path_serialize_deserialize) +START_TEST (test_path_serialize) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; char *serialized_vpath; GError *error = NULL; + /* when */ vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER); serialized_vpath = vfs_path_serialize (vpath, &error); vfs_path_free (vpath); - if (serialized_vpath == NULL) - { - fail ("serialized_vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, - error->message); - g_clear_error (&error); - return; - } + /* then */ + mctest_assert_ptr_ne (serialized_vpath, NULL); + mctest_assert_str_eq (serialized_vpath, ETALON_SERIALIZED_PATH); +} +/* *INDENT-OFF* */ +END_TEST +/* *INDENT-ON* */ - fail_unless (strcmp (serialized_vpath, ETALON_SERIALIZED_PATH) == 0, - "\nserialized_vpath (%s)\nnot equal to etalon (%s)", serialized_vpath, - ETALON_SERIALIZED_PATH); +/* --------------------------------------------------------------------------------------------- */ - vpath = vfs_path_deserialize (serialized_vpath, &error); - g_free (serialized_vpath); +/* *INDENT-OFF* */ +START_TEST (test_path_deserialize) +/* *INDENT-ON* */ +{ + /* given */ + vfs_path_t *vpath; + char *path; + GError *error = NULL; - if (vpath == NULL) - { - fail ("vpath is NULL!\nError code is '%d'; error message is '%s'", error->code, - error->message); - g_clear_error (&error); - return; - } + /* when */ + vpath = vfs_path_deserialize (ETALON_SERIALIZED_PATH, &error); + path = vfs_path_to_str (vpath); + + /* then */ + mctest_assert_ptr_ne (vpath, NULL); + mctest_assert_str_eq (path, ETALON_PATH_URL_STR); - serialized_vpath = vfs_path_to_str (vpath); - fail_unless (strcmp (serialized_vpath, ETALON_PATH_URL_STR) == 0, - "\ndeserialized path (%s)\nnot equal to etalon (%s)", serialized_vpath, - ETALON_PATH_URL_STR); vfs_path_free (vpath); - g_free (serialized_vpath); + g_free (path); } /* *INDENT-OFF* */ @@ -198,7 +206,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_path_serialize_deserialize); + tcase_add_test (tc_core, test_path_serialize); + tcase_add_test (tc_core, test_path_deserialize); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/vfs/relative_cd.c b/tests/lib/vfs/relative_cd.c index 7728d14ba..ee43b71a3 100644 --- a/tests/lib/vfs/relative_cd.c +++ b/tests/lib/vfs/relative_cd.c @@ -37,7 +37,36 @@ struct vfs_class vfs_test_ops1; static int test_chdir (const vfs_path_t * vpath); +/* --------------------------------------------------------------------------------------------- */ +/* @CapturedValue */ +static vfs_path_t *test_chdir__vpath__captured; +/* @ThenReturnValue */ +static int test_chdir__return_value; + +/* @Mock */ +static int +test_chdir (const vfs_path_t * vpath) +{ + test_chdir__vpath__captured = vfs_path_clone (vpath); + return test_chdir__return_value; +} + +static void +test_chdir__init (void) +{ + test_chdir__vpath__captured = NULL; +} + +static void +test_chdir__deinit (void) +{ + vfs_path_free (test_chdir__vpath__captured); +} + +/* --------------------------------------------------------------------------------------------- */ + +/* @Before */ static void setup (void) { @@ -58,58 +87,92 @@ setup (void) vfs_register_class (&vfs_test_ops1); mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR; + + vfs_local_ops.chdir = test_chdir; + + test_chdir__init (); } +/* --------------------------------------------------------------------------------------------- */ + +/* @After */ static void teardown (void) { + test_chdir__deinit (); + vfs_shut (); str_uninit_strings (); } /* --------------------------------------------------------------------------------------------- */ - -static int -test_chdir (const vfs_path_t * vpath) -{ - char *path = vfs_path_to_str (vpath); - printf ("test_chdir: %s\n", path); - g_free (path); - return 0; -} - -/* --------------------------------------------------------------------------------------------- */ - +/* @DataSource("test_relative_cd_ds") */ /* *INDENT-OFF* */ -START_TEST (test_relative_cd) +static const struct test_relative_cd_ds +{ + const char *input_string; + const vfs_path_flag_t input_flags; + const char *expected_element_path; +} test_relative_cd_ds[] = +{ + { /* 0. */ + "/test1://user:pass@some.host:12345/path/to/dir", + VPF_NONE, + "path/to/dir" + }, + { /* 1. */ + "some-non-exists-dir", + VPF_NO_CANON, + "some-non-exists-dir" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_relative_cd_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_relative_cd, test_relative_cd_ds) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath; + int actual_result; - vpath = vfs_path_from_str ("/test1://user:pass@some.host:12345/path/to/dir"); - fail_if (mc_chdir (vpath) == -1); - vfs_path_free (vpath); + test_chdir__return_value = 0; - vpath = vfs_path_from_str_flags ("some-non-exists-dir", VPF_NO_CANON); - fail_if (mc_chdir (vpath) == -1); - vfs_path_free (vpath); + vpath = vfs_path_from_str_flags (data->input_string, data->input_flags); + + /* when */ + actual_result = mc_chdir (vpath); + + /* then */ + { + const vfs_path_element_t *element; + + mctest_assert_int_eq (actual_result, 0); + element = vfs_path_get_by_index (vpath, -1); + mctest_assert_str_eq (element->path, data->expected_element_path); + vfs_path_free (vpath); + } } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ /* Relative to panel_correct_path_to_show() */ +/* @Test */ /* *INDENT-OFF* */ START_TEST (test_vpath_to_str_filter) /* *INDENT-ON* */ { + /* given */ vfs_path_t *vpath, *last_vpath; char *filtered_path; const vfs_path_element_t *path_element; + /* when */ vpath = vfs_path_from_str ("/test1://some.host/dir"); path_element = vfs_path_element_clone (vfs_path_get_by_index (vpath, -1)); vfs_path_free (vpath); @@ -121,11 +184,12 @@ START_TEST (test_vpath_to_str_filter) filtered_path = vfs_path_to_str_flags (last_vpath, 0, VPF_STRIP_HOME | VPF_STRIP_PASSWORD | VPF_HIDE_CHARSET); + + /* then */ + mctest_assert_str_eq (filtered_path, "test1://some.host/dir"); + vfs_path_free (last_vpath); - - fail_unless (strcmp ("test1://some.host/dir", filtered_path) == 0, "actual: %s", filtered_path); g_free (filtered_path); - } /* *INDENT-OFF* */ END_TEST @@ -145,7 +209,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_relative_cd); + mctest_add_parameterized_test (tc_core, test_relative_cd, test_relative_cd_ds); tcase_add_test (tc_core, test_vpath_to_str_filter); /* *********************************** */ From 0d2682928970918ac89a5c93970332a63a6b6693 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 30 Jan 2013 09:45:45 +0400 Subject: [PATCH 11/35] (mc_defines_destroy): use g_strfreev. Signed-off-by: Andrew Borodin --- src/editor/syntax.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/editor/syntax.c b/src/editor/syntax.c index a54baa6f8..7be2da25f 100644 --- a/src/editor/syntax.c +++ b/src/editor/syntax.c @@ -139,14 +139,10 @@ static char *error_file_name = NULL; static gint mc_defines_destroy (gpointer key, gpointer value, gpointer data) { - char **values = value; - (void) data; g_free (key); - while (*values) - g_free (*values++); - g_free (value); + g_strfreev ((char **) value); return FALSE; } From 9b0b01720181b1674317e16f2264bd7f20035f74 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 30 Jan 2013 21:32:49 +0400 Subject: [PATCH 12/35] (input_update): minor optimization: don't call str_term_width2() twice. Signed-off-by: Andrew Borodin --- lib/widget/input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/widget/input.c b/lib/widget/input.c index 5d671ec6d..a880b8146 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -1332,13 +1332,13 @@ input_update (WInput * in, gboolean clear_first) } else { - int sel_width; + int sel_width, buf_width; widget_move (in, 0, m1 - in->term_first_shown); + buf_width = str_term_width2 (in->buffer, m1); sel_width = min (m2 - m1, - (in->field_width - has_history) - (str_term_width2 (in->buffer, m1) - - in->term_first_shown)); + (in->field_width - has_history) - (buf_width - in->term_first_shown)); tty_print_string (str_term_substring (in->buffer, m1, sel_width)); } } From 2f25803ce271a7089cd937fd86c379cc74989581 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 30 Jan 2013 21:34:12 +0400 Subject: [PATCH 13/35] Sync with gnulib 47f4ca8fe9506254200028c8a8c5fffbf1bf1161 Don't consider "devtmpfs" as dummy. * src/filemanager/mountlist.c (ME_DUMMY_0): Remove "devtmpfs" as there is storage associcated with it. Signed-off-by: Andrew Borodin --- src/filemanager/mountlist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/filemanager/mountlist.c b/src/filemanager/mountlist.c index db98e811a..67339f9a2 100644 --- a/src/filemanager/mountlist.c +++ b/src/filemanager/mountlist.c @@ -208,7 +208,6 @@ /* for Linux 2.6/3.x */ \ || strcmp (Fs_type, "debugfs") == 0 \ || strcmp (Fs_type, "devpts") == 0 \ - || strcmp (Fs_type, "devtmpfs") == 0 \ || strcmp (Fs_type, "fusectl") == 0 \ || strcmp (Fs_type, "mqueue") == 0 \ || strcmp (Fs_type, "rpc_pipefs") == 0 \ From f6a5241e18e2a19e6d65756942bc5b91312adde8 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 31 Jan 2013 10:29:59 +0400 Subject: [PATCH 14/35] (mcview_scroll_to_cursor): make static. Signed-off-by: Andrew Borodin --- src/viewer/internal.h | 1 - src/viewer/move.c | 46 ++++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/viewer/internal.h b/src/viewer/internal.h index 79728d222..3a3d1a32f 100644 --- a/src/viewer/internal.h +++ b/src/viewer/internal.h @@ -295,7 +295,6 @@ void mcview_move_up (mcview_t *, off_t); void mcview_move_down (mcview_t *, off_t); void mcview_move_left (mcview_t *, off_t); void mcview_move_right (mcview_t *, off_t); -void mcview_scroll_to_cursor (mcview_t *); void mcview_moveto_top (mcview_t *); void mcview_moveto_bottom (mcview_t *); void mcview_moveto_bol (mcview_t *); diff --git a/src/viewer/move.c b/src/viewer/move.c index 23ab02265..3ea809db0 100644 --- a/src/viewer/move.c +++ b/src/viewer/move.c @@ -3,7 +3,7 @@ Functions for handle cursor movement Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2009, 2011 + 2004, 2005, 2006, 2007, 2009, 2011, 2013 The Free Software Foundation, Inc. Written by: @@ -15,7 +15,7 @@ Pavel Machek, 1998 Roland Illig , 2004, 2005 Slava Zanko , 2009 - Andrew Borodin , 2009 + Andrew Borodin , 2009, 2013 Ilia Maslakov , 2009, 2010 This file is part of the Midnight Commander. @@ -64,9 +64,31 @@ /*** file scope variables ************************************************************************/ +/* --------------------------------------------------------------------------------------------- */ /*** file scope functions ************************************************************************/ /* --------------------------------------------------------------------------------------------- */ +static void +mcview_scroll_to_cursor (mcview_t * view) +{ + if (view->hex_mode) + { + off_t bytes = view->bytes_per_line; + off_t cursor = view->hex_cursor; + off_t topleft = view->dpy_start; + off_t displaysize; + + displaysize = view->data_area.height * bytes; + if (topleft + displaysize <= cursor) + topleft = mcview_offset_rounddown (cursor, bytes) - (displaysize - bytes); + if (cursor < topleft) + topleft = mcview_offset_rounddown (cursor, bytes); + view->dpy_start = topleft; + } +} + +/* --------------------------------------------------------------------------------------------- */ + static void mcview_movement_fixups (mcview_t * view, gboolean reset_search) { @@ -277,26 +299,6 @@ mcview_move_right (mcview_t * view, off_t columns) /* --------------------------------------------------------------------------------------------- */ -void -mcview_scroll_to_cursor (mcview_t * view) -{ - if (view->hex_mode) - { - const off_t bytes = view->bytes_per_line; - const off_t displaysize = view->data_area.height * bytes; - const off_t cursor = view->hex_cursor; - off_t topleft = view->dpy_start; - - if (topleft + displaysize <= cursor) - topleft = mcview_offset_rounddown (cursor, bytes) - (displaysize - bytes); - if (cursor < topleft) - topleft = mcview_offset_rounddown (cursor, bytes); - view->dpy_start = topleft; - } -} - -/* --------------------------------------------------------------------------------------------- */ - void mcview_moveto_top (mcview_t * view) { From c52003ec435dabe65a9f3c742433e4410c0c89bc Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 1 Feb 2013 10:16:42 +0400 Subject: [PATCH 15/35] More use SELECTED_IS_PANEL define. Signed-off-by: Andrew Borodin --- src/filemanager/cmd.c | 2 +- src/filemanager/midnight.h | 2 +- src/filemanager/panelize.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c index d54736629..3a2551383 100644 --- a/src/filemanager/cmd.c +++ b/src/filemanager/cmd.c @@ -1752,7 +1752,7 @@ change_listing_cmd (void) char *user, *status; WPanel *p = NULL; - if (get_display_type (MENU_PANEL_IDX) == view_listing) + if (SELECTED_IS_PANEL) p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; list_type = panel_listing_box (p, &user, &status, &use_msformat, MENU_PANEL_IDX); diff --git a/src/filemanager/midnight.h b/src/filemanager/midnight.h index 9828479bf..e93f56d8b 100644 --- a/src/filemanager/midnight.h +++ b/src/filemanager/midnight.h @@ -16,7 +16,7 @@ #define MENU_PANEL (mc_global.widget.is_right ? right_panel : left_panel) #define MENU_PANEL_IDX (mc_global.widget.is_right ? 1 : 0) -#define SELECTED_IS_PANEL (get_display_type (mc_global.widget.is_right ? 1 : 0) == view_listing) +#define SELECTED_IS_PANEL (get_display_type (MENU_PANEL_IDX) == view_listing) #define other_panel get_other_panel() diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c index e99e7f9f0..25d0ed489 100644 --- a/src/filemanager/panelize.c +++ b/src/filemanager/panelize.c @@ -2,7 +2,7 @@ External panelize Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2007, 2009, 2011 + 2007, 2009, 2011, 2013 The Free Software Foundation, Inc. Written by: @@ -510,7 +510,7 @@ panelize_save_panel (struct WPanel *panel) void cd_panelize_cmd (void) { - if (get_display_type (MENU_PANEL_IDX) != view_listing) + if (!SELECTED_IS_PANEL) set_display_type (MENU_PANEL_IDX, view_listing); do_panelize_cd ((struct WPanel *) get_panel_widget (MENU_PANEL_IDX)); From 556192bd4adbb8a8405ac9f8776d5275a232157c Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 1 Feb 2013 10:19:33 +0400 Subject: [PATCH 16/35] (init_panelize): support --disable-nls. Signed-off-by: Andrew Borodin --- src/filemanager/panelize.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/filemanager/panelize.c b/src/filemanager/panelize.c index 25d0ed489..45aa516e6 100644 --- a/src/filemanager/panelize.c +++ b/src/filemanager/panelize.c @@ -159,7 +159,9 @@ init_panelize (void) blen = i - 1; /* gaps between buttons */ while (i-- != 0) { +#ifdef ENABLE_NLS panelize_but[i].text = _(panelize_but[i].text); +#endif blen += str_term_width1 (panelize_but[i].text) + 3 + 1; if (panelize_but[i].flags == DEFPUSH_BUTTON) blen += 2; From 0fbb469c42f8cee0ab26eaae18f31af0a2cb47c0 Mon Sep 17 00:00:00 2001 From: Vladislav Petrov Date: Mon, 4 Feb 2013 14:56:59 +0300 Subject: [PATCH 17/35] Grammar fix in English man-page. Signed-off-by: Slava Zanko --- doc/man/mc.1.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 7e990f8a5..ec802e9b1 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -2013,7 +2013,7 @@ and the suffixes are shown in upper case (K, M ...) .PP .I Mix all files. If this option is enabled, all files and directories are shown mixed -together. If the option is desabled (default), directories (and links to +together. If the option is disabled (default), directories (and links to directories) are shown at the beginning of the listing, and other files below. .PP .I Show backup files. From 1bd438923dea5e40727d27a9d0fba6ad23d97b84 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Mon, 4 Feb 2013 16:05:29 +0300 Subject: [PATCH 18/35] Code refactoring in tests. Signed-off-by: Slava Zanko --- tests/lib/widget/complete_engine.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/tests/lib/widget/complete_engine.c b/tests/lib/widget/complete_engine.c index 94352b217..3ef3c32ac 100644 --- a/tests/lib/widget/complete_engine.c +++ b/tests/lib/widget/complete_engine.c @@ -25,11 +25,8 @@ #define TEST_SUITE_NAME "/lib/widget" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/strutil.h" #include "lib/widget.h" @@ -191,18 +188,15 @@ static const struct test_complete_engine_fill_completions_ds }, }; /* *INDENT-ON* */ -// " \t;|<>" /* @Test(dataSource = "test_complete_engine_fill_completions_ds") */ /* *INDENT-OFF* */ -START_TEST (test_complete_engine_fill_completions) +START_PARAMETRIZED_TEST (test_complete_engine_fill_completions, + test_complete_engine_fill_completions_ds) /* *INDENT-ON* */ { /* given */ - WInput *w_input; - const struct test_complete_engine_fill_completions_ds *data = - &test_complete_engine_fill_completions_ds[_i]; w_input = g_new (WInput, 1); w_input->buffer = g_strdup (data->input_buffer); @@ -213,14 +207,13 @@ START_TEST (test_complete_engine_fill_completions) complete_engine_fill_completions (w_input); /* then */ - g_assert_cmpstr (try_complete__text__captured, ==, data->input_buffer); - ck_assert_int_eq (try_complete__lc_start__captured, data->expected_start); - ck_assert_int_eq (try_complete__lc_end__captured, data->expected_end); - ck_assert_int_eq (try_complete__flags__captured, data->input_completion_flags); - + mctest_assert_str_eq (try_complete__text__captured, data->input_buffer); + mctest_assert_int_eq (try_complete__lc_start__captured, data->expected_start); + mctest_assert_int_eq (try_complete__lc_end__captured, data->expected_end); + mctest_assert_int_eq (try_complete__flags__captured, data->input_completion_flags); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -237,9 +230,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, test_complete_engine_fill_completions, 0, - sizeof (test_complete_engine_fill_completions_ds) / - sizeof (test_complete_engine_fill_completions_ds[0])); + mctest_add_parameterized_test (tc_core, test_complete_engine_fill_completions, + test_complete_engine_fill_completions_ds); /* *********************************** */ suite_add_tcase (s, tc_core); From ef35db06d2842577ad89af629388103a72f7ee22 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 6 Feb 2013 10:55:17 +0400 Subject: [PATCH 19/35] (edit_get_byte): refactoring: use edit_get_byte_ptr(). Signed-off-by: Andrew Borodin --- src/editor/edit.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index b2ef4950f..dc1e485bc 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -652,7 +652,6 @@ edit_modification (WEdit * edit) /* --------------------------------------------------------------------------------------------- */ -#ifdef HAVE_CHARSET static char * edit_get_byte_ptr (const WEdit * edit, off_t byte_index) { @@ -671,7 +670,6 @@ edit_get_byte_ptr (const WEdit * edit, off_t byte_index) return (char *) (edit->buffers1[byte_index >> S_EDIT_BUF_SIZE] + (byte_index & M_EDIT_BUF_SIZE)); } -#endif /* --------------------------------------------------------------------------------------------- */ @@ -1819,18 +1817,11 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry) int edit_get_byte (const WEdit * edit, off_t byte_index) { - off_t p; + char *p; - if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) - return '\n'; + p = edit_get_byte_ptr (edit, byte_index); - if (byte_index >= edit->curs1) - { - p = edit->curs1 + edit->curs2 - byte_index - 1; - return edit->buffers2[p >> S_EDIT_BUF_SIZE][EDIT_BUF_SIZE - (p & M_EDIT_BUF_SIZE) - 1]; - } - - return edit->buffers1[byte_index >> S_EDIT_BUF_SIZE][byte_index & M_EDIT_BUF_SIZE]; + return (p != NULL) ? *(unsigned char *) p : '\n'; } /* --------------------------------------------------------------------------------------------- */ From 17ceb233b0a42d28a9765a6184a417dd05b5490b Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 6 Feb 2013 10:51:36 +0400 Subject: [PATCH 20/35] (edit_insert_column_of_text_from_file): refactoring: * move from src/editor/editcmd.c into src/editor/edit.c and make static; * rename to edit_insert_column_from_file; * make some refactoring. Signed-off-by: Andrew Borodin --- src/editor/edit-impl.h | 3 -- src/editor/edit.c | 75 +++++++++++++++++++++++++++++++++++++-- src/editor/editcmd.c | 79 ++---------------------------------------- 3 files changed, 74 insertions(+), 83 deletions(-) diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 16c1b276d..3c8cf84df 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -254,9 +254,6 @@ gboolean edit_save_block (WEdit * edit, const char *filename, off_t start, off_t gboolean edit_save_block_cmd (WEdit * edit); gboolean edit_insert_file_cmd (WEdit * edit); void edit_insert_over (WEdit * edit); -off_t edit_insert_column_of_text_from_file (WEdit * edit, int file, - off_t * start_pos, off_t * end_pos, long *col1, - long *col2); char *edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsize * len, gsize * cut); diff --git a/src/editor/edit.c b/src/editor/edit.c index dc1e485bc..e2a482fc2 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -2,13 +2,13 @@ Editor low level data handling and cursor fundamentals. Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012 + 2007, 2008, 2009, 2010, 2011, 2012, 2013 The Free Software Foundation, Inc. Written by: Paul Sheer 1996, 1997 Ilia Maslakov 2009, 2010, 2011 - Andrew Borodin 2012. + Andrew Borodin 2012, 2013 This file is part of the Midnight Commander. @@ -1757,6 +1757,75 @@ edit_print_string (WEdit * e, const char *s) return i; } +/* --------------------------------------------------------------------------------------------- */ + +static off_t +edit_insert_column_from_file (WEdit * edit, int file, off_t * start_pos, off_t * end_pos, + long *col1, long *col2) +{ + off_t cursor; + int col; + off_t blocklen = -1, width = 0; + unsigned char *data; + + cursor = edit->curs1; + col = edit_get_col (edit); + data = g_malloc0 (TEMP_BUF_LEN); + + while ((blocklen = mc_read (file, (char *) data, TEMP_BUF_LEN)) > 0) + { + off_t i; + char *pn; + + pn = strchr ((char *) data, '\n'); + width = pn == NULL ? blocklen : pn - (char *) data; + + for (i = 0; i < blocklen; i++) + { + if (data[i] != '\n') + edit_insert (edit, data[i]); + else + { /* fill in and move to next line */ + long l; + off_t p; + + if (edit_get_byte (edit, edit->curs1) != '\n') + for (l = width - (edit_get_col (edit) - col); l > 0; l -= space_width) + edit_insert (edit, ' '); + + for (p = edit->curs1; ; p++) + { + if (p == edit->last_byte) + { + edit_cursor_move (edit, edit->last_byte - edit->curs1); + edit_insert_ahead (edit, '\n'); + p++; + break; + } + if (edit_get_byte (edit, p) == '\n') + { + p++; + break; + } + } + + edit_cursor_move (edit, edit_move_forward3 (edit, p, col, 0) - edit->curs1); + + for (l = col - edit_get_col (edit); l >= space_width; l -= space_width) + edit_insert (edit, ' '); + } + } + } + *col1 = col; + *col2 = col + width; + *start_pos = cursor; + *end_pos = edit->curs1; + edit_cursor_move (edit, cursor - edit->curs1); + g_free (data); + + return blocklen; +} + /* --------------------------------------------------------------------------------------------- */ /*** public functions ****************************************************************************/ /* --------------------------------------------------------------------------------------------- */ @@ -2131,7 +2200,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath) off_t mark1, mark2; long c1, c2; - blocklen = edit_insert_column_of_text_from_file (edit, file, &mark1, &mark2, &c1, &c2); + blocklen = edit_insert_column_from_file (edit, file, &mark1, &mark2, &c1, &c2); edit_set_markers (edit, edit->curs1, mark2, c1, c2); /* highlight inserted text then not persistent blocks */ diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 70a308d83..668dd7e9d 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -2,12 +2,12 @@ Editor high level editing commands Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2011, 2012 + 2007, 2011, 2012, 2013 The Free Software Foundation, Inc. Written by: Paul Sheer, 1996, 1997 - Andrew Borodin , 2012 + Andrew Borodin , 2012, 2013 Ilia Maslakov , 2012 This file is part of the Midnight Commander. @@ -2309,81 +2309,6 @@ edit_insert_over (WEdit * edit) /* --------------------------------------------------------------------------------------------- */ -off_t -edit_insert_column_of_text_from_file (WEdit * edit, int file, - off_t * start_pos, off_t * end_pos, long *col1, long *col2) -{ - off_t cursor; - int col; - off_t blocklen = -1, width = 0; - unsigned char *data; - - cursor = edit->curs1; - col = edit_get_col (edit); - data = g_malloc0 (TEMP_BUF_LEN); - - while ((blocklen = mc_read (file, (char *) data, TEMP_BUF_LEN)) > 0) - { - off_t i; - for (width = 0; width < blocklen; width++) - { - if (data[width] == '\n') - break; - } - for (i = 0; i < blocklen; i++) - { - if (data[i] == '\n') - { /* fill in and move to next line */ - long l; - off_t p; - if (edit_get_byte (edit, edit->curs1) != '\n') - { - l = width - (edit_get_col (edit) - col); - while (l > 0) - { - edit_insert (edit, ' '); - l -= space_width; - } - } - for (p = edit->curs1;; p++) - { - if (p == edit->last_byte) - { - edit_cursor_move (edit, edit->last_byte - edit->curs1); - edit_insert_ahead (edit, '\n'); - p++; - break; - } - if (edit_get_byte (edit, p) == '\n') - { - p++; - break; - } - } - edit_cursor_move (edit, edit_move_forward3 (edit, p, col, 0) - edit->curs1); - l = col - edit_get_col (edit); - while (l >= space_width) - { - edit_insert (edit, ' '); - l -= space_width; - } - continue; - } - edit_insert (edit, data[i]); - } - } - *col1 = col; - *col2 = col + width; - *start_pos = cursor; - *end_pos = edit->curs1; - edit_cursor_move (edit, cursor - edit->curs1); - g_free (data); - - return blocklen; -} - -/* --------------------------------------------------------------------------------------------- */ - void edit_block_copy_cmd (WEdit * edit) { From f1316549a282964c449ab41829d177ac53ae44be Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 6 Feb 2013 11:08:18 +0400 Subject: [PATCH 21/35] (edit_insert_over): move from src/editor/editcmd.c into src/editor/edit.c. Signed-off-by: Andrew Borodin --- src/editor/edit-impl.h | 2 +- src/editor/edit.c | 12 ++++++++++++ src/editor/editcmd.c | 14 -------------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 3c8cf84df..4d04bb895 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -214,6 +214,7 @@ void edit_delete_line (WEdit * edit); int edit_delete (WEdit * edit, gboolean byte_delete); int edit_backspace (WEdit * edit, gboolean byte_delete); void edit_insert (WEdit * edit, int c); +void edit_insert_over (WEdit * edit); void edit_cursor_move (WEdit * edit, off_t increment); void edit_push_undo_action (WEdit * edit, long c); void edit_push_redo_action (WEdit * edit, long c); @@ -253,7 +254,6 @@ void edit_set_spell_lang (void); gboolean edit_save_block (WEdit * edit, const char *filename, off_t start, off_t finish); gboolean edit_save_block_cmd (WEdit * edit); gboolean edit_insert_file_cmd (WEdit * edit); -void edit_insert_over (WEdit * edit); char *edit_get_word_from_pos (const WEdit * edit, off_t start_pos, off_t * start, gsize * len, gsize * cut); diff --git a/src/editor/edit.c b/src/editor/edit.c index e2a482fc2..b33b4ae42 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -2809,6 +2809,18 @@ edit_insert_ahead (WEdit * edit, int c) edit->curs2++; } +/* --------------------------------------------------------------------------------------------- */ + +void +edit_insert_over (WEdit * edit) +{ + long i; + + for (i = 0; i < edit->over_col; i++) + edit_insert (edit, ' '); + + edit->over_col = 0; +} /* --------------------------------------------------------------------------------------------- */ diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 668dd7e9d..890547388 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -2295,20 +2295,6 @@ eval_marks (WEdit * edit, off_t * start_mark, off_t * end_mark) /* --------------------------------------------------------------------------------------------- */ -void -edit_insert_over (WEdit * edit) -{ - int i; - - for (i = 0; i < edit->over_col; i++) - { - edit_insert (edit, ' '); - } - edit->over_col = 0; -} - -/* --------------------------------------------------------------------------------------------- */ - void edit_block_copy_cmd (WEdit * edit) { From 3715c5254c34fcdac6db2d30541ceb842d86fe9d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 7 Feb 2013 12:37:07 +0400 Subject: [PATCH 22/35] Fix wrapper location in description of -P/printwd option. Signed-off-by: Andrew Borodin --- doc/man/date-of-man-include.am | 3 ++- doc/man/es/mc.1.in | 4 ++-- doc/man/hu/mc.1.in | 4 ++-- doc/man/it/mc.1.in | 4 ++-- doc/man/mc.1.in | 4 ++-- doc/man/ru/mc.1.in | 4 ++-- doc/man/sr/mc.1.in | 4 ++-- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/doc/man/date-of-man-include.am b/doc/man/date-of-man-include.am index 5fd6e8e85..58327d576 100644 --- a/doc/man/date-of-man-include.am +++ b/doc/man/date-of-man-include.am @@ -2,7 +2,8 @@ SED_PARAMETERS = \ -e "s/%DATE_OF_MAN_PAGE%/$${MAN_DATE}/g" \ -e "s/%DISTR_VERSION%/@DISTR_VERSION@/g" \ -e "s{%prefix%{@prefix@{g" \ - -e "s{%sysconfdir%{@sysconfdir@{g" + -e "s{%sysconfdir%{@sysconfdir@{g" \ + -e "s{%libexecdir%{@libexecdir@{g" MAN_DATE_CMD = \ LC_ALL=$(DATE_LANG) @PERL@ -MPOSIX -e '\ diff --git a/doc/man/es/mc.1.in b/doc/man/es/mc.1.in index 0288460c1..a5d7cd4ee 100644 --- a/doc/man/es/mc.1.in +++ b/doc/man/es/mc.1.in @@ -98,9 +98,9 @@ directorio de trabajo en el archivo indicado. Esta opción no debe ser usada directamente, sino desde un guión de shell adecuado, para dejar como directorio activo el directorio que estaba en uso dentro de Midnight Commander. Consúltese en los archivos -.B %prefix%/share/mc/bin/mc.sh +.B %libexecdir%/mc/mc.sh (usuarios de bash y zsh) y -.B %prefix%/share/mc/bin/mc.csh +.B %libexecdir%/mc/mc.csh (usuarios de tcsh) la manera de definir .B mc como un alias para el correspondiente guión de shell. diff --git a/doc/man/hu/mc.1.in b/doc/man/hu/mc.1.in index c1ef9648c..00a8fc533 100644 --- a/doc/man/hu/mc.1.in +++ b/doc/man/hu/mc.1.in @@ -59,9 +59,9 @@ helyett a Midnight Commander által utoljára meglátogatott könyvtárra való átváltást (köszönet a funkcióért és a funkcióhoz szükséges kódért Torben Fjerdingstad\-nek és Sergey\-nek közreműködésükért). Kérlek, ne csinálj szó szerinti másolatot a funkció beállításairól. A fájlok forrása a -.I %prefix%/share/mc/bin/mc.sh +.I %libexecdir%/mc/mc.sh (bash és zsh felhasználóknak), illetőleg a -.I %prefix%/share/mc/bin/mc.csh +.I %libexecdir%/mc/mc.csh (tcsh felhasználóknak) fájl. Ilyenkor, amikor a funkció beállításokat változtatod, a profil értékeket nem szükséges megváltoztatnod, csak arról gondoskodj, hogy az MC\-t ne fordítsd eltérő beállításokkal. diff --git a/doc/man/it/mc.1.in b/doc/man/it/mc.1.in index 0491928fb..78457ab64 100644 --- a/doc/man/it/mc.1.in +++ b/doc/man/it/mc.1.in @@ -80,9 +80,9 @@ Questa funzione non è fatta per un uso diretto, ma dovrebbe essere utilizzata da una speciale funzione shell che imposti automaticamente l'ultima directory corrente della shell come l'ultima directory in cui stava il Midnight Commander. Prelevate i file -.B %prefix%/share/mc/bin/mc.sh +.B %libexecdir%/mc/mc.sh (utenti bash e zsh) o rispettivamente -.B %prefix%/share/mc/bin/mc.csh +.B %libexecdir%/mc/mc.csh (utenti tcsh) per definire .B mc come un alias allo script di shell appropriato. diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index ec802e9b1..21bbd17b6 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -83,9 +83,9 @@ Print the last working directory to the specified file. This option is not meant to be used directly. Instead, it's used from a special shell script that automatically changes the current directory of the shell to the last directory the Midnight Commander was in. Source the file -.B %prefix%/share/mc/bin/mc.sh +.B %libexecdir%/mc/mc.sh (bash and zsh users) or -.B %prefix%/share/mc/bin/mc.csh +.B %libexecdir%/mc.csh (tcsh users) respectively to define .B mc as an alias to the appropriate shell script. diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index bc4573863..c4015f914 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -99,9 +99,9 @@ termcap/terminfo. Этот ключ используется только на Commander. .IP Для того чтобы эта функция была определена, используйте файл -.B %prefix%/share/mc/bin/mc.sh +.B %libexecdir%/mc/mc.sh для оболочек bash и zsh, а для оболочки tcsh соответственно файл -.B %prefix%/share/mc/bin/mc.csh +.B %libexecdir%/mc/mc.csh .TP .I \-s, \-\-slow Включает медленный режим терминала, в котором программа выводит меньше diff --git a/doc/man/sr/mc.1.in b/doc/man/sr/mc.1.in index b03ce62af..320261830 100644 --- a/doc/man/sr/mc.1.in +++ b/doc/man/sr/mc.1.in @@ -60,9 +60,9 @@ termcap/terminfo. Корисно је само на ХП\-овим термин посебног списа љуске који аутоматски поставља текући директоријум љуске на последњи директоријум у коме се налазио Поноћни наредник. Учитајте датотеку -.B %prefix%/share/mc/bin/mc.sh +.B %libexecdir%/mc/mc.sh (за кориснике љуски bash и zsh) или -.B %prefix%/share/mc/bin/mc.csh +.B %libexecdir%/mc/mc.csh (за кориснике љуске tcsh), тим редом, да бисте задали .B mc као надимак за одговарајући спис љуске. From 22f0cac4ea6a5e0aa5ba6aef8b5d48e86cfaf82d Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Fri, 8 Feb 2013 10:19:41 +0400 Subject: [PATCH 23/35] Fix formatting in manual pages. Signed-off-by: Andrew Borodin --- doc/man/es/mc.1.in | 6 +++--- doc/man/mc.1.in | 6 +++--- doc/man/mcedit.1.in | 2 +- doc/man/ru/mc.1.in | 23 ++++++++++++----------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/doc/man/es/mc.1.in b/doc/man/es/mc.1.in index a5d7cd4ee..65d9ebe76 100644 --- a/doc/man/es/mc.1.in +++ b/doc/man/es/mc.1.in @@ -108,7 +108,7 @@ como un alias para el correspondiente guión de shell. .I \-s, \-\-slow Activa el modo para terminales lentos. En este modo el programa no dibuja bordes con líneas de caracteres y desactiva el modo detallado. -Si no se rellana la sección [Lines] el marco pseudo-gráfico estará +Si no se rellana la sección [Lines] el marco pseudo\-gráfico estará formado por espacios; en caso contrario el marco se contruye con caracteres de texto según los parámetros siguientes: .TP @@ -3747,7 +3747,7 @@ de 900 segundos. .TP .I clipboard_store Ruta de acceso y opciones a una utilidad de portapapeles externa como 'xclip' -para cargar texto de un archivo como selección en X-Windows. +para cargar texto de un archivo como selección en X Window. Por ejemplo: .PP .nf @@ -3756,7 +3756,7 @@ clipboard_store=xclip \-i .TP .I clipboard_paste Ruta de acceso y opciones a una utilidad de portapapeles externa como 'xclip' -para volcar la selección de X-Windows a la salida estándar. +para volcar la selección de X Window a la salida estándar. Por ejemplo: .PP .nf diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 21bbd17b6..749ede103 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -1142,12 +1142,12 @@ You can change either one. Sometimes you may want to change the absolute path of the original into a relative path. An absolute path starts from the root directory: .PP -.I /home/frodo/mc/mc -> /home/frodo/new/mc +.I /home/frodo/mc/mc \-> /home/frodo/new/mc .PP A relative link describes the original file's location starting from the location of the link itself: .PP -.I /home/frodo/mc/mc -> ../new/mc +.I /home/frodo/mc/mc \-> ../new/mc .PP You can force Midnight Commander to suggest a relative path by pressing "C\-x v" instead of "C\-x s". @@ -3567,7 +3567,7 @@ is used for selected hyperlink. .PP Popup menu uses following colors: .I pmenunormal -is used for non-selected menu items and as a main color of popup menu window, +is used for non\-selected menu items and as a main color of popup menu window, .I pmenusel is used for selected menu item, .I pmenutitle diff --git a/doc/man/mcedit.1.in b/doc/man/mcedit.1.in index d10a470b2..d451cf6f9 100644 --- a/doc/man/mcedit.1.in +++ b/doc/man/mcedit.1.in @@ -589,7 +589,7 @@ Search autocomplete candidates in entire of file or just from begin of file to cursor position (0) .TP .I spell_language -Spelling language (en, en-variant_0, ru, etc) installed with aspell +Spelling language (en, en\-variant_0, ru, etc) installed with aspell package (a full list can be get using 'aspell' utility). Use .B spell_language = NONE diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index c4015f914..7e0d13977 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -49,6 +49,7 @@ UNIX\-подобных операционных системах. .TP .I \-d, \-\-nomouse Отключает поддержку мыши. +.TP .I \-e [файл] Запустить встроенный редактор. Если параметр "файл" задан, этот файл будет открыт при запуске. Смотрите также @@ -83,7 +84,7 @@ termcap/terminfo. Этот ключ используется только на Сохранить диалог с ftp\-сервером, а также отладочную информацию smbfs в файл file. .TP -.I \-D N, --debuglevel=N +.I \-D N, \-\-debuglevel=N Используется только если код был скомпилирован с поддержкой .\"LINK2" виртуальной файловой системы smbfs @@ -109,7 +110,7 @@ Commander. отключается вывод дополнительных (избыточных) сообщений. .TP .I \-t, \-\-termcap -Используется только в том случае, когда код был скомпилирован с S-Lang и +Используется только в том случае, когда код был скомпилирован с S\-Lang и terminfo: в этом случае Midnight Commander использует значение переменной .B TERMCAP @@ -134,7 +135,7 @@ terminfo: в этом случае Midnight Commander использует зн .I \-V, \-\-version Отображает версию программы. .TP -.I \-x, --xterm +.I \-x, \-\-xterm Запускает программу в режиме xterm. Используется только на терминалах, работающих в режиме xterm (два режима работы экрана и возможность формировать экранирующие последовательности с помощью мыши) (two screen @@ -144,7 +145,7 @@ modes, and able to send mouse escape sequences). Не использовать X11 для получения состояния модификаторов Alt, Ctrl, Shift. .TP .I \-g, \-\-oldmouse -Принудительно устанавливает режим мыши "normal tracking". В xterm-совместимых +Принудительно устанавливает режим мыши "normal tracking". В xterm\-совместимых терминалах (например, tmux/screen). .PP Первое путевое имя (path name) в командной строке (если указано) задает @@ -1155,12 +1156,12 @@ Midnight Commander указывает символические ссылки, Но иногда требуется, чтобы ссылка указывала на файл не по абсолютному пути, а по относительному. Абсолютный путь начинается с корневого каталога: .PP -.I /home/frodo/mc/mc -> /home/frodo/new/mc +.I /home/frodo/mc/mc \-> /home/frodo/new/mc .PP Относительный путь указывает на расположение файла относительно места, где будет располагаться создаваемая ссылка: .PP -.I /home/frodo/mc/mc -> ../new/mc +.I /home/frodo/mc/mc \-> ../new/mc .PP Для того, чтобы создать относительную символическую ссылку, используйте клавиатурное сочетание "C\-x v" вместо "C\-x s". @@ -2992,7 +2993,7 @@ subshell, в файле отключена, то регистр символов учитываться не будет. .\"NODE "Diff Viewer" .SH "Встроенная программа сравнения файлов" -mcdiff -- это встроенное средство для сравнения файлов, позволяющее сравнить два файла. +mcdiff \- это встроенное средство для сравнения файлов, позволяющее сравнить два файла. Также оно позволяет редактировать их (после завершения редактирования произойдет обновление различий). Можно просматривать файлы, находящиеся под контролем различных систем управления версиями, такими как GIT, Subversion и другие. @@ -3245,7 +3246,7 @@ pipe text blocks through shell commands like indent). .IP .\"LINK2" -Опции в ини-файле для редактора +Опции в ini\-файле для редактора .\"Internal File Editor / options" .PP @@ -3314,7 +3315,7 @@ pipe text blocks through shell commands like indent). .B info mcedit .\"NODE "Internal File Editor / options" -.SH "Опции в ини-файле для редактора" +.SH "Опции в ini\-файле для редактора" .PP В данном разделе кратко описаны опции ini\-файла, относящиеся к редактору. Опции записываются в секцию [Midnight\-Commander]. @@ -3925,7 +3926,7 @@ editnormal, editbold, editmarked, editwhitespace, editlinestate. графическом отображении хода выполнения файловых операций (копирование и др.). .I disabled -определяет цвет элемента диалога, который не может по каким-то причинам быть выбран +определяет цвет элемента диалога, который не может по каким\-то причинам быть выбран для работы с ним. .PP Диалоговые окна используют следующие цвета: @@ -4302,7 +4303,7 @@ menuhotsel=yellow;black;bold+underline Цвета\&. .\"Colors" .PP -В данном случае переназначение цветов имеет приоритет над скин-файлами и носит +В данном случае переназначение цветов имеет приоритет над скин\-файлами и носит дополняющий характер. .\"NODE "Filenames Highlight" From ef94b84eaf570dd1cc3faa383cdb49a7638c3be6 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 21 Jan 2013 15:02:58 +0400 Subject: [PATCH 24/35] (size_trunc_len): support automatic maximum unit for specified size. Fix typos. Signed-off-by: Andrew Borodin --- lib/util.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/util.c b/lib/util.c index 4c4aeb083..b7787ab7e 100644 --- a/lib/util.c +++ b/lib/util.c @@ -406,6 +406,7 @@ size_trunc_sep (uintmax_t size, gboolean use_si) * * Units: size units (filesystem sizes are 1K blocks) * 0=bytes, 1=Kbytes, 2=Mbytes, etc. + * -1 means maximum possible unit for specified size */ void @@ -425,7 +426,7 @@ size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gbool 10000000ULL, 100000000ULL, 1000000000ULL - /* maximmum value of uintmax_t (in case of 4 bytes) is + /* maximum value of uintmax_t (in case of 4 bytes) is 4294967295 */ #if SIZEOF_UINTMAX_T == 8 @@ -440,7 +441,7 @@ size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gbool 100000000000000000ULL, 1000000000000000000ULL, 10000000000000000000ULL - /* maximmum value of uintmax_t (in case of 8 bytes) is + /* maximum value of uintmax_t (in case of 8 bytes) is 18447644073710439615 */ #endif @@ -462,6 +463,16 @@ size_trunc_len (char *buffer, unsigned int len, uintmax_t size, int units, gbool len = 9; #endif + /* find maximum unit */ + if (units < 0) + { + const unsigned int divider = use_si ? 1000 : 1024; + uintmax_t size_remain = size; + + for (units = 0; size_remain >= divider; units++) + size_remain /= divider; + } + /* * recalculate from 1024 base to 1000 base if units>0 * We can't just multiply by 1024 - that might cause overflow From 30959e0b7d136073dc9bc4905a7b4c826251aec7 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 11 Feb 2013 15:35:00 +0400 Subject: [PATCH 25/35] Clarify widget redraw in runtime. Signed-off-by: Andrew Borodin --- lib/widget/button.c | 3 +-- lib/widget/buttonbar.h | 7 ------- lib/widget/dialog.c | 3 +-- lib/widget/gauge.c | 4 ++-- lib/widget/groupbox.c | 5 +---- lib/widget/hline.c | 3 +-- lib/widget/input.c | 5 +++-- lib/widget/input_complete.c | 4 ++-- lib/widget/label.c | 5 ++--- lib/widget/widget-common.c | 14 ++++++++++++++ lib/widget/widget-common.h | 1 + src/editor/edit.c | 2 +- src/editor/editcmd.c | 2 +- src/editor/editwidget.c | 2 +- src/filemanager/find.c | 2 +- src/filemanager/layout.c | 2 +- src/filemanager/midnight.c | 4 ++-- src/filemanager/panel.c | 6 +++--- src/filemanager/tree.c | 2 +- src/viewer/display.c | 2 +- 20 files changed, 40 insertions(+), 38 deletions(-) diff --git a/lib/widget/button.c b/lib/widget/button.c index 4740f9373..50d31bd5b 100644 --- a/lib/widget/button.c +++ b/lib/widget/button.c @@ -241,8 +241,7 @@ button_set_text (WButton * b, const char *text) release_hotkey (b->text); b->text = parse_hotkey (text); w->cols = button_get_len (b); - if (w->owner != NULL) - send_message (w, NULL, MSG_DRAW, 0, NULL); + widget_redraw (w); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/buttonbar.h b/lib/widget/buttonbar.h index d6694a11a..e5781630b 100644 --- a/lib/widget/buttonbar.h +++ b/lib/widget/buttonbar.h @@ -47,13 +47,6 @@ WButtonBar *find_buttonbar (const WDialog * h); /*** inline functions ****************************************************************************/ -static inline void -buttonbar_redraw (WButtonBar * bb) -{ - if (bb != NULL) - send_message (bb, NULL, MSG_DRAW, 0, NULL); -} - static inline void buttonbar_set_visible (WButtonBar * bb, gboolean visible) { diff --git a/lib/widget/dialog.c b/lib/widget/dialog.c index 86f16af6b..8187cf59f 100644 --- a/lib/widget/dialog.c +++ b/lib/widget/dialog.c @@ -1382,8 +1382,7 @@ dlg_replace_widget (Widget * old_w, Widget * new_w) if (should_focus) dlg_select_widget (new_w); - if (new_w->owner->state == DLG_ACTIVE) - send_message (new_w, NULL, MSG_DRAW, 0, NULL); + widget_redraw (new_w); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/gauge.c b/lib/widget/gauge.c index 317aed689..b6876ed9d 100644 --- a/lib/widget/gauge.c +++ b/lib/widget/gauge.c @@ -164,7 +164,7 @@ gauge_set_value (WGauge * g, int max, int current) max = 1; /* I do not like division by zero :) */ g->current = current; g->max = max; - gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (g)); } /* --------------------------------------------------------------------------------------------- */ @@ -175,7 +175,7 @@ gauge_show (WGauge * g, gboolean shown) if (g->shown != shown) { g->shown = shown; - gauge_callback (WIDGET (g), NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (g)); } } diff --git a/lib/widget/groupbox.c b/lib/widget/groupbox.c index 7fef8f91f..0ff62d119 100644 --- a/lib/widget/groupbox.c +++ b/lib/widget/groupbox.c @@ -119,8 +119,6 @@ groupbox_new (int y, int x, int height, int width, const char *title) void groupbox_set_title (WGroupbox * g, const char *title) { - Widget *w = WIDGET (g); - g_free (g->title); g->title = NULL; @@ -134,8 +132,7 @@ groupbox_set_title (WGroupbox * g, const char *title) g_free (t); } - if (w->owner != NULL) - send_message (w, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (g)); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/hline.c b/lib/widget/hline.c index b094e01c3..54c83413a 100644 --- a/lib/widget/hline.c +++ b/lib/widget/hline.c @@ -150,8 +150,7 @@ hline_set_text (WHLine * l, const char *text) else l->text = g_strdup (text); - if (WIDGET (l)->owner != NULL) - send_message (l, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (l)); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/input.c b/lib/widget/input.c index a880b8146..a2825f2f0 100644 --- a/lib/widget/input.c +++ b/lib/widget/input.c @@ -1265,6 +1265,7 @@ input_set_point (WInput * in, int pos) void input_update (WInput * in, gboolean clear_first) { + Widget *w = WIDGET (in); int has_history = 0; int i; int buf_len; @@ -1292,13 +1293,13 @@ input_update (WInput * in, gboolean clear_first) in->mark = min (in->mark, buf_len); /* don't draw widget not put into dialog */ - if (WIDGET (in)->owner == NULL) + if (w->owner == NULL || w->owner->state != DLG_ACTIVE) return; if (has_history != 0) draw_history_button (in); - if ((WIDGET (in)->options & W_DISABLED) != 0) + if ((w->options & W_DISABLED) != 0) tty_setcolor (DISABLED_COLOR); else if (in->first) tty_setcolor (in->color[WINPUTC_UNCHANGED]); diff --git a/lib/widget/input_complete.c b/lib/widget/input_complete.c index 3dd3d0231..23f4c11ab 100644 --- a/lib/widget/input_complete.c +++ b/lib/widget/input_complete.c @@ -1058,7 +1058,7 @@ query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d listbox_select_entry (LISTBOX (h->current->data), i); end = new_end; input_handle_char (input, parm); - send_message (h->current->data, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (h->current->data)); break; } } @@ -1161,7 +1161,7 @@ query_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d if (need_redraw == 2) { insert_text (input, last_text, low); - send_message (h->current->data, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (h->current->data)); } else if (need_redraw == 1) { diff --git a/lib/widget/label.c b/lib/widget/label.c index ec31c3226..965fbcfaf 100644 --- a/lib/widget/label.c +++ b/lib/widget/label.c @@ -182,11 +182,10 @@ label_set_text (WLabel * label, const char *text) } } - if (w->owner != NULL) - send_message (w, NULL, MSG_DRAW, 0, NULL); - if (newcols < w->cols) w->cols = newcols; + + widget_redraw (w); } /* --------------------------------------------------------------------------------------------- */ diff --git a/lib/widget/widget-common.c b/lib/widget/widget-common.c index 549202bb1..ccb90580c 100644 --- a/lib/widget/widget-common.c +++ b/lib/widget/widget-common.c @@ -268,6 +268,20 @@ widget_erase (Widget * w) /* --------------------------------------------------------------------------------------------- */ +void +widget_redraw (Widget * w) +{ + if (w != NULL) + { + WDialog *h = w->owner; + + if (h != NULL && h->state == DLG_ACTIVE) + w->callback (w, NULL, MSG_DRAW, 0, NULL); + } +} + +/* --------------------------------------------------------------------------------------------- */ + /* get mouse pointer location within widget */ Gpm_Event mouse_get_local (const Gpm_Event * global, const Widget * w) diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h index 4aa873466..77c516b96 100644 --- a/lib/widget/widget-common.h +++ b/lib/widget/widget-common.h @@ -142,6 +142,7 @@ void widget_set_options (Widget * w, widget_options_t options, gboolean enable); void widget_set_size (Widget * widget, int y, int x, int lines, int cols); /* select color for widget in dependance of state */ void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey); +void widget_redraw (Widget * w); void widget_erase (Widget * w); /* get mouse pointer location within widget */ diff --git a/src/editor/edit.c b/src/editor/edit.c index b33b4ae42..db70eea15 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -1878,7 +1878,7 @@ user_menu (WEdit * edit, const char *menu_file, int selected_entry) edit_cursor_move (edit, curs - edit->curs1); edit->force |= REDRAW_PAGE; - send_message (edit, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (edit)); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 890547388..4a221aa34 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -3333,7 +3333,7 @@ edit_select_codepage_cmd (WEdit * edit) edit_set_codeset (edit); edit->force = REDRAW_PAGE; - send_message (edit, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (edit)); } #endif diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index f71e4c271..6061403d4 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -1173,7 +1173,7 @@ edit_update_screen (WEdit * e) edit_render_keypress (e); } - buttonbar_redraw (find_buttonbar (h)); + widget_redraw (WIDGET (find_buttonbar (h))); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/filemanager/find.c b/src/filemanager/find.c index f114f1338..08e91a53c 100644 --- a/src/filemanager/find.c +++ b/src/filemanager/find.c @@ -922,7 +922,7 @@ find_add_match (const char *dir, const char *file) /* Don't scroll */ if (matches == 0) listbox_select_first (find_list); - send_message (find_list, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (find_list)); matches++; found_num_update (); diff --git a/src/filemanager/layout.c b/src/filemanager/layout.c index fca176510..23e95f1ec 100644 --- a/src/filemanager/layout.c +++ b/src/filemanager/layout.c @@ -233,7 +233,7 @@ update_split (const WDialog * h) check_options[0].widget->state = _panels_layout.horizontal_equal ? 1 : 0; else check_options[0].widget->state = _panels_layout.vertical_equal ? 1 : 0; - send_message (check_options[0].widget, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (check_options[0].widget)); tty_setcolor (check_options[0].widget->state & C_BOOL ? DISABLED_COLOR : COLOR_NORMAL); diff --git a/src/filemanager/midnight.c b/src/filemanager/midnight.c index a63d6f60d..f97a18e85 100644 --- a/src/filemanager/midnight.c +++ b/src/filemanager/midnight.c @@ -1097,10 +1097,10 @@ static void update_dirty_panels (void) { if (get_current_type () == view_listing && current_panel->dirty) - send_message (current_panel, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (current_panel)); if (get_other_type () == view_listing && other_panel->dirty) - send_message (other_panel, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (other_panel)); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/filemanager/panel.c b/src/filemanager/panel.c index 86fd21fdf..482a59551 100644 --- a/src/filemanager/panel.c +++ b/src/filemanager/panel.c @@ -2497,7 +2497,7 @@ do_search (WPanel * panel, int c_code) unselect_item (panel); panel->selected = sel; select_item (panel); - send_message (panel, NULL, MSG_DRAW, 0, NULL); + widget_redraw (WIDGET (panel)); } else if (c_code != KEY_BACKSPACE) { @@ -3462,7 +3462,7 @@ panel_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *d bb = find_buttonbar (w->owner); midnight_set_buttonbar (bb); - buttonbar_redraw (bb); + widget_redraw (WIDGET (bb)); return MSG_HANDLED; case MSG_UNFOCUS: @@ -3718,7 +3718,7 @@ panel_event (Gpm_Event * event, void *data) finish: if (panel->dirty) - send_message (w, NULL, MSG_DRAW, 0, NULL); + widget_redraw (w); return MOU_NORMAL; } diff --git a/src/filemanager/tree.c b/src/filemanager/tree.c index bba6a12cc..ca2bb11af 100644 --- a/src/filemanager/tree.c +++ b/src/filemanager/tree.c @@ -1236,7 +1236,7 @@ tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *da buttonbar_clear_label (b, 7, WIDGET (tree)); #endif buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, w); - buttonbar_redraw (b); + widget_redraw (WIDGET (b)); /* FIXME: Should find a better way of only displaying the currently selected item */ diff --git a/src/viewer/display.c b/src/viewer/display.c index 41606c52f..9c1611abf 100644 --- a/src/viewer/display.c +++ b/src/viewer/display.c @@ -189,7 +189,7 @@ mcview_update (mcview_t * view) { view->dpy_bbar_dirty = FALSE; mcview_set_buttonbar (view); - buttonbar_redraw (find_buttonbar (WIDGET (view)->owner)); + widget_redraw (WIDGET (find_buttonbar (WIDGET (view)->owner))); } if (view->dirty > dirt_limit) From 6787221c156102601550dd05b09d55dcc7da1c30 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 23 Jan 2013 10:25:02 +0400 Subject: [PATCH 26/35] (overwrite_query_dialog): adjust dialog size. Signed-off-by: Andrew Borodin --- src/filemanager/filegui.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c index 6b4e12917..1d90b251d 100644 --- a/src/filemanager/filegui.c +++ b/src/filemanager/filegui.c @@ -398,9 +398,8 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) #define ADD_RD_LABEL(i, p1, p2, ypos) \ g_snprintf (buffer, sizeof (buffer), rd_widgets [i].text, p1, p2); \ - add_widget_autopos (ui->replace_dlg, \ - label_new (ypos, rd_widgets [i].xpos, buffer), \ - rd_widgets [i].pos_flags, \ + label2 = WIDGET (label_new (ypos, rd_widgets [i].xpos, buffer)); \ + add_widget_autopos (ui->replace_dlg, label2, rd_widgets [i].pos_flags, \ ui->replace_dlg->current != NULL ? ui->replace_dlg->current->data : NULL) /* dialog sizes */ @@ -422,10 +421,10 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) { N_("Target file already exists!"), 3, 4, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, 0 }, /* 1 */ { "%s", 4, 4, WPOS_KEEP_TOP | WPOS_CENTER_HORZ, 0 }, - /* 2 */ /* cannot use PRIuMAX here; %llu is used instead */ - { N_("New : %s, size %llu"), 6, 4, WPOS_KEEP_DEFAULT, 0 }, - /* 3 */ /* cannot use PRIuMAX here; %llu is used instead */ - { N_("Existing: %s, size %llu"), 7, 4, WPOS_KEEP_DEFAULT, 0 }, + /* 2 */ + { N_("New : %s, size %s"), 6, 4, WPOS_KEEP_DEFAULT, 0 }, + /* 3 */ + { N_("Existing: %s, size %s"), 7, 4, WPOS_KEEP_DEFAULT, 0 }, /* 4 */ { N_("Overwrite this target?"), 9, 4, WPOS_KEEP_DEFAULT, 0 }, /* 5 */ @@ -457,6 +456,8 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) FileOpContextUI *ui = ctx->ui; char buffer[BUF_SMALL]; + char fsize_buffer[BUF_SMALL]; + Widget *label1, *label2; const char *title; vfs_path_t *stripped_vpath; const char *stripped_name; @@ -541,16 +542,19 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) /* prompt */ ADD_RD_LABEL (0, "", "", y++); /* file name */ - ADD_RD_LABEL (1, str_trunc (stripped_name, rd_xlen - 8), "", y++); + ADD_RD_LABEL (1, "", "", y++); + label1 = label2; add_widget (ui->replace_dlg, hline_new (y++, -1, -1)); /* source date and size */ - ADD_RD_LABEL (2, file_date (ui->s_stat->st_mtime), (unsigned long long) ui->s_stat->st_size, - y++); + size_trunc_len (fsize_buffer, sizeof (fsize_buffer), ui->s_stat->st_size, -1, panels_options.kilobyte_si); + ADD_RD_LABEL (2, file_date (ui->s_stat->st_mtime), fsize_buffer, y++); + rd_xlen = max (rd_xlen, label2->cols + 8); /* destination date and size */ - ADD_RD_LABEL (3, file_date (ui->d_stat->st_mtime), (unsigned long long) ui->d_stat->st_size, - y++); + size_trunc_len (fsize_buffer, sizeof (fsize_buffer), ui->d_stat->st_size, -1, panels_options.kilobyte_si); + ADD_RD_LABEL (3, file_date (ui->d_stat->st_mtime), fsize_buffer, y++); + rd_xlen = max (rd_xlen, label2->cols + 8); add_widget (ui->replace_dlg, hline_new (y++, -1, -1)); @@ -580,6 +584,7 @@ overwrite_query_dialog (FileOpContext * ctx, enum OperationMode mode) ADD_RD_BUTTON (14, y); /* Abort */ + label_set_text (LABEL (label1), str_trunc (stripped_name, rd_xlen - 8)); dlg_set_size (ui->replace_dlg, y + 3, rd_xlen); dlg_select_by_id (ui->replace_dlg, yes_id); result = run_dlg (ui->replace_dlg); From 3037d88587c0ca1ddff8827be7f6ed68d9d9f458 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 13 Feb 2013 10:27:49 +0400 Subject: [PATCH 27/35] Clarify EN and RU man pages: list command line options alphabetically. Signed-off-by: Andrew Borodin --- doc/man/mc.1.in | 36 ++++++++++++++++++------------------ doc/man/ru/mc.1.in | 45 ++++++++++++++++++++++----------------------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/doc/man/mc.1.in b/doc/man/mc.1.in index 749ede103..9f2c317ed 100644 --- a/doc/man/mc.1.in +++ b/doc/man/mc.1.in @@ -36,17 +36,15 @@ Colors .\"Colors" section. .TP -.I \-S arg, \-\-skin=arg -Specify a name of skin in the command line. Technology of skins is -documented in the -.\"LINK2" -Skins -.\"Skins" -section. +.I \-\-configure\-options +Display configure options. .TP .I \-d, \-\-nomouse Disable mouse support. .TP +.I \-D N, \-\-debuglevel=N +Save the debug level for SMB VFS. N is in 0\-10 range. +.TP .I \-e [file], \-\-edit[=file] Start the internal editor. If the file is specified, open it on startup. See also @@ -59,8 +57,9 @@ Display the compiled\-in search paths for Midnight Commander files. Display extended info about compiled\-in paths for Midnight Commander. .TP -.I \-\-configure\-options -Display configure options. +.I \-g, \-\-oldmouse +Force a "normal tracking" mouse mode. Used when running on +xterm\-capable terminals (tmux/screen). .TP .I \-k, \-\-resetsoft Reset softkeys to their default from the termcap/terminfo @@ -69,14 +68,11 @@ database. Only useful on HP terminals when the function keys don't work. .I \-K file, \-\-keymap=file Specify a name of keymap file in the command line. .TP -.I \-\-nokeymap -Don't load key bindings from any file, use default hardcoded keys. -.TP .I \-l file, \-\-ftplog=file Save the ftpfs dialog with the server in file. .TP -.I \-D N, \-\-debuglevel=N -Save the debug level for SMB VFS. N is in 0\-10 range. +.I \-\-nokeymap +Don't load key bindings from any file, use default hardcoded keys. .TP .I \-P file, \-\-printwd=file Print the last working directory to the specified file. This option is @@ -136,6 +132,14 @@ thin horizontal line .B thinvert thin vertical line .TP +.I \-S arg, \-\-skin=arg +Specify a name of skin in the command line. Technology of skins is +documented in the +.\"LINK2" +Skins +.\"Skins" +section. +.TP .I \-t, \-\-termcap Used only if the code was compiled with Slang and terminfo: it makes the Midnight Commander use the value of the @@ -165,10 +169,6 @@ screen modes, and able to send mouse escape sequences). .TP .I \-X, \-\-no\-x11 Do not use X11 to get the state of modifiers Alt, Ctrl, Shift -.TP -.I \-g, \-\-oldmouse -Force a "normal tracking" mouse mode. Used when running on -xterm\-capable terminals (tmux/screen). .PP If specified, the first path name is the directory to show in the selected panel; the second path name is the directory to be shown in diff --git a/doc/man/ru/mc.1.in b/doc/man/ru/mc.1.in index 7e0d13977..3c473a989 100644 --- a/doc/man/ru/mc.1.in +++ b/doc/man/ru/mc.1.in @@ -40,16 +40,19 @@ UNIX\-подобных операционных системах. Цвета\&. .\"Colors" .TP -.I \-S arg, \-\-skin -Используется для того, чтобы задать другой скин в командной -строке. Технология скинов описана в разделе -.\"LINK2" -Внешний вид\&. -.\"Skins" +.I \-\-configure\-options +Выводит опции конфигурирования, с которыми был собран Midnight Commander. .TP .I \-d, \-\-nomouse Отключает поддержку мыши. .TP +.I \-D N, \-\-debuglevel=N +Используется только если код был скомпилирован с поддержкой +.\"LINK2" +виртуальной файловой системы smbfs +.\"SMB File System" +для установки уровня отладочных сообщений smbfs в N (0\-10). +.TP .I \-e [файл] Запустить встроенный редактор. Если параметр "файл" задан, этот файл будет открыт при запуске. Смотрите также @@ -63,8 +66,9 @@ UNIX\-подобных операционных системах. Выводит на экран расширенную информацию о путях, используемых при работе программы Midnight Commander. .TP -.I \-\-configure\-options -Выводит опции конфигурирования, с которыми был собран Midnight Commander. +.I \-g, \-\-oldmouse +Принудительно устанавливает режим мыши "normal tracking". В xterm\-совместимых +терминалах (например, tmux/screen). .TP .I \-k, \-\-resetsoft Восстанавливает значения команд, назначенных функциональным клавишам в @@ -76,21 +80,13 @@ termcap/terminfo. Этот ключ используется только на Задаёт файл клавиатурных команд для переопределения привязки клавиатурных комбинаций к действиям. .TP -.I \-\-nokeymap -Не загружать клавиатурные комбинации из файла, использовать определённые -в исходном коде. -.TP .I \-l файл, \-\-ftplog=файл Сохранить диалог с ftp\-сервером, а также отладочную информацию smbfs в файл file. .TP -.I \-D N, \-\-debuglevel=N -Используется только если код был скомпилирован с поддержкой -.\"LINK2" -виртуальной файловой системы smbfs -.\"SMB File System" -для установки уровня отладочных сообщений smbfs в N (0\-10). -.TP +.I \-\-nokeymap +Не загружать клавиатурные комбинации из файла, использовать определённые +в исходном коде. .TP .I \-P файл, \-\-printwd=файл По окончании работы Midnight Commander запишет последний текущий каталог @@ -109,6 +105,13 @@ Commander. псевдографических символов (в том числе в меню и экранах помощи) и отключается вывод дополнительных (избыточных) сообщений. .TP +.I \-S arg, \-\-skin +Используется для того, чтобы задать другой скин в командной +строке. Технология скинов описана в разделе +.\"LINK2" +Внешний вид\&. +.\"Skins" +.TP .I \-t, \-\-termcap Используется только в том случае, когда код был скомпилирован с S\-Lang и terminfo: в этом случае Midnight Commander использует значение @@ -143,10 +146,6 @@ modes, and able to send mouse escape sequences). .TP .I \-X, \-\-no\-x11 Не использовать X11 для получения состояния модификаторов Alt, Ctrl, Shift. -.TP -.I \-g, \-\-oldmouse -Принудительно устанавливает режим мыши "normal tracking". В xterm\-совместимых -терминалах (например, tmux/screen). .PP Первое путевое имя (path name) в командной строке (если указано) задает каталог, который будет отображаться в активной панели; второй путь \- From b3bc8569743504a8b0007d0b580c0108741cce58 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Wed, 13 Feb 2013 14:42:18 +0400 Subject: [PATCH 28/35] Adjust look'n'feel of editor options dialog window. Signed-off-by: Andrew Borodin --- src/editor/editoptions.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/editor/editoptions.c b/src/editor/editoptions.c index 0c315c72a..4ab2aeae6 100644 --- a/src/editor/editoptions.c +++ b/src/editor/editoptions.c @@ -150,6 +150,7 @@ edit_options_dialog (WDialog * h) QUICK_RADIO (3, wrap_str, &wrap_mode, NULL), QUICK_STOP_GROUPBOX, QUICK_SEPARATOR (FALSE), + QUICK_SEPARATOR (FALSE), QUICK_START_GROUPBOX (N_("Tabulation")), QUICK_CHECKBOX (N_("&Fake half tabs"), &option_fake_half_tabs, NULL), QUICK_CHECKBOX (N_("&Backspace through tabs"), &option_backspace_through_tabs, From 79ee80c2013775f97dd0e762cdfc8c9cbadf5ede Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 14 Feb 2013 14:44:35 +0300 Subject: [PATCH 29/35] Code refactoring in tests. Signed-off-by: Slava Zanko --- tests/lib/mcconfig/config_string.c | 2 +- .../search/translate_replace_glob_to_regex.c | 68 ++++++++----- tests/lib/strutil/replace__str_replace_all.c | 39 ++++---- tests/lib/utilunix__my_system-common.c | 34 +++---- tests/lib/utilunix__my_system-fork_child.c | 17 ++-- .../utilunix__my_system-fork_child_shell.c | 19 ++-- tests/lib/utilunix__my_system-fork_fail.c | 10 +- tests/lib/vfs/path_manipulations.c | 2 +- tests/src/execute__common.c | 2 +- ...ecute__execute_external_editor_or_viewer.c | 36 ++++--- ...xecute_get_external_cmd_opts_from_config.c | 30 +++--- tests/src/execute__execute_with_vfs_arg.c | 99 +++++++++---------- 12 files changed, 179 insertions(+), 179 deletions(-) diff --git a/tests/lib/mcconfig/config_string.c b/tests/lib/mcconfig/config_string.c index 0b03e2e00..e623be6a3 100644 --- a/tests/lib/mcconfig/config_string.c +++ b/tests/lib/mcconfig/config_string.c @@ -116,7 +116,7 @@ static const struct test_create_ini_file_ds "param-not_exists", NULL, NULL, - "" /* it's a bug: should be NULL. Will be fixed in another branch */ + NULL }, { /* 1. */ "test-group1", diff --git a/tests/lib/search/translate_replace_glob_to_regex.c b/tests/lib/search/translate_replace_glob_to_regex.c index 870c9807f..009df09a0 100644 --- a/tests/lib/search/translate_replace_glob_to_regex.c +++ b/tests/lib/search/translate_replace_glob_to_regex.c @@ -1,11 +1,12 @@ /* libmc - checks for processing esc sequences in replace string - Copyright (C) 2011 + Copyright (C) 2011, 2013 The Free Software Foundation, Inc. Written by: Andrew Borodin , 2011 + Slava Zanko , 2013 This file is part of the Midnight Commander. @@ -21,38 +22,60 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -*/ + */ #define TEST_SUITE_NAME "lib/search/glob" -#include +#include "tests/mctest.h" -#include - -#include "glob.c" /* for testing static functions */ +#include "glob.c" /* for testing static functions */ /* --------------------------------------------------------------------------------------------- */ -static void -test_helper_valid_data (const char *from, const char *etalon) +/* @DataSource("test_translate_replace_glob_to_regex_ds") */ +/* *INDENT-OFF* */ +static const struct test_translate_replace_glob_to_regex_ds { + const char *input_value; + const char *expected_result; +} test_translate_replace_glob_to_regex_ds[] = +{ + { + "a&a?a", + "a\\&a\\1a" + }, + { + "a\\&a?a", + "a\\&a\\1a" + }, + { + "a&a\\?a", + "a\\&a\\?a" + }, + { + "a\\&a\\?a", + "a\\&a\\?a" + }, +}; +/* *INDENT-ON* */ + +/* @Test(dataSource = "test_translate_replace_glob_to_regex_ds") */ +/* *INDENT-OFF* */ +START_PARAMETRIZED_TEST (test_translate_replace_glob_to_regex, test_translate_replace_glob_to_regex_ds) +/* *INDENT-ON* */ +{ + /* given */ GString *dest_str; - dest_str = mc_search__translate_replace_glob_to_regex (from); - fail_if (strcmp (dest_str->str, etalon), "dest_str(%s) != %s", dest_str->str, etalon); - g_string_free (dest_str, TRUE); -} + /* when */ + dest_str = mc_search__translate_replace_glob_to_regex (data->input_value); -/* --------------------------------------------------------------------------------------------- */ - -START_TEST (test_translate_replace_glob_to_regex) -{ - test_helper_valid_data ("a&a?a", "a\\&a\\1a"); - test_helper_valid_data ("a\\&a?a", "a\\&a\\1a"); - test_helper_valid_data ("a&a\\?a", "a\\&a\\?a"); - test_helper_valid_data ("a\\&a\\?a", "a\\&a\\?a"); + /* then */ + mctest_assert_str_eq (dest_str->str, data->expected_result) g_string_free (dest_str, TRUE); } -END_TEST +/* *INDENT-OFF* */ +END_PARAMETRIZED_TEST +/* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -66,7 +89,8 @@ main (void) SRunner *sr; /* Add new tests here: *************** */ - tcase_add_test (tc_core, test_translate_replace_glob_to_regex); + mctest_add_parameterized_test (tc_core, test_translate_replace_glob_to_regex, + test_translate_replace_glob_to_regex_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/lib/strutil/replace__str_replace_all.c b/tests/lib/strutil/replace__str_replace_all.c index 2742879a2..1d4662601 100644 --- a/tests/lib/strutil/replace__str_replace_all.c +++ b/tests/lib/strutil/replace__str_replace_all.c @@ -25,10 +25,8 @@ #define TEST_SUITE_NAME "/lib/strutil" -#include -#include +#include "tests/mctest.h" -#include "lib/global.h" #include "lib/strutil.h" /* --------------------------------------------------------------------------------------------- */ @@ -62,84 +60,84 @@ static const struct str_replace_all_test_ds } str_replace_all_test_ds[] = { { - /*needle not found*/ + /* 0. needle not found*/ "needle not found", "blablablabla", "1234567890", "needle not found", }, { - /* replacement is less rather that needle */ + /* 1. replacement is less rather that needle */ "some string blablablabla string", "blablablabla", "1234", "some string 1234 string", }, { - /* replacement is great rather that needle */ + /* 2. replacement is great rather that needle */ "some string bla string", "bla", "1234567890", "some string 1234567890 string", }, { - /* replace few substrings in a start of string */ + /* 3. replace few substrings in a start of string */ "blabla blabla string", "blabla", "111111111", "111111111 111111111 string", }, { - /* replace few substrings in a middle of string */ + /* 4. replace few substrings in a middle of string */ "some string blabla str blabla string", "blabla", "111111111", "some string 111111111 str 111111111 string", }, { - /* replace few substrings in an end of string */ + /* 5. replace few substrings in an end of string */ "some string blabla str blabla", "blabla", "111111111", "some string 111111111 str 111111111", }, { - /* escaped substring */ + /* 6. escaped substring */ "\\blabla blabla", "blabla", "111111111", "blabla 111111111", }, { - /* escaped substring */ + /* 7. escaped substring */ "str \\blabla blabla", "blabla", "111111111", "str blabla 111111111", }, { - /* escaped substring */ + /* 8. escaped substring */ "str \\\\\\blabla blabla", "blabla", "111111111", "str \\\\blabla 111111111", }, { - /* double-escaped substring (actually non-escaped) */ + /* 9. double-escaped substring (actually non-escaped) */ "\\\\blabla blabla", "blabla", "111111111", "\\\\111111111 111111111", }, { - /* partial substring */ + /* 10. partial substring */ "blablabla", "blabla", "111111111", "111111111bla", }, { - /* special symbols */ + /* 11. special symbols */ "bla bla", "bla", "111\t1 1\n1111", @@ -150,12 +148,11 @@ static const struct str_replace_all_test_ds /* @Test(dataSource = "str_replace_all_test_ds") */ /* *INDENT-OFF* */ -START_TEST (str_replace_all_test) +START_PARAMETRIZED_TEST (str_replace_all_test, str_replace_all_test_ds) /* *INDENT-ON* */ { /* given */ char *actual_result; - const struct str_replace_all_test_ds *data = &str_replace_all_test_ds[_i]; /* when */ actual_result = str_replace_all (data->haystack, data->needle, data->replacement); @@ -163,10 +160,9 @@ START_TEST (str_replace_all_test) /* then */ g_assert_cmpstr (actual_result, ==, data->expected_result); g_free (actual_result); - } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -183,14 +179,13 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, str_replace_all_test, 0, - sizeof (str_replace_all_test_ds) / sizeof (str_replace_all_test_ds[0])); + mctest_add_parameterized_test (tc_core, str_replace_all_test, str_replace_all_test_ds); /* *********************************** */ suite_add_tcase (s, tc_core); sr = srunner_create (s); srunner_set_log (sr, "replace__str_replace_all.log"); - srunner_run_all (sr, CK_NOFORK); + srunner_run_all (sr, CK_NORMAL); number_failed = srunner_ntests_failed (sr); srunner_free (sr); return (number_failed == 0) ? 0 : 1; diff --git a/tests/lib/utilunix__my_system-common.c b/tests/lib/utilunix__my_system-common.c index 5741591b5..1cd04b487 100644 --- a/tests/lib/utilunix__my_system-common.c +++ b/tests/lib/utilunix__my_system-common.c @@ -26,8 +26,7 @@ #include #include -#include "lib/global.h" - +#include "lib/vfs/vfs.h" /* --------------------------------------------------------------------------------------------- */ @@ -228,8 +227,8 @@ execvp__deinit (void) #define VERIFY_SIGACTION__ACT_IGNORED(_pntr) { \ struct sigaction *_act = (struct sigaction *) _pntr; \ - fail_unless (_act->sa_handler == SIG_IGN, " sa_handler should be equals to SIG_IGN"); \ - ck_assert_int_eq (_act->sa_flags, 0); \ + mctest_assert_ptr_eq (_act->sa_handler, SIG_IGN); \ + mctest_assert_int_eq (_act->sa_flags, 0); \ } #define VERIFY_SIGACTION__IS_RESTORED(oldact_idx, act_idx) { \ @@ -241,14 +240,14 @@ execvp__deinit (void) /* @Verify */ #define VERIFY_SIGACTION_CALLS() { \ - ck_assert_int_eq (sigaction_signum__captured->len, 6); \ + mctest_assert_int_eq (sigaction_signum__captured->len, 6); \ \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 0)), SIGINT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 1)), SIGQUIT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 2)), SIGTSTP); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 3)), SIGINT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 4)), SIGQUIT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 5)), SIGTSTP); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 0)), SIGINT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 1)), SIGQUIT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 2)), SIGTSTP); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 3)), SIGINT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 4)), SIGQUIT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(sigaction_signum__captured, 5)), SIGTSTP); \ \ VERIFY_SIGACTION__ACT_IGNORED(g_ptr_array_index(sigaction_act__captured, 0)); \ VERIFY_SIGACTION__ACT_IGNORED(g_ptr_array_index(sigaction_act__captured, 1)); \ @@ -274,17 +273,16 @@ execvp__deinit (void) #define VERIFY_SIGNAL_HANDLER_IS_SIG_DFL(_idx) { \ sighandler_t *tmp_handler = (sighandler_t *) g_ptr_array_index(signal_handler__captured, _idx);\ - fail_unless (tmp_handler == (sighandler_t *) SIG_DFL, \ - "signal handler should be SIG_DFL"); \ + mctest_assert_ptr_eq (tmp_handler, (sighandler_t *) SIG_DFL); \ } /* @Verify */ #define VERIFY_SIGNAL_CALLS() { \ - ck_assert_int_eq (signal_signum__captured->len, 4); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 0)), SIGINT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 1)), SIGQUIT); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 2)), SIGTSTP); \ - ck_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 3)), SIGCHLD); \ + mctest_assert_int_eq (signal_signum__captured->len, 4); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 0)), SIGINT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 1)), SIGQUIT); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 2)), SIGTSTP); \ + mctest_assert_int_eq (*((int *) g_ptr_array_index(signal_signum__captured, 3)), SIGCHLD); \ \ VERIFY_SIGNAL_HANDLER_IS_SIG_DFL (0); \ VERIFY_SIGNAL_HANDLER_IS_SIG_DFL (1); \ diff --git a/tests/lib/utilunix__my_system-fork_child.c b/tests/lib/utilunix__my_system-fork_child.c index 0de07a8f0..b9cebbe1a 100644 --- a/tests/lib/utilunix__my_system-fork_child.c +++ b/tests/lib/utilunix__my_system-fork_child.c @@ -25,10 +25,7 @@ #define TEST_SUITE_NAME "/lib/utilunix" -#include -#include - -#include "lib/global.h" +#include "tests/mctest.h" #include "lib/util.h" #include "lib/utilunix.h" @@ -49,19 +46,19 @@ START_TEST (fork_child) actual_value = my_system (0, "/bin/some-command", "some parameter"); /* then */ - ck_assert_int_eq (actual_value, 0); + mctest_assert_int_eq (actual_value, 0); VERIFY_SIGACTION_CALLS (); VERIFY_SIGNAL_CALLS (); - g_assert_cmpstr (execvp__file__captured, ==, "/bin/some-command"); - ck_assert_int_eq (execvp__args__captured->len, 2); + mctest_assert_str_eq (execvp__file__captured, "/bin/some-command"); + mctest_assert_int_eq (execvp__args__captured->len, 2); - g_assert_cmpstr (g_ptr_array_index (execvp__args__captured, 0), ==, "/bin/some-command"); - g_assert_cmpstr (g_ptr_array_index (execvp__args__captured, 1), ==, "some parameter"); + mctest_assert_str_eq (g_ptr_array_index (execvp__args__captured, 0), "/bin/some-command"); + mctest_assert_str_eq (g_ptr_array_index (execvp__args__captured, 1), "some parameter"); /* All exec* calls is mocked, so call to _exit() function with 127 status code it's a normal situation */ - ck_assert_int_eq (my_exit__status__captured, 127); + mctest_assert_int_eq (my_exit__status__captured, 127); } /* *INDENT-OFF* */ END_TEST diff --git a/tests/lib/utilunix__my_system-fork_child_shell.c b/tests/lib/utilunix__my_system-fork_child_shell.c index be4586a0d..e1931db4d 100644 --- a/tests/lib/utilunix__my_system-fork_child_shell.c +++ b/tests/lib/utilunix__my_system-fork_child_shell.c @@ -25,10 +25,7 @@ #define TEST_SUITE_NAME "/lib/utilunix" -#include -#include - -#include "lib/global.h" +#include "tests/mctest.h" #include "lib/util.h" #include "lib/utilunix.h" @@ -49,20 +46,20 @@ START_TEST (fork_child_as_shell) actual_value = my_system (EXECUTE_AS_SHELL, "/bin/shell", "some command"); /* then */ - ck_assert_int_eq (actual_value, 0); + mctest_assert_int_eq (actual_value, 0); VERIFY_SIGACTION_CALLS (); VERIFY_SIGNAL_CALLS (); - g_assert_cmpstr (execvp__file__captured, ==, "/bin/shell"); - ck_assert_int_eq (execvp__args__captured->len, 3); + mctest_assert_str_eq (execvp__file__captured, "/bin/shell"); + mctest_assert_int_eq (execvp__args__captured->len, 3); - g_assert_cmpstr (g_ptr_array_index (execvp__args__captured, 0), ==, "/bin/shell"); - g_assert_cmpstr (g_ptr_array_index (execvp__args__captured, 1), ==, "-c"); - g_assert_cmpstr (g_ptr_array_index (execvp__args__captured, 2), ==, "some command"); + mctest_assert_str_eq (g_ptr_array_index (execvp__args__captured, 0), "/bin/shell"); + mctest_assert_str_eq (g_ptr_array_index (execvp__args__captured, 1), "-c"); + mctest_assert_str_eq (g_ptr_array_index (execvp__args__captured, 2), "some command"); /* All exec* calls is mocked, so call to _exit() function with 127 status code it's a normal situation */ - ck_assert_int_eq (my_exit__status__captured, 127); + mctest_assert_int_eq (my_exit__status__captured, 127); } /* *INDENT-OFF* */ END_TEST diff --git a/tests/lib/utilunix__my_system-fork_fail.c b/tests/lib/utilunix__my_system-fork_fail.c index 319f3f1af..53a7ef56a 100644 --- a/tests/lib/utilunix__my_system-fork_fail.c +++ b/tests/lib/utilunix__my_system-fork_fail.c @@ -25,12 +25,10 @@ #define TEST_SUITE_NAME "/lib/utilunix" -#include +#include "tests/mctest.h" + #include #include -#include - -#include "lib/global.h" #include "lib/util.h" #include "lib/utilunix.h" @@ -52,11 +50,11 @@ START_TEST (fork_fail) actual_value = my_system (0, NULL, NULL); /* then */ - ck_assert_int_eq (actual_value, -1); + mctest_assert_int_eq (actual_value, -1); VERIFY_SIGACTION_CALLS (); - ck_assert_int_eq (signal_signum__captured->len, 0); + mctest_assert_int_eq (signal_signum__captured->len, 0); } /* *INDENT-OFF* */ END_TEST diff --git a/tests/lib/vfs/path_manipulations.c b/tests/lib/vfs/path_manipulations.c index fd2882916..6bc2355c0 100644 --- a/tests/lib/vfs/path_manipulations.c +++ b/tests/lib/vfs/path_manipulations.c @@ -316,7 +316,7 @@ static const struct test_vfs_path_append_vpath_ds { const char *input_path1; const char *input_path2; - const size_t expected_element_count; + const int expected_element_count; const char *expected_path; } test_vfs_path_append_vpath_ds[] = { diff --git a/tests/src/execute__common.c b/tests/src/execute__common.c index 883b30a50..a313abf86 100644 --- a/tests/src/execute__common.c +++ b/tests/src/execute__common.c @@ -26,7 +26,7 @@ #include "lib/widget.h" #include "lib/strutil.h" -#include "lib/vfs/path.h" +#include "lib/vfs/vfs.h" #include "src/vfs/local/local.c" #include "src/execute.h" diff --git a/tests/src/execute__execute_external_editor_or_viewer.c b/tests/src/execute__execute_external_editor_or_viewer.c index 0d4fe1d15..573aca4d7 100644 --- a/tests/src/execute__execute_external_editor_or_viewer.c +++ b/tests/src/execute__execute_external_editor_or_viewer.c @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/src" -#include - -#include - -#include "lib/global.h" +#include "tests/mctest.h" #include "execute__common.c" @@ -158,23 +154,25 @@ START_TEST (do_open_external_editor_or_viewer) /* then */ /* check call to execute_get_external_cmd_opts_from_config() */ - g_assert_cmpstr (execute_external_cmd_opts__command__captured, ==, "editor_or_viewer"); - ck_assert_int_eq (vfs_path_cmp - (execute_external_cmd_opts__filename_vpath__captured, filename_vpath), 0); - ck_assert_int_eq (execute_external_cmd_opts__start_line__captured, 123); + mctest_assert_str_eq (execute_external_cmd_opts__command__captured, "editor_or_viewer"); + mctest_assert_int_eq (vfs_path_equal + (execute_external_cmd_opts__filename_vpath__captured, filename_vpath), + TRUE); + mctest_assert_int_eq (execute_external_cmd_opts__start_line__captured, 123); /* check call to do_executev() */ - g_assert_cmpstr (do_executev__lc_shell__captured, ==, "editor_or_viewer"); - ck_assert_int_eq (do_executev__flags__captured, EXECUTE_INTERNAL); - ck_assert_int_eq (do_executev__argv__captured->len, 7); + mctest_assert_str_eq (do_executev__lc_shell__captured, "editor_or_viewer"); + mctest_assert_int_eq (do_executev__flags__captured, EXECUTE_INTERNAL); + mctest_assert_int_eq (do_executev__argv__captured->len, 7); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 0), ==, "param 1 with spaces"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 1), ==, "param 2"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 2), ==, "-a"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 3), ==, "-b"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 4), ==, "-cdef"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 5), ==, "/path/to/file.txt"); - g_assert_cmpstr (g_ptr_array_index (do_executev__argv__captured, 6), ==, "+123"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 0), + "param 1 with spaces"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 1), "param 2"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 2), "-a"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 3), "-b"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 4), "-cdef"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 5), "/path/to/file.txt"); + mctest_assert_str_eq (g_ptr_array_index (do_executev__argv__captured, 6), "+123"); vfs_path_free (filename_vpath); } diff --git a/tests/src/execute__execute_get_external_cmd_opts_from_config.c b/tests/src/execute__execute_get_external_cmd_opts_from_config.c index 8bdf3883b..f1d208615 100644 --- a/tests/src/execute__execute_get_external_cmd_opts_from_config.c +++ b/tests/src/execute__execute_get_external_cmd_opts_from_config.c @@ -25,14 +25,11 @@ #define TEST_SUITE_NAME "/src" -#include +#include "tests/mctest.h" -#include - -#include "lib/global.h" #include "lib/mcconfig.h" #include "lib/strutil.h" -#include "lib/vfs/path.h" +#include "lib/vfs/vfs.h" #include "src/vfs/local/local.c" char *execute_get_external_cmd_opts_from_config (const char *command, @@ -150,11 +147,10 @@ static const struct check_subtitute_ds /* @Test(dataSource = "check_subtitute_ds") */ /* *INDENT-OFF* */ -START_TEST (check_if_filename_and_lineno_will_be_subtituted) +START_PARAMETRIZED_TEST (check_if_filename_and_lineno_will_be_subtituted, check_subtitute_ds) /* *INDENT-ON* */ { /* given */ - const struct check_subtitute_ds *data = &check_subtitute_ds[_i]; char *actual_result; vfs_path_t *filename_vpath; @@ -169,21 +165,21 @@ START_TEST (check_if_filename_and_lineno_will_be_subtituted) /* then */ /* check returned value */ - g_assert_cmpstr (actual_result, ==, data->expected_result); + mctest_assert_str_eq (actual_result, data->expected_result); /* check calls to mc_config_get_string() function */ - g_assert_cmpstr (g_ptr_array_index (mc_config_get_string__group__captured, 0), ==, - CONFIG_EXT_EDITOR_VIEWER_SECTION); - g_assert_cmpstr (g_ptr_array_index (mc_config_get_string__param__captured, 0), ==, - data->app_name); - g_assert_cmpstr (g_ptr_array_index (mc_config_get_string__default_value__captured, 0), ==, - NULL); + mctest_assert_str_eq (g_ptr_array_index (mc_config_get_string__group__captured, 0), + CONFIG_EXT_EDITOR_VIEWER_SECTION); + mctest_assert_str_eq (g_ptr_array_index (mc_config_get_string__param__captured, 0), + data->app_name); + mctest_assert_str_eq (g_ptr_array_index (mc_config_get_string__default_value__captured, 0), + NULL); vfs_path_free (filename_vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -200,8 +196,8 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, check_if_filename_and_lineno_will_be_subtituted, 0, - sizeof (check_subtitute_ds) / sizeof (check_subtitute_ds[0])); + mctest_add_parameterized_test (tc_core, check_if_filename_and_lineno_will_be_subtituted, + check_subtitute_ds); /* *********************************** */ suite_add_tcase (s, tc_core); diff --git a/tests/src/execute__execute_with_vfs_arg.c b/tests/src/execute__execute_with_vfs_arg.c index 052786ab3..d14dec6de 100644 --- a/tests/src/execute__execute_with_vfs_arg.c +++ b/tests/src/execute__execute_with_vfs_arg.c @@ -25,11 +25,7 @@ #define TEST_SUITE_NAME "/src" -#include - -#include - -#include "lib/global.h" +#include "tests/mctest.h" #include "execute__common.c" @@ -53,13 +49,12 @@ static const struct the_file_is_local_ds /* @Test(dataSource = "the_file_is_local_ds") */ /* *INDENT-OFF* */ -START_TEST (the_file_is_local) +START_PARAMETRIZED_TEST (the_file_is_local, the_file_is_local_ds) /* *INDENT-ON* */ { /* given */ vfs_path_t *filename_vpath; - const char *input_path = the_file_is_local_ds[_i].input_path; - filename_vpath = vfs_path_from_str (input_path); + filename_vpath = vfs_path_from_str (data->input_path); vfs_file_is_local__return_value = TRUE; @@ -67,26 +62,26 @@ START_TEST (the_file_is_local) execute_with_vfs_arg ("cmd_for_local_file", filename_vpath); /* then */ - g_assert_cmpstr (do_execute__lc_shell__captured, ==, "cmd_for_local_file"); - g_assert_cmpstr (do_execute__command__captured, ==, input_path); + mctest_assert_str_eq (do_execute__lc_shell__captured, "cmd_for_local_file"); + mctest_assert_str_eq (do_execute__command__captured, data->input_path); - ck_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); + mctest_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); { const vfs_path_t *tmp_vpath; - tmp_vpath = (input_path == NULL) ? vfs_get_raw_current_dir () : filename_vpath; - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), tmp_vpath), - 0); + tmp_vpath = (data->input_path == NULL) ? vfs_get_raw_current_dir () : filename_vpath; + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), + tmp_vpath), TRUE); } - ck_assert_int_eq (do_execute__flags__captured, EXECUTE_INTERNAL); + mctest_assert_int_eq (do_execute__flags__captured, EXECUTE_INTERNAL); fail_unless (mc_getlocalcopy__pathname_vpath__captured == NULL, "\nFunction mc_getlocalcopy() shouldn't be called!"); vfs_path_free (filename_vpath); } /* *INDENT-OFF* */ -END_TEST +END_PARAMETRIZED_TEST /* *INDENT-ON* */ /* --------------------------------------------------------------------------------------------- */ @@ -106,14 +101,14 @@ START_TEST (the_file_is_remote_but_empty) execute_with_vfs_arg ("cmd_for_remote_file", filename_vpath); /* then */ - g_assert_cmpstr (do_execute__lc_shell__captured, ==, NULL); - g_assert_cmpstr (do_execute__command__captured, ==, NULL); + mctest_assert_str_eq (do_execute__lc_shell__captured, NULL); + mctest_assert_str_eq (do_execute__command__captured, NULL); - ck_assert_int_eq (vfs_file_is_local__vpath__captured->len, 2); + mctest_assert_int_eq (vfs_file_is_local__vpath__captured->len, 2); - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), - vfs_get_raw_current_dir ()), 0); + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), + vfs_get_raw_current_dir ()), TRUE); fail_unless (g_ptr_array_index (vfs_file_is_local__vpath__captured, 1) == NULL, "\nParameter for second call to vfs_file_is_local() should be NULL!"); fail_unless (mc_getlocalcopy__pathname_vpath__captured == NULL, @@ -144,20 +139,21 @@ START_TEST (the_file_is_remote_fail_to_create_local_copy) execute_with_vfs_arg ("cmd_for_remote_file", filename_vpath); /* then */ - g_assert_cmpstr (do_execute__lc_shell__captured, ==, NULL); - g_assert_cmpstr (do_execute__command__captured, ==, NULL); + mctest_assert_str_eq (do_execute__lc_shell__captured, NULL); + mctest_assert_str_eq (do_execute__command__captured, NULL); - ck_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); + mctest_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), filename_vpath), - 0); + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), + filename_vpath), TRUE); - ck_assert_int_eq (vfs_path_cmp (mc_getlocalcopy__pathname_vpath__captured, filename_vpath), 0); + mctest_assert_int_eq (vfs_path_equal + (mc_getlocalcopy__pathname_vpath__captured, filename_vpath), TRUE); - g_assert_cmpstr (message_title__captured, ==, _("Error")); - g_assert_cmpstr (message_text__captured, ==, - _("Cannot fetch a local copy of /ftp://some.host/editme.txt")); + mctest_assert_str_eq (message_title__captured, _("Error")); + mctest_assert_str_eq (message_text__captured, + _("Cannot fetch a local copy of /ftp://some.host/editme.txt")); vfs_path_free (filename_vpath); @@ -187,29 +183,31 @@ START_TEST (the_file_is_remote) execute_with_vfs_arg ("cmd_for_remote_file", filename_vpath); /* then */ - g_assert_cmpstr (do_execute__lc_shell__captured, ==, "cmd_for_remote_file"); - g_assert_cmpstr (do_execute__command__captured, ==, "/tmp/blabla-editme.txt"); + mctest_assert_str_eq (do_execute__lc_shell__captured, "cmd_for_remote_file"); + mctest_assert_str_eq (do_execute__command__captured, "/tmp/blabla-editme.txt"); - ck_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); + mctest_assert_int_eq (vfs_file_is_local__vpath__captured->len, 1); - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), filename_vpath), - 0); + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (vfs_file_is_local__vpath__captured, 0), + filename_vpath), TRUE); - ck_assert_int_eq (vfs_path_cmp (mc_getlocalcopy__pathname_vpath__captured, filename_vpath), 0); + mctest_assert_int_eq (vfs_path_equal + (mc_getlocalcopy__pathname_vpath__captured, filename_vpath), TRUE); - ck_assert_int_eq (mc_stat__vpath__captured->len, 2); + mctest_assert_int_eq (mc_stat__vpath__captured->len, 2); - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (mc_stat__vpath__captured, 0), local_vpath), 0); - ck_assert_int_eq (vfs_path_cmp - (g_ptr_array_index (mc_stat__vpath__captured, 0), - g_ptr_array_index (mc_stat__vpath__captured, 1)), 0); + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (mc_stat__vpath__captured, 0), local_vpath), TRUE); + mctest_assert_int_eq (vfs_path_equal + (g_ptr_array_index (mc_stat__vpath__captured, 0), + g_ptr_array_index (mc_stat__vpath__captured, 1)), TRUE); - ck_assert_int_eq (vfs_path_cmp (mc_ungetlocalcopy__pathname_vpath__captured, filename_vpath), - 0); + mctest_assert_int_eq (vfs_path_equal + (mc_ungetlocalcopy__pathname_vpath__captured, filename_vpath), TRUE); - ck_assert_int_eq (vfs_path_cmp (mc_ungetlocalcopy__local_vpath__captured, local_vpath), 0); + mctest_assert_int_eq (vfs_path_equal (mc_ungetlocalcopy__local_vpath__captured, local_vpath), + TRUE); vfs_path_free (filename_vpath); vfs_path_free (local_vpath); @@ -232,8 +230,7 @@ main (void) tcase_add_checked_fixture (tc_core, setup, teardown); /* Add new tests here: *************** */ - tcase_add_loop_test (tc_core, the_file_is_local, 0, - sizeof (the_file_is_local_ds) / sizeof (the_file_is_local_ds[0])); + mctest_add_parameterized_test (tc_core, the_file_is_local, the_file_is_local_ds); tcase_add_test (tc_core, the_file_is_remote_but_empty); tcase_add_test (tc_core, the_file_is_remote_fail_to_create_local_copy); tcase_add_test (tc_core, the_file_is_remote); From a85fc3367e4e821e7585f52b3a04715f9d6c1b1a Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 24 Feb 2013 09:57:59 +0400 Subject: [PATCH 30/35] Sync with gnulib 62bb7a8bf95807d6339e1e17fc0d21c319b280a2. * src/filemanager/lib/mountlist.c: port to HP NonStop. (hasmntopt) [!HAVE_HASMNTOPT]: New function. (MNT_IGNORE) [MNTOPT_IGNORE]: Use it. Signed-off-by: Andrew Borodin --- src/filemanager/mountlist.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/filemanager/mountlist.c b/src/filemanager/mountlist.c index 67339f9a2..f06a6ac1f 100644 --- a/src/filemanager/mountlist.c +++ b/src/filemanager/mountlist.c @@ -160,8 +160,12 @@ #include #endif +#ifndef HAVE_HASMNTOPT +#define hasmntopt(mnt, opt) ((char *) 0) +#endif + #undef MNT_IGNORE -#if defined MNTOPT_IGNORE && defined HAVE_HASMNTOPT +#ifdef MNTOPT_IGNORE #define MNT_IGNORE(M) hasmntopt ((M), MNTOPT_IGNORE) #else #define MNT_IGNORE(M) 0 From 18cc9ac0ddae467360de6406ad9ff2272472ca30 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 28 Feb 2013 10:49:14 +0400 Subject: [PATCH 31/35] (edit_translate_key): move from editkeys.c into editwidget.c ...and remove editkeys.c since it is empty. Signed-off-by: Andrew Borodin --- src/editor/Makefile.am | 18 +++- src/editor/edit-impl.h | 1 - src/editor/editkeys.c | 197 ---------------------------------------- src/editor/editwidget.c | 143 +++++++++++++++++++++++++++-- 4 files changed, 147 insertions(+), 212 deletions(-) delete mode 100644 src/editor/editkeys.c diff --git a/src/editor/Makefile.am b/src/editor/Makefile.am index abe0ac12b..8f013597a 100644 --- a/src/editor/Makefile.am +++ b/src/editor/Makefile.am @@ -7,11 +7,19 @@ noinst_LTLIBRARIES = endif libedit_la_SOURCES = \ - bookmark.c edit.c editcmd.c editwidget.c editwidget.h \ - editdraw.c editkeys.c \ - editmenu.c editoptions.c edit-impl.h edit.h \ - syntax.c wordproc.c \ - choosesyntax.c etags.c etags.h editcmd_dialogs.c editcmd_dialogs.h + bookmark.c \ + choosesyntax.c \ + edit.c edit.h \ + edit-impl.h \ + editcmd.c \ + editcmd_dialogs.c editcmd_dialogs.h \ + editdraw.c \ + editmenu.c \ + editoptions.c \ + editwidget.c editwidget.h \ + etags.c etags.h \ + syntax.c \ + wordproc.c if USE_ASPELL if HAVE_GMODULE diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index 4d04bb895..0cf7e52c8 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -181,7 +181,6 @@ void edit_menu_cmd (WDialog * h); void user_menu (WEdit * edit, const char *menu_file, int selected_entry); void edit_init_menu (struct WMenuBar *menubar); void edit_save_mode_cmd (void); -gboolean edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch); int edit_get_byte (const WEdit * edit, off_t byte_index); int edit_get_utf (const WEdit * edit, off_t byte_index, int *char_width); long edit_count_lines (const WEdit * edit, off_t current, off_t upto); diff --git a/src/editor/editkeys.c b/src/editor/editkeys.c deleted file mode 100644 index 45cacec1a..000000000 --- a/src/editor/editkeys.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - Editor key translation. - - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2011, 2012 - The Free Software Foundation, Inc. - - Written by: - Paul Sheer, 1996, 1997 - Andrew Borodin 2012 - - This file is part of the Midnight Commander. - - The Midnight Commander is free software: you can redistribute it - and/or modify it under the terms of the GNU General Public License as - published by the Free Software Foundation, either version 3 of the License, - or (at your option) any later version. - - The Midnight Commander is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - */ - -/** \file - * \brief Source: editor key translation - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "lib/global.h" -#include "lib/tty/tty.h" /* keys */ -#include "lib/tty/key.h" /* KEY_M_SHIFT */ -#include "lib/strutil.h" /* str_isutf8 () */ -#include "lib/util.h" /* is_printable() */ -#ifdef HAVE_CHARSET -#include "lib/charsets.h" -#endif - -#include "edit-impl.h" -#include "editwidget.h" /* WEdit */ -#include "editcmd_dialogs.h" - -#include "src/keybind-defaults.h" /* keybind_lookup_keymap_command() */ - -/*** global variables ****************************************************************************/ - -/*** file scope macro definitions ****************************************************************/ - -/*** file scope type declarations ****************************************************************/ - -/*** file scope variables ************************************************************************/ - -/*** file scope functions ************************************************************************/ -/* --------------------------------------------------------------------------------------------- */ - -/* --------------------------------------------------------------------------------------------- */ -/*** public functions ****************************************************************************/ -/* --------------------------------------------------------------------------------------------- */ - -/* - * Translate the keycode into either 'command' or 'char_for_insertion'. - * 'command' is one of the editor commands from cmddef.h. - */ -gboolean -edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch) -{ - unsigned long command = (unsigned long) CK_InsertChar; - int char_for_insertion = -1; - - /* an ordinary insertable character */ - if (!edit->extmod && x_key < 256) - { -#ifndef HAVE_CHARSET - if (is_printable (x_key)) - { - char_for_insertion = x_key; - goto fin; - } -#else - int c; - - if (edit->charpoint >= 4) - { - edit->charpoint = 0; - edit->charbuf[edit->charpoint] = '\0'; - } - if (edit->charpoint < 4) - { - edit->charbuf[edit->charpoint++] = x_key; - edit->charbuf[edit->charpoint] = '\0'; - } - - /* input from 8-bit locale */ - if (!mc_global.utf8_display) - { - /* source in 8-bit codeset */ - c = convert_from_input_c (x_key); - - if (is_printable (c)) - { - if (!edit->utf8) - char_for_insertion = c; - else - char_for_insertion = convert_from_8bit_to_utf_c2 ((unsigned char) x_key); - goto fin; - } - } - else - { - /* UTF-8 locale */ - int res; - - res = str_is_valid_char (edit->charbuf, edit->charpoint); - if (res < 0 && res != -2) - { - edit->charpoint = 0; /* broken multibyte char, skip */ - goto fin; - } - - if (edit->utf8) - { - /* source in UTF-8 codeset */ - if (res < 0) - { - char_for_insertion = x_key; - goto fin; - } - - edit->charbuf[edit->charpoint] = '\0'; - edit->charpoint = 0; - if (g_unichar_isprint (g_utf8_get_char (edit->charbuf))) - { - char_for_insertion = x_key; - goto fin; - } - } - else - { - /* 8-bit source */ - if (res < 0) - { - /* not finised multibyte input (in meddle multibyte utf-8 char) */ - goto fin; - } - - if (g_unichar_isprint (g_utf8_get_char (edit->charbuf))) - { - c = convert_from_utf_to_current (edit->charbuf); - edit->charbuf[0] = '\0'; - edit->charpoint = 0; - char_for_insertion = c; - goto fin; - } - - /* unprinteble utf input, skip it */ - edit->charbuf[0] = '\0'; - edit->charpoint = 0; - } - } -#endif /* HAVE_CHARSET */ - } - - /* Commands specific to the key emulation */ - if (edit->extmod) - { - edit->extmod = FALSE; - command = keybind_lookup_keymap_command (editor_x_map, x_key); - } - else - command = keybind_lookup_keymap_command (editor_map, x_key); - - if (command == CK_IgnoreKey) - command = CK_InsertChar; - - fin: - *cmd = (int) command; /* FIXME */ - *ch = char_for_insertion; - - return !(command == (unsigned long) CK_InsertChar && char_for_insertion == -1); -} - -/* --------------------------------------------------------------------------------------------- */ diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index 6061403d4..808046c29 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -2,12 +2,12 @@ Editor initialisation and callback handler. Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2011, 2012 + 2007, 2011, 2012, 2013 The Free Software Foundation, Inc. Written by: Paul Sheer, 1996, 1997 - Andrew Borodin 2012 + Andrew Borodin 2012, 2013 This file is part of the Midnight Commander. @@ -33,15 +33,12 @@ #include -#include -#include -#include -#include -#include #include #include -#include #include +#include +#include +#include #include "lib/global.h" @@ -54,8 +51,11 @@ #include "lib/widget.h" #include "lib/mcconfig.h" #include "lib/event.h" /* mc_event_raise() */ +#ifdef HAVE_CHARSET +#include "lib/charsets.h" +#endif -#include "src/keybind-defaults.h" +#include "src/keybind-defaults.h" /* keybind_lookup_keymap_command() */ #include "src/setup.h" /* home_dir */ #include "src/filemanager/cmd.h" /* view_other_cmd(), save_setup_cmd() */ #include "src/learn.h" /* learn_keys() */ @@ -809,6 +809,131 @@ edit_dialog_command_execute (WDialog * h, unsigned long command) return ret; } +/* --------------------------------------------------------------------------------------------- */ +/* + * Translate the keycode into either 'command' or 'char_for_insertion'. + * 'command' is one of the editor commands from cmddef.h. + */ + +static gboolean +edit_translate_key (WEdit * edit, long x_key, int *cmd, int *ch) +{ + unsigned long command = (unsigned long) CK_InsertChar; + int char_for_insertion = -1; + + /* an ordinary insertable character */ + if (!edit->extmod && x_key < 256) + { +#ifndef HAVE_CHARSET + if (is_printable (x_key)) + { + char_for_insertion = x_key; + goto fin; + } +#else + int c; + + if (edit->charpoint >= 4) + { + edit->charpoint = 0; + edit->charbuf[edit->charpoint] = '\0'; + } + if (edit->charpoint < 4) + { + edit->charbuf[edit->charpoint++] = x_key; + edit->charbuf[edit->charpoint] = '\0'; + } + + /* input from 8-bit locale */ + if (!mc_global.utf8_display) + { + /* source in 8-bit codeset */ + c = convert_from_input_c (x_key); + + if (is_printable (c)) + { + if (!edit->utf8) + char_for_insertion = c; + else + char_for_insertion = convert_from_8bit_to_utf_c2 ((unsigned char) x_key); + goto fin; + } + } + else + { + /* UTF-8 locale */ + int res; + + res = str_is_valid_char (edit->charbuf, edit->charpoint); + if (res < 0 && res != -2) + { + edit->charpoint = 0; /* broken multibyte char, skip */ + goto fin; + } + + if (edit->utf8) + { + /* source in UTF-8 codeset */ + if (res < 0) + { + char_for_insertion = x_key; + goto fin; + } + + edit->charbuf[edit->charpoint] = '\0'; + edit->charpoint = 0; + if (g_unichar_isprint (g_utf8_get_char (edit->charbuf))) + { + char_for_insertion = x_key; + goto fin; + } + } + else + { + /* 8-bit source */ + if (res < 0) + { + /* not finised multibyte input (in meddle multibyte utf-8 char) */ + goto fin; + } + + if (g_unichar_isprint (g_utf8_get_char (edit->charbuf))) + { + c = convert_from_utf_to_current (edit->charbuf); + edit->charbuf[0] = '\0'; + edit->charpoint = 0; + char_for_insertion = c; + goto fin; + } + + /* unprinteble utf input, skip it */ + edit->charbuf[0] = '\0'; + edit->charpoint = 0; + } + } +#endif /* HAVE_CHARSET */ + } + + /* Commands specific to the key emulation */ + if (edit->extmod) + { + edit->extmod = FALSE; + command = keybind_lookup_keymap_command (editor_x_map, x_key); + } + else + command = keybind_lookup_keymap_command (editor_map, x_key); + + if (command == CK_IgnoreKey) + command = CK_InsertChar; + + fin: + *cmd = (int) command; /* FIXME */ + *ch = char_for_insertion; + + return !(command == (unsigned long) CK_InsertChar && char_for_insertion == -1); +} + + /* --------------------------------------------------------------------------------------------- */ static inline void From 2254b24008ffe819dc5a20ff6247721461565c46 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Thu, 28 Feb 2013 11:07:12 +0400 Subject: [PATCH 32/35] Refactoring: use GString instead of "struct selection". Signed-off-by: Andrew Borodin --- src/editor/editcmd.c | 33 +++++++++++++-------------------- src/editor/editcmd_dialogs.c | 4 ++-- src/editor/editcmd_dialogs.h | 8 +------- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c index 4a221aa34..ba120bb88 100644 --- a/src/editor/editcmd.c +++ b/src/editor/editcmd.c @@ -1203,7 +1203,7 @@ edit_collect_completions_get_current_word (WEdit * edit, mc_search_t * srch, off static gsize edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len, - char *match_expr, struct selection *compl, gsize * num) + char *match_expr, GString ** compl, gsize * num) { gsize len = 0; gsize max_len = 0; @@ -1267,14 +1267,12 @@ edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len, for (i = 0; i < *num; i++) { if (strncmp - ((char *) &compl[i].text[word_len], - (char *) &temp->str[word_len], max (len, compl[i].len) - word_len) == 0) + ((char *) &compl[i]->str[word_len], + (char *) &temp->str[word_len], max (len, compl[i]->len) - word_len) == 0) { - struct selection this = compl[i]; + GString *this = compl[i]; for (++i; i < *num; i++) - { compl[i - 1] = compl[i]; - } compl[*num - 1] = this; skip = 1; break; /* skip it, already added */ @@ -1285,11 +1283,9 @@ edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len, if (*num == MAX_WORD_COMPLETIONS) { - g_free (compl[0].text); + g_string_free (compl[0], TRUE); for (i = 1; i < *num; i++) - { compl[i - 1] = compl[i]; - } (*num)--; } #ifdef HAVE_CHARSET @@ -1303,9 +1299,7 @@ edit_collect_completions (WEdit * edit, off_t word_start, gsize word_len, g_string_free (recoded, TRUE); } #endif - compl[*num].text = g_strndup (temp->str, temp->len); - compl[*num].len = temp->len; - (*num)++; + compl[(*num)++] = g_string_new_len (temp->str, temp->len); start += len; /* note the maximal length needed for the completion dialog */ @@ -3274,7 +3268,7 @@ edit_complete_word_cmd (WEdit * edit) off_t word_start = 0; unsigned char *bufpos; char *match_expr; - struct selection compl[MAX_WORD_COMPLETIONS]; /* completions */ + GString *compl[MAX_WORD_COMPLETIONS]; /* completions */ /* search start of word to be completed */ if (!edit_find_word_start (edit, &word_start, &word_len)) @@ -3292,16 +3286,16 @@ edit_complete_word_cmd (WEdit * edit) /* collect the possible completions */ /* start search from begin to end of file */ max_len = - edit_collect_completions (edit, word_start, word_len, match_expr, - (struct selection *) &compl, &num_compl); + edit_collect_completions (edit, word_start, word_len, match_expr, (GString **) &compl, + &num_compl); if (num_compl > 0) { /* insert completed word if there is only one match */ if (num_compl == 1) { - for (i = word_len; i < compl[0].len; i++) - edit_insert (edit, *(compl[0].text + i)); + for (i = word_len; i < compl[0]->len; i++) + edit_insert (edit, *(compl[0]->str + i)); } /* more than one possible completion => ask the user */ else @@ -3312,15 +3306,14 @@ edit_complete_word_cmd (WEdit * edit) /*tty_beep (); */ /* let the user select the preferred completion */ - editcmd_dialog_completion_show (edit, max_len, word_len, - (struct selection *) &compl, num_compl); + editcmd_dialog_completion_show (edit, max_len, word_len, (GString **) &compl, num_compl); } } g_free (match_expr); /* release memory before return */ for (i = 0; i < num_compl; i++) - g_free (compl[i].text); + g_string_free (compl[i], TRUE); } /* --------------------------------------------------------------------------------------------- */ diff --git a/src/editor/editcmd_dialogs.c b/src/editor/editcmd_dialogs.c index e70620153..1443c07e1 100644 --- a/src/editor/editcmd_dialogs.c +++ b/src/editor/editcmd_dialogs.c @@ -338,7 +338,7 @@ editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c void editcmd_dialog_completion_show (WEdit * edit, int max_len, int word_len, - struct selection *compl, int num_compl) + GString ** compl, int num_compl) { int start_x, start_y, offset, i; @@ -382,7 +382,7 @@ editcmd_dialog_completion_show (WEdit * edit, int max_len, int word_len, /* fill the listbox with the completions */ for (i = num_compl - 1; i >= 0; i--) /* reverse order */ - listbox_add_item (compl_list, LISTBOX_APPEND_AT_END, 0, (char *) compl[i].text, NULL); + listbox_add_item (compl_list, LISTBOX_APPEND_AT_END, 0, (char *) compl[i]->str, NULL); /* pop up the dialog and apply the choosen completion */ if (run_dlg (compl_dlg) == B_ENTER) diff --git a/src/editor/editcmd_dialogs.h b/src/editor/editcmd_dialogs.h index 2d06e62c9..24b9008fd 100644 --- a/src/editor/editcmd_dialogs.h +++ b/src/editor/editcmd_dialogs.h @@ -15,12 +15,6 @@ struct etags_hash_struct; /*** structures declarations (and typedefs of structures)*****************************************/ -struct selection -{ - gchar *text; - gsize len; -}; - /*** global variables defined in .c file *********************************************************/ /*** declarations of public functions ************************************************************/ @@ -31,7 +25,7 @@ gboolean editcmd_dialog_search_show (WEdit * edit); int editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean cancel); -void editcmd_dialog_completion_show (WEdit *, int, int, struct selection *, int); +void editcmd_dialog_completion_show (WEdit *, int, int, GString **, int); void editcmd_dialog_select_definition_show (WEdit *, char *, int, int, struct etags_hash_struct *, int); From 705afe88c0332317bedc0615fa851dd383aae9b3 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sat, 2 Mar 2013 16:33:21 +0400 Subject: [PATCH 33/35] (mc_config_new_or_override_file): minor optimization. Signed-off-by: Andrew Borodin --- lib/mcconfig/common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mcconfig/common.c b/lib/mcconfig/common.c index ea708df89..6deade237 100644 --- a/lib/mcconfig/common.c +++ b/lib/mcconfig/common.c @@ -58,29 +58,31 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path, ssize_t cur_written; vfs_path_t *ini_vpath; - ini_vpath = vfs_path_from_str (ini_path); data = g_key_file_to_data (mc_config->handle, &len, NULL); if (!exist_file (ini_path)) { ret = g_file_set_contents (ini_path, data, len, error); g_free (data); - vfs_path_free (ini_vpath); return ret; } + mc_util_make_backup_if_possible (ini_path, "~"); + ini_vpath = vfs_path_from_str (ini_path); fd = mc_open (ini_vpath, O_WRONLY | O_TRUNC, 0); + vfs_path_free (ini_vpath); + if (fd == -1) { g_propagate_error (error, g_error_new (MC_ERROR, 0, "%s", unix_error_string (errno))); g_free (data); - vfs_path_free (ini_vpath); return FALSE; } for (written_data = data, total_written = len; (cur_written = mc_write (fd, (const void *) written_data, total_written)) > 0; - written_data += cur_written, total_written -= cur_written); + written_data += cur_written, total_written -= cur_written) + ; mc_close (fd); g_free (data); @@ -88,12 +90,10 @@ mc_config_new_or_override_file (mc_config_t * mc_config, const gchar * ini_path, { mc_util_restore_from_backup_if_possible (ini_path, "~"); g_propagate_error (error, g_error_new (MC_ERROR, 0, "%s", unix_error_string (errno))); - vfs_path_free (ini_vpath); return FALSE; } mc_util_unlink_backup_if_possible (ini_path, "~"); - vfs_path_free (ini_vpath); return TRUE; } From ff2483e4b3e2aff12f1b7ec9b2c4f89844971a04 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 4 Mar 2013 16:51:44 +0400 Subject: [PATCH 34/35] Rename keymap files to be with .keymap suffix. Signed-off-by: Andrew Borodin --- doc/keybind-migration.txt | 2 +- misc/Makefile.am | 4 ++-- misc/{mc.keymap.default => mc.default.keymap} | 0 misc/{mc.keymap.emacs => mc.emacs.keymap} | 0 misc/mc.keymap | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename misc/{mc.keymap.default => mc.default.keymap} (100%) rename misc/{mc.keymap.emacs => mc.emacs.keymap} (100%) diff --git a/doc/keybind-migration.txt b/doc/keybind-migration.txt index 2cda08ce1..cf913b535 100644 --- a/doc/keybind-migration.txt +++ b/doc/keybind-migration.txt @@ -1,4 +1,4 @@ -This file describes how keybind names used in mc.keymap.* files +This file describes how keybind names used in mc.*.keymap files are changed in 4.8.* releases. +---------------------------------+-------------------------+-----------------------------------------+ diff --git a/misc/Makefile.am b/misc/Makefile.am index fa78487cf..870a164bd 100644 --- a/misc/Makefile.am +++ b/misc/Makefile.am @@ -16,8 +16,8 @@ LIBFILES_CONST = \ mcedit.menu \ filehighlight.ini \ mc.keymap \ - mc.keymap.default \ - mc.keymap.emacs \ + mc.default.keymap \ + mc.emacs.keymap \ mc.menu \ mc.menu.sr diff --git a/misc/mc.keymap.default b/misc/mc.default.keymap similarity index 100% rename from misc/mc.keymap.default rename to misc/mc.default.keymap diff --git a/misc/mc.keymap.emacs b/misc/mc.emacs.keymap similarity index 100% rename from misc/mc.keymap.emacs rename to misc/mc.emacs.keymap diff --git a/misc/mc.keymap b/misc/mc.keymap index f73fea290..247202227 120000 --- a/misc/mc.keymap +++ b/misc/mc.keymap @@ -1 +1 @@ -mc.keymap.default \ No newline at end of file +mc.default.keymap \ No newline at end of file From 86a9627187cfe46bc135f2eca21eddb2baf03690 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 12 Mar 2013 13:31:40 +0400 Subject: [PATCH 35/35] Update all po/*.po files. Signed-off-by: Andrew Borodin --- po/az.po | 10 +- po/be.po | 14 +-- po/bg.po | 10 +- po/ca.po | 10 +- po/cs.po | 10 +- po/da.po | 10 +- po/de.po | 10 +- po/de_CH.po | 10 +- po/el.po | 16 +-- po/eo.po | 18 +-- po/es.po | 18 +-- po/et.po | 10 +- po/eu.po | 16 +-- po/fa.po | 10 +- po/fi.po | 10 +- po/fi_FI.po | 10 +- po/fr.po | 10 +- po/gl.po | 20 +-- po/hr.po | 10 +- po/hu.po | 14 +-- po/ia.po | 10 +- po/id.po | 10 +- po/it.po | 12 +- po/it_IT.po | 10 +- po/ja.po | 10 +- po/ka.po | 10 +- po/ko.po | 10 +- po/lt.po | 10 +- po/lv.po | 10 +- po/mc.pot | 350 ++++++++++++++++++++++++++-------------------------- po/mn.po | 10 +- po/nb.po | 10 +- po/nl.po | 16 +-- po/pl.po | 18 +-- po/pt.po | 14 +-- po/pt_BR.po | 10 +- po/ro.po | 10 +- po/ru.po | 67 ++++------ po/sk.po | 10 +- po/sl.po | 10 +- po/sr.po | 10 +- po/sv.po | 10 +- po/sv_SE.po | 10 +- po/ta.po | 10 +- po/tr.po | 10 +- po/uk.po | 14 +-- po/vi.po | 10 +- po/wa.po | 10 +- po/zh_CN.po | 16 +-- po/zh_TW.po | 10 +- 50 files changed, 476 insertions(+), 497 deletions(-) diff --git a/po/az.po b/po/az.po index d399656a9..ae9b60e21 100644 --- a/po/az.po +++ b/po/az.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2486,11 +2486,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3787,7 +3787,7 @@ msgstr "" "%3$s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/be.po b/po/be.po index fd38452a6..07cdc15d3 100644 --- a/po/be.po +++ b/po/be.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Павал Клёк \n" "Language-Team: Belarusian (http://www.transifex.com/projects/p/mc/language/" @@ -76,8 +76,8 @@ msgstr "Нельга стварыць каталёґ «%s»" msgid "FATAL: not a directory:" msgstr "ХІБА: ня ёсьць каталёґам:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Не ўдалося перанесьці налады карыстальніка: %s" #, c-format @@ -2656,11 +2656,11 @@ msgid "Target file already exists!" msgstr "Прызначаны файл ужо сінуе!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3991,8 +3991,8 @@ msgstr "" "Перасьцярога: хібная пазнака «%c» у «%s»\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: не ўдалося прачытаць «%s»: «%s»" msgid "sftp: Unable to get current user name." diff --git a/po/bg.po b/po/bg.po index a2812425f..17ca0929f 100644 --- a/po/bg.po +++ b/po/bg.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Yasen Pramatarov \n" "Language-Team: Bulgarian (http://www.transifex.com/projects/p/mc/language/" @@ -74,7 +74,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2497,11 +2497,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3803,7 +3803,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ca.po b/po/ca.po index 943906a3d..c5edf2170 100644 --- a/po/ca.po +++ b/po/ca.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Daniel \n" "Language-Team: Catalan (http://www.transifex.com/projects/p/mc/language/" @@ -79,7 +79,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2499,11 +2499,11 @@ msgid "Target file already exists!" msgstr "Ja existeix el fitxer de destinació" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3812,7 +3812,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/cs.po b/po/cs.po index e17e1b6b7..503702d8c 100644 --- a/po/cs.po +++ b/po/cs.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Czech (http://www.transifex.com/projects/p/mc/language/cs/)\n" @@ -75,7 +75,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2606,11 +2606,11 @@ msgid "Target file already exists!" msgstr "Cílový soubor už existuje!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3929,7 +3929,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/da.po b/po/da.po index 0818a6ef2..8589467ae 100644 --- a/po/da.po +++ b/po/da.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Danish (http://www.transifex.com/projects/p/mc/language/da/)\n" @@ -75,7 +75,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2608,11 +2608,11 @@ msgid "Target file already exists!" msgstr "Målfil findes allerede!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3925,7 +3925,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/de.po b/po/de.po index 26ab06abb..e41ebb05b 100644 --- a/po/de.po +++ b/po/de.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Fabian Affolter \n" "Language-Team: German (http://www.transifex.com/projects/p/mc/language/de/)\n" @@ -77,7 +77,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2630,11 +2630,11 @@ msgid "Target file already exists!" msgstr "Zieldatei existiert bereits!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3951,7 +3951,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/de_CH.po b/po/de_CH.po index 6af3fb084..7254f2c5b 100644 --- a/po/de_CH.po +++ b/po/de_CH.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: German (Switzerland) (http://www.transifex.com/projects/p/mc/" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2482,11 +2482,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3752,7 +3752,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/el.po b/po/el.po index 06991ab9b..944c89f9c 100644 --- a/po/el.po +++ b/po/el.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Panos Bouklis \n" "Language-Team: Greek (http://www.transifex.com/projects/p/mc/language/el/)\n" @@ -75,8 +75,8 @@ msgstr "Αδυναμία δημιουργία καταλόγου %s" msgid "FATAL: not a directory:" msgstr "" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Συνέβη ένα σφάλμα κατά τη μετάβαση των ρυθμίσεων χρήστη: %s" #, c-format @@ -2581,11 +2581,11 @@ msgid "Target file already exists!" msgstr "Το αρχείο στόχος υπάρχει ήδη!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3886,9 +3886,9 @@ msgstr "" "Προειδοποίηση: Μη έγκυρη σημαία %c στο %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" -msgstr "" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" +msgstr "Συνέβη ένα σφάλμα κατά τη μετάβαση των ρυθμίσεων χρήστη: %s" msgid "sftp: Unable to get current user name." msgstr "" diff --git a/po/eo.po b/po/eo.po index 1d7c1a7c4..a0234e896 100644 --- a/po/eo.po +++ b/po/eo.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Keith Bowes \n" "Language-Team: Esperanto (http://www.transifex.com/projects/p/mc/language/" @@ -75,8 +75,8 @@ msgstr "Ne eblas krei dosierujon %s" msgid "FATAL: not a directory:" msgstr "PEREIGA: ne estas dosierujo:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Eraro okazis dum migri uzanto-agordon: %s" #, c-format @@ -2661,12 +2661,12 @@ msgstr "%ld B/s" msgid "Target file already exists!" msgstr "Cela dosiero jam ekzistas!" -#, c-format -msgid "New : %s, size %llu" +#, fuzzy, c-format +msgid "New : %s, size %s" msgstr "Nova : %s, grando %llu" -#, c-format -msgid "Existing: %s, size %llu" +#, fuzzy, c-format +msgid "Existing: %s, size %s" msgstr "Jama: %s, grando %llu" msgid "Overwrite this target?" @@ -3991,8 +3991,8 @@ msgstr "" "Averto: Nevalida marko %c in %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: Eraro okazis dum lego de %s: %s" msgid "sftp: Unable to get current user name." diff --git a/po/es.po b/po/es.po index c549c1340..efef60e55 100644 --- a/po/es.po +++ b/po/es.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-27 10:39+0000\n" "Last-Translator: David Martin \n" "Language-Team: Spanish (http://www.transifex.com/projects/p/mc/language/" @@ -79,8 +79,8 @@ msgstr "Imposible crear directorio %s" msgid "FATAL: not a directory:" msgstr "¡FATAL! No es directorio:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Error en la migración de la configuración personal: %s" #, c-format @@ -2671,12 +2671,12 @@ msgstr "%ld B/s" msgid "Target file already exists!" msgstr "¡El archivo destino ya existe!" -#, c-format -msgid "New : %s, size %llu" +#, fuzzy, c-format +msgid "New : %s, size %s" msgstr "Nuevo : %s, tamaño %llu" -#, c-format -msgid "Existing: %s, size %llu" +#, fuzzy, c-format +msgid "Existing: %s, size %s" msgstr "Actual: %s, tamaño %llu" msgid "Overwrite this target?" @@ -4000,8 +4000,8 @@ msgstr "" "Atención: Bandera %c no válida en %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: Ocurrió un error durante la lectura de «%s»: %s" msgid "sftp: Unable to get current user name." diff --git a/po/et.po b/po/et.po index 889563a97..9b63eb2ab 100644 --- a/po/et.po +++ b/po/et.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2011-07-11 17:34+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -70,7 +70,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2480,11 +2480,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3750,7 +3750,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/eu.po b/po/eu.po index bf99b9f60..df90b7f15 100644 --- a/po/eu.po +++ b/po/eu.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Basque (http://www.transifex.com/projects/p/mc/language/eu/)\n" @@ -75,8 +75,8 @@ msgstr "%s direktorioa ezin sortu" msgid "FATAL: not a directory:" msgstr "LARRIA: ez da direktorioa:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Akats bat gertatu da erabiltzailearen ezarpenak migratzerakoan: %s" #, c-format @@ -2638,11 +2638,11 @@ msgid "Target file already exists!" msgstr "Helburu fitxategia dagoeneko existitzen da!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3961,9 +3961,9 @@ msgstr "" "Abisua: Baliogabeko %c bandera %s-n:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" -msgstr "" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" +msgstr "Akats bat gertatu da erabiltzailearen ezarpenak migratzerakoan: %s" msgid "sftp: Unable to get current user name." msgstr "" diff --git a/po/fa.po b/po/fa.po index 418453471..ddfedbe23 100644 --- a/po/fa.po +++ b/po/fa.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-28 08:17+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Persian (http://www.transifex.com/projects/p/mc/language/" @@ -76,7 +76,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2488,11 +2488,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3753,7 +3753,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/fi.po b/po/fi.po index f20694cc3..ad09108fe 100644 --- a/po/fi.po +++ b/po/fi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Finnish (http://www.transifex.com/projects/p/mc/language/" @@ -73,7 +73,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2483,11 +2483,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3753,7 +3753,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/fi_FI.po b/po/fi_FI.po index d9376ab30..53ebd997e 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -75,7 +75,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2492,11 +2492,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3767,7 +3767,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/fr.po b/po/fr.po index 062f70545..07ec154db 100644 --- a/po/fr.po +++ b/po/fr.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Stéphane Aulery \n" "Language-Team: French (http://www.transifex.com/projects/p/mc/language/fr/)\n" @@ -76,7 +76,7 @@ msgid "FATAL: not a directory:" msgstr "FATAL : n'est pas un répertoire :" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2519,11 +2519,11 @@ msgid "Target file already exists!" msgstr "Le fichier cible existe déjà !" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3846,7 +3846,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/gl.po b/po/gl.po index 3da9c726c..78599db96 100644 --- a/po/gl.po +++ b/po/gl.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: mbouzada \n" "Language-Team: Galician (http://www.transifex.com/projects/p/mc/language/" @@ -78,8 +78,8 @@ msgstr "Non é posíbel crear o directorio %s" msgid "FATAL: not a directory:" msgstr "FATAL! Non é un directorio:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Produciuse un erro na migración da configuración do usuario: %s" #, c-format @@ -2650,12 +2650,12 @@ msgstr "%ld B/s" msgid "Target file already exists!" msgstr "O ficheiro destino xa existe!" -#, c-format -msgid "New : %s, size %llu" +#, fuzzy, c-format +msgid "New : %s, size %s" msgstr "Novo : %s, tamaño %llu" -#, c-format -msgid "Existing: %s, size %llu" +#, fuzzy, c-format +msgid "Existing: %s, size %s" msgstr "Existente: %s, tamaño %llu" msgid "Overwrite this target?" @@ -3978,9 +3978,9 @@ msgstr "" "Atención: marca %c incorrecta en %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" -msgstr "" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" +msgstr "Produciuse un erro na migración da configuración do usuario: %s" msgid "sftp: Unable to get current user name." msgstr "" diff --git a/po/hr.po b/po/hr.po index 588d4bbf0..c6b88327d 100644 --- a/po/hr.po +++ b/po/hr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2010-12-29 10:19+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: Croatian (http://www.transifex.com/projects/p/mc/language/" @@ -73,7 +73,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2483,11 +2483,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3758,7 +3758,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/hu.po b/po/hu.po index 7ad3271a7..6ed122864 100644 --- a/po/hu.po +++ b/po/hu.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 15:01+0000\n" "Last-Translator: Rezső Páder \n" "Language-Team: Hungarian (http://www.transifex.com/projects/p/mc/language/" @@ -76,8 +76,8 @@ msgstr "A(z) %s könyvtár nem létrehozható" msgid "FATAL: not a directory:" msgstr "HIBA: nem könyvtár:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Hiba történt a felhasználói adatok migrálásakor: %s" #, c-format @@ -2642,11 +2642,11 @@ msgid "Target file already exists!" msgstr "A célfájl már létezik!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3967,8 +3967,8 @@ msgstr "" "Figyelem: hibás jel (%c) ebben: %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: hiba %s olvasásakor: %s" msgid "sftp: Unable to get current user name." diff --git a/po/ia.po b/po/ia.po index 18c1c37ab..45f2e2f60 100644 --- a/po/ia.po +++ b/po/ia.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Martijn Dekker \n" "Language-Team: Interlingua (http://www.transifex.com/projects/p/mc/language/" @@ -77,7 +77,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2508,11 +2508,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3800,7 +3800,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/id.po b/po/id.po index b85f91376..c61eb1f34 100644 --- a/po/id.po +++ b/po/id.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Andika Triwidada \n" "Language-Team: Indonesian (http://www.transifex.com/projects/p/mc/language/" @@ -76,7 +76,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2492,11 +2492,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3761,7 +3761,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/it.po b/po/it.po index ad96d7b0d..557991067 100644 --- a/po/it.po +++ b/po/it.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-11-13 02:12+0100\n" "Last-Translator: Slava Zanko \n" "Language-Team: Italian (http://www.transifex.com/projects/p/mc/language/" @@ -77,8 +77,8 @@ msgstr "Impossibile creare la directory %s" msgid "FATAL: not a directory:" msgstr "FATALE: non è una directory:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "" "Si è verificato un errore durante la migrazione delle impostazioni " "dell'utente: %s" @@ -2703,11 +2703,11 @@ msgid "Target file already exists!" msgstr " Il file obiettivo esiste già!" #, fuzzy, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "Data sorgen.: %s, dim. %llu" #, fuzzy, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "Data sorgen.: %s, dim. %llu" msgid "Overwrite this target?" @@ -4034,7 +4034,7 @@ msgstr "" "%s\n" #, fuzzy, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" "Si è verificato un errore durante la migrazione delle impostazioni " "dell'utente: %s" diff --git a/po/it_IT.po b/po/it_IT.po index 228027e9f..c2ed84acb 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2011-12-07 11:21+0000\n" "Last-Translator: slavazanko \n" "Language-Team: Italian (Italy) (http://www.transifex.net/projects/p/mc/team/" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2482,11 +2482,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3752,7 +3752,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ja.po b/po/ja.po index 26d068237..dc6f53875 100644 --- a/po/ja.po +++ b/po/ja.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Japanese (http://www.transifex.com/projects/p/mc/language/" @@ -79,7 +79,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2504,11 +2504,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3802,7 +3802,7 @@ msgstr "" "%3$s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ka.po b/po/ka.po index a7b8c5307..612ca97d2 100644 --- a/po/ka.po +++ b/po/ka.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: George Machitidze \n" "Language-Team: Georgian (http://www.transifex.com/projects/p/mc/language/" @@ -73,7 +73,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2485,11 +2485,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3750,7 +3750,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ko.po b/po/ko.po index a1a46734b..b46b065ec 100644 --- a/po/ko.po +++ b/po/ko.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Korean (http://www.transifex.com/projects/p/mc/language/ko/)\n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2491,11 +2491,11 @@ msgid "Target file already exists!" msgstr "대상 파일 \"%s\"이(가) 이미 있는데요!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3796,7 +3796,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/lt.po b/po/lt.po index a1f61a440..d716069c5 100644 --- a/po/lt.po +++ b/po/lt.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Lithuanian (http://www.transifex.com/projects/p/mc/language/" @@ -75,7 +75,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2499,11 +2499,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3813,7 +3813,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/lv.po b/po/lv.po index c04e5f9c8..d150f64bc 100644 --- a/po/lv.po +++ b/po/lv.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -73,7 +73,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2488,11 +2488,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3801,7 +3801,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/mc.pot b/po/mc.pot index 07738e61d..942a2d753 100644 --- a/po/mc.pot +++ b/po/mc.pot @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: mc 4.8.7-76-g96d8539\n" +"Project-Id-Version: mc 4.8.7-113-gff2483e\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -87,7 +87,7 @@ msgstr "" #: lib/mcconfig/paths.c:220 #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #: lib/mcconfig/paths.c:484 @@ -108,7 +108,7 @@ msgstr "" #: lib/search/lib.c:43 src/diffviewer/search.c:230 src/editor/editcmd.c:838 #: src/editor/editcmd.c:859 src/editor/editcmd.c:899 src/editor/editcmd.c:987 -#: src/editor/editcmd.c:2759 src/viewer/search.c:107 +#: src/editor/editcmd.c:2664 src/viewer/search.c:107 msgid "Search string not found" msgstr "" @@ -553,8 +553,8 @@ msgstr "" #: lib/utilunix.c:514 lib/utilunix.c:519 lib/utilunix.c:574 #: src/editor/editcmd.c:207 src/editor/editcmd.c:230 src/editor/editcmd.c:438 -#: src/editor/editcmd.c:603 src/editor/editcmd.c:1688 -#: src/editor/editcmd.c:3473 src/editor/editcmd.c:3502 +#: src/editor/editcmd.c:603 src/editor/editcmd.c:1682 +#: src/editor/editcmd.c:3377 src/editor/editcmd.c:3406 #: src/editor/editcmd_dialogs.c:492 src/execute.c:130 #: src/filemanager/file.c:1676 src/filemanager/panel.c:4254 src/help.c:363 #: src/main.c:359 src/main.c:389 src/subshell.c:390 src/subshell.c:1056 @@ -664,10 +664,10 @@ msgid "Do you want clean this history?" msgstr "" #: lib/widget/listbox.c:285 src/diffviewer/ydiff.c:3099 -#: src/editor/editcmd.c:209 src/editor/editcmd.c:232 src/editor/editcmd.c:2883 -#: src/editor/editcmd.c:2889 src/filemanager/cmd.c:143 +#: src/editor/editcmd.c:209 src/editor/editcmd.c:232 src/editor/editcmd.c:2788 +#: src/editor/editcmd.c:2794 src/filemanager/cmd.c:143 #: src/filemanager/file.c:692 src/filemanager/file.c:2809 -#: src/filemanager/filegui.c:432 src/filemanager/hotlist.c:1115 +#: src/filemanager/filegui.c:431 src/filemanager/hotlist.c:1115 #: src/filemanager/hotlist.c:1132 src/filemanager/midnight.c:1044 #: src/filemanager/midnight.c:1052 src/filemanager/panel.c:2607 #: src/filemanager/tree.c:901 src/subshell.c:1058 src/viewer/lib.c:171 @@ -676,10 +676,10 @@ msgid "&Yes" msgstr "" #: lib/widget/listbox.c:285 src/diffviewer/ydiff.c:3099 -#: src/editor/editcmd.c:209 src/editor/editcmd.c:2883 -#: src/editor/editcmd.c:2889 src/filemanager/cmd.c:143 +#: src/editor/editcmd.c:209 src/editor/editcmd.c:2788 +#: src/editor/editcmd.c:2794 src/filemanager/cmd.c:143 #: src/filemanager/file.c:692 src/filemanager/file.c:2809 -#: src/filemanager/filegui.c:434 src/filemanager/hotlist.c:1115 +#: src/filemanager/filegui.c:433 src/filemanager/hotlist.c:1115 #: src/filemanager/hotlist.c:1132 src/filemanager/midnight.c:1044 #: src/filemanager/midnight.c:1052 src/filemanager/panel.c:2607 #: src/filemanager/tree.c:901 src/subshell.c:1058 src/viewer/lib.c:171 @@ -687,22 +687,22 @@ msgstr "" msgid "&No" msgstr "" -#: lib/widget/quick.h:215 src/editor/editcmd.c:2759 +#: lib/widget/quick.h:215 src/editor/editcmd.c:2664 #: src/editor/editcmd_dialogs.c:121 src/editor/editwidget.c:150 -#: src/filemanager/boxes.c:1126 src/filemanager/filegui.c:1201 +#: src/filemanager/boxes.c:1126 src/filemanager/filegui.c:1209 #: src/filemanager/find.c:524 src/filemanager/layout.c:450 src/subshell.c:393 msgid "&OK" msgstr "" #: lib/widget/quick.h:216 src/editor/editcmd.c:209 src/editor/editcmd.c:232 -#: src/editor/editcmd.c:440 src/editor/editcmd.c:606 src/editor/editcmd.c:1689 -#: src/editor/editcmd.c:2045 src/editor/editcmd.c:2883 -#: src/editor/editcmd.c:3476 src/editor/editcmd.c:3505 +#: src/editor/editcmd.c:440 src/editor/editcmd.c:606 src/editor/editcmd.c:1683 +#: src/editor/editcmd.c:2039 src/editor/editcmd.c:2788 +#: src/editor/editcmd.c:3380 src/editor/editcmd.c:3409 #: src/editor/editcmd_dialogs.c:123 src/editor/editcmd_dialogs.c:278 #: src/editor/editcmd_dialogs.c:494 src/editor/spell_dialogs.c:98 #: src/filemanager/achown.c:97 src/filemanager/chmod.c:126 #: src/filemanager/chown.c:92 src/filemanager/cmd.c:1282 -#: src/filemanager/filegui.c:1205 src/filemanager/find.c:524 +#: src/filemanager/filegui.c:1213 src/filemanager/find.c:524 #: src/filemanager/hotlist.c:192 src/filemanager/hotlist.c:971 #: src/filemanager/hotlist.c:1033 src/filemanager/layout.c:451 #: src/filemanager/panelize.c:144 src/learn.c:258 src/viewer/hex.c:389 @@ -714,12 +714,12 @@ msgid "Background process:" msgstr "" #: lib/widget/wtools.c:287 lib/widget/wtools.c:412 src/editor/edit.c:219 -#: src/editor/edit.c:253 src/editor/edit.c:405 src/editor/edit.c:2100 -#: src/editor/edit.c:2110 src/editor/editcmd.c:294 src/editor/editcmd.c:304 -#: src/editor/editcmd.c:382 src/editor/editcmd.c:2984 src/editor/spell.c:318 +#: src/editor/edit.c:253 src/editor/edit.c:405 src/editor/edit.c:2160 +#: src/editor/edit.c:2170 src/editor/editcmd.c:294 src/editor/editcmd.c:304 +#: src/editor/editcmd.c:382 src/editor/editcmd.c:2889 src/editor/spell.c:318 #: src/editor/spell.c:555 src/editor/spell.c:563 #: tests/src/execute__common.c:145 -#: tests/src/execute__execute_with_vfs_arg.c:158 +#: tests/src/execute__execute_with_vfs_arg.c:154 msgid "Error" msgstr "" @@ -974,7 +974,7 @@ msgstr "" #: src/diffviewer/search.c:106 src/diffviewer/search.c:230 #: src/diffviewer/search.c:243 src/diffviewer/search.c:270 #: src/editor/editcmd.c:987 src/editor/editcmd.c:1017 -#: src/editor/editcmd.c:2653 src/editor/editcmd_dialogs.c:130 +#: src/editor/editcmd.c:2558 src/editor/editcmd_dialogs.c:130 #: src/viewer/dialogs.c:112 src/viewer/search.c:150 src/viewer/search.c:253 #: src/viewer/search.c:356 msgid "Search" @@ -1062,17 +1062,17 @@ msgstr "" msgid "Goto line (right)" msgstr "" -#: src/diffviewer/ydiff.c:2912 src/editor/editcmd.c:3063 +#: src/diffviewer/ydiff.c:2912 src/editor/editcmd.c:2968 msgid "Enter line:" msgstr "" -#: src/diffviewer/ydiff.c:2953 src/editor/editwidget.c:852 +#: src/diffviewer/ydiff.c:2953 src/editor/editwidget.c:977 #: src/filemanager/midnight.c:1659 src/filemanager/tree.c:1225 src/help.c:1147 #: src/viewer/display.c:87 msgid "ButtonBar|Help" msgstr "" -#: src/diffviewer/ydiff.c:2954 src/editor/editwidget.c:853 +#: src/diffviewer/ydiff.c:2954 src/editor/editwidget.c:978 #: src/viewer/display.c:99 msgid "ButtonBar|Save" msgstr "" @@ -1086,7 +1086,7 @@ msgstr "" msgid "ButtonBar|Merge" msgstr "" -#: src/diffviewer/ydiff.c:2957 src/editor/editwidget.c:858 +#: src/diffviewer/ydiff.c:2957 src/editor/editwidget.c:983 #: src/viewer/display.c:109 msgid "ButtonBar|Search" msgstr "" @@ -1095,13 +1095,13 @@ msgstr "" msgid "ButtonBar|Options" msgstr "" -#: src/diffviewer/ydiff.c:2959 src/editor/editwidget.c:861 +#: src/diffviewer/ydiff.c:2959 src/editor/editwidget.c:986 #: src/filemanager/midnight.c:1668 src/help.c:1156 src/viewer/display.c:121 #: src/viewer/display.c:124 msgid "ButtonBar|Quit" msgstr "" -#: src/diffviewer/ydiff.c:3096 src/editor/editcmd.c:2889 src/viewer/lib.c:169 +#: src/diffviewer/ydiff.c:3096 src/editor/editcmd.c:2794 src/viewer/lib.c:169 #: src/viewer/lib.c:175 msgid "Quit" msgstr "" @@ -1179,12 +1179,12 @@ msgstr "" msgid "File \"%s\" is too large" msgstr "" -#: src/editor/edit.c:2099 +#: src/editor/edit.c:2159 #, c-format msgid "Error reading from pipe: %s" msgstr "" -#: src/editor/edit.c:2109 +#: src/editor/edit.c:2169 #, c-format msgid "Cannot open pipe for reading: %s" msgstr "" @@ -1216,8 +1216,8 @@ msgstr "" msgid "The file you are saving is not finished with a newline" msgstr "" -#: src/editor/editcmd.c:440 src/editor/editcmd.c:606 src/editor/editcmd.c:3475 -#: src/editor/editcmd.c:3504 src/editor/editcmd_dialogs.c:494 +#: src/editor/editcmd.c:440 src/editor/editcmd.c:606 src/editor/editcmd.c:3379 +#: src/editor/editcmd.c:3408 src/editor/editcmd_dialogs.c:494 msgid "C&ontinue" msgstr "" @@ -1237,8 +1237,8 @@ msgstr "" msgid "&Macintosh format (CR)" msgstr "" -#: src/editor/editcmd.c:465 src/editor/editcmd.c:2066 -#: src/editor/editcmd.c:3106 src/editor/editcmd.c:3138 +#: src/editor/editcmd.c:465 src/editor/editcmd.c:2060 +#: src/editor/editcmd.c:3011 src/editor/editcmd.c:3043 #: src/filemanager/cmd.c:861 msgid "Enter file name:" msgstr "" @@ -1255,260 +1255,260 @@ msgstr "" msgid "Block is large, you may not be able to undo this action" msgstr "" -#: src/editor/editcmd.c:1585 +#: src/editor/editcmd.c:1579 msgid "&Quick save" msgstr "" -#: src/editor/editcmd.c:1586 +#: src/editor/editcmd.c:1580 msgid "&Safe save" msgstr "" -#: src/editor/editcmd.c:1587 +#: src/editor/editcmd.c:1581 msgid "&Do backups with following extension:" msgstr "" -#: src/editor/editcmd.c:1608 +#: src/editor/editcmd.c:1602 msgid "Check &POSIX new line" msgstr "" -#: src/editor/editcmd.c:1616 +#: src/editor/editcmd.c:1610 msgid "Edit Save Mode" msgstr "" -#: src/editor/editcmd.c:1673 src/editor/editcmd.c:1743 +#: src/editor/editcmd.c:1667 src/editor/editcmd.c:1737 msgid "Save as" msgstr "" -#: src/editor/editcmd.c:1675 +#: src/editor/editcmd.c:1669 msgid "Cannot save: destination is not a regular file" msgstr "" -#: src/editor/editcmd.c:1689 +#: src/editor/editcmd.c:1683 msgid "A file already exists with this name" msgstr "" -#: src/editor/editcmd.c:1689 +#: src/editor/editcmd.c:1683 msgid "&Overwrite" msgstr "" -#: src/editor/editcmd.c:1743 src/editor/editcmd.c:3116 +#: src/editor/editcmd.c:1737 src/editor/editcmd.c:3021 msgid "Cannot save file" msgstr "" -#: src/editor/editcmd.c:1768 src/editor/editcmd.c:1771 +#: src/editor/editcmd.c:1762 src/editor/editcmd.c:1765 msgid "Delete macro" msgstr "" -#: src/editor/editcmd.c:1768 +#: src/editor/editcmd.c:1762 msgid "Press macro hotkey:" msgstr "" -#: src/editor/editcmd.c:1771 +#: src/editor/editcmd.c:1765 msgid "Macro not deleted" msgstr "" -#: src/editor/editcmd.c:1826 +#: src/editor/editcmd.c:1820 msgid "Save macro" msgstr "" -#: src/editor/editcmd.c:1826 +#: src/editor/editcmd.c:1820 msgid "Press the macro's new hotkey:" msgstr "" -#: src/editor/editcmd.c:1900 +#: src/editor/editcmd.c:1894 msgid "Repeat last commands" msgstr "" -#: src/editor/editcmd.c:1900 +#: src/editor/editcmd.c:1894 msgid "Repeat times:" msgstr "" -#: src/editor/editcmd.c:2043 +#: src/editor/editcmd.c:2037 #, c-format msgid "Confirm save file: \"%s\"" msgstr "" -#: src/editor/editcmd.c:2045 src/viewer/hex.c:377 src/viewer/hex.c:389 +#: src/editor/editcmd.c:2039 src/viewer/hex.c:377 src/viewer/hex.c:389 msgid "Save file" msgstr "" -#: src/editor/editcmd.c:2045 src/editor/editmenu.c:77 src/learn.c:196 +#: src/editor/editcmd.c:2039 src/editor/editmenu.c:77 src/learn.c:196 #: src/learn.c:257 msgid "&Save" msgstr "" -#: src/editor/editcmd.c:2066 +#: src/editor/editcmd.c:2060 msgid "Load" msgstr "" -#: src/editor/editcmd.c:2099 +#: src/editor/editcmd.c:2093 msgid "Syntax file edit" msgstr "" -#: src/editor/editcmd.c:2100 +#: src/editor/editcmd.c:2094 msgid "Which syntax file you want to edit?" msgstr "" -#: src/editor/editcmd.c:2101 src/editor/editcmd.c:2146 +#: src/editor/editcmd.c:2095 src/editor/editcmd.c:2140 #: src/filemanager/cmd.c:1100 src/filemanager/cmd.c:1136 #: src/filemanager/cmd.c:1194 msgid "&User" msgstr "" -#: src/editor/editcmd.c:2101 src/editor/editcmd.c:2146 +#: src/editor/editcmd.c:2095 src/editor/editcmd.c:2140 msgid "&System wide" msgstr "" -#: src/editor/editcmd.c:2144 src/filemanager/cmd.c:1134 +#: src/editor/editcmd.c:2138 src/filemanager/cmd.c:1134 msgid "Menu edit" msgstr "" -#: src/editor/editcmd.c:2145 src/filemanager/cmd.c:1135 +#: src/editor/editcmd.c:2139 src/filemanager/cmd.c:1135 msgid "Which menu file do you want to edit?" msgstr "" -#: src/editor/editcmd.c:2146 src/filemanager/cmd.c:1136 +#: src/editor/editcmd.c:2140 src/filemanager/cmd.c:1136 msgid "&Local" msgstr "" -#: src/editor/editcmd.c:2718 src/editor/editcmd.c:2759 -#: src/editor/editcmd.c:2770 src/editor/editcmd_dialogs.c:220 +#: src/editor/editcmd.c:2623 src/editor/editcmd.c:2664 +#: src/editor/editcmd.c:2675 src/editor/editcmd_dialogs.c:220 msgid "Replace" msgstr "" -#: src/editor/editcmd.c:2770 +#: src/editor/editcmd.c:2675 #, c-format msgid "%ld replacements made" msgstr "" -#: src/editor/editcmd.c:2855 src/editor/editwidget.c:399 +#: src/editor/editcmd.c:2760 src/editor/editwidget.c:399 msgid "[NoName]" msgstr "" -#: src/editor/editcmd.c:2882 +#: src/editor/editcmd.c:2787 #, c-format msgid "" "File %s was modified.\n" "Save before close?" msgstr "" -#: src/editor/editcmd.c:2883 +#: src/editor/editcmd.c:2788 msgid "Close file" msgstr "" -#: src/editor/editcmd.c:2887 +#: src/editor/editcmd.c:2792 #, c-format msgid "" "Midnight Commander is being shut down.\n" "Save modified file %s?" msgstr "" -#: src/editor/editcmd.c:2984 +#: src/editor/editcmd.c:2889 msgid "This function is not implemented" msgstr "" -#: src/editor/editcmd.c:2998 +#: src/editor/editcmd.c:2903 msgid "Copy to clipboard" msgstr "" -#: src/editor/editcmd.c:2998 src/editor/editcmd.c:3018 +#: src/editor/editcmd.c:2903 src/editor/editcmd.c:2923 msgid "Unable to save to file" msgstr "" -#: src/editor/editcmd.c:3018 +#: src/editor/editcmd.c:2923 msgid "Cut to clipboard" msgstr "" -#: src/editor/editcmd.c:3063 +#: src/editor/editcmd.c:2968 msgid "Goto line" msgstr "" -#: src/editor/editcmd.c:3106 src/editor/editcmd.c:3116 +#: src/editor/editcmd.c:3011 src/editor/editcmd.c:3021 msgid "Save block" msgstr "" -#: src/editor/editcmd.c:3138 src/editor/editcmd.c:3153 +#: src/editor/editcmd.c:3043 src/editor/editcmd.c:3058 msgid "Insert file" msgstr "" -#: src/editor/editcmd.c:3153 +#: src/editor/editcmd.c:3058 msgid "Cannot insert file" msgstr "" -#: src/editor/editcmd.c:3175 +#: src/editor/editcmd.c:3080 msgid "Sort block" msgstr "" -#: src/editor/editcmd.c:3175 +#: src/editor/editcmd.c:3080 msgid "You must first highlight a block of text" msgstr "" -#: src/editor/editcmd.c:3183 +#: src/editor/editcmd.c:3088 msgid "Run sort" msgstr "" -#: src/editor/editcmd.c:3184 +#: src/editor/editcmd.c:3089 msgid "Enter sort options (see manpage) separated by whitespace:" msgstr "" -#: src/editor/editcmd.c:3205 src/editor/editcmd.c:3212 +#: src/editor/editcmd.c:3110 src/editor/editcmd.c:3117 msgid "Sort" msgstr "" -#: src/editor/editcmd.c:3205 +#: src/editor/editcmd.c:3110 msgid "Cannot execute sort command" msgstr "" -#: src/editor/editcmd.c:3211 +#: src/editor/editcmd.c:3116 #, c-format msgid "Sort returned non-zero: %s" msgstr "" -#: src/editor/editcmd.c:3246 +#: src/editor/editcmd.c:3151 msgid "Paste output of external command" msgstr "" -#: src/editor/editcmd.c:3247 +#: src/editor/editcmd.c:3152 msgid "Enter shell command(s):" msgstr "" -#: src/editor/editcmd.c:3264 +#: src/editor/editcmd.c:3169 msgid "External command" msgstr "" -#: src/editor/editcmd.c:3264 +#: src/editor/editcmd.c:3169 msgid "Cannot execute command" msgstr "" -#: src/editor/editcmd.c:3315 +#: src/editor/editcmd.c:3220 msgid "mail -s -c " msgstr "" -#: src/editor/editcmd.c:3316 +#: src/editor/editcmd.c:3221 msgid "To" msgstr "" -#: src/editor/editcmd.c:3319 +#: src/editor/editcmd.c:3224 msgid "Subject" msgstr "" -#: src/editor/editcmd.c:3322 +#: src/editor/editcmd.c:3227 msgid "Copies to" msgstr "" -#: src/editor/editcmd.c:3332 +#: src/editor/editcmd.c:3237 msgid "Mail" msgstr "" -#: src/editor/editcmd.c:3436 +#: src/editor/editcmd.c:3340 msgid "Insert literal" msgstr "" -#: src/editor/editcmd.c:3437 +#: src/editor/editcmd.c:3341 msgid "Press any key:" msgstr "" -#: src/editor/editcmd.c:3474 src/editor/editcmd.c:3503 +#: src/editor/editcmd.c:3378 src/editor/editcmd.c:3407 msgid "" "Current text was modified without a file save.\n" "Continue discards these changes" @@ -1535,7 +1535,7 @@ msgid "&Replace" msgstr "" #: src/editor/editcmd_dialogs.c:276 src/filemanager/file.c:692 -#: src/filemanager/filegui.c:442 +#: src/filemanager/filegui.c:441 msgid "A&ll" msgstr "" @@ -1872,76 +1872,76 @@ msgstr "" msgid "Wrap mode" msgstr "" -#: src/editor/editoptions.c:153 +#: src/editor/editoptions.c:154 msgid "Tabulation" msgstr "" -#: src/editor/editoptions.c:154 +#: src/editor/editoptions.c:155 msgid "&Fake half tabs" msgstr "" -#: src/editor/editoptions.c:155 +#: src/editor/editoptions.c:156 msgid "&Backspace through tabs" msgstr "" -#: src/editor/editoptions.c:157 +#: src/editor/editoptions.c:158 msgid "Fill tabs with &spaces" msgstr "" -#: src/editor/editoptions.c:159 +#: src/editor/editoptions.c:160 msgid "Tab spacing:" msgstr "" -#: src/editor/editoptions.c:163 src/filemanager/boxes.c:475 +#: src/editor/editoptions.c:164 src/filemanager/boxes.c:475 #: src/filemanager/layout.c:443 msgid "Other options" msgstr "" -#: src/editor/editoptions.c:164 +#: src/editor/editoptions.c:165 msgid "&Return does autoindent" msgstr "" -#: src/editor/editoptions.c:166 +#: src/editor/editoptions.c:167 msgid "Confir&m before saving" msgstr "" -#: src/editor/editoptions.c:167 +#: src/editor/editoptions.c:168 msgid "Save file &position" msgstr "" -#: src/editor/editoptions.c:168 +#: src/editor/editoptions.c:169 msgid "&Visible trailing spaces" msgstr "" -#: src/editor/editoptions.c:169 +#: src/editor/editoptions.c:170 msgid "Visible &tabs" msgstr "" -#: src/editor/editoptions.c:170 +#: src/editor/editoptions.c:171 msgid "Synta&x highlighting" msgstr "" -#: src/editor/editoptions.c:171 +#: src/editor/editoptions.c:172 msgid "C&ursor after inserted block" msgstr "" -#: src/editor/editoptions.c:172 +#: src/editor/editoptions.c:173 msgid "Pers&istent selection" msgstr "" -#: src/editor/editoptions.c:174 +#: src/editor/editoptions.c:175 msgid "Cursor be&yond end of line" msgstr "" -#: src/editor/editoptions.c:176 +#: src/editor/editoptions.c:177 msgid "&Group undo" msgstr "" -#: src/editor/editoptions.c:177 +#: src/editor/editoptions.c:178 msgid "Word wrap line length:" msgstr "" -#: src/editor/editoptions.c:188 +#: src/editor/editoptions.c:189 msgid "Editor options" msgstr "" @@ -1967,28 +1967,28 @@ msgstr "" msgid "Edit: " msgstr "" -#: src/editor/editwidget.c:854 +#: src/editor/editwidget.c:979 msgid "ButtonBar|Mark" msgstr "" -#: src/editor/editwidget.c:855 +#: src/editor/editwidget.c:980 msgid "ButtonBar|Replac" msgstr "" -#: src/editor/editwidget.c:856 src/filemanager/midnight.c:1663 +#: src/editor/editwidget.c:981 src/filemanager/midnight.c:1663 #: src/filemanager/tree.c:1230 msgid "ButtonBar|Copy" msgstr "" -#: src/editor/editwidget.c:857 +#: src/editor/editwidget.c:982 msgid "ButtonBar|Move" msgstr "" -#: src/editor/editwidget.c:859 src/filemanager/midnight.c:1666 +#: src/editor/editwidget.c:984 src/filemanager/midnight.c:1666 msgid "ButtonBar|Delete" msgstr "" -#: src/editor/editwidget.c:860 src/filemanager/midnight.c:1667 +#: src/editor/editwidget.c:985 src/filemanager/midnight.c:1667 msgid "ButtonBar|PullDn" msgstr "" @@ -2016,18 +2016,18 @@ msgstr "" msgid "Select language" msgstr "" -#: src/editor/syntax.c:1505 src/editor/syntax.c:1511 +#: src/editor/syntax.c:1501 src/editor/syntax.c:1507 msgid "Load syntax file" msgstr "" -#: src/editor/syntax.c:1506 src/filemanager/usermenu.c:949 src/help.c:1088 +#: src/editor/syntax.c:1502 src/filemanager/usermenu.c:949 src/help.c:1088 #, c-format msgid "" "Cannot open file %s\n" "%s" msgstr "" -#: src/editor/syntax.c:1512 +#: src/editor/syntax.c:1508 #, c-format msgid "Error in file %s on line %d" msgstr "" @@ -2657,7 +2657,7 @@ msgstr "" msgid "&Files only" msgstr "" -#: src/filemanager/cmd.c:239 src/filemanager/filegui.c:1188 +#: src/filemanager/cmd.c:239 src/filemanager/filegui.c:1196 #: src/filemanager/find.c:506 msgid "&Using shell patterns" msgstr "" @@ -2956,7 +2956,7 @@ msgstr "" msgid " with source mask:" msgstr "" -#: src/filemanager/file.c:169 src/filemanager/filegui.c:1190 +#: src/filemanager/file.c:169 src/filemanager/filegui.c:1198 msgid "to:" msgstr "" @@ -2992,7 +2992,7 @@ msgstr "" #: src/filemanager/file.c:607 src/filemanager/file.c:648 #: src/filemanager/file.c:692 src/filemanager/file.c:2515 -#: src/filemanager/filegui.c:276 src/filemanager/filegui.c:450 +#: src/filemanager/filegui.c:276 src/filemanager/filegui.c:449 msgid "&Abort" msgstr "" @@ -3019,7 +3019,7 @@ msgid "" "Delete it recursively?" msgstr "" -#: src/filemanager/file.c:692 src/filemanager/filegui.c:446 +#: src/filemanager/file.c:692 src/filemanager/filegui.c:445 msgid "Non&e" msgstr "" @@ -3305,125 +3305,125 @@ msgstr "" msgid "%ld B/s" msgstr "" -#: src/filemanager/filegui.c:422 +#: src/filemanager/filegui.c:421 msgid "Target file already exists!" msgstr "" -#: src/filemanager/filegui.c:426 +#: src/filemanager/filegui.c:425 #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" -#: src/filemanager/filegui.c:428 +#: src/filemanager/filegui.c:427 #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" -#: src/filemanager/filegui.c:430 +#: src/filemanager/filegui.c:429 msgid "Overwrite this target?" msgstr "" -#: src/filemanager/filegui.c:436 src/filemanager/hotlist.c:200 +#: src/filemanager/filegui.c:435 src/filemanager/hotlist.c:200 msgid "A&ppend" msgstr "" -#: src/filemanager/filegui.c:438 +#: src/filemanager/filegui.c:437 msgid "&Reget" msgstr "" -#: src/filemanager/filegui.c:440 +#: src/filemanager/filegui.c:439 msgid "Overwrite all targets?" msgstr "" -#: src/filemanager/filegui.c:444 +#: src/filemanager/filegui.c:443 msgid "&Update" msgstr "" -#: src/filemanager/filegui.c:448 +#: src/filemanager/filegui.c:447 msgid "If &size differs" msgstr "" -#: src/filemanager/filegui.c:469 +#: src/filemanager/filegui.c:470 msgid "File exists" msgstr "" -#: src/filemanager/filegui.c:471 +#: src/filemanager/filegui.c:472 msgid "Background process: File exists" msgstr "" -#: src/filemanager/filegui.c:904 +#: src/filemanager/filegui.c:911 #, c-format msgid "Files processed: %zu/%zu" msgstr "" -#: src/filemanager/filegui.c:906 +#: src/filemanager/filegui.c:913 #, c-format msgid "Files processed: %zu" msgstr "" -#: src/filemanager/filegui.c:950 +#: src/filemanager/filegui.c:957 #, c-format msgid "Time: %s %s" msgstr "" -#: src/filemanager/filegui.c:954 +#: src/filemanager/filegui.c:961 #, c-format msgid "Time: %s %s (%s)" msgstr "" -#: src/filemanager/filegui.c:960 +#: src/filemanager/filegui.c:967 #, c-format msgid "Time: %s" msgstr "" -#: src/filemanager/filegui.c:964 +#: src/filemanager/filegui.c:971 #, c-format msgid "Time: %s (%s)" msgstr "" -#: src/filemanager/filegui.c:972 +#: src/filemanager/filegui.c:979 #, c-format msgid " Total: %s " msgstr "" -#: src/filemanager/filegui.c:976 +#: src/filemanager/filegui.c:983 #, c-format msgid " Total: %s/%s " msgstr "" -#: src/filemanager/filegui.c:1001 +#: src/filemanager/filegui.c:1008 msgid "Source" msgstr "" -#: src/filemanager/filegui.c:1029 +#: src/filemanager/filegui.c:1036 msgid "Target" msgstr "" -#: src/filemanager/filegui.c:1051 +#: src/filemanager/filegui.c:1058 msgid "Deleting" msgstr "" -#: src/filemanager/filegui.c:1194 +#: src/filemanager/filegui.c:1202 msgid "Follow &links" msgstr "" -#: src/filemanager/filegui.c:1195 +#: src/filemanager/filegui.c:1203 msgid "Preserve &attributes" msgstr "" -#: src/filemanager/filegui.c:1197 +#: src/filemanager/filegui.c:1205 msgid "Di&ve into subdir if exists" msgstr "" -#: src/filemanager/filegui.c:1198 +#: src/filemanager/filegui.c:1206 msgid "&Stable symlinks" msgstr "" -#: src/filemanager/filegui.c:1203 +#: src/filemanager/filegui.c:1211 msgid "&Background" msgstr "" -#: src/filemanager/filegui.c:1257 +#: src/filemanager/filegui.c:1265 #, c-format msgid "Invalid source pattern `%s'" msgstr "" @@ -4079,7 +4079,7 @@ msgstr "" msgid "ButtonBar|Mkdir" msgstr "" -#: src/filemanager/mountlist.c:850 +#: src/filemanager/mountlist.c:853 msgid "Memory exhausted!" msgstr "" @@ -4255,52 +4255,52 @@ msgstr "" msgid "&Add new" msgstr "" -#: src/filemanager/panelize.c:173 src/filemanager/panelize.c:389 +#: src/filemanager/panelize.c:175 src/filemanager/panelize.c:391 msgid "External panelize" msgstr "" -#: src/filemanager/panelize.c:182 src/filemanager/panelize.c:284 -#: src/filemanager/panelize.c:587 src/filemanager/panelize.c:634 +#: src/filemanager/panelize.c:184 src/filemanager/panelize.c:286 +#: src/filemanager/panelize.c:589 src/filemanager/panelize.c:636 msgid "Other command" msgstr "" -#: src/filemanager/panelize.c:186 +#: src/filemanager/panelize.c:188 msgid "Command" msgstr "" -#: src/filemanager/panelize.c:264 +#: src/filemanager/panelize.c:266 msgid "Add to external panelize" msgstr "" -#: src/filemanager/panelize.c:265 +#: src/filemanager/panelize.c:267 msgid "Enter command label:" msgstr "" -#: src/filemanager/panelize.c:324 +#: src/filemanager/panelize.c:326 msgid "Cannot invoke command." msgstr "" -#: src/filemanager/panelize.c:389 +#: src/filemanager/panelize.c:391 msgid "Pipe close failed" msgstr "" -#: src/filemanager/panelize.c:528 +#: src/filemanager/panelize.c:530 msgid "Cannot run external panelize in a non-local directory" msgstr "" -#: src/filemanager/panelize.c:591 +#: src/filemanager/panelize.c:593 msgid "Modified git files" msgstr "" -#: src/filemanager/panelize.c:592 +#: src/filemanager/panelize.c:594 msgid "Find rejects after patching" msgstr "" -#: src/filemanager/panelize.c:594 +#: src/filemanager/panelize.c:596 msgid "Find *.orig after patching" msgstr "" -#: src/filemanager/panelize.c:596 +#: src/filemanager/panelize.c:598 msgid "Find SUID and SGID programs" msgstr "" @@ -4952,7 +4952,7 @@ msgstr "" #: src/vfs/sftpfs/config_parcer.c:222 #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" #: src/vfs/sftpfs/config_parcer.c:321 @@ -5296,6 +5296,6 @@ msgstr "" msgid "Continue from beginning?" msgstr "" -#: tests/src/execute__execute_with_vfs_arg.c:160 +#: tests/src/execute__execute_with_vfs_arg.c:156 msgid "Cannot fetch a local copy of /ftp://some.host/editme.txt" msgstr "" diff --git a/po/mn.po b/po/mn.po index 08efb1c99..f795dbb42 100644 --- a/po/mn.po +++ b/po/mn.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2486,11 +2486,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3792,7 +3792,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/nb.po b/po/nb.po index 17003aff8..32da300c5 100644 --- a/po/nb.po +++ b/po/nb.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2486,11 +2486,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3792,7 +3792,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/nl.po b/po/nl.po index 527e3a8c7..14e40b597 100644 --- a/po/nl.po +++ b/po/nl.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: bucovaina78 \n" "Language-Team: Dutch (http://www.transifex.com/projects/p/mc/language/nl/)\n" @@ -75,8 +75,8 @@ msgstr "Aanmaken van map %s mislukt" msgid "FATAL: not a directory:" msgstr "FATAAL: geen directory:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Er trad een fout op bij het migreren van gebruikersinstellingen: %s" #, c-format @@ -2633,11 +2633,11 @@ msgid "Target file already exists!" msgstr "Doelbestand bestaat reeds!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3960,9 +3960,9 @@ msgstr "" "Waarschuwing: ongeldige vlag %c in %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" -msgstr "" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" +msgstr "Er trad een fout op bij het migreren van gebruikersinstellingen: %s" msgid "sftp: Unable to get current user name." msgstr "" diff --git a/po/pl.po b/po/pl.po index 61924bb9f..966d909c9 100644 --- a/po/pl.po +++ b/po/pl.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 17:35+0000\n" "Last-Translator: Piotr Drąg \n" "Language-Team: Polish (http://www.transifex.com/projects/p/mc/language/pl/)\n" @@ -76,8 +76,8 @@ msgstr "Nie można utworzyć katalogu %s" msgid "FATAL: not a directory:" msgstr "KRYTYCZNE: nie jest katalogiem:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Wystąpił błąd podczas migrowania ustawień użytkownika: %s" #, c-format @@ -2667,12 +2667,12 @@ msgstr "%ld B/s" msgid "Target file already exists!" msgstr "Plik docelowy już istnieje." -#, c-format -msgid "New : %s, size %llu" +#, fuzzy, c-format +msgid "New : %s, size %s" msgstr "Nowy : %s, rozmiar %llu" -#, c-format -msgid "Existing: %s, size %llu" +#, fuzzy, c-format +msgid "Existing: %s, size %s" msgstr "Istniejący: %s, rozmiar %llu" msgid "Overwrite this target?" @@ -4003,8 +4003,8 @@ msgstr "" "Ostrzeżenie: nieprawidłowa flaga %c w %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: wystąpił błąd podczas odczytywania %s: %s" msgid "sftp: Unable to get current user name." diff --git a/po/pt.po b/po/pt.po index 8e1f60d48..62cb29099 100644 --- a/po/pt.po +++ b/po/pt.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Gilberto J \n" "Language-Team: Portuguese (http://www.transifex.com/projects/p/mc/language/" @@ -77,8 +77,8 @@ msgstr "Não é possível criar diretório %s" msgid "FATAL: not a directory:" msgstr "FATAL: não é um diretório:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Ocorreu um erro ao migrar a configuração de utilizador: %s" #, c-format @@ -2661,11 +2661,11 @@ msgid "Target file already exists!" msgstr "Ficheiro alvo já existe!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3987,8 +3987,8 @@ msgstr "" "Aviso: Flag inválida %c em %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: ocorreu um erro durante a leitura %s: %s" msgid "sftp: Unable to get current user name." diff --git a/po/pt_BR.po b/po/pt_BR.po index d4b99997e..7ff13c627 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Rafael Ferreira \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/projects/p/mc/" @@ -78,7 +78,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2597,11 +2597,11 @@ msgid "Target file already exists!" msgstr "O arquivo alvo já existe!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3909,7 +3909,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ro.po b/po/ro.po index f680cb009..c36a65bd1 100644 --- a/po/ro.po +++ b/po/ro.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Romanian (http://www.transifex.com/projects/p/mc/language/" @@ -74,7 +74,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2488,11 +2488,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3798,7 +3798,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ru.po b/po/ru.po index ce2984b7e..03019963f 100644 --- a/po/ru.po +++ b/po/ru.po @@ -18,17 +18,15 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" -"PO-Revision-Date: 2012-12-24 11:23+0300\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" +"PO-Revision-Date: 2013-03-12 13:31+0300\n" "Last-Translator: Andrew Borodin \n" -"Language-Team: Russian (http://www.transifex.com/projects/p/mc/language/" -"ru/)\n" +"Language-Team: Russian (http://www.transifex.com/projects/p/mc/language/ru/)\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" msgid "Warning: cannot load codepages list" msgstr "Внимание: невозможно загрузить список кодировок" @@ -87,7 +85,7 @@ msgid "FATAL: not a directory:" msgstr "ОШИБКА: не является каталогом:" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "Произошла ошибка при переносе пользовательских настроек: %s" #, c-format @@ -117,8 +115,7 @@ msgid "Not implemented yet" msgstr "Пока не реализовано" msgid "Num of replace tokens not equal to num of found tokens" -msgstr "" -"Количество шаблонных полей не соответствует количеству полей для замены" +msgstr "Количество шаблонных полей не соответствует количеству полей для замены" #, c-format msgid "Invalid token number %d" @@ -616,8 +613,7 @@ msgid "Load definitions of key bindings from specified file" msgstr "Чтение определений привязок клавиш из указанного файла" msgid "Don't load definitions of key bindings from file, use defaults" -msgstr "" -"Не загружать привязки клавиш из файла, использовать привязки по умолчанию" +msgstr "Не загружать привязки клавиш из файла, использовать привязки по умолчанию" msgid "Requests to run in black and white" msgstr "Принудительно установить черно-белый режим" @@ -654,26 +650,22 @@ msgid "" msgstr "" "--colors КЛЮЧЕВОЕ_СЛОВО={ТЕКСТ},{ФОН},{АТРИБУТ}:КЛЮЧЕВОЕ_СЛОВО2=...\n" "\n" -"{ТЕКСТ}, {ФОН} и {АТРИБУТ} можно опустить, чтобы использовать значения по " -"умолчанию\n" +"{ТЕКСТ}, {ФОН} и {АТРИБУТ} можно опустить, чтобы использовать значения по умолчанию\n" "\n" "Ключевые слова:\n" " Общие: errors, disabled, reverse, gauge, header\n" " input, inputmark, inputunchanged, commandlinemark\n" " bbarhotkey, bbarbutton, statusbar\n" " Отображение файлов: normal, selected, marked, markselect\n" -" Диалоги: dnormal, dfocus, dhotnormal, dhotfocus, " -"errdhotnormal,\n" +" Диалоги: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n" " errdhotfocus\n" -" Меню: menunormal, menuhot, menusel, menuhotsel, " -"menuinactive\n" +" Меню: menunormal, menuhot, menusel, menuhotsel, menuinactive\n" " Всплывающие меню: pmenunormal, pmenusel, pmenutitle\n" " Редактор: editnormal, editbold, editmarked, editwhitespace,\n" " editlinestate, editbg, editframe, editframeactive\n" " editframedrag\n" " Просмотрщик: viewbold, viewunderline, viewselected\n" -" Справка: helpnormal, helpitalic, helpbold, helplink, " -"helpslink\n" +" Справка: helpnormal, helpitalic, helpbold, helplink, helpslink\n" #. TRANSLATORS: don't translate color names and attributes msgid "" @@ -698,8 +690,7 @@ msgstr "" " от color16 до color255 или от rgb000 до rgb555 и от gray0 до gray23\n" "\n" "Атрибуты:\n" -" bold, underline, reverse, blink; несколько атрибутов объединяются знаком " -"\"+\"\n" +" bold, underline, reverse, blink; несколько атрибутов объединяются знаком \"+\"\n" msgid "Color options" msgstr "Цветовые настройки" @@ -1685,7 +1676,6 @@ msgstr "Обычный индикатор про&гресса" msgid "Mkdi&r autoname" msgstr "Автоим&я каталога" -#, fuzzy msgid "&Preallocate space" msgstr "Предварительно в&ыделить место" @@ -1717,7 +1707,6 @@ msgstr "Автоматические &меню" msgid "&Drop down menus" msgstr "Выпадение мен&ю при вызове" -#, fuzzy msgid "S&hell patterns" msgstr "Образцы в стиле &shell" @@ -2249,25 +2238,16 @@ msgid " %s%s file error" msgstr "ошибка файла %s%s" #, c-format -msgid "" -"The format of the %smc.ext file has changed with version 3.0. It seems that " -"the installation failed. Please fetch a fresh copy from the Midnight " -"Commander package." -msgstr "" -"Формат %smc.ext изменён с версии 3.0. Возможно, произошёл сбой при " -"установке. Пожалуйста, возьмите свежую копию из пакета Midnight Commander." +msgid "The format of the %smc.ext file has changed with version 3.0. It seems that the installation failed. Please fetch a fresh copy from the Midnight Commander package." +msgstr "Формат %smc.ext изменён с версии 3.0. Возможно, произошёл сбой при установке. Пожалуйста, возьмите свежую копию из пакета Midnight Commander." #, c-format msgid "%s file error" msgstr "ошибка файла %s" #, c-format -msgid "" -"The format of the %s file has changed with version 3.0. You may either want " -"to copy it from %smc.ext or use that file as an example of how to write it." -msgstr "" -"Формат файла %s изменён с версии 3.0. Вы можете либо скопировать его с %s/mc." -"ext, либо использовать этот файл как пример и написать свой." +msgid "The format of the %s file has changed with version 3.0. You may either want to copy it from %smc.ext or use that file as an example of how to write it." +msgstr "Формат файла %s изменён с версии 3.0. Вы можете либо скопировать его с %s/mc.ext, либо использовать этот файл как пример и написать свой." msgid "DialogTitle|Copy" msgstr "Копирование" @@ -2337,8 +2317,7 @@ msgid "" "\n" "Option Stable Symlinks will be disabled" msgstr "" -"Невозможно создать устойчивые симв. ссылки через нелокальные файловые " -"системы:\n" +"Невозможно создать устойчивые симв. ссылки через нелокальные файловые системы:\n" "\n" "Опция \"Устойчивые символические ссылки\" будет отменена" @@ -2681,12 +2660,12 @@ msgid "Target file already exists!" msgstr "Целевой файл уже существует!" #, c-format -msgid "New : %s, size %llu" -msgstr "Новый: дата модификации: %s, размер: %llu" +msgid "New : %s, size %s" +msgstr "Новый: %s, размер: %llu" #, c-format -msgid "Existing: %s, size %llu" -msgstr "Существующий: дата модификации: %s, размер: %llu" +msgid "Existing: %s, size %s" +msgstr "Существующий: %s, размер: %llu" msgid "Overwrite this target?" msgstr "Переписать этот файл?" @@ -4014,8 +3993,8 @@ msgstr "" "Предупреждение: неправильный флаг %c в %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: произошла ошибка при чтении %s: %s" msgid "sftp: Unable to get current user name." diff --git a/po/sk.po b/po/sk.po index 847f2c127..6a38c49ac 100644 --- a/po/sk.po +++ b/po/sk.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Jose Riha \n" "Language-Team: Slovak (http://www.transifex.com/projects/p/mc/language/sk/)\n" @@ -78,7 +78,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2497,11 +2497,11 @@ msgid "Target file already exists!" msgstr "Cieľový súbor už existuje!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3815,7 +3815,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/sl.po b/po/sl.po index 3c737ba0e..b2850e130 100644 --- a/po/sl.po +++ b/po/sl.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Slovenian (http://www.transifex.com/projects/p/mc/language/" @@ -79,7 +79,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2497,11 +2497,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3815,7 +3815,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/sr.po b/po/sr.po index abe8259e4..6a5e4c015 100644 --- a/po/sr.po +++ b/po/sr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Serbian (http://www.transifex.com/projects/p/mc/language/" @@ -74,7 +74,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2488,11 +2488,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3802,7 +3802,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/sv.po b/po/sv.po index b3dbe3a2e..1c7b90468 100644 --- a/po/sv.po +++ b/po/sv.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Cybjit \n" "Language-Team: Swedish (http://www.transifex.com/projects/p/mc/language/" @@ -74,7 +74,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2488,11 +2488,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3793,7 +3793,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/sv_SE.po b/po/sv_SE.po index 52a764556..4396d4469 100644 --- a/po/sv_SE.po +++ b/po/sv_SE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2011-12-07 11:21+0000\n" "Last-Translator: slavazanko \n" "Language-Team: Swedish (Sweden) (http://www.transifex.net/projects/p/mc/team/" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2482,11 +2482,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3752,7 +3752,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/ta.po b/po/ta.po index 3b5ad8513..46802bbac 100644 --- a/po/ta.po +++ b/po/ta.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2482,11 +2482,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3752,7 +3752,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/tr.po b/po/tr.po index a09531886..1364e412f 100644 --- a/po/tr.po +++ b/po/tr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Turkish (http://www.transifex.com/projects/p/mc/language/" @@ -73,7 +73,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2487,11 +2487,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3789,7 +3789,7 @@ msgstr "" "%3$s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/uk.po b/po/uk.po index 617ae4dc3..63c653909 100644 --- a/po/uk.po +++ b/po/uk.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: peinguin \n" "Language-Team: Ukrainian (http://www.transifex.com/projects/p/mc/language/" @@ -78,8 +78,8 @@ msgstr "Не вдалося створити каталог %s" msgid "FATAL: not a directory:" msgstr "Сталася помилка. Не є каталогом:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "Сталася помилка під час перенесення користувацьких настройок: %s" #, c-format @@ -2655,11 +2655,11 @@ msgid "Target file already exists!" msgstr "Цільовий файл вже існує." #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3986,8 +3986,8 @@ msgstr "" "Попередження: неправильний прапорець %c у %s:\n" "%s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" msgstr "sftp: сталася помилка при читанні %s: %s" msgid "sftp: Unable to get current user name." diff --git a/po/vi.po b/po/vi.po index bbfc09799..998daf819 100644 --- a/po/vi.po +++ b/po/vi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2486,11 +2486,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3791,7 +3791,7 @@ msgstr "" "%s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/wa.po b/po/wa.po index 0499bd9d4..622d38d60 100644 --- a/po/wa.po +++ b/po/wa.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2484,11 +2484,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3776,7 +3776,7 @@ msgid "" msgstr "" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name." diff --git a/po/zh_CN.po b/po/zh_CN.po index e57d6a95e..c3d28e3bf 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: Chinese (China) (http://www.transifex.com/projects/p/mc/" @@ -77,8 +77,8 @@ msgstr "不能建立目录%s" msgid "FATAL: not a directory:" msgstr "严重错误:不是一个目录:" -#, c-format -msgid "An error occured while migrating user settings: %s" +#, fuzzy, c-format +msgid "An error occurred while migrating user settings: %s" msgstr "迁移用户设置时发生了错误:%s" #, c-format @@ -2626,11 +2626,11 @@ msgid "Target file already exists!" msgstr "目标文件已存在!" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3947,9 +3947,9 @@ msgstr "" "警告:%2$s 中有无效的标志 %1$c\n" "%3$s\n" -#, c-format -msgid "sftp: an error occured while reading %s: %s" -msgstr "" +#, fuzzy, c-format +msgid "sftp: an error occurred while reading %s: %s" +msgstr "迁移用户设置时发生了错误:%s" msgid "sftp: Unable to get current user name." msgstr "" diff --git a/po/zh_TW.po b/po/zh_TW.po index 52cefb788..7b04ebd80 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Midnight Commander\n" "Report-Msgid-Bugs-To: http://www.midnight-commander.org/\n" -"POT-Creation-Date: 2013-03-09 15:45+0400\n" +"POT-Creation-Date: 2013-03-12 13:28+0400\n" "PO-Revision-Date: 2012-12-26 08:42+0000\n" "Last-Translator: Slava Zanko \n" "Language-Team: LANGUAGE \n" @@ -72,7 +72,7 @@ msgid "FATAL: not a directory:" msgstr "" #, c-format -msgid "An error occured while migrating user settings: %s" +msgid "An error occurred while migrating user settings: %s" msgstr "" #, c-format @@ -2486,11 +2486,11 @@ msgid "Target file already exists!" msgstr "" #, c-format -msgid "New : %s, size %llu" +msgid "New : %s, size %s" msgstr "" #, c-format -msgid "Existing: %s, size %llu" +msgid "Existing: %s, size %s" msgstr "" msgid "Overwrite this target?" @@ -3787,7 +3787,7 @@ msgstr "" "%3$s\n" #, c-format -msgid "sftp: an error occured while reading %s: %s" +msgid "sftp: an error occurred while reading %s: %s" msgstr "" msgid "sftp: Unable to get current user name."