Skip to content

Commit bdac2ef

Browse files
yegappanchrisbra
authored andcommitted
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 <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 7019788 commit bdac2ef

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

src/testdir/test_vim9_import.vim

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,43 @@ def Run_Test_import_in_printexpr()
15601560
set printexpr=
15611561
enddef
15621562

1563+
" Test for using an imported function as 'findexpr'
1564+
func Test_import_in_findexpr()
1565+
call Run_Test_import_in_findexpr()
1566+
endfunc
1567+
1568+
def Run_Test_import_in_findexpr()
1569+
var lines =<< trim END
1570+
vim9script
1571+
1572+
export def FindExpr(): list<string>
1573+
var fnames = ['Xfile1.c', 'Xfile2.c', 'Xfile3.c']
1574+
return fnames->copy()->filter('v:val =~? v:fname')
1575+
enddef
1576+
END
1577+
writefile(lines, 'Xfindexpr', 'D')
1578+
1579+
lines =<< trim END
1580+
vim9script
1581+
import './Xfindexpr' as find
1582+
1583+
set findexpr=find.FindExpr()
1584+
END
1585+
v9.CheckScriptSuccess(lines)
1586+
1587+
enew!
1588+
find Xfile2
1589+
assert_equal('Xfile2.c', @%)
1590+
bwipe!
1591+
1592+
botright vert new
1593+
find Xfile1
1594+
assert_equal('Xfile1.c', @%)
1595+
1596+
set findexpr=
1597+
bwipe!
1598+
enddef
1599+
15631600
def Test_import_in_charconvert()
15641601
var lines =<< trim END
15651602
vim9script

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
819,
707709
/**/
708710
818,
709711
/**/

0 commit comments

Comments
 (0)