annotate src/testdir/test_makeencoding.vim @ 14172:f049f9ba9b61

Added tag v8.1.0103 for changeset ddf160d8297191f206e5d4168e039b4a17d2a717
author Christian Brabandt <cb@256bit.org>
date Sat, 23 Jun 2018 16:15:05 +0200
parents e71d3bdf3bc3
children 2dcaa860e3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11063
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'makeencoding'.
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 if !has('multi_byte')
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 finish
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 endif
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 source shared.vim
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let s:python = PythonProg()
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 if s:python == ''
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " Can't run this test.
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 finish
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 endif
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let s:script = 'test_makeencoding.py'
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 let s:message_tbl = {
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ 'latin1': 'ÀÈÌÒÙ',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 \ 'cp932': 'こんにちは',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 \ 'cp936': '你好',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 \}
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " Tests for :cgetfile and :lgetfile.
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 func Test_getfile()
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 set errorfile=Xerror.txt
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 set errorformat=%f(%l)\ :\ %m
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " :cgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 cgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " :lgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 exec "silent !" . s:python . " " . s:script . " " . enc . " > " . &errorfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 lgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call delete(&errorfile)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 endfunc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " Tests for :grep and :lgrep.
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 func Test_grep()
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 let &grepprg = s:python
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 set grepformat=%f(%l)\ :\ %m
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " :grep
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 exec "silent grep! " . s:script . " " . enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " :lgrep
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 exec "silent lgrep! " . s:script . " " . enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 endfunc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 " Tests for :make and :lmake.
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 func Test_make()
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 let &makeprg = s:python
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 set errorformat=%f(%l)\ :\ %m
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 " :make
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 exec "silent make! " . s:script . " " . enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " :lmake
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 for enc in keys(s:message_tbl)
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 let &makeencoding = enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 exec "silent lmake! " . s:script . " " . enc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 call assert_equal("Xfoobar.c|10| " . s:message_tbl[enc] . " (" . enc . ")",
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 endfunc