Mercurial > vim
annotate src/testdir/test_modeline.vim @ 21509:00a2e4d3fc38
Added tag v8.2.1304 for changeset 6b2a5418cbc3b357c54049dbecabd18713e9d5b0
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 27 Jul 2020 20:00:05 +0200 |
parents | 246101db63a4 |
children | 08940efa6b4e |
rev | line source |
---|---|
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for parsing the modeline. |
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
14383
8846b8344430
patch 8.1.0206: duplicate test function name
Christian Brabandt <cb@256bit.org>
parents:
14381
diff
changeset
|
3 func Test_modeline_invalid() |
14989
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
4 " This was reading allocated memory in the past. |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 call writefile(['vi:0', 'nothing'], 'Xmodeline') |
14989
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
6 let modeline = &modeline |
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
7 set modeline |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call assert_fails('split Xmodeline', 'E518:') |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
9 |
18908
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
10 " Missing end colon (ignored). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
11 call writefile(['// vim: set ts=2'], 'Xmodeline') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
12 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
13 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
14 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
15 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
16 " Missing colon at beginning (ignored). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
17 call writefile(['// vim set ts=2:'], 'Xmodeline') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
18 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
19 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
20 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
21 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
22 " Missing space after vim (ignored). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
23 call writefile(['// vim:ts=2:'], 'Xmodeline') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
24 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
25 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
26 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
27 |
14989
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
28 let &modeline = modeline |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 bwipe! |
14387
68722ba52971
patch 8.1.0208: file left behind after running individual test
Christian Brabandt <cb@256bit.org>
parents:
14383
diff
changeset
|
30 call delete('Xmodeline') |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 endfunc |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
32 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
33 func Test_modeline_filetype() |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
34 call writefile(['vim: set ft=c :', 'nothing'], 'Xmodeline_filetype') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
35 let modeline = &modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
36 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
37 filetype plugin on |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
38 split Xmodeline_filetype |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
39 call assert_equal("c", &filetype) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
40 call assert_equal(1, b:did_ftplugin) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
41 call assert_equal("ccomplete#Complete", &ofu) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
42 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
43 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
44 call delete('Xmodeline_filetype') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
45 let &modeline = modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
46 filetype plugin off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
47 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
48 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
49 func Test_modeline_syntax() |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
50 call writefile(['vim: set syn=c :', 'nothing'], 'Xmodeline_syntax') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
51 let modeline = &modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
52 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
53 syntax enable |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
54 split Xmodeline_syntax |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
55 call assert_equal("c", &syntax) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
56 call assert_equal("c", b:current_syntax) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
57 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
58 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
59 call delete('Xmodeline_syntax') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
60 let &modeline = modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
61 syntax off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
62 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
63 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
64 func Test_modeline_keymap() |
15071
aabaf1499d05
patch 8.1.0546: modeline test with keymap fails
Bram Moolenaar <Bram@vim.org>
parents:
15066
diff
changeset
|
65 if !has('keymap') |
aabaf1499d05
patch 8.1.0546: modeline test with keymap fails
Bram Moolenaar <Bram@vim.org>
parents:
15066
diff
changeset
|
66 return |
aabaf1499d05
patch 8.1.0546: modeline test with keymap fails
Bram Moolenaar <Bram@vim.org>
parents:
15066
diff
changeset
|
67 endif |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
68 call writefile(['vim: set keymap=greek :', 'nothing'], 'Xmodeline_keymap') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
69 let modeline = &modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
70 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
71 split Xmodeline_keymap |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
72 call assert_equal("greek", &keymap) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
73 call assert_match('greek\|grk', b:keymap_name) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
74 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
75 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
76 call delete('Xmodeline_keymap') |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
77 let &modeline = modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
78 set keymap= iminsert=0 imsearch=-1 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
79 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
80 |
18908
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
81 func Test_modeline_version() |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
82 let modeline = &modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
83 set modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
84 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
85 " Test with vim:{vers}: (version {vers} or later). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
86 call writefile(['// vim' .. v:version .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
87 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
88 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
89 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
90 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
91 call writefile(['// vim' .. (v:version - 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
92 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
93 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
94 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
95 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
96 call writefile(['// vim' .. (v:version + 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
97 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
98 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
99 bw! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
100 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
101 " Test with vim>{vers}: (version after {vers}). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
102 call writefile(['// vim>' .. v:version .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
103 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
104 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
105 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
106 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
107 call writefile(['// vim>' .. (v:version - 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
108 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
109 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
110 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
111 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
112 call writefile(['// vim>' .. (v:version + 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
113 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
114 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
115 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
116 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
117 " Test with vim<{vers}: (version before {vers}). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
118 call writefile(['// vim<' .. v:version .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
119 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
120 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
121 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
122 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
123 call writefile(['// vim<' .. (v:version - 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
124 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
125 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
126 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
127 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
128 call writefile(['// vim<' .. (v:version + 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
129 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
130 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
131 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
132 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
133 " Test with vim={vers}: (version {vers} only). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
134 call writefile(['// vim=' .. v:version .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
135 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
136 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
137 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
138 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
139 call writefile(['// vim=' .. (v:version - 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
140 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
141 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
142 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
143 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
144 call writefile(['// vim=' .. (v:version + 100) .. ': ts=2:'], 'Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
145 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
146 call assert_equal(8, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
147 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
148 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
149 let &modeline = modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
150 call delete('Xmodeline_version') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
151 endfunc |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
152 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
153 func Test_modeline_colon() |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
154 let modeline = &modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
155 set modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
156 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
157 call writefile(['// vim: set showbreak=\: ts=2: sw=2'], 'Xmodeline_colon') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
158 edit Xmodeline_colon |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
159 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
160 " backlash colon should become colon. |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
161 call assert_equal(':', &showbreak) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
162 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
163 " 'ts' should be set. |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
164 " 'sw' should be ignored because it is after the end colon. |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
165 call assert_equal(2, &ts) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
166 call assert_equal(8, &sw) |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
167 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
168 let &modeline = modeline |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
169 call delete('Xmodeline_colon') |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
170 endfunc |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
171 |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
172 func s:modeline_fails(what, text, error) |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
173 if !exists('+' .. a:what) |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
174 return |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
175 endif |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
176 let fname = "Xmodeline_fails_" . a:what |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
177 call writefile(['vim: set ' . a:text . ' :', 'nothing'], fname) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
178 let modeline = &modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
179 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
180 filetype plugin on |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
181 syntax enable |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
182 call assert_fails('split ' . fname, a:error) |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
183 call assert_equal("", &filetype) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
184 call assert_equal("", &syntax) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
185 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
186 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
187 call delete(fname) |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
188 let &modeline = modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
189 filetype plugin off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
190 syntax off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
191 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
192 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
193 func Test_modeline_filetype_fails() |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
194 call s:modeline_fails('filetype', 'ft=evil$CMD', 'E474:') |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
195 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
196 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
197 func Test_modeline_syntax_fails() |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
198 call s:modeline_fails('syntax', 'syn=evil$CMD', 'E474:') |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
199 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
200 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
201 func Test_modeline_keymap_fails() |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
202 call s:modeline_fails('keymap', 'keymap=evil$CMD', 'E474:') |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
203 endfunc |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
204 |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
205 func Test_modeline_fails_always() |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
206 call s:modeline_fails('backupdir', 'backupdir=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
207 call s:modeline_fails('cdpath', 'cdpath=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
208 call s:modeline_fails('charconvert', 'charconvert=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
209 call s:modeline_fails('completefunc', 'completefunc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
210 call s:modeline_fails('cscopeprg', 'cscopeprg=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
211 call s:modeline_fails('diffexpr', 'diffexpr=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
212 call s:modeline_fails('directory', 'directory=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
213 call s:modeline_fails('equalprg', 'equalprg=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
214 call s:modeline_fails('errorfile', 'errorfile=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
215 call s:modeline_fails('exrc', 'exrc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
216 call s:modeline_fails('formatprg', 'formatprg=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
217 call s:modeline_fails('fsync', 'fsync=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
218 call s:modeline_fails('grepprg', 'grepprg=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
219 call s:modeline_fails('helpfile', 'helpfile=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
220 call s:modeline_fails('imactivatefunc', 'imactivatefunc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
221 call s:modeline_fails('imstatusfunc', 'imstatusfunc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
222 call s:modeline_fails('imstyle', 'imstyle=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
223 call s:modeline_fails('keywordprg', 'keywordprg=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
224 call s:modeline_fails('langmap', 'langmap=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
225 call s:modeline_fails('luadll', 'luadll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
226 call s:modeline_fails('makeef', 'makeef=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
227 call s:modeline_fails('makeprg', 'makeprg=Something()', 'E520:') |
16798
63ac51f16ea1
patch 8.1.1401: misspelled mkspellmem as makespellmem
Bram Moolenaar <Bram@vim.org>
parents:
16732
diff
changeset
|
228 call s:modeline_fails('mkspellmem', 'mkspellmem=Something()', 'E520:') |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
229 call s:modeline_fails('mzschemedll', 'mzschemedll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
230 call s:modeline_fails('mzschemegcdll', 'mzschemegcdll=Something()', 'E520:') |
16730
000350f8e4d1
patch 8.1.1367: can set 'modelineexpr' in modeline
Bram Moolenaar <Bram@vim.org>
parents:
16728
diff
changeset
|
231 call s:modeline_fails('modelineexpr', 'modelineexpr', 'E520:') |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
232 call s:modeline_fails('omnifunc', 'omnifunc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
233 call s:modeline_fails('operatorfunc', 'operatorfunc=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
234 call s:modeline_fails('perldll', 'perldll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
235 call s:modeline_fails('printdevice', 'printdevice=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
236 call s:modeline_fails('patchexpr', 'patchexpr=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
237 call s:modeline_fails('printexpr', 'printexpr=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
238 call s:modeline_fails('pythondll', 'pythondll=Something()', 'E520:') |
16732
6411f8ef550d
patch 8.1.1368: modeline test fails with python but without pythonhome
Bram Moolenaar <Bram@vim.org>
parents:
16730
diff
changeset
|
239 call s:modeline_fails('pythonhome', 'pythonhome=Something()', 'E520:') |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
240 call s:modeline_fails('pythonthreedll', 'pythonthreedll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
241 call s:modeline_fails('pythonthreehome', 'pythonthreehome=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
242 call s:modeline_fails('pyxversion', 'pyxversion=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
243 call s:modeline_fails('rubydll', 'rubydll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
244 call s:modeline_fails('runtimepath', 'runtimepath=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
245 call s:modeline_fails('secure', 'secure=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
246 call s:modeline_fails('shell', 'shell=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
247 call s:modeline_fails('shellcmdflag', 'shellcmdflag=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
248 call s:modeline_fails('shellpipe', 'shellpipe=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
249 call s:modeline_fails('shellquote', 'shellquote=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
250 call s:modeline_fails('shellredir', 'shellredir=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
251 call s:modeline_fails('shellxquote', 'shellxquote=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
252 call s:modeline_fails('spellfile', 'spellfile=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
253 call s:modeline_fails('spellsuggest', 'spellsuggest=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
254 call s:modeline_fails('tcldll', 'tcldll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
255 call s:modeline_fails('titleold', 'titleold=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
256 call s:modeline_fails('viewdir', 'viewdir=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
257 call s:modeline_fails('viminfo', 'viminfo=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
258 call s:modeline_fails('viminfofile', 'viminfofile=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
259 call s:modeline_fails('winptydll', 'winptydll=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
260 call s:modeline_fails('undodir', 'undodir=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
261 " only check a few terminal options |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
262 call s:modeline_fails('t_AB', 't_AB=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
263 call s:modeline_fails('t_ce', 't_ce=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
264 call s:modeline_fails('t_sr', 't_sr=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
265 call s:modeline_fails('t_8b', 't_8b=Something()', 'E520:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
266 endfunc |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
267 |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
268 func Test_modeline_fails_modelineexpr() |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
269 call s:modeline_fails('balloonexpr', 'balloonexpr=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
270 call s:modeline_fails('foldexpr', 'foldexpr=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
271 call s:modeline_fails('foldtext', 'foldtext=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
272 call s:modeline_fails('formatexpr', 'formatexpr=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
273 call s:modeline_fails('guitablabel', 'guitablabel=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
274 call s:modeline_fails('iconstring', 'iconstring=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
275 call s:modeline_fails('includeexpr', 'includeexpr=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
276 call s:modeline_fails('indentexpr', 'indentexpr=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
277 call s:modeline_fails('rulerformat', 'rulerformat=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
278 call s:modeline_fails('statusline', 'statusline=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
279 call s:modeline_fails('tabline', 'tabline=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
280 call s:modeline_fails('titlestring', 'titlestring=Something()', 'E992:') |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
281 endfunc |
20269
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
282 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
283 func Test_modeline_setoption_verbose() |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
284 let modeline = &modeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
285 set modeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
286 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
287 let lines =<< trim END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
288 1 vim:ts=2 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
289 2 two |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
290 3 three |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
291 4 four |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
292 5 five |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
293 6 six |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
294 7 seven |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
295 8 eight |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
296 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
297 call writefile(lines, 'Xmodeline') |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
298 edit Xmodeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
299 let info = split(execute('verbose set tabstop?'), "\n") |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
300 call assert_match('^\s*Last set from modeline line 1$', info[-1]) |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
301 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
302 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
303 let lines =<< trim END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
304 1 one |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
305 2 two |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
306 3 three |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
307 4 vim:ts=4 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
308 5 five |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
309 6 six |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
310 7 seven |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
311 8 eight |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
312 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
313 call writefile(lines, 'Xmodeline') |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
314 edit Xmodeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
315 let info = split(execute('verbose set tabstop?'), "\n") |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
316 call assert_match('^\s*Last set from modeline line 4$', info[-1]) |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
317 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
318 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
319 let lines =<< trim END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
320 1 one |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
321 2 two |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
322 3 three |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
323 4 four |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
324 5 five |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
325 6 six |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
326 7 seven |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
327 8 vim:ts=8 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
328 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
329 call writefile(lines, 'Xmodeline') |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
330 edit Xmodeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
331 let info = split(execute('verbose set tabstop?'), "\n") |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
332 call assert_match('^\s*Last set from modeline line 8$', info[-1]) |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
333 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
334 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
335 let &modeline = modeline |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
336 call delete('Xmodeline') |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
337 endfunc |