aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-01-07 13:05:03 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-01-22 22:36:40 +0100
commiteb5d15e3838f53e2fcd25989c88db87458e9f984 (patch)
treede13432021adb8632ed61cd9bbe4270eaec0674c /test
parent13d50c3b13fb6f2bba948e50fefee451e0a90487 (diff)
downloadrneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.tar.gz
rneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.tar.bz2
rneovim-eb5d15e3838f53e2fcd25989c88db87458e9f984.zip
refactor: rewrite python provider in lua
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/script_spec.lua2
-rw-r--r--test/functional/helpers.lua9
-rw-r--r--test/functional/provider/python3_spec.lua2
-rw-r--r--test/old/testdir/test_python3.vim2
-rw-r--r--test/old/testdir/test_pyx3.vim2
5 files changed, 7 insertions, 10 deletions
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index ebdaa0f656..4c963c5da7 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -96,7 +96,7 @@ describe('script_get-based command', function()
-- Provider-based scripts
test_garbage_exec('ruby', not missing_provider('ruby'))
- test_garbage_exec('python3', not missing_provider('python3'))
+ test_garbage_exec('python3', not missing_provider('python'))
-- Missing scripts
test_garbage_exec('python', false)
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index eddf336b6f..159016b484 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -932,17 +932,14 @@ function module.new_pipename()
end
--- @param provider string
---- @return string|false?
+--- @return string|boolean?
function module.missing_provider(provider)
if provider == 'ruby' or provider == 'node' or provider == 'perl' then
--- @type string?
local e = module.fn['provider#' .. provider .. '#Detect']()[2]
return e ~= '' and e or false
- elseif provider == 'python' or provider == 'python3' then
- local py_major_version = (provider == 'python3' and 3 or 2)
- --- @type string?
- local e = module.fn['provider#pythonx#Detect'](py_major_version)[2]
- return e ~= '' and e or false
+ elseif provider == 'python' then
+ return module.exec_lua([[return {require('vim.provider.python').detect_by_module('neovim')}]])[2]
end
assert(false, 'Unknown provider: ' .. provider)
end
diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua
index 1419d7f651..9bde57f777 100644
--- a/test/functional/provider/python3_spec.lua
+++ b/test/functional/provider/python3_spec.lua
@@ -13,7 +13,7 @@ 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.*]]
diff --git a/test/old/testdir/test_python3.vim b/test/old/testdir/test_python3.vim
index 23c63f22d8..c9dbc0b84e 100644
--- a/test/old/testdir/test_python3.vim
+++ b/test/old/testdir/test_python3.vim
@@ -169,7 +169,7 @@ func Test_Catch_Exception_Message()
try
py3 raise RuntimeError( 'TEST' )
catch /.*/
- call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
+ call assert_match('^Vim(.*):.*RuntimeError: TEST.*$', v:exception )
endtry
endfunc
diff --git a/test/old/testdir/test_pyx3.vim b/test/old/testdir/test_pyx3.vim
index 09ece6f812..89a3cc22ff 100644
--- a/test/old/testdir/test_pyx3.vim
+++ b/test/old/testdir/test_pyx3.vim
@@ -76,7 +76,7 @@ func Test_Catch_Exception_Message()
try
pyx raise RuntimeError( 'TEST' )
catch /.*/
- call assert_match('^Vim(.*):.*RuntimeError: TEST$', v:exception )
+ call assert_match('^Vim(.*):.*RuntimeError: TEST.*$', v:exception )
endtry
endfunc