diff options
Diffstat (limited to 'test/functional/provider')
-rw-r--r-- | test/functional/provider/clipboard_spec.lua | 48 | ||||
-rw-r--r-- | test/functional/provider/define_spec.lua | 15 | ||||
-rw-r--r-- | test/functional/provider/nodejs_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/perl_spec.lua | 80 | ||||
-rw-r--r-- | test/functional/provider/python3_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/python_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/ruby_spec.lua | 5 |
7 files changed, 137 insertions, 26 deletions
diff --git a/test/functional/provider/clipboard_spec.lua b/test/functional/provider/clipboard_spec.lua index b2d75db745..da9dd09129 100644 --- a/test/functional/provider/clipboard_spec.lua +++ b/test/functional/provider/clipboard_spec.lua @@ -88,6 +88,11 @@ describe('clipboard', function() before_each(function() clear() screen = Screen.new(72, 4) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, + [1] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, + [2] = {bold = true, foreground = Screen.colors.SeaGreen4}, + }) screen:attach() command("set display-=msgsep") end) @@ -103,22 +108,22 @@ describe('clipboard', function() feed_command('redir @+> | :silent echo system("cat CONTRIBUTING.md") | redir END') screen:expect([[ ^ | - ~ | - ~ | + {0:~ }| + {0:~ }| clipboard: No provider. Try ":checkhealth" or ":h clipboard". | - ]], nil, {{bold = true, foreground = Screen.colors.Blue}}) + ]]) end) it('`:redir @+>|bogus_cmd|redir END` + invalid g:clipboard must not recurse #7184', function() command("let g:clipboard = 'bogus'") feed_command('redir @+> | bogus_cmd | redir END') - screen:expect([[ - ~ | + screen:expect{grid=[[ + {0:~ }| clipboard: No provider. Try ":checkhealth" or ":h clipboard". | - E492: Not an editor command: bogus_cmd | redir END | - Press ENTER or type command to continue^ | - ]], nil, {{bold = true, foreground = Screen.colors.Blue}}) + {1:E492: Not an editor command: bogus_cmd | redir END} | + {2:Press ENTER or type command to continue}^ | + ]]} end) it('invalid g:clipboard shows hint if :redir is not active', function() @@ -131,10 +136,10 @@ describe('clipboard', function() feed_command('let @+="foo"') screen:expect([[ ^ | - ~ | - ~ | + {0:~ }| + {0:~ }| clipboard: No provider. Try ":checkhealth" or ":h clipboard". | - ]], nil, {{bold = true, foreground = Screen.colors.Blue}}) + ]]) end) it('valid g:clipboard', function() @@ -266,13 +271,17 @@ describe('clipboard (with fake clipboard.vim)', function() function() local screen = Screen.new(72, 4) screen:attach() + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, + [1] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, + }) feed_command('redir @+> | bogus_cmd | redir END') screen:expect([[ ^ | - ~ | - ~ | - E492: Not an editor command: bogus_cmd | redir END | - ]], nil, {{bold = true, foreground = Screen.colors.Blue}}) + {0:~ }| + {0:~ }| + {1:E492: Not an editor command: bogus_cmd | redir END} | + ]]) end) it('has independent "* and unnamed registers by default', function() @@ -637,6 +646,9 @@ describe('clipboard (with fake clipboard.vim)', function() feed_command('set mouse=a') local screen = Screen.new(30, 5) + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}, + }) screen:attach() insert([[ the source @@ -646,10 +658,10 @@ describe('clipboard (with fake clipboard.vim)', function() screen:expect([[ the ^source | a target | - ~ | - ~ | + {0:~ }| + {0:~ }| | - ]], nil, {{bold = true, foreground = Screen.colors.Blue}}) + ]]) feed('<MiddleMouse><0,1>') expect([[ diff --git a/test/functional/provider/define_spec.lua b/test/functional/provider/define_spec.lua index 51a8831274..1d50ce0a56 100644 --- a/test/functional/provider/define_spec.lua +++ b/test/functional/provider/define_spec.lua @@ -89,6 +89,21 @@ local function command_specs_for(fn, sync, first_arg_factory, init) runx(sync, handler, on_setup) end) + it('with nargs/double-quote', function() + call(fn, args..', {"nargs": "*"}') + local function on_setup() + command('RpcCommand "arg1" "arg2" "arg3"') + end + + local function handler(method, arguments) + eq('test-handler', method) + eq({'"arg1"', '"arg2"', '"arg3"'}, arguments[1]) + return '' + end + + runx(sync, handler, on_setup) + end) + it('with range', function() call(fn,args..', {"range": ""}') local function on_setup() diff --git a/test/functional/provider/nodejs_spec.lua b/test/functional/provider/nodejs_spec.lua index 07a00f8a8c..661a6f4f94 100644 --- a/test/functional/provider/nodejs_spec.lua +++ b/test/functional/provider/nodejs_spec.lua @@ -8,8 +8,9 @@ local retry = helpers.retry do clear() - if missing_provider('node') then - pending("Missing nodejs host, or nodejs version is too old.", function()end) + local reason = missing_provider('node') + if reason then + pending(string.format("Missing nodejs host, or nodejs version is too old (%s)", reason), function() end) return end end diff --git a/test/functional/provider/perl_spec.lua b/test/functional/provider/perl_spec.lua new file mode 100644 index 0000000000..7b446e4ab3 --- /dev/null +++ b/test/functional/provider/perl_spec.lua @@ -0,0 +1,80 @@ +local helpers = require('test.functional.helpers')(after_each) +local eq, clear = helpers.eq, helpers.clear +local missing_provider = helpers.missing_provider +local command = helpers.command +local write_file = helpers.write_file +local eval = helpers.eval +local retry = helpers.retry + +do + clear() + local reason = missing_provider('perl') + if reason then + pending(string.format("Missing perl host, or perl version is too old (%s)", reason), function() end) + return + end +end + +before_each(function() + clear() +end) + +describe('perl host', function() + if helpers.pending_win32(pending) then return end + teardown(function () + os.remove('Xtest-perl-hello.pl') + os.remove('Xtest-perl-hello-plugin.pl') + end) + + it('works', function() + local fname = 'Xtest-perl-hello.pl' + write_file(fname, [[ + package main; + use strict; + use warnings; + use Neovim::Ext; + use Neovim::Ext::MsgPack::RPC; + + my $session = Neovim::Ext::MsgPack::RPC::socket_session($ENV{NVIM_LISTEN_ADDRESS}); + my $nvim = Neovim::Ext::from_session($session); + $nvim->command('let g:job_out = "hello"'); + 1; + ]]) + command('let g:job_id = jobstart(["perl", "'..fname..'"])') + retry(nil, 3000, function() eq('hello', eval('g:job_out')) end) + end) + + it('plugin works', function() + local fname = 'Xtest-perl-hello-plugin.pl' + write_file(fname, [[ + package TestPlugin; + use strict; + use warnings; + use parent qw(Neovim::Ext::Plugin); + + __PACKAGE__->register; + + @{TestPlugin::commands} = (); + @{TestPlugin::specs} = (); + sub test_command :nvim_command('TestCommand') + { + my ($this) = @_; + $this->nvim->command('let g:job_out = "hello-plugin"'); + } + + package main; + use strict; + use warnings; + use Neovim::Ext; + use Neovim::Ext::MsgPack::RPC; + + my $session = Neovim::Ext::MsgPack::RPC::socket_session($ENV{NVIM_LISTEN_ADDRESS}); + my $nvim = Neovim::Ext::from_session($session); + my $plugin = TestPlugin->new($nvim); + $plugin->test_command(); + 1; + ]]) + command('let g:job_id = jobstart(["perl", "'..fname..'"])') + retry(nil, 3000, function() eq('hello-plugin', eval('g:job_out')) end) + end) +end) diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index b319d5e948..d254edc7d5 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -10,13 +10,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('python3') then + local reason = missing_provider('python3') + if reason then it(':python3 reports E319 if provider is missing', function() local expected = [[Vim%(py3.*%):E319: No "python3" provider found.*]] matches(expected, pcall_err(command, 'py3 print("foo")')) matches(expected, pcall_err(command, 'py3file foo')) end) - pending('Python 3 (or the pynvim module) is broken/missing', function() end) + pending(string.format('Python 3 (or the pynvim module) is broken/missing (%s)', reason), function() end) return end end diff --git a/test/functional/provider/python_spec.lua b/test/functional/provider/python_spec.lua index 986f10b2e9..d60d8d1001 100644 --- a/test/functional/provider/python_spec.lua +++ b/test/functional/provider/python_spec.lua @@ -18,13 +18,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('python') then + local reason = missing_provider('python') + if reason then it(':python reports E319 if provider is missing', function() local expected = [[Vim%(py.*%):E319: No "python" provider found.*]] matches(expected, pcall_err(command, 'py print("foo")')) matches(expected, pcall_err(command, 'pyfile foo')) end) - pending('Python 2 (or the pynvim module) is broken/missing', function() end) + pending(string.format('Python 2 (or the pynvim module) is broken/missing (%s)', reason), function() end) return end end diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua index d20adde2ef..bb7d23ede6 100644 --- a/test/functional/provider/ruby_spec.lua +++ b/test/functional/provider/ruby_spec.lua @@ -18,13 +18,14 @@ local pcall_err = helpers.pcall_err do clear() - if missing_provider('ruby') then + local reason = missing_provider('ruby') + if reason then it(':ruby reports E319 if provider is missing', function() local expected = [[Vim%(ruby.*%):E319: No "ruby" provider found.*]] matches(expected, pcall_err(command, 'ruby puts "foo"')) matches(expected, pcall_err(command, 'rubyfile foo')) end) - pending("Missing neovim RubyGem.", function() end) + pending(string.format('Missing neovim RubyGem (%s)', reason), function() end) return end end |