aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/ctx_functions_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-01-12 19:40:58 +0000
committerGitHub <noreply@github.com>2024-01-12 19:40:58 +0000
commit07a7c0ec999102f223a6aca17e93d33e18c02b94 (patch)
tree221ea513b45596f8e63035955494167fc20bf826 /test/functional/vimscript/ctx_functions_spec.lua
parent7f249936a989dbc21ad03e394197afc07cb9c0bf (diff)
parent795f896a5772d5e0795f86642bdf90c82efac45c (diff)
downloadrneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.tar.gz
rneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.tar.bz2
rneovim-07a7c0ec999102f223a6aca17e93d33e18c02b94.zip
Merge pull request #26994 from lewis6991/vimhelpers
test: big cleanup
Diffstat (limited to 'test/functional/vimscript/ctx_functions_spec.lua')
-rw-r--r--test/functional/vimscript/ctx_functions_spec.lua44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/functional/vimscript/ctx_functions_spec.lua b/test/functional/vimscript/ctx_functions_spec.lua
index 01daeddbab..b8f9bbc92d 100644
--- a/test/functional/vimscript/ctx_functions_spec.lua
+++ b/test/functional/vimscript/ctx_functions_spec.lua
@@ -6,12 +6,12 @@ local command = helpers.command
local eq = helpers.eq
local eval = helpers.eval
local feed = helpers.feed
-local map = helpers.tbl_map
-local nvim = helpers.nvim
+local map = vim.tbl_map
+local api = helpers.api
local parse_context = helpers.parse_context
local exec_capture = helpers.exec_capture
local source = helpers.source
-local trim = helpers.trim
+local trim = vim.trim
local write_file = helpers.write_file
local pcall_err = helpers.pcall_err
@@ -126,16 +126,16 @@ describe('context functions', function()
end)
it('saves and restores global variables properly', function()
- nvim('set_var', 'one', 1)
- nvim('set_var', 'Two', 2)
- nvim('set_var', 'THREE', 3)
+ api.nvim_set_var('one', 1)
+ api.nvim_set_var('Two', 2)
+ api.nvim_set_var('THREE', 3)
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
call('ctxpush')
call('ctxpush', { 'gvars' })
- nvim('del_var', 'one')
- nvim('del_var', 'Two')
- nvim('del_var', 'THREE')
+ api.nvim_del_var('one')
+ api.nvim_del_var('Two')
+ api.nvim_del_var('THREE')
eq('Vim:E121: Undefined variable: g:one', pcall_err(eval, 'g:one'))
eq('Vim:E121: Undefined variable: g:Two', pcall_err(eval, 'g:Two'))
eq('Vim:E121: Undefined variable: g:THREE', pcall_err(eval, 'g:THREE'))
@@ -143,9 +143,9 @@ describe('context functions', function()
call('ctxpop')
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
- nvim('del_var', 'one')
- nvim('del_var', 'Two')
- nvim('del_var', 'THREE')
+ api.nvim_del_var('one')
+ api.nvim_del_var('Two')
+ api.nvim_del_var('THREE')
eq('Vim:E121: Undefined variable: g:one', pcall_err(eval, 'g:one'))
eq('Vim:E121: Undefined variable: g:Two', pcall_err(eval, 'g:Two'))
eq('Vim:E121: Undefined variable: g:THREE', pcall_err(eval, 'g:THREE'))
@@ -300,9 +300,9 @@ describe('context functions', function()
feed('G')
feed('gg')
command('edit ' .. fname2)
- nvim('set_var', 'one', 1)
- nvim('set_var', 'Two', 2)
- nvim('set_var', 'THREE', 3)
+ api.nvim_set_var('one', 1)
+ api.nvim_set_var('Two', 2)
+ api.nvim_set_var('THREE', 3)
local with_regs = {
['regs'] = {
@@ -412,14 +412,14 @@ describe('context functions', function()
end)
it('sets context dictionary at index in context stack', function()
- nvim('set_var', 'one', 1)
- nvim('set_var', 'Two', 2)
- nvim('set_var', 'THREE', 3)
+ api.nvim_set_var('one', 1)
+ api.nvim_set_var('Two', 2)
+ api.nvim_set_var('THREE', 3)
call('ctxpush')
local ctx1 = call('ctxget')
- nvim('set_var', 'one', 'a')
- nvim('set_var', 'Two', 'b')
- nvim('set_var', 'THREE', 'c')
+ api.nvim_set_var('one', 'a')
+ api.nvim_set_var('Two', 'b')
+ api.nvim_set_var('THREE', 'c')
call('ctxpush')
call('ctxpush')
local ctx2 = call('ctxget')
@@ -431,7 +431,7 @@ describe('context functions', function()
eq({ 1, 2, 3 }, eval('[g:one, g:Two, g:THREE]'))
call('ctxpop')
eq({ 'a', 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
- nvim('set_var', 'one', 1.5)
+ api.nvim_set_var('one', 1.5)
eq({ 1.5, 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))
call('ctxpop')
eq({ 'a', 'b', 'c' }, eval('[g:one, g:Two, g:THREE]'))