comparison src/testdir/test_vim9_script.vim @ 19183:1168c53d1b49 v8.2.0150

patch 8.2.0150: cannot define python function when using :execute Commit: https://github.com/vim/vim/commit/673660ab00d808d1e96e7181a60c5c8545c0ee75 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 26 16:50:05 2020 +0100 patch 8.2.0150: cannot define python function when using :execute Problem: Cannot define python function when using :execute. (Yasuhiro Matsumoto) Solution: Do not recognize "def" inside "function.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 Jan 2020 17:00:04 +0100
parents 94eda51ba9ba
children 17d878a2ddaa
comparison
equal deleted inserted replaced
19182:418299e3f4a7 19183:1168c53d1b49
1 " Test various aspects of the Vim9 script language. 1 " Test various aspects of the Vim9 script language.
2
3 source check.vim
2 4
3 " Check that "lines" inside ":def" results in an "error" message. 5 " Check that "lines" inside ":def" results in an "error" message.
4 func CheckDefFailure(lines, error) 6 func CheckDefFailure(lines, error)
5 call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef') 7 call writefile(['def! Func()'] + a:lines + ['enddef'], 'Xdef')
6 call assert_fails('so Xdef', a:error, a:lines) 8 call assert_fails('so Xdef', a:error, a:lines)
353 l->add(5) 355 l->add(5)
354 l->insert(99, 1) 356 l->insert(99, 1)
355 call assert_equal([2, 99, 3, 4, 5], l) 357 call assert_equal([2, 99, 3, 4, 5], l)
356 enddef 358 enddef
357 359
360 " Test that inside :function a Python function can be defined, :def is not
361 " recognized.
362 func Test_function_python()
363 CheckFeature python3
364 let py = 'python3'
365 execute py "<< EOF"
366 def do_something():
367 return 1
368 EOF
369 endfunc
370
358 371
359 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker 372 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker