Skip to content

Commit

Permalink
test: add tests for W
Browse files Browse the repository at this point in the history
  • Loading branch information
armed committed Oct 24, 2023
1 parent ddf887e commit c0ae0fd
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions tests/nvim-paredit/operator_motion_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local defaults = require("nvim-paredit.defaults")
describe("motions with operator pending", function()
before_each(function()
keybindings.setup_keybindings({
keys = defaults.default_keys
keys = defaults.default_keys,
})
end)

Expand All @@ -29,6 +29,42 @@ describe("motions with operator pending", function()
})
end)

it("should delete til next", function()
prepare_buffer({
content = "(a a) (b b)",
cursor = { 1, 0 },
})
feedkeys("d<S-w>")
expect({
content = "(b b)",
cursor = { 1, 0 },
})
end)

it("should delete form if there is no next", function()
prepare_buffer({
content = "(b b)",
cursor = { 1, 0 },
})
feedkeys("d<S-w>")
expect({
content = "",
cursor = { 1, 0 },
})
end)

it("should delete 2 forms within parent form and join up", function()
prepare_buffer({
content = {"[(a a) (b b) (c c)]"},
cursor = { 1, 1 },
})
feedkeys("2d<S-w>")
expect({
content = "[(c c)]",
cursor = { 1, 1 },
})
end)

it("should delete next form (multiline)", function()
prepare_buffer({
content = { "(a a)", ";; comment", "(b b)" },
Expand Down Expand Up @@ -91,7 +127,7 @@ end)
describe("motions with operator pending and v:count", function()
before_each(function()
keybindings.setup_keybindings({
keys = defaults.default_keys
keys = defaults.default_keys,
})
end)

Expand Down

0 comments on commit c0ae0fd

Please sign in to comment.