@@ -77,17 +77,8 @@ func s:doc_config_teardown()
7777 endif
7878endfunc
7979
80- func s: get_cmd_compl_list (cmd)
81- let list = []
82- let str = ' '
83- for cnt in range (1 , 999 )
84- call feedkeys (a: cmd . repeat (" \<Tab> " , cnt) . " '\<C-B> let str='\<CR> " , ' tx' )
85- if str == # a: cmd [1 :]
86- break
87- endif
88- call add (list , str)
89- endfor
90- return list
80+ func s: get_help_compl_list (cmd)
81+ return getcompletion (a: cmd , ' help' )
9182endfunc
9283
9384func Test_help_complete ()
@@ -99,49 +90,49 @@ func Test_help_complete()
9990 if has (' multi_lang' )
10091 set helplang =
10192 endif
102- let list = s: get_cmd_compl_list ( " :h test" )
103- call assert_equal ([' h test-col' , ' h test-char' ], list )
93+ let list = s: get_help_compl_list ( " test" )
94+ call assert_equal ([' test-col' , ' test-char' ], list )
10495
10596 if has (' multi_lang' )
10697 " 'helplang=ab' and help file lang is 'en'
10798 set helplang = ab
108- let list = s: get_cmd_compl_list ( " :h test" )
109- call assert_equal ([' h test-col' , ' h test-char' ], list )
99+ let list = s: get_help_compl_list ( " test" )
100+ call assert_equal ([' test-col' , ' test-char' ], list )
110101
111102 " 'helplang=' and help file lang is 'en' and 'ab'
112103 set rtp += Xdir1/doc- ab
113104 set helplang =
114- let list = s: get_cmd_compl_list ( " :h test" )
115- call assert_equal (sort ([' h test-col@en' , ' h test-col@ab' ,
116- \ ' h test-char@en' , ' h test-char@ab' ]), sort (list ))
105+ let list = s: get_help_compl_list ( " test" )
106+ call assert_equal (sort ([' test-col@en' , ' test-col@ab' ,
107+ \ ' test-char@en' , ' test-char@ab' ]), sort (list ))
117108
118109 " 'helplang=ab' and help file lang is 'en' and 'ab'
119110 set helplang = ab
120- let list = s: get_cmd_compl_list ( " :h test" )
121- call assert_equal (sort ([' h test-col' , ' h test-col@en' ,
122- \ ' h test-char' , ' h test-char@en' ]), sort (list ))
111+ let list = s: get_help_compl_list ( " test" )
112+ call assert_equal (sort ([' test-col' , ' test-col@en' ,
113+ \ ' test-char' , ' test-char@en' ]), sort (list ))
123114
124115 " 'helplang=' and help file lang is 'en', 'ab' and 'ja'
125116 set rtp += Xdir1/doc- ja
126117 set helplang =
127- let list = s: get_cmd_compl_list ( " :h test" )
128- call assert_equal (sort ([' h test-col@en' , ' h test-col@ab' ,
129- \ ' h test-col@ja' , ' h test-char@en' ,
130- \ ' h test-char@ab' , ' h test-char@ja' ]), sort (list ))
118+ let list = s: get_help_compl_list ( " test" )
119+ call assert_equal (sort ([' test-col@en' , ' test-col@ab' ,
120+ \ ' test-col@ja' , ' test-char@en' ,
121+ \ ' test-char@ab' , ' test-char@ja' ]), sort (list ))
131122
132123 " 'helplang=ab' and help file lang is 'en', 'ab' and 'ja'
133124 set helplang = ab
134- let list = s: get_cmd_compl_list ( " :h test" )
135- call assert_equal (sort ([' h test-col' , ' h test-col@en' ,
136- \ ' h test-col@ja' , ' h test-char' ,
137- \ ' h test-char@en' , ' h test-char@ja' ]), sort (list ))
125+ let list = s: get_help_compl_list ( " test" )
126+ call assert_equal (sort ([' test-col' , ' test-col@en' ,
127+ \ ' test-col@ja' , ' test-char' ,
128+ \ ' test-char@en' , ' test-char@ja' ]), sort (list ))
138129
139130 " 'helplang=ab,ja' and help file lang is 'en', 'ab' and 'ja'
140131 set helplang = ab ,ja
141- let list = s: get_cmd_compl_list ( " :h test" )
142- call assert_equal (sort ([' h test-col' , ' h test-col@ja' ,
143- \ ' h test-col@en' , ' h test-char' ,
144- \ ' h test-char@ja' , ' h test-char@en' ]), sort (list ))
132+ let list = s: get_help_compl_list ( " test" )
133+ call assert_equal (sort ([' test-col' , ' test-col@ja' ,
134+ \ ' test-col@en' , ' test-char' ,
135+ \ ' test-char@ja' , ' test-char@en' ]), sort (list ))
145136 endif
146137 catch
147138 call assert_exception (' X' )
0 commit comments