Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 20275:350bb78345ba v8.2.0693
patch 8.2.0693: closure using argument not tested
Commit: https://github.com/vim/vim/commit/2fd4cd755c3e87e733b7363ac13e5c0fe0297a80
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 3 22:30:49 2020 +0200
patch 8.2.0693: closure using argument not tested
Problem: Closure using argument not tested.
Solution: Add a test, make it work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 03 May 2020 22:45:03 +0200 |
parents | 683c2da4982b |
children | 49b50843e725 |
comparison
equal
deleted
inserted
replaced
20274:ffb9ba069032 | 20275:350bb78345ba |
---|---|
698 | 698 |
699 unlet g:Extend | 699 unlet g:Extend |
700 unlet g:Read | 700 unlet g:Read |
701 enddef | 701 enddef |
702 | 702 |
703 def MakeArgRefs(theArg: string) | |
704 let local = 'loc_val' | |
705 g:UseArg = {s -> theArg .. '/' .. local .. '/' .. s} | |
706 enddef | |
707 | |
708 def MakeArgRefsVarargs(theArg: string, ...rest: list<string>) | |
709 let local = 'the_loc' | |
710 g:UseVararg = {s -> theArg .. '/' .. local .. '/' .. s .. '/' .. join(rest)} | |
711 enddef | |
712 | |
713 def Test_closure_using_argument() | |
714 MakeArgRefs('arg_val') | |
715 assert_equal('arg_val/loc_val/call_val', g:UseArg('call_val')) | |
716 | |
717 MakeArgRefsVarargs('arg_val', 'one', 'two') | |
718 assert_equal('arg_val/the_loc/call_val/one two', g:UseVararg('call_val')) | |
719 | |
720 unlet g:UseArg | |
721 unlet g:UseVararg | |
722 enddef | |
723 | |
703 | 724 |
704 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 725 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |