blob: d18b3b6de8169361eea2930acf303cc3fc4dfe63 (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
" Tests for 'makeencoding'.
source shared.vim
let s:python = PythonProg()
if s:python == ''
" Can't run this test.
finish
endif
let s:script = 'test_makeencoding.py'
let s:message_tbl = {
\ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好',
\ 'latin1': 'ÀÈÌÒÙ',
\ 'cp932': 'こんにちは',
\ 'cp936': '你好',
\}
" Tests for :cgetfile and :lgetfile.
func Test_getfile()
set errorfile=Xerror.txt
set errorformat=%f(%l)\ :\ %m
" :cgetfile
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile
cgetfile
copen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
cclose
endfor
" :lgetfile
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile
lgetfile
lopen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
lclose
endfor
call delete(&errorfile)
endfunc
" Tests for :grep and :lgrep.
func Test_grep()
let &grepprg = s:python
set grepformat=%f(%l)\ :\ %m
" :grep
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent grep! " . s:script . " " . enc
copen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
cclose
endfor
" :lgrep
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent lgrep! " . s:script . " " . enc
lopen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
lclose
endfor
endfunc
" Tests for :make and :lmake.
func Test_make()
let &makeprg = s:python
set errorformat=%f(%l)\ :\ %m
" :make
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent make! " . s:script . " " . enc
copen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
cclose
endfor
" :lmake
for enc in keys(s:message_tbl)
let &makeencoding = enc
exec "silent lmake! " . s:script . " " . enc
lopen
call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
\ getline('.'))
lclose
endfor
endfunc
|