tests: update testing and makefile

main
olimorris 2023-03-09 09:40:20 +00:00
parent 88f27dcab2
commit 3dcad75325
6 changed files with 43 additions and 24 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
plenary.nvim/
misc/
!tests/**/*
.luarc.json
todo.md

View File

@ -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 +TestAutoloading
nvim --headless --noplugin -u tests/minimal.vim +TestGitBranching
nvim --headless --noplugin -u tests/minimal.vim +TestDefaults
nvim --headless --noplugin -u tests/minimal.vim +TearDown
check:
stylua --color always --check .
$(PLENARY_DIR):
git clone --depth=1 --no-single-branch $(PLENARY_URL) $(PLENARY_DIR)
@rm -rf $(PLENARY_DIR)/.git

View File

@ -10,7 +10,6 @@ require("persisted").setup({
describe("Follow cwd change", function()
it("creates two sessions with change in cwd", function()
vim.cmd(":e tests/stubs/test_autoload.txt")
vim.cmd(":w")
@ -19,7 +18,6 @@ describe("Follow cwd change", function()
vim.cmd(":w")
require("persisted").save()
vim.cmd(":bdelete")
end)
it("ensures both sessions were created", function()
local pattern = "/"
@ -42,7 +40,6 @@ require("persisted").setup({
describe("Don't follow cwd change", function()
it("creates two sessions with change in cwd", function()
vim.cmd(":e tests/stubs/test_autoload.txt")
vim.cmd(":w")
require("persisted").save()
@ -51,7 +48,6 @@ describe("Don't follow cwd change", function()
vim.cmd(":w")
require("persisted").save()
vim.cmd(":bdelete")
end)
it("ensures only one session was created", function()
local pattern = "/"

View File

@ -18,7 +18,6 @@ describe("Git Branching", function()
require("persisted").save()
assert.equals(vim.fn.system("ls tests/git_branch_data | wc -l"):gsub("%s+", ""), "2")
end)
it("ensures the session has the branch name in", function()

View File

@ -1,13 +1,7 @@
if !isdirectory('plenary.nvim')
!git clone https://github.com/nvim-lua/plenary.nvim.git plenary.nvim
" !git -C plenary.nvim reset --hard 4b7e52044bbb84242158d977a50c4cbcd85070c7
endif
set rtp+=.
set rtp+=./misc/plenary
set runtimepath+=plenary.nvim,.
set noswapfile
set noundofile
runtime plugin/plenary.vim
runtime! plugin/plenary.vim
command Setup PlenaryBustedDirectory tests/setup {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'}

View File

@ -9,7 +9,6 @@ require("persisted").setup({
describe("As part of the setup", function()
it("creates a session to autoload from", function()
vim.cmd(":e tests/stubs/test_autoload.txt")
vim.cmd(":w")