Skip to content

Commit

Permalink
test: Add teardown to fix key setup
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewferrier committed Oct 8, 2023
1 parent f380ab4 commit b0dc0d4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@ M.setup = function(o)
wrapping.setup(opts)
end

M.teardown = function()
vim.keymap.del("n", "yow")
vim.keymap.del("n", "[ow")
vim.keymap.del("n", "]ow")
end

return M
2 changes: 2 additions & 0 deletions tests/minimal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ local common = require("tests.common")
local wrapping = require("wrapping")

describe("handle treesitter blocks", function()
after_each(common.teardown)

it("won't exclude fenced code blocks", function()
common.setup()
vim.opt.textwidth = 80
Expand Down
6 changes: 6 additions & 0 deletions tests/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ describe("detect wrapping mode", function()
common.setup()
end)

after_each(common.teardown)

it("can detect hard mode when filetype not set", function()
common.set_lines({
"test1",
Expand Down Expand Up @@ -103,6 +105,8 @@ describe("detect wrapping mode", function()
end)

describe("detect wrapping mode with different softeners", function()
after_each(common.teardown)

it(
"can detect hard mode when textwidth set globally but softener low",
function()
Expand Down Expand Up @@ -237,6 +241,8 @@ describe("detect wrapping mode with different softeners", function()
end)

describe("handle treesitter blocks", function()
after_each(common.teardown)

it("can exclude fenced code blocks - hard", function()
common.setup()
vim.opt.textwidth = 80
Expand Down

0 comments on commit b0dc0d4

Please sign in to comment.