aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/input_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/vimscript/input_spec.lua')
-rw-r--r--test/functional/vimscript/input_spec.lua54
1 files changed, 27 insertions, 27 deletions
diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua
index 52c28869ff..2e1d0501cf 100644
--- a/test/functional/vimscript/input_spec.lua
+++ b/test/functional/vimscript/input_spec.lua
@@ -110,7 +110,7 @@ describe('input()', function()
end)
it('allows unequal numeric values when using {opts} dictionary', function()
command('echohl Test')
- meths.set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 })
+ meths.nvim_set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 })
feed([[:echo input(opts)<CR>]])
screen:expect([[
|
@@ -132,7 +132,7 @@ describe('input()', function()
end)
it('works with redraw', function()
command('echohl Test')
- meths.set_var('opts', { prompt = 'Foo>', default = 'Bar' })
+ meths.nvim_set_var('opts', { prompt = 'Foo>', default = 'Bar' })
feed([[:echo inputdialog(opts)<CR>]])
screen:expect([[
|
@@ -176,34 +176,34 @@ describe('input()', function()
it('supports completion', function()
feed(':let var = input("", "", "custom,CustomCompl")<CR>')
feed('<Tab><CR>')
- eq('TEST', meths.get_var('var'))
+ eq('TEST', meths.nvim_get_var('var'))
feed(':let var = input({"completion": "customlist,CustomListCompl"})<CR>')
feed('<Tab><CR>')
- eq('FOO', meths.get_var('var'))
+ eq('FOO', meths.nvim_get_var('var'))
end)
it('supports cancelreturn', function()
feed(':let var = input({"cancelreturn": "BAR"})<CR>')
feed('<Esc>')
- eq('BAR', meths.get_var('var'))
+ eq('BAR', meths.nvim_get_var('var'))
feed(':let var = input({"cancelreturn": []})<CR>')
feed('<Esc>')
- eq({}, meths.get_var('var'))
+ eq({}, meths.nvim_get_var('var'))
feed(':let var = input({"cancelreturn": v:false})<CR>')
feed('<Esc>')
- eq(false, meths.get_var('var'))
+ eq(false, meths.nvim_get_var('var'))
feed(':let var = input({"cancelreturn": v:null})<CR>')
feed('<Esc>')
- eq(NIL, meths.get_var('var'))
+ eq(NIL, meths.nvim_get_var('var'))
end)
it('supports default string', function()
feed(':let var = input("", "DEF1")<CR>')
feed('<CR>')
- eq('DEF1', meths.get_var('var'))
+ eq('DEF1', meths.nvim_get_var('var'))
feed(':let var = input({"default": "DEF2"})<CR>')
feed('<CR>')
- eq('DEF2', meths.get_var('var'))
+ eq('DEF2', meths.nvim_get_var('var'))
end)
it('errors out on invalid inputs', function()
eq('Vim(call):E730: Using a List as a String', exc_exec('call input([])'))
@@ -292,7 +292,7 @@ describe('inputdialog()', function()
end)
it('allows unequal numeric values when using {opts} dictionary', function()
command('echohl Test')
- meths.set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 })
+ meths.nvim_set_var('opts', { prompt = 1, default = 2, cancelreturn = 3 })
feed([[:echo input(opts)<CR>]])
screen:expect([[
|
@@ -314,7 +314,7 @@ describe('inputdialog()', function()
end)
it('works with redraw', function()
command('echohl Test')
- meths.set_var('opts', { prompt = 'Foo>', default = 'Bar' })
+ meths.nvim_set_var('opts', { prompt = 'Foo>', default = 'Bar' })
feed([[:echo input(opts)<CR>]])
screen:expect([[
|
@@ -358,25 +358,25 @@ describe('inputdialog()', function()
it('supports completion', function()
feed(':let var = inputdialog({"completion": "customlist,CustomListCompl"})<CR>')
feed('<Tab><CR>')
- eq('FOO', meths.get_var('var'))
+ eq('FOO', meths.nvim_get_var('var'))
end)
it('supports cancelreturn', function()
feed(':let var = inputdialog("", "", "CR1")<CR>')
feed('<Esc>')
- eq('CR1', meths.get_var('var'))
+ eq('CR1', meths.nvim_get_var('var'))
feed(':let var = inputdialog({"cancelreturn": "BAR"})<CR>')
feed('<Esc>')
- eq('BAR', meths.get_var('var'))
+ eq('BAR', meths.nvim_get_var('var'))
end)
it('supports default string', function()
feed(':let var = inputdialog("", "DEF1")<CR>')
feed('<CR>')
- eq('DEF1', meths.get_var('var'))
+ eq('DEF1', meths.nvim_get_var('var'))
feed(':let var = inputdialog({"default": "DEF2"})<CR>')
feed('<CR>')
- eq('DEF2', meths.get_var('var'))
+ eq('DEF2', meths.nvim_get_var('var'))
end)
it('errors out on invalid inputs', function()
eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog([])'))
@@ -409,8 +409,8 @@ end)
describe('confirm()', function()
-- oldtest: Test_confirm()
it('works', function()
- meths.set_option_value('more', false, {}) -- Avoid hit-enter prompt
- meths.set_option_value('laststatus', 2, {})
+ meths.nvim_set_option_value('more', false, {}) -- Avoid hit-enter prompt
+ meths.nvim_set_option_value('laststatus', 2, {})
-- screen:expect() calls are needed to avoid feeding input too early
screen:expect({ any = '%[No Name%]' })
@@ -418,19 +418,19 @@ describe('confirm()', function()
screen:expect({ any = '{CONFIRM:.+: }' })
feed('o')
screen:expect({ any = '%[No Name%]' })
- eq(1, meths.get_var('a'))
+ eq(1, meths.nvim_get_var('a'))
async_meths.command([[let a = 'Are you sure?'->confirm("&Yes\n&No")]])
screen:expect({ any = '{CONFIRM:.+: }' })
feed('y')
screen:expect({ any = '%[No Name%]' })
- eq(1, meths.get_var('a'))
+ eq(1, meths.nvim_get_var('a'))
async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No")]])
screen:expect({ any = '{CONFIRM:.+: }' })
feed('n')
screen:expect({ any = '%[No Name%]' })
- eq(2, meths.get_var('a'))
+ eq(2, meths.nvim_get_var('a'))
-- Not possible to match Vim's CTRL-C test here as CTRL-C always sets got_int in Nvim.
@@ -439,26 +439,26 @@ describe('confirm()', function()
screen:expect({ any = '{CONFIRM:.+: }' })
feed('<Esc>')
screen:expect({ any = '%[No Name%]' })
- eq(0, meths.get_var('a'))
+ eq(0, meths.nvim_get_var('a'))
-- Default choice is returned when pressing <CR>.
async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No")]])
screen:expect({ any = '{CONFIRM:.+: }' })
feed('<CR>')
screen:expect({ any = '%[No Name%]' })
- eq(1, meths.get_var('a'))
+ eq(1, meths.nvim_get_var('a'))
async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No", 2)]])
screen:expect({ any = '{CONFIRM:.+: }' })
feed('<CR>')
screen:expect({ any = '%[No Name%]' })
- eq(2, meths.get_var('a'))
+ eq(2, meths.nvim_get_var('a'))
async_meths.command([[let a = confirm('Are you sure?', "&Yes\n&No", 0)]])
screen:expect({ any = '{CONFIRM:.+: }' })
feed('<CR>')
screen:expect({ any = '%[No Name%]' })
- eq(0, meths.get_var('a'))
+ eq(0, meths.nvim_get_var('a'))
-- Test with the {type} 4th argument
for _, type in ipairs({ 'Error', 'Question', 'Info', 'Warning', 'Generic' }) do
@@ -466,7 +466,7 @@ describe('confirm()', function()
screen:expect({ any = '{CONFIRM:.+: }' })
feed('y')
screen:expect({ any = '%[No Name%]' })
- eq(1, meths.get_var('a'))
+ eq(1, meths.nvim_get_var('a'))
end
eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call confirm([])'))