From 4ceca862fceb021049144a9aed05c60ae39b7aba Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 20 Apr 2026 14:16:41 -0400 Subject: refactor(test): drop deprecated exc_exec #39242 --- test/functional/vimscript/input_spec.lua | 55 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'test/functional/vimscript/input_spec.lua') diff --git a/test/functional/vimscript/input_spec.lua b/test/functional/vimscript/input_spec.lua index 1995b033b9..c0ab4adebb 100644 --- a/test/functional/vimscript/input_spec.lua +++ b/test/functional/vimscript/input_spec.lua @@ -3,12 +3,12 @@ local n = require('test.functional.testnvim')() local Screen = require('test.functional.ui.screen') local eq = t.eq +local pcall_err = t.pcall_err local feed = n.feed local api = n.api local clear = n.clear local source = n.source local command = n.command -local exc_exec = n.exc_exec local async_meths = n.async_meths local NIL = vim.NIL @@ -205,16 +205,25 @@ describe('input()', function() eq('DEF2', api.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([])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call input("", [])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call input("", "", [])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call input({"prompt": []})')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call input({"default": []})')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call input({"completion": []})')) - eq('Vim(call):E5050: {opts} must be the only argument', exc_exec('call input({}, "default")')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call input([])')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call input("", [])')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call input("", "", [])')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call input({"prompt": []})')) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call input({"default": []})') + ) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call input({"completion": []})') + ) + eq( + 'Vim(call):E5050: {opts} must be the only argument', + pcall_err(command, 'call input({}, "default")') + ) eq( 'Vim(call):E118: Too many arguments for function: input', - exc_exec('call input("prompt> ", "default", "file", "extra")') + pcall_err(command, 'call input("prompt> ", "default", "file", "extra")') ) end) it('supports highlighting', function() @@ -378,19 +387,31 @@ describe('inputdialog()', function() eq('DEF2', api.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([])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog("", [])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog("", "", [])')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog({"prompt": []})')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog({"default": []})')) - eq('Vim(call):E730: Using a List as a String', exc_exec('call inputdialog({"completion": []})')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call inputdialog([])')) + eq('Vim(call):E730: Using a List as a String', pcall_err(command, 'call inputdialog("", [])')) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call inputdialog("", "", [])') + ) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call inputdialog({"prompt": []})') + ) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call inputdialog({"default": []})') + ) + eq( + 'Vim(call):E730: Using a List as a String', + pcall_err(command, 'call inputdialog({"completion": []})') + ) eq( 'Vim(call):E5050: {opts} must be the only argument', - exc_exec('call inputdialog({}, "default")') + pcall_err(command, 'call inputdialog({}, "default")') ) eq( 'Vim(call):E118: Too many arguments for function: inputdialog', - exc_exec('call inputdialog("prompt> ", "default", "file", "extra")') + pcall_err(command, 'call inputdialog("prompt> ", "default", "file", "extra")') ) end) it('supports highlighting', function() -- cgit