Skip to content

Commit fc9c045

Browse files
committed
Add test for vsnip#completefunc()
1 parent bcfa8e0 commit fc9c045

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

spec/autoload/vsnip.vimspec

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,50 @@ Describe vsnip
145145

146146
End
147147

148+
Describe #completefunc
149+
150+
It should return start position
151+
enew!
152+
set filetype=basic_spec
153+
call setline(1, ' if')
154+
call cursor([1, 3])
155+
call s:expect(vsnip#completefunc(1, '')).to_equal(1)
156+
End
157+
158+
It should return complete items
159+
enew!
160+
set filetype=basic_spec
161+
call s:expect(vsnip#completefunc(0, 'if')[-1]).to_equal({
162+
\ 'word': 'if',
163+
\ 'abbr': 'if',
164+
\ 'kind': 'Snippet',
165+
\ 'menu': '[v] if',
166+
\ 'dup': 1,
167+
\ 'user_data': json_encode({
168+
\ 'vsnip': {
169+
\ 'snippet': [
170+
\ "if ${1:condition}",
171+
\ "\t$0",
172+
\ "endif",
173+
\ ]
174+
\ }
175+
\ })
176+
\ }, {
177+
\ 'word': 'inline-fn',
178+
\ 'abbr': 'inline-fn',
179+
\ 'kind': 'Snippet',
180+
\ 'menu': '[v] inline-fn',
181+
\ 'dup': 1,
182+
\ 'user_data': json_encode({
183+
\ 'vsnip': {
184+
\ 'snippet': [
185+
\ "{ -> $1 }$0"
186+
\ ]
187+
\ }
188+
\ })
189+
\ })
190+
End
191+
End
192+
148193
End
149194

0 commit comments

Comments
 (0)