diff options
Diffstat (limited to 'test')
4 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/fixtures/autoload/provider/brokencall.vim b/test/functional/fixtures/autoload/provider/brokencall.vim new file mode 100644 index 0000000000..2c83dd2b4a --- /dev/null +++ b/test/functional/fixtures/autoload/provider/brokencall.vim @@ -0,0 +1,2 @@ +" A dummy test provider +let g:provider#brokencall#enabled = 1 diff --git a/test/functional/fixtures/autoload/provider/brokenenabled.vim b/test/functional/fixtures/autoload/provider/brokenenabled.vim new file mode 100644 index 0000000000..54ed11cedc --- /dev/null +++ b/test/functional/fixtures/autoload/provider/brokenenabled.vim @@ -0,0 +1,6 @@ +" Dummy test provider, missing +" let g:provider#brokenenabled#enabled = 0 + +function! provider#brokenenabled#Call(method, args) + return 42 +endfunction diff --git a/test/functional/fixtures/autoload/provider/clipboard.vim b/test/functional/fixtures/autoload/provider/clipboard.vim index 6d777255c8..d1ddd81b12 100644 --- a/test/functional/fixtures/autoload/provider/clipboard.vim +++ b/test/functional/fixtures/autoload/provider/clipboard.vim @@ -35,6 +35,7 @@ function! s:methods.set(lines, regtype, reg) let g:test_clip[a:reg] = [a:lines, a:regtype] endfunction +let provider#clipboard#enabled = 1 function! provider#clipboard#Call(method, args) return call(s:methods[a:method],a:args,s:methods) diff --git a/test/functional/provider/provider_spec.lua b/test/functional/provider/provider_spec.lua new file mode 100644 index 0000000000..6f414f36f4 --- /dev/null +++ b/test/functional/provider/provider_spec.lua @@ -0,0 +1,19 @@ + +local helpers = require('test.functional.helpers')(after_each) +local clear, eq, feed_command, eval = helpers.clear, helpers.eq, helpers.feed_command, helpers.eval + +describe('Providers', function() + before_each(function() + clear('--cmd', 'let &rtp = "test/functional/fixtures,".&rtp') + end) + + it('must set the enabled variable or fail', function() + eq(42, eval("provider#brokenenabled#Call('dosomething', [])")) + feed_command("call has('brokenenabled')") + eq(0, eval("has('brokenenabled')")) + end) + + it('without Call() are enabled', function() + eq(1, eval("has('brokencall')")) + end) +end) |