-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathbackspace.c
55 lines (42 loc) · 1020 Bytes
/
backspace.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "libvim.h"
#include "minunit.h"
void test_setup(void)
{
vimKey("<Esc>");
vimKey("<Esc>");
vimExecute("e!");
vimInput("g");
vimInput("g");
vimInput("0");
}
void test_teardown(void) {}
MU_TEST(backspace_beyond_insert)
{
// Go to end of 'This'
vimInput("e");
// Enter insert after 'This'
vimInput("a");
// Backspace a couple of times...
// This verifies we have the correct backspace settings
// (default doesn't backspace past insert region)
vimKey("<c-h>");
vimKey("<c-h>");
char_u *line = vimBufferGetLine(curbuf, vimCursorGetLine());
printf("LINE: %s\n", line);
mu_check(strcmp(line, "Th is the first line of a test file") == 0);
}
MU_TEST_SUITE(test_suite)
{
MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
MU_RUN_TEST(backspace_beyond_insert);
}
int main(int argc, char **argv)
{
vimInit(argc, argv);
win_setwidth(5);
win_setheight(100);
vimBufferOpen("collateral/testfile.txt", 1, 0);
MU_RUN_SUITE(test_suite);
MU_REPORT();
MU_RETURN();
}