aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-09-03 22:51:45 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-09-06 17:19:07 -0700
commitaf946046b922dc5d5285a70a23d11916d8389a5d (patch)
tree090d68a1dd675b5ad6e99abc829be0daafe2a7d9 /test/functional/eval
parent638f2b6dee7439de303bea12dec80240617e8034 (diff)
downloadrneovim-af946046b922dc5d5285a70a23d11916d8389a5d.tar.gz
rneovim-af946046b922dc5d5285a70a23d11916d8389a5d.tar.bz2
rneovim-af946046b922dc5d5285a70a23d11916d8389a5d.zip
test: Rename meth_pcall to pcall_err
- Rename `meth_pcall`. - Make `pcall_err` raise an error if the function does not fail. - Add `vim.pesc()` to treat a string as literal where a Lua pattern is expected.
Diffstat (limited to 'test/functional/eval')
-rw-r--r--test/functional/eval/api_functions_spec.lua6
-rw-r--r--test/functional/eval/changedtick_spec.lua10
2 files changed, 8 insertions, 8 deletions
diff --git a/test/functional/eval/api_functions_spec.lua b/test/functional/eval/api_functions_spec.lua
index 3947f88c0a..4fbd08f102 100644
--- a/test/functional/eval/api_functions_spec.lua
+++ b/test/functional/eval/api_functions_spec.lua
@@ -4,7 +4,7 @@ local lfs = require('lfs')
local neq, eq, command = helpers.neq, helpers.eq, helpers.command
local clear, curbufmeths = helpers.clear, helpers.curbufmeths
local exc_exec, expect, eval = helpers.exc_exec, helpers.expect, helpers.eval
-local insert, meth_pcall = helpers.insert, helpers.meth_pcall
+local insert, pcall_err = helpers.insert, helpers.pcall_err
local meths = helpers.meths
describe('eval-API', function()
@@ -148,8 +148,8 @@ describe('eval-API', function()
end)
it('cannot be called from sandbox', function()
- eq({false, 'Vim(call):E48: Not allowed in sandbox'},
- meth_pcall(command, "sandbox call nvim_input('ievil')"))
+ eq('Vim(call):E48: Not allowed in sandbox',
+ pcall_err(command, "sandbox call nvim_input('ievil')"))
eq({''}, meths.buf_get_lines(0, 0, -1, true))
end)
end)
diff --git a/test/functional/eval/changedtick_spec.lua b/test/functional/eval/changedtick_spec.lua
index 60ea9fa12b..99406d9d7a 100644
--- a/test/functional/eval/changedtick_spec.lua
+++ b/test/functional/eval/changedtick_spec.lua
@@ -9,7 +9,7 @@ local meths = helpers.meths
local command = helpers.command
local exc_exec = helpers.exc_exec
local redir_exec = helpers.redir_exec
-local meth_pcall = helpers.meth_pcall
+local pcall_err = helpers.pcall_err
local curbufmeths = helpers.curbufmeths
before_each(clear)
@@ -64,8 +64,8 @@ describe('b:changedtick', function()
redir_exec('let b:.changedtick = ' .. ctn))
eq('\nE46: Cannot change read-only variable "d.changedtick"',
redir_exec('let d.changedtick = ' .. ctn))
- eq({false, 'Key is read-only: changedtick'},
- meth_pcall(curbufmeths.set_var, 'changedtick', ctn))
+ eq('Key is read-only: changedtick',
+ pcall_err(curbufmeths.set_var, 'changedtick', ctn))
eq('\nE795: Cannot delete variable b:changedtick',
redir_exec('unlet b:changedtick'))
@@ -75,8 +75,8 @@ describe('b:changedtick', function()
redir_exec('unlet b:["changedtick"]'))
eq('\nE46: Cannot change read-only variable "d.changedtick"',
redir_exec('unlet d.changedtick'))
- eq({false, 'Key is read-only: changedtick'},
- meth_pcall(curbufmeths.del_var, 'changedtick'))
+ eq('Key is read-only: changedtick',
+ pcall_err(curbufmeths.del_var, 'changedtick'))
eq(ct, changedtick())
eq('\nE46: Cannot change read-only variable "b:["changedtick"]"',