Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 23197:4ba101403fa2 v8.2.2144
patch 8.2.2144: Vim9: some corner cases not tested
Commit: https://github.com/vim/vim/commit/025cb1ca8605055383c53bf2c823d7093cf29b82
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 14 18:31:27 2020 +0100
patch 8.2.2144: Vim9: some corner cases not tested
Problem: Vim9: some corner cases not tested.
Solution: Add a few tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Dec 2020 18:45:04 +0100 |
parents | 055fa9db6f39 |
children | 657216220293 |
comparison
equal
deleted
inserted
replaced
23196:88a6a5655af0 | 23197:4ba101403fa2 |
---|---|
21 assert_equal('two', Screenline(&lines)) | 21 assert_equal('two', Screenline(&lines)) |
22 :3 | 22 :3 |
23 list | 23 list |
24 assert_equal('three$', Screenline(&lines)) | 24 assert_equal('three$', Screenline(&lines)) |
25 bwipe! | 25 bwipe! |
26 | |
27 # won't generate anything | |
28 if false | |
29 :123 | |
30 endif | |
26 enddef | 31 enddef |
27 | 32 |
28 let g:alist = [7] | 33 let g:alist = [7] |
29 let g:astring = 'text' | 34 let g:astring = 'text' |
30 let g:anumber = 123 | 35 let g:anumber = 123 |
1888 endfor | 1893 endfor |
1889 assert_equal(6, total) | 1894 assert_equal(6, total) |
1890 enddef | 1895 enddef |
1891 | 1896 |
1892 def Test_for_loop_fails() | 1897 def Test_for_loop_fails() |
1898 CheckDefFailure(['for '], 'E1097:') | |
1899 CheckDefFailure(['for x'], 'E1097:') | |
1900 CheckDefFailure(['for x in'], 'E1097:') | |
1893 CheckDefFailure(['for # in range(5)'], 'E690:') | 1901 CheckDefFailure(['for # in range(5)'], 'E690:') |
1894 CheckDefFailure(['for i In range(5)'], 'E690:') | 1902 CheckDefFailure(['for i In range(5)'], 'E690:') |
1895 CheckDefFailure(['var x = 5', 'for x in range(5)'], 'E1017:') | 1903 CheckDefFailure(['var x = 5', 'for x in range(5)'], 'E1017:') |
1896 CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:') | 1904 CheckScriptFailure(['def Func(arg: any)', 'for arg in range(5)', 'enddef', 'defcompile'], 'E1006:') |
1897 delfunc! g:Func | 1905 delfunc! g:Func |
3052 writefile(lines, 'Xdef') | 3060 writefile(lines, 'Xdef') |
3053 assert_fails('so Xdef', ['E684:', 'E1012:']) | 3061 assert_fails('so Xdef', ['E684:', 'E1012:']) |
3054 delete('Xdef') | 3062 delete('Xdef') |
3055 enddef | 3063 enddef |
3056 | 3064 |
3057 def Test_put_with_linebreak() | |
3058 new | |
3059 var lines =<< trim END | |
3060 vim9script | |
3061 pu =split('abc', '\zs') | |
3062 ->join() | |
3063 END | |
3064 CheckScriptSuccess(lines) | |
3065 getline(2)->assert_equal('a b c') | |
3066 bwipe! | |
3067 enddef | |
3068 | |
3069 def InvokeNormal() | 3065 def InvokeNormal() |
3070 exe "norm! :m+1\r" | 3066 exe "norm! :m+1\r" |
3071 enddef | 3067 enddef |
3072 | 3068 |
3073 def Test_invoke_normal_in_visual_mode() | 3069 def Test_invoke_normal_in_visual_mode() |