aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/trust_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ex_cmds/trust_spec.lua')
-rw-r--r--test/functional/ex_cmds/trust_spec.lua44
1 files changed, 22 insertions, 22 deletions
diff --git a/test/functional/ex_cmds/trust_spec.lua b/test/functional/ex_cmds/trust_spec.lua
index 2997b504fa..7c84d1d04b 100644
--- a/test/functional/ex_cmds/trust_spec.lua
+++ b/test/functional/ex_cmds/trust_spec.lua
@@ -1,27 +1,27 @@
-local helpers = require('test.functional.helpers')(after_each)
+local t = require('test.functional.testutil')(after_each)
-local eq = helpers.eq
-local clear = helpers.clear
-local command = helpers.command
-local exec_capture = helpers.exec_capture
-local matches = helpers.matches
-local pathsep = helpers.get_pathsep()
-local is_os = helpers.is_os
-local fn = helpers.fn
+local eq = t.eq
+local clear = t.clear
+local command = t.command
+local exec_capture = t.exec_capture
+local matches = t.matches
+local pathsep = t.get_pathsep()
+local is_os = t.is_os
+local fn = t.fn
describe(':trust', function()
local xstate = 'Xstate'
setup(function()
- helpers.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
+ t.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
end)
teardown(function()
- helpers.rmdir(xstate)
+ t.rmdir(xstate)
end)
before_each(function()
- helpers.write_file('test_file', 'test')
+ t.write_file('test_file', 'test')
clear { env = { XDG_STATE_HOME = xstate } }
end)
@@ -31,37 +31,37 @@ describe(':trust', function()
it('trust then deny then remove a file using current buffer', function()
local cwd = fn.getcwd()
- local hash = fn.sha256(helpers.read_file('test_file'))
+ local hash = fn.sha256(t.read_file('test_file'))
command('edit test_file')
matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust'))
- local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny'))
- trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove'))
- trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
it('deny then trust then remove a file using current buffer', function()
local cwd = fn.getcwd()
- local hash = fn.sha256(helpers.read_file('test_file'))
+ local hash = fn.sha256(t.read_file('test_file'))
command('edit test_file')
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny'))
- local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Allowed ".*test_file" in trust database%.$', exec_capture('trust'))
- trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('%s %s', hash, cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches('^Removed ".*test_file" from trust database%.$', exec_capture('trust ++remove'))
- trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
@@ -69,14 +69,14 @@ describe(':trust', function()
local cwd = fn.getcwd()
matches('^Denied ".*test_file" in trust database%.$', exec_capture('trust ++deny test_file'))
- local trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ local trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format('! %s', cwd .. pathsep .. 'test_file'), vim.trim(trust))
matches(
'^Removed ".*test_file" from trust database%.$',
exec_capture('trust ++remove test_file')
)
- trust = helpers.read_file(fn.stdpath('state') .. pathsep .. 'trust')
+ trust = t.read_file(fn.stdpath('state') .. pathsep .. 'trust')
eq(string.format(''), vim.trim(trust))
end)
end)