2015-08-31 20:56:41 +00:00
|
|
|
let s:suite = themis#suite('toml')
|
|
|
|
let s:assert = themis#helper('assert')
|
|
|
|
|
2016-02-08 12:48:14 +00:00
|
|
|
function! s:suite.get_in_paren() abort
|
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')
|
2017-01-02 01:41:43 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_in_paren(
|
|
|
|
\ '(', ')',
|
|
|
|
\ 'wait() (long, int)'),
|
|
|
|
\ '')
|
2015-08-31 20:56:41 +00:00
|
|
|
endfunction
|
|
|
|
|
2016-02-08 12:48:14 +00:00
|
|
|
function! s:suite.get_completed_snippet() abort
|
2015-12-26 03:12:08 +00:00
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo()',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), ')${1}')
|
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'foo(', 'abbr' : 'foo()',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
|
|
|
\ }, 'foo)', ''), '')
|
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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), '${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), '${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo', ''), '(${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' : ''
|
2017-01-09 09:19:16 +00:00
|
|
|
\ }, 'foo(', ''), '${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' : ''
|
2017-01-09 09:19:16 +00:00
|
|
|
\ }, 'foo(', ''), '${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), '${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), '${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo(', ''), '${1:#:hoge}${2:#:, ...})${3}')
|
2015-12-30 03:49:24 +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-11-21 18:51:38 +00:00
|
|
|
\ }, 'foo{', ''), '${1}}${2}')
|
2016-01-01 11:53:21 +00:00
|
|
|
|
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' : ''
|
2017-01-09 09:19:16 +00:00
|
|
|
\ }, 'Dictionary', ''), '<${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-11-21 18:51:38 +00:00
|
|
|
\ }, 'Dictionary(', ''), '${1:#:foo})${2}')
|
2016-01-04 03:13:47 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : '',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'Dictionary(', '('), '')
|
2016-01-04 03:13:47 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'Dictionary(', '('), '')
|
2016-01-04 03:13:47 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary(', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'Dictionary(', ')'), '${1:#:foo})${2}')
|
2016-01-04 03:13:47 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'Dictionary', 'abbr' : 'Dictionary(foo)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'Dictionary', ''), '(${1:#:foo})${2}')
|
2016-01-18 03:03:13 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'forEach', 'abbr' : 'forEach(BiConsumer<Object, Object>)',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'forEach', ''), '(${1:#:BiConsumer<>})${2}')
|
2016-02-06 02:50:02 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'for[', 'abbr' : '',
|
|
|
|
\ 'menu' : '', 'info' : ''
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'for[', ''), '${1}]${2}')
|
2016-06-09 04:18:23 +00:00
|
|
|
|
|
|
|
call s:assert.equals(neosnippet#parser#_get_completed_snippet({
|
|
|
|
\ 'word' : 'something', 'abbr' : 'something(else)',
|
|
|
|
\ 'menu' : '', 'info' : '', 'snippet' : '(${1:custom})${2}'
|
2016-11-21 18:51:38 +00:00
|
|
|
\ }, 'something', ''), '(${1:custom})${2}')
|
2015-12-26 03:12:08 +00:00
|
|
|
endfunction
|
|
|
|
|