Skip to content

Commit

Permalink
Add test coverage
Browse files Browse the repository at this point in the history
Brings some of the new highlight duration related tests into the
new highlight_spec file
  • Loading branch information
aaronik committed Dec 18, 2024
1 parent 9ffeff3 commit 8162e35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 189 deletions.
188 changes: 0 additions & 188 deletions tests/treewalker/acceptance_spec.lua

This file was deleted.

16 changes: 15 additions & 1 deletion tests/treewalker/highlight_spec.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local util = require "treewalker.util"
local load_fixture = require "tests.load_fixture"
local stub = require 'luassert.stub'
local spy = require 'luassert.spy'
local assert = require "luassert"
local tw = require 'treewalker'
local ops = require 'treewalker.ops'
Expand All @@ -25,7 +26,7 @@ describe("Highlights in a regular lua file: ", function()
end)

it("respects highlight config option", function()
tw.setup() -- highlight defaults to true, doesn't blow up with empty setup
tw.setup() -- highlight defaults to true, doesn't blow up with empty setup
vim.fn.cursor(23, 5)
tw.move_out()
tw.move_down()
Expand All @@ -52,6 +53,19 @@ describe("Highlights in a regular lua file: ", function()
assert.equal(4, #highlight_stub.calls)
end)

it("respects highlight_duration config option", function()
local duration = 50
tw.setup({ highlight = true, highlight_duration = duration })
vim.fn.cursor(23, 5)
tw.move_out()
tw.move_down()
tw.move_up()
tw.move_in()
assert.stub(highlight_stub).was.called(4)
local called_with_duration = highlight_stub.calls[1].refs[2]
assert.equal(duration, called_with_duration)
end)

it("highlights whole functions", function()
vim.fn.cursor(10, 1)
tw.move_down()
Expand Down

0 comments on commit 8162e35

Please sign in to comment.