aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/secure_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-07-28 17:45:26 -0400
committerJustin M. Keyes <justinkz@gmail.com>2025-07-28 22:00:25 -0400
commitdc3a30cfbb8304e10cff894a30c56fe43fc895ec (patch)
treeb3a64bca38782c3b43f307dad58f54213bd97295 /test/functional/lua/secure_spec.lua
parentc81dc320b0246c25d2580d67a83a3b9f56738808 (diff)
downloadrneovim-dc3a30cfbb8304e10cff894a30c56fe43fc895ec.tar.gz
rneovim-dc3a30cfbb8304e10cff894a30c56fe43fc895ec.tar.bz2
rneovim-dc3a30cfbb8304e10cff894a30c56fe43fc895ec.zip
fix(messages): 'exrc' / secure messages
Diffstat (limited to 'test/functional/lua/secure_spec.lua')
-rw-r--r--test/functional/lua/secure_spec.lua51
1 files changed, 25 insertions, 26 deletions
diff --git a/test/functional/lua/secure_spec.lua b/test/functional/lua/secure_spec.lua
index fdf7f1e9a6..64a8dcbdc4 100644
--- a/test/functional/lua/secure_spec.lua
+++ b/test/functional/lua/secure_spec.lua
@@ -55,22 +55,18 @@ describe('vim.secure', function()
})
local cwd = fn.getcwd()
- local msg = cwd
- .. pathsep
- .. 'Xfile is not trusted. To enable it, choose (v)iew then run `:trust`.'
- if #msg >= screen._width then
- pending('path too long')
- return
- end
+ local msg = 'exrc: Found untrusted code. To enable it, choose (v)iew then run `:trust`:'
+ local path = ('%s%sXfile'):format(cwd, pathsep)
-- Need to use feed_command instead of exec_lua because of the confirmation prompt
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xfile'){MATCH: +}|
- {3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. msg .. [[}{MATCH: *}|
+ {3:]] .. path .. [[}{MATCH: *}|
{3:[i]gnore, (v)iew, (d)eny: }^{MATCH: +}|
]])
feed('d')
@@ -89,10 +85,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xfile'){MATCH: +}|
- {3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. msg .. [[}{MATCH: *}|
+ {3:]] .. path .. [[}{MATCH: *}|
{3:[i]gnore, (v)iew, (d)eny: }^{MATCH: +}|
]])
feed('v')
@@ -104,7 +101,7 @@ describe('vim.secure', function()
{MATCH: +}|
{1:~{MATCH: +}}|
{4:[No Name]{MATCH: +}}|
- Allowed "]] .. cwd .. pathsep .. [[Xfile" in trust database.{MATCH: +}|
+ Allowed in trust database: "]] .. cwd .. pathsep .. [[Xfile"{MATCH: +}|
]])
-- close the split for the next test below.
feed(':q<CR>')
@@ -119,10 +116,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xfile'){MATCH: +}|
- {3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. msg .. [[}{MATCH: *}|
+ {3:]] .. path .. [[}{MATCH: *}|
{3:[i]gnore, (v)iew, (d)eny: }^{MATCH: +}|
]])
feed('i')
@@ -138,10 +136,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xfile')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xfile'){MATCH: +}|
{3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. path .. [[}{MATCH: *}|
{3:[i]gnore, (v)iew, (d)eny: }^{MATCH: +}|
]])
feed('v')
@@ -172,22 +171,19 @@ describe('vim.secure', function()
})
local cwd = fn.getcwd()
- local msg = cwd
- .. pathsep
- .. 'Xdir is not trusted. DIRECTORY trust is decided only by its name, not its contents.'
- if #msg >= screen._width then
- pending('path too long')
- return
- end
+ local msg =
+ 'exrc: Found untrusted code. DIRECTORY trust is decided only by name, not contents:'
+ local path = ('%s%sXdir'):format(cwd, pathsep)
-- Need to use feed_command instead of exec_lua because of the confirmation prompt
feed_command([[lua vim.secure.read('Xdir')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xdir'){MATCH: +}|
{3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. path .. [[}{MATCH: +}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
]])
feed('d')
@@ -206,10 +202,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xdir')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xdir'){MATCH: +}|
{3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. path .. [[}{MATCH: +}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
]])
feed('a')
@@ -231,10 +228,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xdir')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xdir'){MATCH: +}|
{3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. path .. [[}{MATCH: +}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
]])
feed('i')
@@ -250,10 +248,11 @@ describe('vim.secure', function()
feed_command([[lua vim.secure.read('Xdir')]])
screen:expect([[
{MATCH: +}|
- {1:~{MATCH: +}}|*3
+ {1:~{MATCH: +}}|*2
{2:{MATCH: +}}|
:lua vim.secure.read('Xdir'){MATCH: +}|
{3:]] .. msg .. [[}{MATCH: +}|
+ {3:]] .. path .. [[}{MATCH: +}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
]])
feed('v')