tests: update testing and makefile
parent
88f27dcab2
commit
3dcad75325
|
|
@ -1,4 +1,4 @@
|
||||||
plenary.nvim/
|
misc/
|
||||||
!tests/**/*
|
!tests/**/*
|
||||||
.luarc.json
|
.luarc.json
|
||||||
todo.md
|
todo.md
|
||||||
|
|
|
||||||
39
Makefile
39
Makefile
|
|
@ -1,11 +1,42 @@
|
||||||
all: test
|
PANVIMDOC_DIR = misc/panvimdoc
|
||||||
|
PANVIMDOC_URL = https://github.com/kdheepak/panvimdoc
|
||||||
|
PLENARY_DIR = misc/plenary
|
||||||
|
PLENARY_URL = https://github.com/nvim-lua/plenary.nvim
|
||||||
|
|
||||||
test:
|
all: format test docs
|
||||||
|
|
||||||
|
docs: $(PANVIMDOC_DIR)
|
||||||
|
@cd $(PANVIMDOC_DIR) && \
|
||||||
|
pandoc \
|
||||||
|
--metadata="project:persisted.nvim" \
|
||||||
|
--metadata="description:Simple session management for Neovim" \
|
||||||
|
--metadata="toc:true" \
|
||||||
|
--metadata="incrementheadinglevelby:0" \
|
||||||
|
--metadata="treesitter:true" \
|
||||||
|
--lua-filter scripts/skip-blocks.lua \
|
||||||
|
--lua-filter scripts/include-files.lua \
|
||||||
|
--lua-filter scripts/remove-emojis.lua \
|
||||||
|
-t scripts/panvimdoc.lua \
|
||||||
|
../../README.md \
|
||||||
|
-o ../../doc/persisted.nvim.txt
|
||||||
|
|
||||||
|
$(PANVIMDOC_DIR):
|
||||||
|
git clone --depth=1 --no-single-branch $(PANVIMDOC_URL) $(PANVIMDOC_DIR)
|
||||||
|
@rm -rf doc/panvimdoc/.git
|
||||||
|
|
||||||
|
check:
|
||||||
|
stylua --check lua/ tests/ -f ./stylua.toml
|
||||||
|
|
||||||
|
format:
|
||||||
|
stylua lua/ tests/ -f ./stylua.toml
|
||||||
|
|
||||||
|
test: $(PLENARY_DIR)
|
||||||
nvim --headless --noplugin -u tests/minimal.vim +Setup
|
nvim --headless --noplugin -u tests/minimal.vim +Setup
|
||||||
# nvim --headless --noplugin -u tests/minimal.vim +TestAutoloading
|
# nvim --headless --noplugin -u tests/minimal.vim +TestAutoloading
|
||||||
nvim --headless --noplugin -u tests/minimal.vim +TestGitBranching
|
nvim --headless --noplugin -u tests/minimal.vim +TestGitBranching
|
||||||
nvim --headless --noplugin -u tests/minimal.vim +TestDefaults
|
nvim --headless --noplugin -u tests/minimal.vim +TestDefaults
|
||||||
nvim --headless --noplugin -u tests/minimal.vim +TearDown
|
nvim --headless --noplugin -u tests/minimal.vim +TearDown
|
||||||
|
|
||||||
check:
|
$(PLENARY_DIR):
|
||||||
stylua --color always --check .
|
git clone --depth=1 --no-single-branch $(PLENARY_URL) $(PLENARY_DIR)
|
||||||
|
@rm -rf $(PLENARY_DIR)/.git
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@ local session_dir = vim.fn.getcwd() .. "/tests/dummy_data/"
|
||||||
|
|
||||||
-- follow_cwd = true
|
-- follow_cwd = true
|
||||||
require("persisted").setup({
|
require("persisted").setup({
|
||||||
save_dir = session_dir,
|
save_dir = session_dir,
|
||||||
follow_cwd = true,
|
follow_cwd = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("Follow cwd change", function()
|
describe("Follow cwd change", function()
|
||||||
it("creates two sessions with change in cwd", function()
|
it("creates two sessions with change in cwd", function()
|
||||||
|
|
||||||
vim.cmd(":e tests/stubs/test_autoload.txt")
|
vim.cmd(":e tests/stubs/test_autoload.txt")
|
||||||
vim.cmd(":w")
|
vim.cmd(":w")
|
||||||
|
|
||||||
|
|
@ -19,7 +18,6 @@ describe("Follow cwd change", function()
|
||||||
vim.cmd(":w")
|
vim.cmd(":w")
|
||||||
require("persisted").save()
|
require("persisted").save()
|
||||||
vim.cmd(":bdelete")
|
vim.cmd(":bdelete")
|
||||||
|
|
||||||
end)
|
end)
|
||||||
it("ensures both sessions were created", function()
|
it("ensures both sessions were created", function()
|
||||||
local pattern = "/"
|
local pattern = "/"
|
||||||
|
|
@ -36,13 +34,12 @@ end)
|
||||||
-- follow_cwd = false
|
-- follow_cwd = false
|
||||||
pcall(vim.fn.system, "rm -rf tests/dummy_data")
|
pcall(vim.fn.system, "rm -rf tests/dummy_data")
|
||||||
require("persisted").setup({
|
require("persisted").setup({
|
||||||
save_dir = session_dir,
|
save_dir = session_dir,
|
||||||
follow_cwd = false,
|
follow_cwd = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("Don't follow cwd change", function()
|
describe("Don't follow cwd change", function()
|
||||||
it("creates two sessions with change in cwd", function()
|
it("creates two sessions with change in cwd", function()
|
||||||
|
|
||||||
vim.cmd(":e tests/stubs/test_autoload.txt")
|
vim.cmd(":e tests/stubs/test_autoload.txt")
|
||||||
vim.cmd(":w")
|
vim.cmd(":w")
|
||||||
require("persisted").save()
|
require("persisted").save()
|
||||||
|
|
@ -51,7 +48,6 @@ describe("Don't follow cwd change", function()
|
||||||
vim.cmd(":w")
|
vim.cmd(":w")
|
||||||
require("persisted").save()
|
require("persisted").save()
|
||||||
vim.cmd(":bdelete")
|
vim.cmd(":bdelete")
|
||||||
|
|
||||||
end)
|
end)
|
||||||
it("ensures only one session was created", function()
|
it("ensures only one session was created", function()
|
||||||
local pattern = "/"
|
local pattern = "/"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ describe("Git Branching", function()
|
||||||
|
|
||||||
require("persisted").save()
|
require("persisted").save()
|
||||||
assert.equals(vim.fn.system("ls tests/git_branch_data | wc -l"):gsub("%s+", ""), "2")
|
assert.equals(vim.fn.system("ls tests/git_branch_data | wc -l"):gsub("%s+", ""), "2")
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("ensures the session has the branch name in", function()
|
it("ensures the session has the branch name in", function()
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,7 @@
|
||||||
if !isdirectory('plenary.nvim')
|
set rtp+=.
|
||||||
!git clone https://github.com/nvim-lua/plenary.nvim.git plenary.nvim
|
set rtp+=./misc/plenary
|
||||||
" !git -C plenary.nvim reset --hard 4b7e52044bbb84242158d977a50c4cbcd85070c7
|
|
||||||
endif
|
|
||||||
|
|
||||||
set runtimepath+=plenary.nvim,.
|
runtime! plugin/plenary.vim
|
||||||
set noswapfile
|
|
||||||
set noundofile
|
|
||||||
|
|
||||||
runtime plugin/plenary.vim
|
|
||||||
command Setup PlenaryBustedDirectory tests/setup {minimal_init = 'tests/minimal.vim'}
|
command Setup PlenaryBustedDirectory tests/setup {minimal_init = 'tests/minimal.vim'}
|
||||||
command TestAutoloading PlenaryBustedDirectory tests/autoload {minimal_init = 'tests/minimal.vim'}
|
command TestAutoloading PlenaryBustedDirectory tests/autoload {minimal_init = 'tests/minimal.vim'}
|
||||||
command TestGitBranching PlenaryBustedDirectory tests/git_branching {minimal_init = 'tests/minimal.vim'}
|
command TestGitBranching PlenaryBustedDirectory tests/git_branching {minimal_init = 'tests/minimal.vim'}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ require("persisted").setup({
|
||||||
|
|
||||||
describe("As part of the setup", function()
|
describe("As part of the setup", function()
|
||||||
it("creates a session to autoload from", function()
|
it("creates a session to autoload from", function()
|
||||||
|
|
||||||
vim.cmd(":e tests/stubs/test_autoload.txt")
|
vim.cmd(":e tests/stubs/test_autoload.txt")
|
||||||
vim.cmd(":w")
|
vim.cmd(":w")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue