I broke up with neovim....vim is my best friend now
This commit is contained in:
97
dot_vim/plugged/vim-vsnip/spec/autoload/vsnip/source.vimspec
Normal file
97
dot_vim/plugged/vim-vsnip/spec/autoload/vsnip/source.vimspec
Normal file
@@ -0,0 +1,97 @@
|
||||
let s:expect = themis#helper('expect')
|
||||
|
||||
Describe vsnip#source
|
||||
|
||||
Describe #filetypes
|
||||
|
||||
It should return all filetype
|
||||
enew!
|
||||
set filetype=javascript.jsx
|
||||
call s:expect(vsnip#source#filetypes(bufnr('%'))).to_equal([
|
||||
\ 'javascript',
|
||||
\ 'jsx',
|
||||
\ 'global'
|
||||
\ ])
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Describe #find
|
||||
|
||||
It should load snippet for extended filetypes
|
||||
enew!
|
||||
set filetype=source_spec_enhanced
|
||||
let l:snippets = vsnip#source#find(bufnr('%'))
|
||||
call s:expect(l:snippets[0]).to_have_length(2)
|
||||
End
|
||||
|
||||
It should load snippet from vscode extension
|
||||
enew!
|
||||
set filetype=source_spec_vscode
|
||||
let l:snippets = vsnip#source#find(bufnr('%'))
|
||||
call s:expect(l:snippets[0]).to_have_length(1)
|
||||
End
|
||||
|
||||
It should format snippets
|
||||
enew!
|
||||
set filetype=source_spec
|
||||
let l:snippets = vsnip#source#find(bufnr('%'))
|
||||
call s:expect(sort(l:snippets[0])).to_equal(sort([{
|
||||
\ 'label': 'no-prefix-alias',
|
||||
\ 'description': '',
|
||||
\ 'prefix': ['---'],
|
||||
\ 'prefix_alias': [],
|
||||
\ 'body': [
|
||||
\ "${VIM:repeat('-', &tw)}"
|
||||
\ ]
|
||||
\ }, {
|
||||
\ 'label': 'prefix-alias',
|
||||
\ 'description': '',
|
||||
\ 'prefix': ['arrow-function'],
|
||||
\ 'prefix_alias': ['af'],
|
||||
\ 'body': [
|
||||
\ "() => "
|
||||
\ ]
|
||||
\ }]))
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Describe #snipmate
|
||||
|
||||
It should load snippets
|
||||
enew!
|
||||
set filetype=snipmate
|
||||
let l:snippets = vsnip#source#find(bufnr('%'))
|
||||
call s:expect(l:snippets[0]).to_have_length(2)
|
||||
End
|
||||
|
||||
It should format snippets
|
||||
enew!
|
||||
set filetype=snipmate
|
||||
let l:snippets = vsnip#source#find(bufnr('%'))
|
||||
call s:expect(sort(l:snippets[0])).to_equal(sort([{
|
||||
\ 'label': 'arrow-function',
|
||||
\ 'description': '',
|
||||
\ 'prefix': ['arrow-function'],
|
||||
\ 'prefix_alias': ['af'],
|
||||
\ 'body': [
|
||||
\ "() => "
|
||||
\ ]
|
||||
\ }, {
|
||||
\ 'label': 'fn',
|
||||
\ 'description': "vim's function",
|
||||
\ 'prefix': ['fn'],
|
||||
\ 'prefix_alias': [],
|
||||
\ 'body': [
|
||||
\ "function! $1($2) abort",
|
||||
\ "\t$0",
|
||||
\ "endfunction",
|
||||
\ ]
|
||||
\ }]))
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
End
|
||||
|
||||
Reference in New Issue
Block a user