aboutsummaryrefslogtreecommitdiff
path: root/test/functional/provider/python3_spec.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 15:00:41 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 15:00:41 -0700
commit7a7f497b483cd65e340064f23ed1c73425ecba0a (patch)
treed5c99ea22a1e10300d06165f8ac96df6b0dc59e1 /test/functional/provider/python3_spec.lua
parent1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.gz
rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.tar.bz2
rneovim-7a7f497b483cd65e340064f23ed1c73425ecba0a.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpost
Diffstat (limited to 'test/functional/provider/python3_spec.lua')
-rw-r--r--test/functional/provider/python3_spec.lua54
1 files changed, 36 insertions, 18 deletions
diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua
index d9c44c3315..80b3552e82 100644
--- a/test/functional/provider/python3_spec.lua
+++ b/test/functional/provider/python3_spec.lua
@@ -8,19 +8,28 @@ local source = helpers.source
local missing_provider = helpers.missing_provider
local matches = helpers.matches
local pcall_err = helpers.pcall_err
-local funcs = helpers.funcs
+local fn = helpers.fn
local dedent = helpers.dedent
do
clear()
- local reason = missing_provider('python3')
+ local reason = missing_provider('python')
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(string.format('Python 3 (or the pynvim module) is broken/missing (%s)', reason), function() end)
+ it('feature test when Python 3 provider is missing', function()
+ eq(0, eval('has("python3")'))
+ eq(0, eval('has("python3_compiled")'))
+ eq(0, eval('has("python3_dynamic")'))
+ eq(0, eval('has("pythonx")'))
+ end)
+ pending(
+ string.format('Python 3 (or the pynvim module) is broken/missing (%s)', reason),
+ function() end
+ )
return
end
end
@@ -35,31 +44,40 @@ describe('python3 provider', function()
eq(1, eval('has("python3")'))
eq(1, eval('has("python3_compiled")'))
eq(1, eval('has("python3_dynamic")'))
+ eq(1, eval('has("pythonx")'))
eq(0, eval('has("python3_dynamic_")'))
eq(0, eval('has("python3_")'))
end)
it('python3_execute', function()
command('python3 vim.vars["set_by_python3"] = [100, 0]')
- eq({100, 0}, eval('g:set_by_python3'))
+ eq({ 100, 0 }, eval('g:set_by_python3'))
end)
it('does not truncate error message <1 MB', function()
-- XXX: Python limits the error name to 200 chars, so this test is
-- mostly bogus.
local very_long_symbol = string.rep('a', 1200)
- feed_command(':silent! py3 print('..very_long_symbol..' b)')
+ feed_command(':silent! py3 print(' .. very_long_symbol .. ' b)')
-- Error message will contain this (last) line.
- matches(string.format(dedent([[
+ matches(
+ string.format(
+ dedent([[
^Error invoking 'python_execute' on channel 3 %%(python3%%-script%%-host%%):
File "<string>", line 1
print%%(%s b%%)
%%C*
- SyntaxError: invalid syntax%%C*$]]), very_long_symbol), eval('v:errmsg'))
+ SyntaxError: invalid syntax%%C*$]]),
+ very_long_symbol
+ ),
+ eval('v:errmsg')
+ )
end)
it('python3_execute with nested commands', function()
- command([[python3 vim.command('python3 vim.command("python3 vim.command(\'let set_by_nested_python3 = 555\')")')]])
+ command(
+ [[python3 vim.command('python3 vim.command("python3 vim.command(\'let set_by_nested_python3 = 555\')")')]]
+ )
eq(555, eval('g:set_by_nested_python3'))
end)
@@ -70,7 +88,7 @@ describe('python3 provider', function()
line3
line4]])
feed('ggjvj:python3 vim.vars["range"] = vim.current.range[:]<CR>')
- eq({'line2', 'line3'}, eval('g:range'))
+ eq({ 'line2', 'line3' }, eval('g:range'))
end)
it('py3file', function()
@@ -102,7 +120,7 @@ describe('python3 provider', function()
describe('py3eval()', function()
it('works', function()
- eq({1, 2, {['key'] = 'val'}}, funcs.py3eval('[1, 2, {"key": "val"}]'))
+ eq({ 1, 2, { ['key'] = 'val' } }, fn.py3eval('[1, 2, {"key": "val"}]'))
end)
it('errors out when given non-string', function()
@@ -131,7 +149,7 @@ describe('python3 provider', function()
command 'set pyxversion=3' -- no error
eq('Vim(set):E474: Invalid argument: pyxversion=2', pcall_err(command, 'set pyxversion=2'))
command 'set pyxversion=0' -- allowed, but equivalent to pyxversion=3
- eq(3, eval'&pyxversion')
+ eq(3, eval '&pyxversion')
end)
it('RPC call to expand("<afile>") during BufDelete #5245 #5617', function()
@@ -146,7 +164,7 @@ describe('python3 provider', function()
autocmd BufDelete * python3 foo()
autocmd BufUnload * python3 foo()]=])
feed_command("exe 'split' tempname()")
- feed_command("bwipeout!")
+ feed_command('bwipeout!')
feed_command('help help')
assert_alive()
end)
@@ -155,11 +173,11 @@ end)
describe('python2 feature test', function()
-- python2 is not supported, so correct behaviour is to return 0
it('works', function()
- eq(0, funcs.has('python2'))
- eq(0, funcs.has('python'))
- eq(0, funcs.has('python_compiled'))
- eq(0, funcs.has('python_dynamic'))
- eq(0, funcs.has('python_dynamic_'))
- eq(0, funcs.has('python_'))
+ eq(0, fn.has('python2'))
+ eq(0, fn.has('python'))
+ eq(0, fn.has('python_compiled'))
+ eq(0, fn.has('python_dynamic'))
+ eq(0, fn.has('python_dynamic_'))
+ eq(0, fn.has('python_'))
end)
end)