Skip to content

Commit

Permalink
add a few tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
L3MON4D3 committed Jun 18, 2023
1 parent 376dfac commit ed6c108
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/integration/snippet_basics_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1133,4 +1133,27 @@ describe("snippets_basic", function()
})
end
)

local engine_data = {
-- list of: trigger, snippet-body, docTrig/inserted text, expected expansion, expected docstring
vim = [[\(\d\+\)]],
pattern = [[(%d+)]],
ecma = [[(\d+)]],
}
for engine, trig in pairs(engine_data) do
it("trigEngine \"" .. engine .. "\" works", function()
exec_lua([[
trigEngine, trig, body, doctrig = ...
snip = s({trig = trig, docTrig = "3", trigEngine = trigEngine}, {t"c1: ", l(l.CAPTURE1)})
ls.add_snippets("all", {snip})
]], engine, trig)
feed("i3")
exec_lua("ls.expand()")
screen:expect{grid=[[
c1: 3^ |
{0:~ }|
{2:-- INSERT --} |]]}
assert.is_true(exec_lua([[return snip:get_docstring()[1] == "c1: 3$0"]]))
end)
end
end)

0 comments on commit ed6c108

Please sign in to comment.