aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/script_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/ex_cmds/script_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/ex_cmds/script_spec.lua')
-rw-r--r--test/functional/ex_cmds/script_spec.lua45
1 files changed, 33 insertions, 12 deletions
diff --git a/test/functional/ex_cmds/script_spec.lua b/test/functional/ex_cmds/script_spec.lua
index 62249caa5e..4c963c5da7 100644
--- a/test/functional/ex_cmds/script_spec.lua
+++ b/test/functional/ex_cmds/script_spec.lua
@@ -5,7 +5,7 @@ local neq = helpers.neq
local command = helpers.command
local exec_capture = helpers.exec_capture
local write_file = helpers.write_file
-local meths = helpers.meths
+local api = helpers.api
local clear = helpers.clear
local dedent = helpers.dedent
local exc_exec = helpers.exc_exec
@@ -17,7 +17,7 @@ before_each(clear)
local function source(code)
write_file(tmpfile, code)
- command('source '..tmpfile)
+ command('source ' .. tmpfile)
end
describe('script_get-based command', function()
@@ -30,29 +30,48 @@ describe('script_get-based command', function()
local function test_garbage_exec(cmd, check_neq)
describe(cmd, function()
it('works correctly when skipping oneline variant', function()
- eq(true, pcall(source, (dedent([[
+ eq(
+ true,
+ pcall(
+ source,
+ (dedent([[
if 0
%s %s
endif
- ]])):format(cmd, garbage)))
+ ]])):format(cmd, garbage)
+ )
+ )
eq('', exec_capture('messages'))
if check_neq then
- neq(0, exc_exec(dedent([[
+ neq(
+ 0,
+ exc_exec(dedent([[
%s %s
- ]])):format(cmd, garbage))
+ ]])):format(cmd, garbage)
+ )
end
end)
it('works correctly when skipping HEREdoc variant', function()
- eq(true, pcall(source, (dedent([[
+ eq(
+ true,
+ pcall(
+ source,
+ (dedent([[
if 0
%s << EOF
%s
EOF
endif
- ]])):format(cmd, garbage)))
+ ]])):format(cmd, garbage)
+ )
+ )
eq('', exec_capture('messages'))
if check_neq then
- eq(true, pcall(source, (dedent([[
+ eq(
+ true,
+ pcall(
+ source,
+ (dedent([[
let g:exc = 0
try
%s << EOF
@@ -61,8 +80,10 @@ describe('script_get-based command', function()
catch
let g:exc = v:exception
endtry
- ]])):format(cmd, garbage)))
- neq(0, meths.get_var('exc'))
+ ]])):format(cmd, garbage)
+ )
+ )
+ neq(0, api.nvim_get_var('exc'))
end
end)
end)
@@ -75,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)