From dc3a30cfbb8304e10cff894a30c56fe43fc895ec Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 28 Jul 2025 17:45:26 -0400 Subject: fix(messages): 'exrc' / secure messages --- test/functional/lua/secure_spec.lua | 51 ++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'test/functional/lua/secure_spec.lua') 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') @@ -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') -- cgit