test: make {MATCH:} behave less unexpectedly in screen:expect()

Include the rest of the line and allow multiple {MATCH:} patterns.
This commit is contained in:
zeertzjq
2023-02-18 09:27:10 +08:00
parent bb369a14f3
commit 9b9f8dfcc4
7 changed files with 37 additions and 120 deletions

View File

@@ -48,6 +48,7 @@ describe('vim.secure', function()
[4] = {reverse = true},
})
--- XXX: screen:expect() may fail if this path is too long.
local cwd = funcs.getcwd()
-- Need to use feed_command instead of exec_lua because of the confirmation prompt
@@ -59,7 +60,7 @@ describe('vim.secure', function()
{1:~ }|
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is untrusted}{MATCH:%s+}|
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^ |
]]}
feed('d')
@@ -88,7 +89,7 @@ describe('vim.secure', function()
{1:~ }|
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is untrusted}{MATCH:%s+}|
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^ |
]]}
feed('a')
@@ -118,7 +119,7 @@ describe('vim.secure', function()
{1:~ }|
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is untrusted}{MATCH:%s+}|
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^ |
]]}
feed('i')
@@ -145,7 +146,7 @@ describe('vim.secure', function()
{1:~ }|
{2: }|
:lua vim.secure.read('Xfile') |
{3:]] .. cwd .. pathsep .. [[Xfile is untrusted}{MATCH:%s+}|
{3:]] .. cwd .. pathsep .. [[Xfile is not trusted.}{MATCH:%s+}|
{3:[i]gnore, (v)iew, (d)eny, (a)llow: }^ |
]]}
feed('v')
@@ -153,7 +154,7 @@ describe('vim.secure', function()
^let g:foobar = 42 |
{1:~ }|
{1:~ }|
{2:]] .. funcs.fnamemodify(cwd, ':~') .. pathsep .. [[Xfile [RO]{MATCH:%s+}|
{2:]] .. funcs.fnamemodify(cwd, ':~') .. pathsep .. [[Xfile [RO]{MATCH:%s+}}|
|
{1:~ }|
{4:[No Name] }|