annotate src/testdir/test_makeencoding.vim @ 16732:6411f8ef550d v8.1.1368

patch 8.1.1368: modeline test fails with python but without pythonhome commit https://github.com/vim/vim/commit/e09244ee3567d658c293fb1ae0d47a1a8be870ac Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 23 17:35:55 2019 +0200 patch 8.1.1368: modeline test fails with python but without pythonhome Problem: Modeline test fails with python but without pythonhome. Solution: Correct test argument.
author Bram Moolenaar <Bram@vim.org>
date Thu, 23 May 2019 17:45:05 +0200
parents 2dcaa860e3fc
children f38fcbf343ce
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
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 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
4
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 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
6 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
7 " 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
8 finish
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endif
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 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
12
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 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
14 \ 'utf-8': 'ÀÈÌÒÙ こんにちは 你好',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ 'latin1': 'ÀÈÌÒÙ',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ 'cp932': 'こんにちは',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ 'cp936': '你好',
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \}
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " 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
22 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
23 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
24 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
25
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " :cgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 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
28 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
29 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
30 cgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 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
33 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " :lgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 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
39 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
40 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
41 lgetfile
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 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
44 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 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
49 endfunc
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
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 " 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
53 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
54 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
55 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
56
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " :grep
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 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
59 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
60 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
61 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 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
63 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 " :lgrep
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 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
69 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
70 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
71 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 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
73 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 endfunc
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 " 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
80 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
81 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
82 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
83
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 " :make
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 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
86 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
87 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
88 copen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 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
90 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 cclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 " :lmake
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 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
96 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
97 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
98 lopen
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 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
100 \ getline('.'))
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 lclose
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 endfor
e71d3bdf3bc3 patch 8.0.0420: text garbled when the system encoding differs from 'encoding'
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 endfunc