Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F131999
matcher_spec.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
980 B
Referenced Files
None
Subscribers
None
matcher_spec.lua
View Options
local
libivy
=
require
"ivy.libivy"
-- Helper function to test a that string `one` has a higher match score than
-- string `two`. If string `one` has a lower score than string `two` a string
-- will be returned that can be used in body of an error. If not then `nil` is
-- returned and all is good.
local
match_test
=
function
(
term
,
one
,
two
)
local
score_one
=
libivy
.
ivy_match
(
term
,
one
)
local
score_two
=
libivy
.
ivy_match
(
term
,
two
)
assert
.
is_true
(
score_one
>
score_two
,
(
"The score of %s (%d) ranked higher than %s (%d)"
):
format
(
one
,
score_one
,
two
,
score_two
)
)
end
describe
(
"ivy matcher"
,
function
()
it
(
"should match path separator"
,
function
()
match_test
(
"file"
,
"some/file.lua"
,
"somefile.lua"
)
end
)
-- it("should match pattern with spaces", function()
-- match_test("so fi", "some/file.lua", "somefile.lua")
-- end)
it
(
"should match the start of a string"
,
function
()
match_test
(
"file"
,
"file.lua"
,
"somefile.lua"
)
end
)
end
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Apr 6 2026, 6:49 PM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10577
Default Alt Text
matcher_spec.lua (980 B)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment