patch 9.1.0819: tests: using findexpr and imported func not tested
Commit:
https://github.com/vim/vim/commit/bdac2ef6fe3bf286dbe61f9511ba3e2347a9da2a
Author: Yegappan Lakshmanan <[email protected]>
Date: Mon Oct 28 21:01:28 2024 +0100
patch 9.1.0819: tests: using findexpr and imported func not tested
Problem: tests: need a test for findexpr and vim9 imported func
Solution: Add a test for 'findexpr' and Vim9 imported script
(Yegappan Lakshmanan)
closes: #15954
Signed-off-by: Yegappan Lakshmanan <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim
index fb309cb3b..ad0248c17 100644
--- a/src/testdir/test_vim9_import.vim
+++ b/src/testdir/test_vim9_import.vim
@@ -1560,6 +1560,43 @@ def Run_Test_import_in_printexpr()
set printexpr=
enddef
+" Test for using an imported function as 'findexpr'
+func Test_import_in_findexpr()
+ call Run_Test_import_in_findexpr()
+endfunc
+
+def Run_Test_import_in_findexpr()
+ var lines =<< trim END
+ vim9script
+
+ export def FindExpr(): list<string>
+ var fnames = ['Xfile1.c', 'Xfile2.c', 'Xfile3.c']
+ return fnames->copy()->filter('v:val =~? v:fname')
+ enddef
+ END
+ writefile(lines, 'Xfindexpr', 'D')
+
+ lines =<< trim END
+ vim9script
+ import './Xfindexpr' as find
+
+ set findexpr=find.FindExpr()
+ END
+ v9.CheckScriptSuccess(lines)
+
+ enew!
+ find Xfile2
+ assert_equal('Xfile2.c', @%)
+ bwipe!
+
+ botright vert new
+ find Xfile1
+ assert_equal('Xfile1.c', @%)
+
+ set findexpr=
+ bwipe!
+enddef
+
def Test_import_in_charconvert()
var lines =<< trim END
vim9script
diff --git a/src/version.c b/src/version.c
index 02e24d552..838f25acd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 819,
/**/
818,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1t5W8l-00EHp3-IM%40256bit.org.