Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 21303:7c50dfe302f8 v8.2.1202
patch 8.2.1202: Vim9: crash when calling a closure from a builtin function
Commit: https://github.com/vim/vim/commit/08f7a41b0a280e5901eb4ee4bbfe682113863492
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jul 13 20:41:08 2020 +0200
patch 8.2.1202: Vim9: crash when calling a closure from a builtin function
Problem: Vim9: crash when calling a closure from a builtin function.
Solution: Use the current execution context. (closes https://github.com/vim/vim/issues/6441)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 13 Jul 2020 20:45:04 +0200 |
parents | 60011b87aae1 |
children | af3663df42bf |
comparison
equal
deleted
inserted
replaced
21302:cc426acfb89d | 21303:7c50dfe302f8 |
---|---|
1017 | 1017 |
1018 def Test_recursive_call() | 1018 def Test_recursive_call() |
1019 assert_equal(6765, Fibonacci(20)) | 1019 assert_equal(6765, Fibonacci(20)) |
1020 enddef | 1020 enddef |
1021 | 1021 |
1022 def TreeWalk(dir: string): list<any> | |
1023 return readdir(dir)->map({_, val -> | |
1024 fnamemodify(dir .. '/' .. val, ':p')->isdirectory() | |
1025 ? {val : TreeWalk(dir .. '/' .. val)} | |
1026 : val | |
1027 }) | |
1028 enddef | |
1029 | |
1030 def Test_closure_in_map() | |
1031 mkdir('XclosureDir/tdir', 'p') | |
1032 writefile(['111'], 'XclosureDir/file1') | |
1033 writefile(['222'], 'XclosureDir/file2') | |
1034 writefile(['333'], 'XclosureDir/tdir/file3') | |
1035 | |
1036 assert_equal(['file1', 'file2', {'tdir': ['file3']}], TreeWalk('XclosureDir')) | |
1037 | |
1038 delete('XclosureDir', 'rf') | |
1039 enddef | |
1040 | |
1022 | 1041 |
1023 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 1042 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |