spacevim/bundle/deoplete.nvim/test/autoload/deoplete/custom.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

124 lines
4.3 KiB
VimL

let s:suite = themis#suite('custom')
let s:assert = themis#helper('assert')
function! s:suite.custom_source() abort
call deoplete#custom#_init()
call deoplete#custom#source('_',
\ 'matchers', ['matcher_head'])
call deoplete#custom#source('_', 'converters',
\ ['converter_auto_delimiter', 'remove_overlap'])
call s:assert.equals(
\ deoplete#custom#_get().source,
\ {'_' : {
\ 'matchers': ['matcher_head'],
\ 'converters': ['converter_auto_delimiter', 'remove_overlap']}})
call deoplete#custom#_init()
call deoplete#custom#source('buffer',
\ 'min_pattern_length', 9999)
call deoplete#custom#source('buffer', 'rank', 9999)
call deoplete#custom#source('buffer', {'filetypes': []})
call s:assert.equals(
\ deoplete#custom#_get_source('buffer').filetypes, [])
call s:assert.equals(
\ deoplete#custom#_get_source('buffer').rank, 9999)
call deoplete#custom#var('file', 'force_completion_length', 2)
call deoplete#custom#var('file', {'foo': -1, 'bar': 1})
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_source_vars('file'),
\ {'force_completion_length' : 2, 'foo': -1, 'bar': 1})
call deoplete#custom#buffer_var('file', 'force_completion_length', 0)
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_source_vars('file'),
\ {'force_completion_length' : 0, 'foo': -1, 'bar': 1})
endfunction
function! s:suite.custom_option() abort
" Simple option test
call deoplete#custom#_init()
call deoplete#custom#_init_buffer()
call deoplete#custom#option('auto_complete', v:true)
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:true)
" Buffer option test
call deoplete#custom#buffer_option('auto_complete', v:false)
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:false)
" Compatibility test
call deoplete#custom#_init()
call deoplete#custom#_init_buffer()
let g:deoplete#disable_auto_complete = 1
call deoplete#init#_custom_variables()
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:false)
" Filetype option test
call deoplete#custom#_init()
call deoplete#custom#_init_buffer()
let s:java_pattern = '[^. *\t]\.\w*'
call deoplete#custom#option('omni_patterns', {
\ 'java': s:java_pattern,
\})
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_filetype_option(
\ 'omni_patterns', 'java', ''), s:java_pattern)
call s:assert.equals(
\ deoplete#custom#_get_filetype_option(
\ 'omni_patterns', 'foobar', ''), '')
" Compatibility test
call deoplete#custom#_init()
call deoplete#custom#_init_buffer()
let s:tex_pattern = '[^\w|\s][a-zA-Z_]\w*'
let g:deoplete#keyword_patterns = {}
let g:deoplete#keyword_patterns.tex = '[^\w|\s][a-zA-Z_]\w*'
call deoplete#init#_custom_variables()
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_filetype_option(
\ 'keyword_patterns', 'tex', ''), s:tex_pattern)
" Dict type format
call deoplete#custom#_init()
call deoplete#custom#_init_buffer()
call deoplete#custom#option({
\ 'auto_complete': v:true, 'camel_case': v:true
\ })
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:true)
call s:assert.equals(
\ deoplete#custom#_get_option('camel_case'), v:true)
endfunction
function! s:suite.custom_filter() abort
call deoplete#custom#_init()
call deoplete#custom#filter('converter_auto_delimiter', {
\ 'delimiters': ['foo', 'bar'],
\ })
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_filter('converter_auto_delimiter'),
\ {'delimiters': ['foo', 'bar']})
call deoplete#custom#buffer_filter('converter_auto_delimiter', {
\ 'delimiters': ['foo'],
\ })
call deoplete#custom#_update_cache()
call s:assert.equals(
\ deoplete#custom#_get_filter('converter_auto_delimiter'),
\ {'delimiters': ['foo']})
endfunction