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' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), ')${1}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
2016-01-01 11:53:21 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : '',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1})${2}')
|
2016-01-01 11:53:21 +00:00
|
|
|
|
2015-12-26 03:12:08 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(hoge)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:hoge})${2}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo', 'abbr' : 'foo(hoge)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '(${1:#:hoge})${2}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:hoge}, ${2:#:piyo})${3}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(hoge, piyo(foobar))',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:hoge}, ${2:#:piyo()})${3}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
2015-12-30 03:49:24 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(hoge[, abc])',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:hoge[, abc]})${2}')
|
2015-12-30 03:49:24 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(...)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:...})${2}')
|
2015-12-30 03:49:24 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo(hoge, ...)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:hoge}${2:#:, ...})${3}')
|
2015-12-30 03:49:24 +00:00
|
|
|
|
2015-12-26 03:12:08 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo{', 'abbr' : 'foo{}',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '}${1}')
|
2015-12-26 03:12:08 +00:00
|
|
|
|
2016-01-01 11:53:21 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo{', 'abbr' : 'foo{',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1}}${2}')
|
2016-01-01 11:53:21 +00:00
|
|
|
|
2015-12-26 03:12:08 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo{', 'abbr' : 'foo{piyo}',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:piyo}}${2}')
|
2015-12-26 03:39:45 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
2016-01-04 03:13:47 +00:00
|
|
|
\ 'word' : 'Dictionary', 'abbr' : 'Dictionary<Key, Value>(foo)',
|
2015-12-26 03:39:45 +00:00
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '<${1:#:Key}, ${2:#:Value}>(${3:#:foo})${4}')
|
2016-01-01 11:37:00 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
2016-01-04 03:13:47 +00:00
|
|
|
\ 'word' : 'Dictionary(',
|
|
|
|
\ 'abbr' : 'Dictionary<Key, Value> Dictionary(foo)',
|
2016-01-01 11:37:00 +00:00
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-01-04 03:13:47 +00:00
|
|
|
\ }, ''), '${1:#:foo})${2}')
|
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : '',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
|
|
|
\ }, '('), '')
|
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
|
|
|
\ }, '('), '')
|
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
|
|
|
\ }, ')'), '${1:#:foo}')
|
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
|
|
|
\ }, ''), '(${1:#:foo})${2}')
|
2015-12-26 03:12:08 +00:00
|
|
|
endfunction
|
|
|
|
|