Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 2f0972b

Browse files
slavazpfalcon
authored andcommitted
Added unit tests for checking "detect type of line breaks" functionality
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
1 parent 53c0830 commit 2f0972b

File tree

3 files changed

+407
-2
lines changed

3 files changed

+407
-2
lines changed

tests/src/editor/Makefile.am

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ AM_CPPFLAGS = \
22
-DTEST_SHARE_DIR=\"$(abs_srcdir)\" \
33
$(GLIB_CFLAGS) \
44
-I$(top_srcdir) \
5+
-I$(top_srcdir)/src/editor \
56
@CHECK_CFLAGS@
67

78
AM_LDFLAGS = @TESTS_LDFLAGS@
@@ -15,13 +16,19 @@ if ENABLE_VFS_SMB
1516
LIBS += $(top_builddir)/src/vfs/smbfs/helpers/libsamba.a
1617
endif
1718

18-
EXTRA_DIST = mc.charsets test-data.txt.in
19+
EXTRA_DIST = mc.charsets test-data.txt.in \
20+
common_editor_includes.c
21+
22+
CLEANFILES = detect_linebreaks.log
1923

2024
TESTS = \
21-
editcmd__edit_complete_word_cmd
25+
editcmd__edit_complete_word_cmd \
26+
detect_linebreaks
2227

2328
check_PROGRAMS = $(TESTS)
2429

2530
editcmd__edit_complete_word_cmd_SOURCES = \
2631
editcmd__edit_complete_word_cmd.c
2732

33+
detect_linebreaks_SOURCES = \
34+
detect_linebreaks.c
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
src/editor - common include files for testing static functions
3+
4+
Copyright (C) 2011
5+
The Free Software Foundation, Inc.
6+
7+
Written by:
8+
Slava Zanko <slavazanko@gmail.com>, 2011
9+
10+
This file is part of the Midnight Commander.
11+
12+
The Midnight Commander is free software: you can redistribute it
13+
and/or modify it under the terms of the GNU General Public License as
14+
published by the Free Software Foundation, either version 3 of the License,
15+
or (at your option) any later version.
16+
17+
The Midnight Commander is distributed in the hope that it will be useful,
18+
but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
GNU General Public License for more details.
21+
22+
You should have received a copy of the GNU General Public License
23+
along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*/
25+
26+
#include "edit-widget.h"
27+
#include "lib/global.h"
28+
#include "lib/keybind.h"
29+
30+
/* ********************************************************************************************* */
31+
/* mock variables and functions */
32+
33+
int drop_menus = 0;
34+
const global_keymap_t *editor_map = NULL;
35+
const global_keymap_t *editor_x_map = NULL;
36+
GArray *macros_list = NULL;
37+
int option_tab_spacing = 8;
38+
int macro_index = -1;
39+
40+
static gboolean
41+
do_select_codepage (void)
42+
{
43+
return TRUE;
44+
}
45+
static gboolean
46+
user_menu_cmd (struct WEdit *edit_widget, const char *menu_file, int selected_entry)
47+
{
48+
(void) edit_widget;
49+
(void) menu_file;
50+
(void) selected_entry;
51+
return TRUE;
52+
}
53+
static int
54+
check_for_default (const char *default_file, const char *file)
55+
{
56+
(void) default_file;
57+
(void) file;
58+
return 0;
59+
}
60+
static void
61+
save_setup_cmd (void)
62+
{
63+
}
64+
static void
65+
learn_keys (void)
66+
{
67+
}
68+
static void
69+
view_other_cmd (void)
70+
{
71+
}
72+
73+
/* ********************************************************************************************* */
74+
75+
#include "bookmark.c"
76+
#include "edit.c"
77+
#include "editcmd.c"
78+
#include "editwidget.c"
79+
#include "editdraw.c"
80+
#include "editkeys.c"
81+
#include "editmenu.c"
82+
#include "editoptions.c"
83+
#include "syntax.c"
84+
#include "wordproc.c"
85+
#include "choosesyntax.c"
86+
#include "etags.c"
87+
#include "editcmd_dialogs.c"

0 commit comments

Comments
 (0)