neosnippet.vim/test/functions.vim

72 lines
2.3 KiB
VimL
Raw Normal View History

2015-08-31 20:56:41 +00:00
let s:suite = themis#suite('toml')
let s:assert = themis#helper('assert')
function! s:suite.get_in_paren()
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ '(foobar)'),
2015-08-31 20:56:41 +00:00
\ 'foobar')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ '(foobar, baz)'),
2015-08-31 20:56:41 +00:00
\ 'foobar, baz')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ '(foobar, (baz))'),
2015-08-31 20:56:41 +00:00
\ 'foobar, (baz)')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ 'foobar('),
2015-12-11 16:51:49 +00:00
\ '')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ 'foobar()'),
\ '')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ 'foobar(fname)'),
2015-12-11 16:51:49 +00:00
\ 'fname')
2015-12-26 03:12:08 +00:00
call s:assert.equals(neosnippet#parser#_get_in_paren(
\ '(', ')',
2015-12-12 09:08:13 +00:00
\ 'wait() wait(long, int)'),
\ 'long, int')
2015-08-31 20:56:41 +00:00
endfunction
2015-12-26 03:12:08 +00:00
function! s:suite.get_completed_snippet()
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : 'foo()',
\ 'menu' : '', 'info' : ''
\ }), ')${1}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : 'foo(hoge)',
\ 'menu' : '', 'info' : ''
\ }), '${1:#:hoge})${2}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo', 'abbr' : 'foo(hoge)',
\ 'menu' : '', 'info' : ''
\ }), '')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo)',
\ 'menu' : '', 'info' : ''
\ }), '${1:#:hoge}, ${2:#:piyo})${3}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo(foobar))',
\ 'menu' : '', 'info' : ''
\ }), '${1:#:hoge}, ${2:#:piyo()})${3}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo{', 'abbr' : 'foo{}',
\ 'menu' : '', 'info' : ''
\ }), '}${1}')
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
\ 'word' : 'foo{', 'abbr' : 'foo{piyo}',
\ 'menu' : '', 'info' : ''
\ }), '${1:#:piyo}}${2}')
endfunction