Skip to content

Commit

Permalink
One more.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Oct 18, 2023
1 parent 156e781 commit 57109ec
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
31 changes: 4 additions & 27 deletions lua/tests/current_search_paths_spec.lua
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
local lean = require('lean')
local helpers = require('tests.helpers')
local fixtures = require('tests.fixtures')

require('lean').setup {
lsp = { enable = true },
lsp3 = { enable = true },
}
require('lean').setup { lsp = { enable = true } }

describe('lean.current_search_paths', function()
for kind, path in unpack(fixtures.lean_project.files_it) do
it(string.format('returns the paths for %s files', kind), function()
vim.api.nvim_command('edit ' .. path)
helpers.wait_for_ready_lsp()

local paths = lean.current_search_paths()
local paths = require('lean').current_search_paths()
assert.are_equal(3, #paths)
-- via its leanpkg.path:
assert.has_all(
table.concat(paths, '\n') .. '\n',
{ "/lib/lean\n", -- standard library
fixtures.lean_project.path .. '\n', -- the project itself
{ "/lib/lean\n", -- standard library
fixtures.lean_project.path .. '\n', -- the project itself
fixtures.lean_project.path .. '/foo\n' } -- its dependency
)
end)
end

for kind, path in unpack(fixtures.lean3_project.files_it) do
it(string.format('returns the paths for %s lean3 files', kind), function()
vim.api.nvim_command('edit ' .. path)
helpers.wait_for_ready_lsp()

local paths = lean.current_search_paths()
assert.are_equal(3, #paths)
-- via its leanpkg.path:
assert.has_all(
table.concat(paths, '\n') .. '\n',
{
'/lib/lean/library\n', -- Lean 3 standard library
fixtures.lean3_project.path .. '/src\n', -- the project itself
fixtures.lean3_project.path .. '/_target/deps/mathlib/src\n' -- the project itself
}
)
end)
end
end)
25 changes: 25 additions & 0 deletions lua/tests/lean3/current_search_paths_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
local helpers = require('tests.helpers')
local fixtures = require('tests.fixtures')

require('lean').setup { lsp3 = { enable = true } }

helpers.if_has_lean3('lean.current_search_paths', function()
for kind, path in unpack(fixtures.lean3_project.files_it) do
it(string.format('returns the paths for %s lean 3 files', kind), function()
vim.api.nvim_command('edit ' .. path)
helpers.wait_for_ready_lsp()

local paths = require('lean').current_search_paths()
assert.are_equal(3, #paths)
-- via its leanpkg.path:
assert.has_all(
table.concat(paths, '\n') .. '\n',
{
'/lib/lean/library\n', -- Lean 3 standard library
fixtures.lean3_project.path .. '/src\n', -- the project itself
fixtures.lean3_project.path .. '/_target/deps/mathlib/src\n' -- the project itself
}
)
end)
end
end)

0 comments on commit 57109ec

Please sign in to comment.