aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/secure_spec.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-11-28 15:40:50 -0700
committerGitHub <noreply@github.com>2022-11-28 15:40:50 -0700
commit80b6edabe3e4203ee4bf50261af07a6a0495ef36 (patch)
tree7f3f0e0338d79df0168b3fceb9a41cce7d769eeb /test/functional/lua/secure_spec.lua
parentf004812b338340e5f5157aa68d09d3f0e5605c6c (diff)
downloadrneovim-80b6edabe3e4203ee4bf50261af07a6a0495ef36.tar.gz
rneovim-80b6edabe3e4203ee4bf50261af07a6a0495ef36.tar.bz2
rneovim-80b6edabe3e4203ee4bf50261af07a6a0495ef36.zip
refactor: rework parameter validation in vim.secure.trust() (#21223)
Diffstat (limited to 'test/functional/lua/secure_spec.lua')
-rw-r--r--test/functional/lua/secure_spec.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua
index 46ca2bba8f..6885253998 100644
--- a/test/functional/lua/secure_spec.lua
+++ b/test/functional/lua/secure_spec.lua
@@ -12,6 +12,7 @@ local feed_command = helpers.feed_command
local feed = helpers.feed
local funcs = helpers.funcs
local pcall_err = helpers.pcall_err
+local matches = helpers.matches
describe('vim.secure', function()
describe('read()', function()
@@ -189,10 +190,15 @@ describe('vim.secure', function()
end)
it('returns error when passing both path and bufnr', function()
- eq('path and bufnr are mutually exclusive',
+ matches('"path" and "bufnr" are mutually exclusive',
pcall_err(exec_lua, [[vim.secure.trust({action='deny', bufnr=0, path='test_file'})]]))
end)
+ it('returns error when passing neither path or bufnr', function()
+ matches('one of "path" or "bufnr" is required',
+ pcall_err(exec_lua, [[vim.secure.trust({action='deny'})]]))
+ end)
+
it('trust then deny then remove a file using bufnr', function()
local cwd = funcs.getcwd()
local hash = funcs.sha256(helpers.read_file('test_file'))