-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathctrl_g.c
65 lines (47 loc) · 1.18 KB
/
ctrl_g.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
56
57
58
59
60
61
62
63
64
65
#include "libvim.h"
#include "minunit.h"
#define MAX_TEST_MESSAGE 8192
char_u lastMessage[MAX_TEST_MESSAGE];
char_u lastTitle[MAX_TEST_MESSAGE];
msgPriority_T lastPriority;
void onMessage(char_u *title, char_u *msg, msgPriority_T priority)
{
printf("onMessage - title: |%s| contents: |%s|", title, msg);
assert(strlen(msg) < MAX_TEST_MESSAGE);
assert(strlen(title) < MAX_TEST_MESSAGE);
strcpy(lastMessage, msg);
strcpy(lastTitle, title);
lastPriority = priority;
};
void test_setup(void)
{
vimSetMessageCallback(&onMessage);
vimKey("<esc>");
vimKey("<esc>");
vimExecute("e!");
vimInput("g");
vimInput("g");
}
void test_teardown(void) {}
MU_TEST(test_fileinfo)
{
vimKey("<c-g>");
char_u *expected = "\"collateral/testfile.txt\" line 1 of 3 --33\%-- col 1";
mu_check(strcmp(lastMessage, expected) == 0);
mu_check(lastPriority == MSG_INFO);
}
MU_TEST_SUITE(test_suite)
{
MU_SUITE_CONFIGURE(&test_setup, &test_teardown);
MU_RUN_TEST(test_fileinfo);
}
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();
}