Skip to content

Commit

Permalink
I have vague recollections this didn't work last time either :/
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Sep 13, 2024
1 parent 74e3bf7 commit 829a28c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion spec/ft_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('ft.detect', function()
end

it('detects standard library files', function()
vim.cmd.edit { project.child 'Test/JumpToStdlib.lean', bang = true }
helpers.jump_to_core()
assert.are.equal('lean', vim.bo.filetype)
local initial_path = vim.api.nvim_buf_get_name(0)

Expand Down
13 changes: 13 additions & 0 deletions spec/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ function helpers.move_cursor(opts)
vim.cmd.doautocmd 'CursorMoved'
end

--- Jump to an arbitrary file in Lean core.
function helpers.jump_to_core()
vim.cmd.edit(fixtures.project.child 'Test/JumpToStdlib.lean')
vim.cmd.normal '$'

helpers.wait_for_ready_lsp()
vim.lsp.buf.definition()

assert.is_truthy(vim.wait(15000, function()
return vim.api.nvim_buf_get_name(0):match '.*/src/lean/.*'
end))
end

---@class MoveCursorOpts
---@field window? integer @the window handle. Defaults to the current window.
---@field to table @the new cursor position (1-row indexed, as per nvim_win_set_cursor)
Expand Down
9 changes: 9 additions & 0 deletions spec/helpers_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,12 @@ describe(
end
)
)

describe('jump_to_core', function()
it('jumps to a file in core Lean', function()
helpers.jump_to_core()
local name = vim.api.nvim_buf_get_name(0)
local is_core = name:match '.*/src/lean/.*'
assert.message("Didn't jump to core Lean!").is_truthy(is_core)
end)
end)

0 comments on commit 829a28c

Please sign in to comment.