Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F131496
utils_vimgrep_action_test.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
utils_vimgrep_action_test.lua
View Options
local
utils
=
require
"ivy.utils"
local
vimgrep_action
=
utils
.
vimgrep_action
()
local
vim_mock
=
require
"ivy.vim_mock"
before_each
(
function
()
vim_mock
.
reset
()
end
)
local
test_data
=
{
{
it
=
"will edit some file and goto the line"
,
completion
=
"some/file.lua:2: This is some text"
,
action
=
utils
.
actions
.
EDIT
,
commands
=
{
"edit some/file.lua"
,
"2"
,
},
},
{
it
=
"will skip the line if its not matched"
,
completion
=
"some/file.lua: This is some text"
,
action
=
utils
.
actions
.
EDIT
,
commands
=
{
"edit some/file.lua"
},
},
{
it
=
"will run the vsplit command"
,
completion
=
"some/file.lua: This is some text"
,
action
=
utils
.
actions
.
VSPLIT
,
commands
=
{
"vsplit some/file.lua"
},
},
{
it
=
"will run the split command"
,
completion
=
"some/file.lua: This is some text"
,
action
=
utils
.
actions
.
SPLIT
,
commands
=
{
"split some/file.lua"
},
},
}
for
i
=
1
,
#
test_data
do
local
data
=
test_data
[
i
]
it
(
data
.
it
,
function
(
t
)
vimgrep_action
(
data
.
completion
,
data
.
action
)
if
#
vim_mock
.
commands
~=
#
data
.
commands
then
t
.
error
(
"Incorrect number of commands run expected "
..
#
data
.
commands
..
" but found "
..
#
vim_mock
.
commands
)
end
for
j
=
1
,
#
data
.
commands
do
if
vim_mock
.
commands
[
j
]
~=
data
.
commands
[
j
]
then
t
.
error
(
"Incorrect command run expected '"
..
data
.
commands
[
j
]
..
"' but found '"
..
vim_mock
.
commands
[
j
]
..
"'"
)
end
end
end
)
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Apr 6 2026, 5:58 PM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16058
Default Alt Text
utils_vimgrep_action_test.lua (1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment