comparison src/testdir/test_vim9_script.vim @ 21098:e88b0daa2fcb v8.2.1100

patch 8.2.1100: Vim9: cannot use line break in :execute argument Commit: https://github.com/vim/vim/commit/47e880d6c13c3ec2888398fd9ba1f5a7180d791a Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 30 22:02:02 2020 +0200 patch 8.2.1100: Vim9: cannot use line break in :execute argument Problem: Vim9: cannot use line break in :execute, :echomsg and :echoerr argument. Solution: Check for line break.
author Bram Moolenaar <Bram@vim.org>
date Tue, 30 Jun 2020 22:15:04 +0200
parents 74e5e212e550
children 839ace6773aa
comparison
equal deleted inserted replaced
21097:598a1201821d 21098:e88b0daa2fcb
1292 1292
1293 call CheckDefFailure(['execute xxx'], 'E1001:') 1293 call CheckDefFailure(['execute xxx'], 'E1001:')
1294 call CheckDefFailure(['execute "cmd"# comment'], 'E488:') 1294 call CheckDefFailure(['execute "cmd"# comment'], 'E488:')
1295 enddef 1295 enddef
1296 1296
1297 def Test_execute_cmd_vimscript()
1298 " only checks line continuation
1299 let lines =<< trim END
1300 vim9script
1301 execute 'g:someVar'
1302 .. ' = ' ..
1303 '28'
1304 assert_equal(28, g:someVar)
1305 unlet g:someVar
1306 END
1307 CheckScriptSuccess(lines)
1308 enddef
1309
1297 def Test_echo_cmd() 1310 def Test_echo_cmd()
1298 echo 'some' # comment 1311 echo 'some' # comment
1299 echon 'thing' 1312 echon 'thing'
1300 assert_match('^something$', Screenline(&lines)) 1313 assert_match('^something$', Screenline(&lines))
1301 1314
1319 assert_match('^some more$', Screenline(&lines)) 1332 assert_match('^some more$', Screenline(&lines))
1320 1333
1321 call CheckDefFailure(['echomsg "xxx"# comment'], 'E488:') 1334 call CheckDefFailure(['echomsg "xxx"# comment'], 'E488:')
1322 enddef 1335 enddef
1323 1336
1337 def Test_echomsg_cmd_vimscript()
1338 " only checks line continuation
1339 let lines =<< trim END
1340 vim9script
1341 echomsg 'here'
1342 .. ' is ' ..
1343 'a message'
1344 assert_match('^here is a message$', Screenline(&lines))
1345 END
1346 CheckScriptSuccess(lines)
1347 enddef
1348
1324 def Test_echoerr_cmd() 1349 def Test_echoerr_cmd()
1325 try 1350 try
1326 echoerr 'something' 'wrong' # comment 1351 echoerr 'something' 'wrong' # comment
1327 catch 1352 catch
1328 assert_match('something wrong', v:exception) 1353 assert_match('something wrong', v:exception)
1329 endtry 1354 endtry
1355 enddef
1356
1357 def Test_echoerr_cmd_vimscript()
1358 " only checks line continuation
1359 let lines =<< trim END
1360 vim9script
1361 try
1362 echoerr 'this'
1363 .. ' is ' ..
1364 'wrong'
1365 catch
1366 assert_match('this is wrong', v:exception)
1367 endtry
1368 END
1369 CheckScriptSuccess(lines)
1330 enddef 1370 enddef
1331 1371
1332 def Test_for_outside_of_function() 1372 def Test_for_outside_of_function()
1333 let lines =<< trim END 1373 let lines =<< trim END
1334 vim9script 1374 vim9script