comparison src/testdir/test_vim9_func.vim @ 24355:beb395ca3e2f v8.2.2718

patch 8.2.2718: Vim9: no explicit test for using a global function without g: Commit: https://github.com/vim/vim/commit/0865b15bc6d869d56713f674d66ad3d0509bf4b9 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 5 15:38:51 2021 +0200 patch 8.2.2718: Vim9: no explicit test for using a global function without g: Problem: Vim9: no explicit test for using a global function without the g: prefix. Solution: Add a test case.
author Bram Moolenaar <Bram@vim.org>
date Mon, 05 Apr 2021 15:45:08 +0200
parents cabed216cc2f
children a97fb00978f6
comparison
equal deleted inserted replaced
24354:5154610c4f93 24355:beb395ca3e2f
619 enddef 619 enddef
620 AnotherFunc() 620 AnotherFunc()
621 END 621 END
622 CheckScriptFailure(lines, 'E705:') 622 CheckScriptFailure(lines, 'E705:')
623 delfunc g:Func 623 delfunc g:Func
624
625 # global function is found without g: prefix
626 lines =<< trim END
627 vim9script
628 def g:Func(): string
629 return 'global'
630 enddef
631 def AnotherFunc(): string
632 return Func()
633 enddef
634 assert_equal('global', AnotherFunc())
635 delfunc g:Func
636 END
637 CheckScriptSuccess(lines)
638
639 lines =<< trim END
640 vim9script
641 def g:Func(): string
642 return 'global'
643 enddef
644 assert_equal('global', Func())
645 delfunc g:Func
646 END
647 CheckScriptSuccess(lines)
624 enddef 648 enddef
625 649
626 func TakesOneArg(arg) 650 func TakesOneArg(arg)
627 echo a:arg 651 echo a:arg
628 endfunc 652 endfunc