mirror of
https://github.com/neovim/neovim.git
synced 2026-04-04 14:49:31 +00:00
test(lua/secure_spec): avoid magic number (#33700)
Avoid magic number in skipping condition by moving the expected message to a variable.
This commit is contained in:
@@ -47,7 +47,8 @@ describe('vim.secure', function()
|
||||
})
|
||||
|
||||
local cwd = fn.getcwd()
|
||||
if #cwd + 23 > 500 then
|
||||
local msg = cwd .. pathsep .. 'Xfile is not trusted.'
|
||||
if #msg >= screen._width then
|
||||
pending('path too long')
|
||||
return
|
||||
end
|
||||
@@ -59,7 +60,7 @@ describe('vim.secure', function()
|
||||
{1:~{MATCH: +}}|*3
|
||||
{2:{MATCH: +}}|
|
||||
:lua vim.secure.read('Xfile'){MATCH: +}|
|
||||
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH: +}|
|
||||
{3:]] .. msg .. [[}{MATCH: +}|
|
||||
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
|
||||
]])
|
||||
feed('d')
|
||||
@@ -81,7 +82,7 @@ describe('vim.secure', function()
|
||||
{1:~{MATCH: +}}|*3
|
||||
{2:{MATCH: +}}|
|
||||
:lua vim.secure.read('Xfile'){MATCH: +}|
|
||||
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH: +}|
|
||||
{3:]] .. msg .. [[}{MATCH: +}|
|
||||
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
|
||||
]])
|
||||
feed('a')
|
||||
@@ -104,7 +105,7 @@ describe('vim.secure', function()
|
||||
{1:~{MATCH: +}}|*3
|
||||
{2:{MATCH: +}}|
|
||||
:lua vim.secure.read('Xfile'){MATCH: +}|
|
||||
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH: +}|
|
||||
{3:]] .. msg .. [[}{MATCH: +}|
|
||||
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
|
||||
]])
|
||||
feed('i')
|
||||
@@ -123,7 +124,7 @@ describe('vim.secure', function()
|
||||
{1:~{MATCH: +}}|*3
|
||||
{2:{MATCH: +}}|
|
||||
:lua vim.secure.read('Xfile'){MATCH: +}|
|
||||
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH: +}|
|
||||
{3:]] .. msg .. [[}{MATCH: +}|
|
||||
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^{MATCH: +}|
|
||||
]])
|
||||
feed('v')
|
||||
|
||||
Reference in New Issue
Block a user