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 From 67d8e586318a3f2f13df22f9a3b25c6d8a109e6c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 28 Apr 2016 20:47:27 -0400 Subject: vim-patch:7.4.1480 Problem: Cannot add a pack direcory without loading a plugin. Solution: Add the :packadd command. https://github.com/vim/vim/commit/91715873d19a1859c08eeded7848113596e2f2bd --- test/functional/legacy/loadplugin_spec.lua | 73 ++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 20 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/loadplugin_spec.lua b/test/functional/legacy/loadplugin_spec.lua index 267520ac5c..af97db3ae5 100644 --- a/test/functional/legacy/loadplugin_spec.lua +++ b/test/functional/legacy/loadplugin_spec.lua @@ -13,34 +13,67 @@ describe('loadplugin', function() clear() source([=[ + func SetUp() + let s:topdir = expand('%:p:h') . '/Xdir' + exe 'set packpath=' . s:topdir + let s:plugdir = s:topdir . '/pack/mine/opt/mytest' + endfunc + + func TearDown() + call delete(s:topdir, 'rf') + endfunc + 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') + call mkdir(s:plugdir . '/plugin', 'p') + call mkdir(s:plugdir . '/ftdetect', 'p') + set rtp& + let rtp = &rtp 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 + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + + exe 'split ' . s: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) + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + endfunc + + func Test_packadd() + call mkdir(s:plugdir . '/syntax', 'p') + set rtp& + let rtp = &rtp + packadd mytest + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + + " check the path is not added twice + let new_rtp = &rtp + packadd mytest + call assert_equal(new_rtp, &rtp) endfunc ]=]) + call('SetUp') + end) + + teardown(function() + call('TearDown') end) it('is working', function() call('Test_loadplugin') expected_empty() end) + + it('works with packadd', function() + call('Test_packadd') + expected_empty() + end) end) -- cgit From 2f72f34f0407dcdf189bb4f3a4b79b51e96744bf Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 28 Apr 2016 22:58:24 -0400 Subject: vim-patch:7.4.1486 Problem: ":loadplugin" is not optimal, some people find it confusing. Solution: Only use ":packadd" with an optional "!". https://github.com/vim/vim/commit/f3654827368e6204608036353a0360e9e7c21e02 --- test/functional/legacy/loadplugin_spec.lua | 79 --------------------------- test/functional/legacy/packadd_spec.lua | 88 ++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 79 deletions(-) delete mode 100644 test/functional/legacy/loadplugin_spec.lua create mode 100644 test/functional/legacy/packadd_spec.lua (limited to 'test') diff --git a/test/functional/legacy/loadplugin_spec.lua b/test/functional/legacy/loadplugin_spec.lua deleted file mode 100644 index af97db3ae5..0000000000 --- a/test/functional/legacy/loadplugin_spec.lua +++ /dev/null @@ -1,79 +0,0 @@ --- 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 SetUp() - let s:topdir = expand('%:p:h') . '/Xdir' - exe 'set packpath=' . s:topdir - let s:plugdir = s:topdir . '/pack/mine/opt/mytest' - endfunc - - func TearDown() - call delete(s:topdir, 'rf') - endfunc - - func Test_loadplugin() - call mkdir(s:plugdir . '/plugin', 'p') - call mkdir(s:plugdir . '/ftdetect', 'p') - set rtp& - let rtp = &rtp - filetype on - - exe 'split ' . s:plugdir . '/plugin/test.vim' - call setline(1, 'let g:plugin_works = 42') - wq - - exe 'split ' . s: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) - call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) - endfunc - - func Test_packadd() - call mkdir(s:plugdir . '/syntax', 'p') - set rtp& - let rtp = &rtp - packadd mytest - call assert_true(len(&rtp) > len(rtp)) - call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) - - " check the path is not added twice - let new_rtp = &rtp - packadd mytest - call assert_equal(new_rtp, &rtp) - endfunc - ]=]) - call('SetUp') - end) - - teardown(function() - call('TearDown') - end) - - it('is working', function() - call('Test_loadplugin') - expected_empty() - end) - - it('works with packadd', function() - call('Test_packadd') - expected_empty() - end) -end) diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua new file mode 100644 index 0000000000..94b5336b9f --- /dev/null +++ b/test/functional/legacy/packadd_spec.lua @@ -0,0 +1,88 @@ +-- Tests for 'packpath' and :packadd + +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('packadd', function() + before_each(function() + clear() + + source([=[ + func SetUp() + let s:topdir = expand('%:p:h') . '/Xdir' + exe 'set packpath=' . s:topdir + let s:plugdir = s:topdir . '/pack/mine/opt/mytest' + endfunc + + func TearDown() + call delete(s:topdir, 'rf') + endfunc + + func Test_packadd() + call mkdir(s:plugdir . '/plugin', 'p') + call mkdir(s:plugdir . '/ftdetect', 'p') + set rtp& + let rtp = &rtp + filetype on + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + + exe 'split ' . s:plugdir . '/ftdetect/test.vim' + call setline(1, 'let g:ftdetect_works = 17') + wq + + packadd mytest + + call assert_true(42, g:plugin_works) + call assert_true(17, g:ftdetect_works) + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + endfunc + + func Test_packadd_noload() + call mkdir(s:plugdir . '/plugin', 'p') + call mkdir(s:plugdir . '/syntax', 'p') + set rtp& + let rtp = &rtp + + exe 'split ' . s:plugdir . '/plugin/test.vim' + call setline(1, 'let g:plugin_works = 42') + wq + let g:plugin_works = 0 + + packadd! mytest + + call assert_true(len(&rtp) > len(rtp)) + call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + call assert_equal(0, g:plugin_works) + + " check the path is not added twice + let new_rtp = &rtp + packadd! mytest + call assert_equal(new_rtp, &rtp) + endfunc + ]=]) + call('SetUp') + end) + + after_each(function() + call('TearDown') + end) + + it('is working', function() + call('Test_packadd') + expected_empty() + end) + + it('works with packadd!', function() + call('Test_packadd_noload') + expected_empty() + end) +end) -- cgit From 85e539c99609cec0b5a0eab3aded394d0bbab555 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 2 May 2016 21:15:57 -0400 Subject: vim-patch:7.4.1492 Problem: No command line completion for ":packadd". Solution: Implement completion. (Hirohito Higashi) https://github.com/vim/vim/commit/35ca0e7a1cb6e6daef8e0052a8437801226cef19 --- test/functional/legacy/packadd_spec.lua | 64 ++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 94b5336b9f..9ca7c4e723 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -1,8 +1,9 @@ -- Tests for 'packpath' and :packadd local helpers = require('test.functional.helpers')(after_each) -local clear, source = helpers.clear, helpers.source +local clear, source, execute = helpers.clear, helpers.source, helpers.execute local call, eq, nvim = helpers.call, helpers.eq, helpers.meths +local feed = helpers.feed local function expected_empty() eq({}, nvim.get_vvar('errors')) @@ -85,4 +86,65 @@ describe('packadd', function() call('Test_packadd_noload') expected_empty() end) + + describe('command line completion', function() + local Screen = require('test.functional.ui.screen') + local screen + + before_each(function() + screen = Screen.new(30, 5) + screen:attach() + screen:set_default_attr_ids({ + [1] = { + foreground = Screen.colors.Black, + background = Screen.colors.Yellow, + }, + [2] = {bold = true, reverse = true} + }) + local NonText = Screen.colors.Blue + screen:set_default_attr_ignore({{}, {bold=true, foreground=NonText}}) + + execute([[let optdir1 = &packpath . '/pack/mine/opt']]) + execute([[let optdir2 = &packpath . '/pack/candidate/opt']]) + execute([[call mkdir(optdir1 . '/pluginA', 'p')]]) + execute([[call mkdir(optdir1 . '/pluginC', 'p')]]) + execute([[call mkdir(optdir2 . '/pluginB', 'p')]]) + execute([[call mkdir(optdir2 . '/pluginC', 'p')]]) + end) + + it('works', function() + feed(':packadd ') + screen:expect([=[ + | + ~ | + ~ | + {1:pluginA}{2: pluginB pluginC }| + :packadd pluginA^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:pluginA }{1:pluginB}{2: pluginC }| + :packadd pluginB^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:pluginA pluginB }{1:pluginC}{2: }| + :packadd pluginC^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:pluginA pluginB pluginC }| + :packadd ^ | + ]=]) + end) + end) end) -- cgit From 8ecdc571b0cf679c5195088d140f2988bcbe87e1 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 20 Jun 2016 10:12:07 -0400 Subject: vim-patch:7.4.1499 Problem: No error message when :packadd does not find anything. Solution: Add an error message. (Hirohito Higashi) https://github.com/vim/vim/commit/be82c254862e475a582c0717455e1db6bf96b0d0 --- test/functional/legacy/packadd_spec.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 9ca7c4e723..e84a8e60d6 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -45,6 +45,10 @@ describe('packadd', function() call assert_true(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + + " Check exception + call assert_fails("packadd directorynotfound", 'E919:') + call assert_fails("packadd", 'E471:') endfunc func Test_packadd_noload() -- cgit From 26f74fdf61827f5afc6fe4e90b9e9497264cb039 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 20 Jun 2016 20:24:13 -0400 Subject: vim-patch:7.4.1550 Problem: Cannot load packages early. Solution: Add the ":packloadall" command. https://github.com/vim/vim/commit/2d8f56acb32428d0f965d42dd13b27100b46fa15 --- test/functional/legacy/packadd_spec.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index e84a8e60d6..5006981f8f 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -73,6 +73,23 @@ describe('packadd', function() packadd! mytest call assert_equal(new_rtp, &rtp) endfunc + + func Test_packloadall() + let plugindir = &packpath . '/pack/mine/start/foo/plugin' + call mkdir(plugindir, 'p') + call writefile(['let g:plugin_foo_number = 1234'], plugindir . '/bar.vim') + packloadall + call assert_equal(1234, g:plugin_foo_number) + + " only works once + call writefile(['let g:plugin_bar_number = 4321'], plugindir . '/bar2.vim') + packloadall + call assert_false(exists('g:plugin_bar_number')) + + " works when ! used + packloadall! + call assert_equal(4321, g:plugin_bar_number) + endfunc ]=]) call('SetUp') end) @@ -91,6 +108,11 @@ describe('packadd', function() expected_empty() end) + it('works with :packloadall', function() + call('Test_packloadall') + expected_empty() + end) + describe('command line completion', function() local Screen = require('test.functional.ui.screen') local screen -- cgit From 55dcf0918c364dd58e700cde5f2efbf7da4b3051 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 20 Jun 2016 21:04:08 -0400 Subject: vim-patch:7.4.1551 Problem: Cannot generate help tags in all doc directories. Solution: Make ":helptags ALL" work. https://github.com/vim/vim/commit/6bef5306e4f2cacb3a93667992c2312d4b293c9d --- test/functional/legacy/packadd_spec.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 5006981f8f..296ec315a7 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -90,6 +90,23 @@ describe('packadd', function() packloadall! call assert_equal(4321, g:plugin_bar_number) endfunc + + func Test_helptags() + let docdir1 = &packpath . '/pack/mine/start/foo/doc' + let docdir2 = &packpath . '/pack/mine/start/bar/doc' + call mkdir(docdir1, 'p') + call mkdir(docdir2, 'p') + call writefile(['look here: *look-here*'], docdir1 . '/bar.txt') + call writefile(['look away: *look-away*'], docdir2 . '/foo.txt') + exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar' + + helptags ALL + + let tags1 = readfile(docdir1 . '/tags') + call assert_true(tags1[0] =~ 'look-here') + let tags2 = readfile(docdir2 . '/tags') + call assert_true(tags2[0] =~ 'look-away') + endfunc ]=]) call('SetUp') end) @@ -113,6 +130,11 @@ describe('packadd', function() expected_empty() end) + it('works with helptags', function() + call('Test_helptags') + expected_empty() + end) + describe('command line completion', function() local Screen = require('test.functional.ui.screen') local screen -- cgit From 080476882be32768a97e26af22133435ccb8fc2a Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 20 Jun 2016 20:34:24 -0400 Subject: vim-patch:7.4.1552 Problem: ":colorscheme" does not use 'packpath'. Solution: Also use in "start" and "opt" directories in 'packpath'. https://github.com/vim/vim/commit/7f8989dd8a627af2185df381195351a913f3777f --- test/functional/legacy/packadd_spec.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 296ec315a7..4def2130df 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -107,6 +107,26 @@ describe('packadd', function() let tags2 = readfile(docdir2 . '/tags') call assert_true(tags2[0] =~ 'look-away') endfunc + + func Test_colorscheme() + let colordirrun = &packpath . '/runtime/colors' + let colordirstart = &packpath . '/pack/mine/start/foo/colors' + let colordiropt = &packpath . '/pack/mine/opt/bar/colors' + call mkdir(colordirrun, 'p') + call mkdir(colordirstart, 'p') + call mkdir(colordiropt, 'p') + call writefile(['let g:found_one = 1'], colordirrun . '/one.vim') + call writefile(['let g:found_two = 1'], colordirstart . '/two.vim') + call writefile(['let g:found_three = 1'], colordiropt . '/three.vim') + exe 'set rtp=' . &packpath . '/runtime' + + colorscheme one + call assert_equal(1, g:found_one) + colorscheme two + call assert_equal(1, g:found_two) + colorscheme three + call assert_equal(1, g:found_three) + endfunc ]=]) call('SetUp') end) @@ -135,6 +155,11 @@ describe('packadd', function() expected_empty() end) + it('works with colorschemes', function() + call('Test_colorscheme') + expected_empty() + end) + describe('command line completion', function() local Screen = require('test.functional.ui.screen') local screen -- cgit From 53613e7fcd27feda32844904f4ef88bf82841015 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 21 Jun 2016 23:13:46 -0400 Subject: vim-patch:7.4.1553 Problem: ":runtime" does not use 'packpath'. Solution: Add "what" argument. https://github.com/vim/vim/commit/8dcf259d904cfb965d31841dc74a5cfaf5a351d9 --- test/functional/legacy/packadd_spec.lua | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 4def2130df..509d52123d 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -127,6 +127,53 @@ describe('packadd', function() colorscheme three call assert_equal(1, g:found_three) endfunc + + func Test_runtime() + let rundir = &packpath . '/runtime/extra' + let startdir = &packpath . '/pack/mine/start/foo/extra' + let optdir = &packpath . '/pack/mine/opt/bar/extra' + call mkdir(rundir, 'p') + call mkdir(startdir, 'p') + call mkdir(optdir, 'p') + call writefile(['let g:sequence .= "run"'], rundir . '/bar.vim') + call writefile(['let g:sequence .= "start"'], startdir . '/bar.vim') + call writefile(['let g:sequence .= "foostart"'], startdir . '/foo.vim') + call writefile(['let g:sequence .= "opt"'], optdir . '/bar.vim') + call writefile(['let g:sequence .= "xxxopt"'], optdir . '/xxx.vim') + exe 'set rtp=' . &packpath . '/runtime' + + let g:sequence = '' + runtime extra/bar.vim + call assert_equal('run', g:sequence) + let g:sequence = '' + runtime START extra/bar.vim + call assert_equal('start', g:sequence) + let g:sequence = '' + runtime OPT extra/bar.vim + call assert_equal('opt', g:sequence) + let g:sequence = '' + runtime PACK extra/bar.vim + call assert_equal('start', g:sequence) + let g:sequence = '' + runtime! PACK extra/bar.vim + call assert_equal('startopt', g:sequence) + let g:sequence = '' + runtime PACK extra/xxx.vim + call assert_equal('xxxopt', g:sequence) + + let g:sequence = '' + runtime ALL extra/bar.vim + call assert_equal('run', g:sequence) + let g:sequence = '' + runtime ALL extra/foo.vim + call assert_equal('foostart', g:sequence) + let g:sequence = '' + runtime! ALL extra/xxx.vim + call assert_equal('xxxopt', g:sequence) + let g:sequence = '' + runtime! ALL extra/bar.vim + call assert_equal('runstartopt', g:sequence) + endfunc ]=]) call('SetUp') end) @@ -160,6 +207,11 @@ describe('packadd', function() expected_empty() end) + it('works with :runtime [what]', function() + call('Test_runtime') + expected_empty() + end) + describe('command line completion', function() local Screen = require('test.functional.ui.screen') local screen -- cgit From 443d335ce31929f0e1c3b2ad6e403f98067c9526 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 22 Jun 2016 11:04:46 -0400 Subject: vim-patch:7.4.1554 Problem: Completion for :colorscheme does not use 'packpath'. Solution: Make it work, add a test. (Hirohito Higashi) https://github.com/vim/vim/commit/52f9c19015df5ee1ee8592b6f3f15b8a57c8f5be --- test/functional/legacy/packadd_spec.lua | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 509d52123d..d85467ced1 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -271,5 +271,52 @@ describe('packadd', function() :packadd ^ | ]=]) end) + + it('works for colorschemes', function() + source([[ + let colordirrun = &packpath . '/runtime/colors' + let colordirstart = &packpath . '/pack/mine/start/foo/colors' + let colordiropt = &packpath . '/pack/mine/opt/bar/colors' + call mkdir(colordirrun, 'p') + call mkdir(colordirstart, 'p') + call mkdir(colordiropt, 'p') + call writefile(['let g:found_one = 1'], colordirrun . '/one.vim') + call writefile(['let g:found_two = 1'], colordirstart . '/two.vim') + call writefile(['let g:found_three = 1'], colordiropt . '/three.vim') + exe 'set rtp=' . &packpath . '/runtime']]) + + feed(':colorscheme ') + screen:expect([=[ + | + ~ | + ~ | + {1:one}{2: three two }| + :colorscheme one^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:one }{1:three}{2: two }| + :colorscheme three^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:one three }{1:two}{2: }| + :colorscheme two^ | + ]=]) + feed('') + screen:expect([=[ + | + ~ | + ~ | + {2:one three two }| + :colorscheme ^ | + ]=]) + end) end) end) -- cgit From 23b2ee077130182c60d6639d99b45546902c8f80 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 7 Jul 2016 23:12:33 -0400 Subject: vim-patch:7.4.1712 Problem: For plugins in packages, plugin authors need to take care of all dependencies. Solution: When loading "start" packages and for :packloadall, first add all directories to 'runtimepath' before sourcing plugins. https://github.com/vim/vim/commit/49b27326447d0827c59c6cd201d58f65c1163086 --- test/functional/legacy/packadd_spec.lua | 34 +++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index d85467ced1..8c680f24b4 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -75,14 +75,40 @@ describe('packadd', function() endfunc func Test_packloadall() - let plugindir = &packpath . '/pack/mine/start/foo/plugin' - call mkdir(plugindir, 'p') - call writefile(['let g:plugin_foo_number = 1234'], plugindir . '/bar.vim') + " plugin foo with an autoload directory + let fooplugindir = &packpath . '/pack/mine/start/foo/plugin' + call mkdir(fooplugindir, 'p') + call writefile(['let g:plugin_foo_number = 1234', + \ 'let g:plugin_foo_auto = bbb#value', + \ 'let g:plugin_extra_auto = extra#value'], fooplugindir . '/bar.vim') + let fooautodir = &packpath . '/pack/mine/start/foo/autoload' + call mkdir(fooautodir, 'p') + call writefile(['let bar#value = 77'], fooautodir . '/bar.vim') + + " plugin aaa with an autoload directory + let aaaplugindir = &packpath . '/pack/mine/start/aaa/plugin' + call mkdir(aaaplugindir, 'p') + call writefile(['let g:plugin_aaa_number = 333', + \ 'let g:plugin_aaa_auto = bar#value'], aaaplugindir . '/bbb.vim') + let aaaautodir = &packpath . '/pack/mine/start/aaa/autoload' + call mkdir(aaaautodir, 'p') + call writefile(['let bbb#value = 55'], aaaautodir . '/bbb.vim') + + " plugin extra with only an autoload directory + let extraautodir = &packpath . '/pack/mine/start/extra/autoload' + call mkdir(extraautodir, 'p') + call writefile(['let extra#value = 99'], extraautodir . '/extra.vim') + packloadall call assert_equal(1234, g:plugin_foo_number) + call assert_equal(55, g:plugin_foo_auto) + call assert_equal(99, g:plugin_extra_auto) + call assert_equal(333, g:plugin_aaa_number) + call assert_equal(77, g:plugin_aaa_auto) " only works once - call writefile(['let g:plugin_bar_number = 4321'], plugindir . '/bar2.vim') + call writefile(['let g:plugin_bar_number = 4321'], + \ fooplugindir . '/bar2.vim') packloadall call assert_false(exists('g:plugin_bar_number')) -- cgit From 520a4f06e20c3917e75e3a413a290d9141cb0a0c Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 8 Jul 2016 00:05:35 -0400 Subject: vim-patch:7.4.1840 Problem: When using packages an "after" directory cannot be used. Solution: Add the "after" directory of the package to 'runtimepath' if it exists. https://github.com/vim/vim/commit/a57024453115592b8847af40ddd965a33898e390 --- test/functional/legacy/packadd_spec.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua index 8c680f24b4..b2ed39f288 100644 --- a/test/functional/legacy/packadd_spec.lua +++ b/test/functional/legacy/packadd_spec.lua @@ -27,6 +27,7 @@ describe('packadd', function() func Test_packadd() call mkdir(s:plugdir . '/plugin', 'p') call mkdir(s:plugdir . '/ftdetect', 'p') + call mkdir(s:plugdir . '/after', 'p') set rtp& let rtp = &rtp filetype on @@ -45,6 +46,7 @@ describe('packadd', function() call assert_true(17, g:ftdetect_works) call assert_true(len(&rtp) > len(rtp)) call assert_true(&rtp =~ (s:plugdir . '\($\|,\)')) + call assert_true(&rtp =~ (s:plugdir . '/after$')) " Check exception call assert_fails("packadd directorynotfound", 'E919:') -- cgit