Skip to content

Commit

Permalink
test config functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kentookura committed Oct 11, 2024
1 parent b72a343 commit 495aff6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ deps:
@mkdir -p deps
git clone --filter=blob:none https://github.com/echasnovski/mini.nvim $@/mini.nvim
git clone --filter=blob:none https://github.com/nvim-lua/plenary.nvim $@/plenary.nvim
git clone --filter=blob:none https://github.com/nvim-telescope/telescope.nvim $@/telescope.nvim
git clone --filter=blob:none https://github.com/nvim-treesitter/nvim-treesitter $@/nvim-treesitter

documentation:
nvim --headless --noplugin -u ./scripts/minimal_init.lua -c "luafile scripts/minidoc.lua" -c "qa!"
Expand Down
4 changes: 4 additions & 0 deletions scripts/minimal_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ vim.cmd([[let &rtp.=','.getcwd()]])
-- Assumed that 'mini.nvim' is stored in 'deps/mini.nvim'
vim.cmd("set rtp+=deps/plenary.nvim")
vim.cmd("set rtp+=deps/mini.nvim")
vim.cmd("set rtp+=deps/telescope.nvim")
vim.cmd("set rtp+=deps/nvim-treesitter")
vim.cmd("set rtp+=scripts/minidoc")

require("nvim-treesitter.configs").setup({ ensure_installed = { "toml" }, auto_install = true, sync_install = true })

require("mini.test").setup()
require("mini.doc").setup()
-- require("mini.doc").setup()
Expand Down
11 changes: 8 additions & 3 deletions tests/test_bindings.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local forester = require("forester.bindings")
local config = require("forester.config")
local path = require("plenary.path")
local expect, eq = MiniTest.expect, MiniTest.expect.equality
local T = MiniTest.new_set()
Expand All @@ -16,16 +17,20 @@ local setup_test_forest = function()
p:mkdir()
cfg:write(
'[forest]\
trees = ["trees"]\
prefixes = ["test"]',
trees = ["trees", "foo", "bar"]\
prefixes = ["test", "pfx"]',
"w",
438
)
vim.g.forester_current_config = "forest.toml"
end

T["bindings"] = MiniTest.new_set({ hooks = { pre_once = setup_test_forest, post_once = clean_test_forest } })

T["bindings"]["config"] = function() end
T["bindings"]["config"] = function()
eq(config.all_prefixes(), { "test", "pfx" })
eq(config.tree_dirs(), {"trees", "foo", "bar"})
end

T["bindings"]["build"] = function()
local res = forester.build("forest.toml", { no_assets = true, no_theme = true })
Expand Down

0 comments on commit 495aff6

Please sign in to comment.