annotate src/testdir/test_vim9_cmd.vim @ 23274:10bbff53d3d1 v8.2.2183

patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used Commit: https://github.com/vim/vim/commit/60f63100b9bc1d24b7b80c81f43cf2fc3da95987 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 21 20:32:43 2020 +0100 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used Problem: Vim9: value of 'edcompatible' and 'gdefault' are used. Solution: Ignore these deprecated options in Vim9 script. (closes https://github.com/vim/vim/issues/7508)
author Bram Moolenaar <Bram@vim.org>
date Mon, 21 Dec 2020 20:45:05 +0100
parents a84e7abb0c92
children 1f37fd20f851
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test commands that are not compiled in a :def function
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
3 source check.vim
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source vim9.vim
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
5 source term_util.vim
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
6 source view_util.vim
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 def Test_edit_wildcards()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
9 var filename = 'Xtest'
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 edit `=filename`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 assert_equal('Xtest', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
13 var filenr = 123
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 edit Xtest`=filenr`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 assert_equal('Xtest123', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 filenr = 77
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 edit `=filename``=filenr`
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 assert_equal('Xtest77', bufname())
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 edit X`=filename`xx`=filenr`yy
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 assert_equal('XXtestxx77yy', bufname())
23197
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
23
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
24 CheckDefFailure(['edit `=xxx`'], 'E1001:')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
25 CheckDefFailure(['edit `="foo"'], 'E1083:')
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 enddef
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
28 def Test_hardcopy_wildcards()
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
29 CheckUnix
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
30 CheckFeature postscript
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
31
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
32 var outfile = 'print'
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
33 hardcopy > X`=outfile`.ps
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
34 assert_true(filereadable('Xprint.ps'))
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
35
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
36 delete('Xprint.ps')
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
37 enddef
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
38
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
39 def Test_syn_include_wildcards()
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
40 writefile(['syn keyword Found found'], 'Xthemine.vim')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
41 var save_rtp = &rtp
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
42 &rtp = '.'
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
43
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
44 var fname = 'mine'
20172
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
45 syn include @Group Xthe`=fname`.vim
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
46 assert_match('Found.* contained found', execute('syn list Found'))
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
47
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
48 &rtp = save_rtp
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
49 delete('Xthemine.vim')
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
50 enddef
1d84eaed0ec8 patch 8.2.0641: Vim9: not expanded in :hardcopy and syn-include
Bram Moolenaar <Bram@vim.org>
parents: 20170
diff changeset
51
21048
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
52 def Test_echo_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
53 var lines =<< trim END
21048
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
54 vim9script
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
55 redir @a
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
56 echo 'one'
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
57 .. 'two'
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
58 redir END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
59 assert_equal("\nonetwo", @a)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
60 END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
61 CheckScriptSuccess(lines)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
62
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
63 lines =<< trim END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
64 vim9script
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
65 redir @a
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
66 echo 11 +
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
67 77
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
68 - 22
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
69 redir END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
70 assert_equal("\n66", @a)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
71 END
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
72 CheckScriptSuccess(lines)
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
73 enddef
524fa1d42e1e patch 8.2.1075: Vim9: no line break allowed in :echo expression
Bram Moolenaar <Bram@vim.org>
parents: 20353
diff changeset
74
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
75 def Test_condition_types()
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
76 var lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
77 if 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
78 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
79 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
80 CheckDefAndScriptFailure(lines, 'E1135:', 1)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
81
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
82 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
83 if [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
84 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
85 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
86 CheckDefFailure(lines, 'E1012:', 1)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
87 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
88
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
89 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
90 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
91 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
92 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
93 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
94 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
95
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
96 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
97 g:cond = 0
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
98 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
99 elseif 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
100 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
101 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
102 CheckDefFailure(lines, 'E1012:', 3)
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
103 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 4)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
104
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
105 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
106 if g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
107 elseif [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
108 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
109 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
110 CheckDefFailure(lines, 'E1012:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
111 CheckScriptFailure(['vim9script'] + lines, 'E745:', 3)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
112
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
113 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
114 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
115 if 0
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
116 elseif g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
117 endif
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
118 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
119 CheckDefExecAndScriptFailure(lines, 'E1135:', 3)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
120
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
121 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
122 while 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
123 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
124 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
125 CheckDefFailure(lines, 'E1012:', 1)
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
126 CheckScriptFailure(['vim9script'] + lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
127
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
128 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
129 while [1]
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
130 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
131 END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
132 CheckDefFailure(lines, 'E1012:', 1)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
133 CheckScriptFailure(['vim9script'] + lines, 'E745:', 2)
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
134
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
135 lines =<< trim END
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
136 g:cond = 'text'
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
137 while g:cond
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
138 endwhile
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
139 END
22860
53acb89ec9f2 patch 8.2.1977: Vim9: error for using a string in a condition is confusing
Bram Moolenaar <Bram@vim.org>
parents: 22814
diff changeset
140 CheckDefExecAndScriptFailure(lines, 'E1135:', 2)
22500
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
141 enddef
ef8a3177edc1 patch 8.2.1798: Vim9: trinary operator condition is too permissive
Bram Moolenaar <Bram@vim.org>
parents: 22494
diff changeset
142
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
143 def Test_if_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
144 var lines =<< trim END
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
145 vim9script
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
146 if 1 &&
22494
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
147 true
4c21f7f6f9e3 patch 8.2.1795: Vim9: operators && and || have a confusing result
Bram Moolenaar <Bram@vim.org>
parents: 22435
diff changeset
148 || 1
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
149 g:res = 42
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
150 endif
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
151 assert_equal(42, g:res)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
152 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
153 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
154 unlet g:res
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
155
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
156 lines =<< trim END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
157 vim9script
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
158 if 1 &&
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
159 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
160 g:res = 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
161 elseif 0 ||
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
162 0
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
163 || 1
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
164 g:res = 12
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
165 endif
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
166 assert_equal(12, g:res)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
167 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
168 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
169 unlet g:res
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
170 enddef
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
171
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
172 def Test_while_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
173 var lines =<< trim END
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
174 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
175 var nr = 0
21056
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
176 while nr <
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
177 10 + 3
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
178 nr = nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
179 + 4
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
180 endwhile
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
181 assert_equal(16, nr)
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
182 END
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
183 CheckScriptSuccess(lines)
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
184
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
185 lines =<< trim END
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
186 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
187 var nr = 0
21056
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
188 while nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
189 <
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
190 10
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
191 +
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
192 3
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
193 nr = nr
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
194 +
a7c202f5cbe9 patch 8.2.1079: Vim9: no line break allowed in a while loop
Bram Moolenaar <Bram@vim.org>
parents: 21050
diff changeset
195 4
21050
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
196 endwhile
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
197 assert_equal(16, nr)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
198 END
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
199 CheckScriptSuccess(lines)
7a9daf73a724 patch 8.2.1076: Vim9: no line break allowed in :if expression
Bram Moolenaar <Bram@vim.org>
parents: 21048
diff changeset
200 enddef
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
202 def Test_for_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
203 var lines =<< trim END
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
204 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
205 var nr = 0
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
206 for x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
207 in
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
208 [1, 2, 3, 4]
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
209 nr = nr + x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
210 endfor
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
211 assert_equal(10, nr)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
212 END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
213 CheckScriptSuccess(lines)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
214
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
215 lines =<< trim END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
216 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
217 var nr = 0
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
218 for x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
219 in
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
220 [1, 2,
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
221 3, 4
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
222 ]
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
223 nr = nr
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
224 +
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
225 x
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
226 endfor
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
227 assert_equal(10, nr)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
228 END
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
229 CheckScriptSuccess(lines)
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
230 enddef
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
231
21130
4a1e8086759b patch 8.2.1116: Vim9: parsing command checks for list twice
Bram Moolenaar <Bram@vim.org>
parents: 21122
diff changeset
232 def Test_method_call_linebreak()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
233 var lines =<< trim END
21122
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
234 vim9script
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
235 var res = []
21122
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
236 func RetArg(
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
237 arg
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
238 )
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
239 let s:res = a:arg
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
240 endfunc
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
241 [1,
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
242 2,
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
243 3]->RetArg()
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
244 assert_equal([1, 2, 3], res)
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
245 END
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
246 CheckScriptSuccess(lines)
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
247 enddef
839ace6773aa patch 8.2.1112: Vim9: no line continuation allowed in method call
Bram Moolenaar <Bram@vim.org>
parents: 21058
diff changeset
248
22685
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
249 def Test_skipped_expr_linebreak()
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
250 if 0
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
251 var x = []
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
252 ->map({ -> 0})
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
253 endif
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
254 enddef
80b4e604d1d5 patch 8.2.1891: Vim9: skipping over expression doesn't handle line breaks
Bram Moolenaar <Bram@vim.org>
parents: 22649
diff changeset
255
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
256 def Test_dict_member()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
257 var test: dict<list<number>> = {data: [3, 1, 2]}
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
258 test.data->sort()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
259 assert_equal({data: [1, 2, 3]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
260 test.data
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
261 ->reverse()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
262 assert_equal({data: [3, 2, 1]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
263
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
264 var lines =<< trim END
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
265 vim9script
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
266 var test: dict<list<number>> = {data: [3, 1, 2]}
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
267 test.data->sort()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
268 assert_equal({data: [1, 2, 3]}, test)
21212
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
269 END
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
270 CheckScriptSuccess(lines)
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
271 enddef
874a28fac941 patch 8.2.1157: Vim9: dict.name is not recognized as an expression
Bram Moolenaar <Bram@vim.org>
parents: 21196
diff changeset
272
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
273 def Test_bar_after_command()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
274 def RedrawAndEcho()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
275 var x = 'did redraw'
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
276 redraw | echo x
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
277 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
278 RedrawAndEcho()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
279 assert_match('did redraw', Screenline(&lines))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
280
21158
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
281 def CallAndEcho()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
282 var x = 'did redraw'
21158
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
283 reg_executing() | echo x
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
284 enddef
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
285 CallAndEcho()
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
286 assert_match('did redraw', Screenline(&lines))
157fe2d26e16 patch 8.2.1130: Vim9: bar not recognized after function call
Bram Moolenaar <Bram@vim.org>
parents: 21156
diff changeset
287
21156
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
288 if has('unix')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
289 # bar in filter write command does not start new command
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
290 def WriteToShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
291 new
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
292 setline(1, 'some text')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
293 w !cat | cat > Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
294 bwipe!
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
295 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
296 WriteToShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
297 assert_equal(['some text'], readfile('Xoutfile'))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
298 delete('Xoutfile')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
299
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
300 # bar in filter read command does not start new command
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
301 def ReadFromShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
302 new
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
303 r! echo hello there | cat > Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
304 r !echo again | cat >> Xoutfile
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
305 bwipe!
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
306 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
307 ReadFromShell()
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
308 assert_equal(['hello there', 'again'], readfile('Xoutfile'))
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
309 delete('Xoutfile')
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
310 endif
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
311 enddef
eb6c27af07dd patch 8.2.1129: Vim9: bar not recognized after not compiled command
Bram Moolenaar <Bram@vim.org>
parents: 21130
diff changeset
312
21255
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
313 def Test_filter_is_not_modifier()
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
314 var tags = [{a: 1, b: 2}, {x: 3, y: 4}]
21255
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
315 filter(tags, { _, v -> has_key(v, 'x') ? 1 : 0 })
23072
4b398a229b0b patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Bram Moolenaar <Bram@vim.org>
parents: 23011
diff changeset
316 assert_equal([{x: 3, y: 4}], tags)
21255
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
317 enddef
4be91a7eafb2 patch 8.2.1178: Vim9: filter function recognized as command modifier
Bram Moolenaar <Bram@vim.org>
parents: 21212
diff changeset
318
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
319 def Test_command_modifier_filter()
22750
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
320 var lines =<< trim END
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
321 final expected = "\nType Name Content\n c \"c piyo"
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
322 @a = 'hoge'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
323 @b = 'fuga'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
324 @c = 'piyo'
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
325
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
326 assert_equal(execute('filter /piyo/ registers abc'), expected)
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
327 END
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
328 CheckDefAndScriptSuccess(lines)
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
329 enddef
f945413264d7 patch 8.2.1923: Vim9: "filter" command modifier doesn't work
Bram Moolenaar <Bram@vim.org>
parents: 22691
diff changeset
330
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
331 def Test_win_command_modifiers()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
332 assert_equal(1, winnr('$'))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
333
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
334 set splitright
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
335 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
336 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
337 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
338 aboveleft vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
339 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
340 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
341 set splitright&
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
342
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
343 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
344 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
345 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
346 belowright vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
347 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
348 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
349 rightbelow vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
350 assert_equal(2, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
351 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
352
22784
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
353 if has('browse')
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
354 browse set
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
355 assert_equal('option-window', expand('%'))
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
356 close
9a6431f4b27a patch 8.2.1940: Vim9: browse modifier test fails on Mac
Bram Moolenaar <Bram@vim.org>
parents: 22778
diff changeset
357 endif
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
358
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
359 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
360 botright split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
361 assert_equal(3, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
362 assert_equal(&columns, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
363 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
364 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
365
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
366 vsplit
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
367 topleft split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
368 assert_equal(1, winnr())
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
369 assert_equal(&columns, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
370 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
371 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
372
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
373 gettabinfo()->len()->assert_equal(1)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
374 tab split
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
375 gettabinfo()->len()->assert_equal(2)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
376 tabclose
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
377
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
378 vertical new
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
379 assert_inrange(&columns / 2 - 2, &columns / 2 + 1, winwidth(0))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
380 close
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
381 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
382
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
383 func Test_command_modifier_confirm()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
384 CheckNotGui
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
385 CheckRunVimInTerminal
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
386
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
387 " Test for saving all the modified buffers
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
388 let lines =<< trim END
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
389 call setline(1, 'changed')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
390 def Getout()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
391 confirm write Xfile
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
392 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
393 END
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
394 call writefile(lines, 'Xconfirmscript')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
395 call writefile(['empty'], 'Xfile')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
396 let buf = RunVimInTerminal('-S Xconfirmscript', {'rows': 8})
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
397 call term_sendkeys(buf, ":call Getout()\n")
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
398 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
399 call term_sendkeys(buf, "y")
22778
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
400 call WaitForAssert({-> assert_match('(Y)es, \[N\]o: ', term_getline(buf, 8))}, 1000)
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
401 call term_sendkeys(buf, "\<CR>")
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
402 call TermWait(buf)
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
403 call StopVimInTerminal(buf)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
404
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
405 call assert_equal(['changed'], readfile('Xfile'))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
406 call delete('Xfile')
22778
3ec5f653f64d patch 8.2.1937: Vim9: test for confirm modifier fails in some situations
Bram Moolenaar <Bram@vim.org>
parents: 22772
diff changeset
407 call delete('.Xfile.swp') " in case Vim was killed
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
408 call delete('Xconfirmscript')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
409 endfunc
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
410
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
411 def Test_command_modifiers_keep()
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
412 if has('unix')
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
413 def DoTest(addRflag: bool, keepMarks: bool, hasMarks: bool)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
414 new
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
415 setline(1, ['one', 'two', 'three'])
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
416 normal 1Gma
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
417 normal 2Gmb
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
418 normal 3Gmc
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
419 if addRflag
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
420 set cpo+=R
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
421 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
422 set cpo-=R
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
423 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
424 if keepMarks
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
425 keepmarks :%!cat
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
426 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
427 :%!cat
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
428 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
429 if hasMarks
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
430 assert_equal(1, line("'a"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
431 assert_equal(2, line("'b"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
432 assert_equal(3, line("'c"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
433 else
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
434 assert_equal(0, line("'a"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
435 assert_equal(0, line("'b"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
436 assert_equal(0, line("'c"))
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
437 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
438 quit!
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
439 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
440 DoTest(false, false, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
441 DoTest(true, false, false)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
442 DoTest(false, true, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
443 DoTest(true, true, true)
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
444 set cpo&vim
22812
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
445
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
446 new
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
447 setline(1, ['one', 'two', 'three', 'four'])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
448 assert_equal(4, line("$"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
449 normal 1Gma
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
450 normal 2Gmb
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
451 normal 3Gmc
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
452 lockmarks :1,2!wc
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
453 # line is deleted, marks don't move
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
454 assert_equal(3, line("$"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
455 assert_equal('four', getline(3))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
456 assert_equal(1, line("'a"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
457 assert_equal(2, line("'b"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
458 assert_equal(3, line("'c"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
459 quit!
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
460 endif
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
461
22812
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
462 edit Xone
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
463 edit Xtwo
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
464 assert_equal('Xone', expand('#'))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
465 keepalt edit Xthree
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
466 assert_equal('Xone', expand('#'))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
467
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
468 normal /a*b*
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
469 assert_equal('a*b*', histget("search"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
470 keeppatterns normal /c*d*
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
471 assert_equal('a*b*', histget("search"))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
472
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
473 new
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
474 setline(1, range(10))
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
475 :10
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
476 normal gg
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
477 assert_equal(10, getpos("''")[1])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
478 keepjumps normal 5G
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
479 assert_equal(10, getpos("''")[1])
1ef3b04875ff patch 8.2.1954: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22790
diff changeset
480 quit!
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
481 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
482
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
483 def Test_command_modifier_other()
22814
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
484 new Xsomefile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
485 setline(1, 'changed')
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
486 var buf = bufnr()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
487 hide edit Xotherfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
488 var info = getbufinfo(buf)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
489 assert_equal(1, info[0].hidden)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
490 assert_equal(1, info[0].changed)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
491 edit Xsomefile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
492 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
493
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
494 au BufNewFile Xfile g:readFile = 1
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
495 g:readFile = 0
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
496 edit Xfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
497 assert_equal(1, g:readFile)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
498 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
499 g:readFile = 0
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
500 noautocmd edit Xfile
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
501 assert_equal(0, g:readFile)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
502
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
503 noswapfile edit XnoSwap
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
504 assert_equal(0, &l:swapfile)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
505 bwipe!
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
506
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
507 var caught = false
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
508 try
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
509 sandbox !ls
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
510 catch /E48:/
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
511 caught = true
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
512 endtry
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
513 assert_true(caught)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
514
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
515 :8verbose g:verbose_now = &verbose
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
516 assert_equal(8, g:verbose_now)
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
517 unlet g:verbose_now
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
518 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
519
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
520 def EchoHere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
521 echomsg 'here'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
522 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
523 def EchoThere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
524 unsilent echomsg 'there'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
525 enddef
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
526
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
527 def Test_modifier_silent_unsilent()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
528 echomsg 'last one'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
529 silent echomsg "text"
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
530 assert_equal("\nlast one", execute(':1messages'))
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
531
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
532 silent! echoerr "error"
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
533
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
534 echomsg 'last one'
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
535 silent EchoHere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
536 assert_equal("\nlast one", execute(':1messages'))
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
537
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
538 silent EchoThere()
bb1b21a2aae3 patch 8.2.1955: Vim9: not all command modifiers are tested
Bram Moolenaar <Bram@vim.org>
parents: 22812
diff changeset
539 assert_equal("\nthere", execute(':1messages'))
22772
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
540 enddef
82a7aff951d2 patch 8.2.1934: Vim9: command modifiers in :def function not tested
Bram Moolenaar <Bram@vim.org>
parents: 22750
diff changeset
541
22790
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
542 def Test_range_after_command_modifier()
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
543 CheckScriptFailure(['vim9script', 'silent keepjump 1d _'], 'E1050:', 2)
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
544 new
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
545 setline(1, 'xxx')
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
546 CheckScriptSuccess(['vim9script', 'silent keepjump :1d _'])
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
547 assert_equal('', getline(1))
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
548 bwipe!
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
549 enddef
44317eb799d7 patch 8.2.1943: Vim9: wrong error message when colon is missing
Bram Moolenaar <Bram@vim.org>
parents: 22784
diff changeset
550
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
551 def Test_eval_command()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
552 var from = 3
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
553 var to = 5
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
554 g:val = 111
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
555 def Increment(nrs: list<number>)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
556 for nr in nrs
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
557 g:val += nr
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
558 endfor
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
559 enddef
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
560 eval range(from, to)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
561 ->Increment()
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
562 assert_equal(111 + 3 + 4 + 5, g:val)
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
563 unlet g:val
23096
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
564
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
565 var lines =<< trim END
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
566 vim9script
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
567 g:caught = 'no'
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
568 try
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
569 eval 123 || 0
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
570 catch
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
571 g:caught = 'yes'
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
572 endtry
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
573 assert_equal('yes', g:caught)
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
574 unlet g:caught
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
575 END
b6aadb0b3a56 patch 8.2.2094: when an expression fails getting next command may be wrong
Bram Moolenaar <Bram@vim.org>
parents: 23072
diff changeset
576 CheckScriptSuccess(lines)
21196
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
577 enddef
f45ce1ce284c patch 8.2.1149: Vim9: :eval command not handled properly
Bram Moolenaar <Bram@vim.org>
parents: 21158
diff changeset
578
21893
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
579 def Test_map_command()
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
580 var lines =<< trim END
21893
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
581 nnoremap <F3> :echo 'hit F3 #'<CR>
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
582 assert_equal(":echo 'hit F3 #'<CR>", maparg("<F3>", "n"))
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
583 END
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
584 CheckDefSuccess(lines)
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
585 CheckScriptSuccess(['vim9script'] + lines)
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
586 enddef
f19ac9b8b011 patch 8.2.1496: Vim9: cannot use " #" in a mapping
Bram Moolenaar <Bram@vim.org>
parents: 21255
diff changeset
587
21941
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
588 def Test_normal_command()
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
589 new
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
590 setline(1, 'doesnotexist')
22425
eabc059a6ac4 patch 8.2.1761: Vim9: Some tests are still using :let
Bram Moolenaar <Bram@vim.org>
parents: 22351
diff changeset
591 var caught = 0
21941
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
592 try
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
593 exe "norm! \<C-]>"
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
594 catch /E433/
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
595 caught = 2
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
596 endtry
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
597 assert_equal(2, caught)
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
598
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
599 try
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
600 exe "norm! 3\<C-]>"
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
601 catch /E433/
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
602 caught = 3
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
603 endtry
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
604 assert_equal(3, caught)
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
605 bwipe!
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
606 enddef
f65e76638eb5 patch 8.2.1520: Vim9: CTRL-] used in :def function does not work
Bram Moolenaar <Bram@vim.org>
parents: 21893
diff changeset
607
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
608 def Test_put_command()
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
609 new
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
610 @p = 'ppp'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
611 put p
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
612 assert_equal('ppp', getline(2))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
613
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
614 put ='below'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
615 assert_equal('below', getline(3))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
616 put! ='above'
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
617 assert_equal('above', getline(3))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
618 assert_equal('below', getline(4))
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
619
23156
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
620 # compute range at runtime
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
621 setline(1, range(1, 8))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
622 @a = 'aaa'
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
623 :$-2put a
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
624 assert_equal('aaa', getline(7))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
625
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
626 setline(1, range(1, 8))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
627 :2
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
628 :+2put! a
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
629 assert_equal('aaa', getline(4))
6aa8ddf7a3fa patch 8.2.2124: Vim9: a range cannot be computed at runtime
Bram Moolenaar <Bram@vim.org>
parents: 23096
diff changeset
630
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
631 bwipe!
23197
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
632
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
633 CheckDefFailure(['put =xxx'], 'E1001:')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
634 enddef
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
635
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
636 def Test_put_with_linebreak()
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
637 new
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
638 var lines =<< trim END
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
639 vim9script
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
640 pu =split('abc', '\zs')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
641 ->join()
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
642 END
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
643 CheckScriptSuccess(lines)
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
644 getline(2)->assert_equal('a b c')
4ba101403fa2 patch 8.2.2144: Vim9: some corner cases not tested
Bram Moolenaar <Bram@vim.org>
parents: 23156
diff changeset
645 bwipe!
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
646 enddef
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
647
22260
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
648 def Test_command_star_range()
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
649 new
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
650 setline(1, ['xxx foo xxx', 'xxx bar xxx', 'xxx foo xx bar'])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
651 setpos("'<", [0, 1, 0, 0])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
652 setpos("'>", [0, 3, 0, 0])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
653 :*s/\(foo\|bar\)/baz/g
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
654 getline(1, 3)->assert_equal(['xxx baz xxx', 'xxx baz xxx', 'xxx baz xx baz'])
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
655
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
656 bwipe!
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
657 enddef
d7c1e3efa88e patch 8.2.1679: Vim9: ":*" is not recognized as a range
Bram Moolenaar <Bram@vim.org>
parents: 22176
diff changeset
658
22649
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
659 def Test_f_args()
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
660 var lines =<< trim END
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
661 vim9script
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
662
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
663 func SaveCmdArgs(...)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
664 let g:args = a:000
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
665 endfunc
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
666
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
667 command -nargs=* TestFArgs call SaveCmdArgs(<f-args>)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
668
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
669 TestFArgs
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
670 assert_equal([], g:args)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
671
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
672 TestFArgs one two three
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
673 assert_equal(['one', 'two', 'three'], g:args)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
674 END
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
675 CheckScriptSuccess(lines)
6e965b3587a4 patch 8.2.1873: Vim9: missing white space when using <f-args>
Bram Moolenaar <Bram@vim.org>
parents: 22500
diff changeset
676 enddef
22176
6941d3205be9 patch 8.2.1637: Vim9: :put ={expr} does not work inside :def function
Bram Moolenaar <Bram@vim.org>
parents: 21941
diff changeset
677
22950
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
678 def Test_star_command()
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
679 var lines =<< trim END
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
680 vim9script
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
681 @s = 'g:success = 8'
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
682 set cpo+=*
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
683 exe '*s'
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
684 assert_equal(8, g:success)
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
685 unlet g:success
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
686 set cpo-=*
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
687 assert_fails("exe '*s'", 'E1050:')
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
688 END
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
689 CheckScriptSuccess(lines)
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
690 enddef
1270401054d8 patch 8.2.2022: Vim9: star command recognized errornously
Bram Moolenaar <Bram@vim.org>
parents: 22860
diff changeset
691
23011
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
692 def Test_cmd_argument_without_colon()
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
693 new Xfile
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
694 setline(1, ['a', 'b', 'c', 'd'])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
695 write
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
696 edit +3 %
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
697 assert_equal(3, getcurpos()[1])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
698 edit +/a %
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
699 assert_equal(1, getcurpos()[1])
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
700 bwipe
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
701 delete('Xfile')
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
702 enddef
ec23d84a096d patch 8.2.2052: Vim9: "edit +4 fname" gives an error
Bram Moolenaar <Bram@vim.org>
parents: 22950
diff changeset
703
23205
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
704 def Test_ambiguous_user_cmd()
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
705 var lines =<< trim END
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
706 com Cmd1 eval 0
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
707 com Cmd2 eval 0
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
708 Cmd
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
709 END
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
710 CheckScriptFailure(lines, 'E464:')
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
711 enddef
d998222d314d patch 8.2.2148: Vim9: crash when user command doesn't match
Bram Moolenaar <Bram@vim.org>
parents: 23197
diff changeset
712
23254
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
713 def Test_command_not_recognized()
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
714 var lines =<< trim END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
715 d.key = 'asdf'
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
716 END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
717 CheckDefFailure(lines, 'E1146:', 1)
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
718
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
719 lines =<< trim END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
720 d['key'] = 'asdf'
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
721 END
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
722 CheckDefFailure(lines, 'E1146:', 1)
4b7e996354e0 patch 8.2.2173: Vim9: get internal error when assigning to undefined variable
Bram Moolenaar <Bram@vim.org>
parents: 23205
diff changeset
723 enddef
21058
111f877e63d9 patch 8.2.1080: Vim9: no line break allowed in a for loop
Bram Moolenaar <Bram@vim.org>
parents: 21056
diff changeset
724
23272
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
725 def Test_magic_not_used()
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
726 new
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
727 for cmd in ['set magic', 'set nomagic']
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
728 exe cmd
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
729 setline(1, 'aaa')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
730 s/.../bbb/
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
731 assert_equal('bbb', getline(1))
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
732 endfor
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
733
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
734 set magic
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
735 setline(1, 'aaa')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
736 assert_fails('s/.\M../bbb/', 'E486:')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
737 assert_fails('snomagic/.../bbb/', 'E486:')
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
738 assert_equal('aaa', getline(1))
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
739
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
740 bwipe!
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
741 enddef
a84e7abb0c92 patch 8.2.2182: Vim9: value of 'magic' is still relevant
Bram Moolenaar <Bram@vim.org>
parents: 23254
diff changeset
742
23274
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
743 def Test_gdefault_not_used()
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
744 new
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
745 for cmd in ['set gdefault', 'set nogdefault']
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
746 exe cmd
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
747 setline(1, 'aaa')
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
748 s/./b/
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
749 assert_equal('baa', getline(1))
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
750 endfor
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
751
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
752 set nogdefault
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
753 bwipe!
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
754 enddef
10bbff53d3d1 patch 8.2.2183: Vim9: value of 'edcompatible' and 'gdefault' are used
Bram Moolenaar <Bram@vim.org>
parents: 23272
diff changeset
755
20170
0612c64a2b87 patch 8.2.0640: Vim9: expanding does not work
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker