From d43ac790f2454e2173eb645bdcd97c7a7c7e4846 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 28 Apr 2016 19:23:15 -0400 Subject: vim-patch:7.4.1479 Problem: No testfor ":loadplugin". Solution: Add a test. Fix how option is being set. https://github.com/vim/vim/commit/863c1a9079fa340d663ccafb011729a29186d73e --- test/functional/legacy/loadplugin_spec.lua | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 test/functional/legacy/loadplugin_spec.lua (limited to 'test') diff --git a/test/functional/legacy/loadplugin_spec.lua b/test/functional/legacy/loadplugin_spec.lua new file mode 100644 index 0000000000..267520ac5c --- /dev/null +++ b/test/functional/legacy/loadplugin_spec.lua @@ -0,0 +1,46 @@ +-- Tests for :loadplugin + +local helpers = require('test.functional.helpers')(after_each) +local clear, source = helpers.clear, helpers.source +local call, eq, nvim = helpers.call, helpers.eq, helpers.meths + +local function expected_empty() + eq({}, nvim.get_vvar('errors')) +end + +describe('loadplugin', function() + setup(function() + clear() + + source([=[ + func Test_loadplugin() + let topdir = expand('%:p:h') . '/Xdir' + exe 'set packpath=' . topdir + let plugdir = topdir . '/pack/mine/opt/mytest' + call mkdir(plugdir . '/plugin', 'p') + call mkdir(plugdir . '/ftdetect', 'p') + filetype on + try + exe 'split ' . plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + + exe 'split ' . plugdir . '/ftdetect/test.vim' + call setline(1, 'let g:ftdetect_works = 17') + wq + + loadplugin mytest + call assert_true(42, g:plugin_works) + call assert_true(17, g:ftdetect_works) + finally + call delete(topdir, 'rf') + endtry + endfunc + ]=]) + end) + + it('is working', function() + call('Test_loadplugin') + expected_empty() + end) +end) -- cgit