11" Tests for expand()
22
3+ source shared.vim
4+
35let s: sfile = expand (' <sfile>' )
46let s: slnum = str2nr (expand (' <slnum>' ))
57let s: sflnum = str2nr (expand (' <sflnum>' ))
@@ -18,20 +20,20 @@ endfunc
1820
1921" This test depends on the location in the test file, put it first.
2022func Test_expand_sflnum ()
21- call assert_equal (5 , s: sflnum )
22- call assert_equal (22 , str2nr (expand (' <sflnum>' )))
23+ call assert_equal (7 , s: sflnum )
24+ call assert_equal (24 , str2nr (expand (' <sflnum>' )))
2325
2426 " Line-continuation
2527 call assert_equal (
26- \ 25 ,
28+ \ 27 ,
2729 \ str2nr (expand (' <sflnum>' )))
2830
2931 " Call in script-local function
30- call assert_equal (16 , s: expand_sflnum ())
32+ call assert_equal (18 , s: expand_sflnum ())
3133
3234 " Call in command
3335 command Flnum echo expand (' <sflnum>' )
34- call assert_equal (34 , str2nr (trim (execute (' Flnum' ))))
36+ call assert_equal (36 , str2nr (trim (execute (' Flnum' ))))
3537 delcommand Flnum
3638endfunc
3739
@@ -60,7 +62,7 @@ func Test_expand_sfile_and_stack()
6062endfunc
6163
6264func Test_expand_slnum ()
63- call assert_equal (4 , s: slnum )
65+ call assert_equal (6 , s: slnum )
6466 call assert_equal (2 , str2nr (expand (' <slnum>' )))
6567
6668 " Line-continuation
@@ -86,6 +88,17 @@ func Test_expand()
8688 quit
8789endfunc
8890
91+ func s: sid_test ()
92+ return ' works'
93+ endfunc
94+
95+ func Test_expand_SID ()
96+ let sid = expand (' <SID>' )
97+ execute ' let g:sid_result = ' .. sid .. ' sid_test()'
98+ call assert_equal (' works' , g: sid_result )
99+ endfunc
100+
101+
89102" Test for 'wildignore' with expand()
90103func Test_expand_wildignore ()
91104 set wildignore = * .vim
0 commit comments