Mercurial > vim
annotate src/testdir/test_modeline.vim @ 27690:fae9567b8024 v8.2.4371
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Commit: https://github.com/vim/vim/commit/75e27d78f5370e7d2e0898326d9b080937e7b090
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 13 13:56:29 2022 +0000
patch 8.2.4371: Vim9: can create a script variable from a legacy function
Problem: Vim9: can create a script variable from a legacy function.
Solution: Disallow creating a script variable from a function.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Feb 2022 15:00:03 +0100 |
parents | 64fa341cc33b |
children | 13b02c1ea0f7 |
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 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
3 source check.vim |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
4 |
14383
8846b8344430
patch 8.1.0206: duplicate test function name
Christian Brabandt <cb@256bit.org>
parents:
14381
diff
changeset
|
5 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
|
6 " 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
|
7 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
|
8 let modeline = &modeline |
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
9 set modeline |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 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
|
11 |
18908
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
12 " Missing end colon (ignored). |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
13 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
|
14 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
15 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
|
16 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
17 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
18 " 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
|
19 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
|
20 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
21 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
|
22 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
23 |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
24 " 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
|
25 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
|
26 edit Xmodeline_version |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
27 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
|
28 bwipe! |
61fa1a9d09dd
patch 8.2.0015: not all modeline variants are tested
Bram Moolenaar <Bram@vim.org>
parents:
16798
diff
changeset
|
29 |
14989
85467d180844
patch 8.1.0506: modeline test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents:
14387
diff
changeset
|
30 let &modeline = modeline |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 bwipe! |
14387
68722ba52971
patch 8.1.0208: file left behind after running individual test
Christian Brabandt <cb@256bit.org>
parents:
14383
diff
changeset
|
32 call delete('Xmodeline') |
14381
d9e6eec551e1
patch 8.1.0205: invalid memory access with invalid modeline
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 endfunc |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
34 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
39 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
45 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
50 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
51 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
|
52 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
|
53 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
|
54 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
55 syntax enable |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
56 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
|
57 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
|
58 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
|
59 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
60 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
61 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
|
62 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
|
63 syntax off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
64 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
65 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
66 func Test_modeline_keymap() |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
67 CheckFeature keymap |
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) |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
173 call CheckOption(a:what) |
15066
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
174 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
|
175 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
|
176 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
|
177 set modeline |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
178 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
|
179 syntax enable |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
180 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
|
181 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
|
182 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
|
183 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
184 bwipe! |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 syntax off |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
189 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
190 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
191 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
|
192 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
|
193 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
194 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
195 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
|
196 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
|
197 endfunc |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
198 |
40d9218b2b12
patch 8.1.0544: setting 'filetype' in a modeline causes an error
Bram Moolenaar <Bram@vim.org>
parents:
14989
diff
changeset
|
199 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
|
200 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
|
201 endfunc |
16728
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
202 |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 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
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 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
|
259 " 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
|
260 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
|
261 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
|
262 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
|
263 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
|
264 endfunc |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
265 |
e55c26aaf484
patch 8.1.1366: using expressions in a modeline is unsafe
Bram Moolenaar <Bram@vim.org>
parents:
15073
diff
changeset
|
266 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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 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
|
274 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
|
275 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
|
276 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
|
277 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
|
278 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
|
279 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
|
280 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
281 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
|
282 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
|
283 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
|
284 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
295 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
|
296 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
|
297 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
|
298 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
|
299 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
300 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
301 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
|
302 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
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
311 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
|
312 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
|
313 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
|
314 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
|
315 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
316 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 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
|
326 END |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
327 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
|
328 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
|
329 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
|
330 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
|
331 bwipe! |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
332 |
246101db63a4
patch 8.2.0690: line number of option set by modeline is wrong
Bram Moolenaar <Bram@vim.org>
parents:
18908
diff
changeset
|
333 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
|
334 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
|
335 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
336 |
24914
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
337 " Test for the 'modeline' default value in compatible and non-compatible modes |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
338 " for root and non-root accounts |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
339 func Test_modeline_default() |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
340 set compatible |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
341 call assert_false(&modeline) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
342 set nocompatible |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
343 call assert_equal(IsRoot() ? 0 : 1, &modeline) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
344 set compatible&vi |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
345 call assert_false(&modeline) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
346 set compatible&vim |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
347 call assert_equal(IsRoot() ? 0 : 1, &modeline) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
348 set compatible& modeline& |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
349 endfunc |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
350 |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
351 " Some options cannot be set from the modeline when 'diff' option is set |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
352 func Test_modeline_diff_buffer() |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
353 call writefile(['vim: diff foldmethod=marker wrap'], 'Xfile') |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
354 set foldmethod& nowrap |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
355 new Xfile |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
356 call assert_equal('manual', &foldmethod) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
357 call assert_false(&wrap) |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
358 set wrap& |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
359 call delete('Xfile') |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
360 bw |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
361 endfunc |
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
362 |
25696
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
363 func Test_modeline_disable() |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
364 set modeline |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
365 call writefile(['vim: sw=2', 'vim: nomodeline', 'vim: sw=3'], 'Xmodeline_disable') |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
366 edit Xmodeline_disable |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
367 call assert_equal(2, &sw) |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
368 call delete('Xmodeline_disable') |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
369 endfunc |
64fa341cc33b
patch 8.2.3384: cannot disable modeline for an individual file
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
370 |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
20269
diff
changeset
|
371 " vim: shiftwidth=2 sts=2 expandtab |