Mercurial > vim
comparison src/testdir/test_vim9_script.vim @ 28156:088d8dc22045 v8.2.4602
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Commit: https://github.com/vim/vim/commit/397a87ac1c9857eb0d5ec3add69e3b9ab6b0c77c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 20 21:14:15 2022 +0000
patch 8.2.4602: Vim9: not enough test coverage for executing :def function
Problem: Vim9: not enough test coverage for executing :def function.
Solution: Add a few more tests. Fix uncovered problem. Remove dead code.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Mar 2022 22:15:02 +0100 |
parents | ae975c8d5438 |
children | 22c8cafe8c9c |
comparison
equal
deleted
inserted
replaced
28155:42ba8af8a1dd | 28156:088d8dc22045 |
---|---|
1244 .. ' someFile' .. | 1244 .. ' someFile' .. |
1245 ' line 19' | 1245 ' line 19' |
1246 assert_equal(19, getqflist()[0].lnum) | 1246 assert_equal(19, getqflist()[0].lnum) |
1247 END | 1247 END |
1248 v9.CheckScriptSuccess(lines) | 1248 v9.CheckScriptSuccess(lines) |
1249 | |
1250 lines =<< trim END | |
1251 vim9script | |
1252 def CexprFail() | |
1253 au QuickfixCmdPre * echo g:doesnotexist | |
1254 cexpr 'File otherFile line 99' | |
1255 g:didContinue = 'yes' | |
1256 enddef | |
1257 CexprFail() | |
1258 g:didContinue = 'also' | |
1259 END | |
1260 g:didContinue = 'no' | |
1261 v9.CheckScriptFailure(lines, 'E121: Undefined variable: g:doesnotexist') | |
1262 assert_equal('no', g:didContinue) | |
1263 au! QuickfixCmdPre | |
1264 | |
1265 lines =<< trim END | |
1266 vim9script | |
1267 def CexprFail() | |
1268 cexpr g:aNumber | |
1269 g:didContinue = 'yes' | |
1270 enddef | |
1271 CexprFail() | |
1272 g:didContinue = 'also' | |
1273 END | |
1274 g:aNumber = 123 | |
1275 g:didContinue = 'no' | |
1276 v9.CheckScriptFailure(lines, 'E777: String or List expected') | |
1277 assert_equal('no', g:didContinue) | |
1278 unlet g:didContinue | |
1279 | |
1249 set errorformat& | 1280 set errorformat& |
1250 enddef | 1281 enddef |
1251 | 1282 |
1252 def Test_statusline_syntax() | 1283 def Test_statusline_syntax() |
1253 # legacy syntax is used for 'statusline' | 1284 # legacy syntax is used for 'statusline' |
1810 | 1841 |
1811 var str1 = 'some' | 1842 var str1 = 'some' |
1812 var str2 = 'more' | 1843 var str2 = 'more' |
1813 echo str1 str2 | 1844 echo str1 str2 |
1814 assert_match('^some more$', g:Screenline(&lines)) | 1845 assert_match('^some more$', g:Screenline(&lines)) |
1846 | |
1847 echo "one\ntwo" | |
1848 assert_match('^one$', g:Screenline(&lines - 1)) | |
1849 assert_match('^two$', g:Screenline(&lines)) | |
1815 | 1850 |
1816 v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:') | 1851 v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:') |
1817 enddef | 1852 enddef |
1818 | 1853 |
1819 def Test_echomsg_cmd() | 1854 def Test_echomsg_cmd() |