1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
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)
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 s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:true)
" Buffer option test
call deoplete#custom#buffer_option('auto_complete', v:false)
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#_variables()
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 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#_variables()
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 s:assert.equals(
\ deoplete#custom#_get_option('auto_complete'), v:true)
call s:assert.equals(
\ deoplete#custom#_get_option('camel_case'), v:true)
endfunction
|