Skip to content

Commit e89d49d

Browse files
committed
add another test for the new restoreNode.
1 parent 3e30ca8 commit e89d49d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

tests/integration/restore_spec.lua

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,95 @@ screen:expect({
458458
{0:~ }|
459459
{2:-- SELECT --} |
460460
]]
461+
})
462+
end)
463+
464+
-- make sure store and update_restore propagate.
465+
it("correctly restores snippets (3).", function()
466+
467+
exec_lua([[
468+
ls.setup({link_children = true})
469+
ls.snip_expand(s("trig", {
470+
i(1, "asdf"), t" ", d(2, function(args)
471+
return sn(nil, {
472+
r(1, "key", i(1)),
473+
i(2, args[1])
474+
})
475+
end, {1})
476+
}))
477+
]])
478+
exec_lua[[ls.jump(1)]]
479+
480+
local function exp()
481+
exec_lua([[
482+
ls.snip_expand(s("trig", {
483+
t("("), r(1, "inside_pairs", dl(1, l.LS_SELECT_DEDENT)), t(")")
484+
}))
485+
]])
486+
feed("i")
487+
end
488+
489+
exp()
490+
exec_lua"ls.jump(1)"
491+
exp()
492+
exec_lua"ls.jump(1)"
493+
exp()
494+
feed("<space><space>i<left><left>")
495+
exp()
496+
exp()
497+
exp()
498+
screen:expect({
499+
grid = [[
500+
asdf (i)(i)(i (i(i(i^))) i)asdf |
501+
{0:~ }|
502+
{2:-- INSERT --} |
503+
]]
504+
})
505+
-- 11x to get back to the i1.
506+
exec_lua"ls.jump(-1) ls.jump(-1) ls.jump(-1)"
507+
exec_lua"ls.jump(-1) ls.jump(-1) ls.jump(-1)"
508+
exec_lua"ls.jump(-1) ls.jump(-1) ls.jump(-1)"
509+
exec_lua"ls.jump(-1) ls.jump(-1)"
510+
feed("qwer")
511+
exec_lua"ls.jump(1)"
512+
screen:expect({
513+
grid = [[
514+
qwer ^({3:i)(i)(i (i(i(i))) i)}qwer |
515+
{0:~ }|
516+
{2:-- SELECT --} |
517+
]]
518+
})
519+
exec_lua"ls.jump(1) ls.jump(1) ls.jump(1)"
520+
screen:expect({
521+
grid = [[
522+
qwer (i)(^i)(i (i(i(i))) i)qwer |
523+
{0:~ }|
524+
{2:-- SELECT --} |
525+
]]
526+
})
527+
exec_lua"ls.jump(1) ls.jump(1) ls.jump(1)"
528+
screen:expect({
529+
grid = [[
530+
qwer (i)(i)(i (^i{3:(i(i))}) i)qwer |
531+
{0:~ }|
532+
{2:-- SELECT --} |
533+
]]
534+
})
535+
exec_lua"ls.jump(1) ls.jump(1) ls.jump(1)"
536+
screen:expect({
537+
grid = [[
538+
qwer (i)(i)(i (i(i(i)^)) i)qwer |
539+
{0:~ }|
540+
{2:-- INSERT --} |
541+
]]
542+
})
543+
exec_lua"ls.jump(1) ls.jump(1) ls.jump(1) ls.jump(1)"
544+
screen:expect({
545+
grid = [[
546+
qwer (i)(i)(i (i(i(i))) i)^q{3:wer} |
547+
{0:~ }|
548+
{2:-- SELECT --} |
549+
]]
461550
})
462551
end)
463552
end)

0 commit comments

Comments
 (0)