@@ -77,17 +77,8 @@ func s:doc_config_teardown()
77
77
endif
78
78
endfunc
79
79
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' )
91
82
endfunc
92
83
93
84
func Test_help_complete ()
@@ -99,49 +90,49 @@ func Test_help_complete()
99
90
if has (' multi_lang' )
100
91
set helplang =
101
92
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 )
104
95
105
96
if has (' multi_lang' )
106
97
" 'helplang=ab' and help file lang is 'en'
107
98
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 )
110
101
111
102
" 'helplang=' and help file lang is 'en' and 'ab'
112
103
set rtp += Xdir1/doc- ab
113
104
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 ))
117
108
118
109
" 'helplang=ab' and help file lang is 'en' and 'ab'
119
110
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 ))
123
114
124
115
" 'helplang=' and help file lang is 'en', 'ab' and 'ja'
125
116
set rtp += Xdir1/doc- ja
126
117
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 ))
131
122
132
123
" 'helplang=ab' and help file lang is 'en', 'ab' and 'ja'
133
124
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 ))
138
129
139
130
" 'helplang=ab,ja' and help file lang is 'en', 'ab' and 'ja'
140
131
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 ))
145
136
endif
146
137
catch
147
138
call assert_exception (' X' )
0 commit comments