From eacdda76c63ce40a8c29d48cb1a439ed51f5fda5 Mon Sep 17 00:00:00 2001 From: bhagwan Date: Sun, 29 May 2022 15:18:41 -0700 Subject: [PATCH] testing framework initial setup --- Makefile | 22 ++++++++++++++++++++++ tests/init_spec.lua | 14 ++++++++++++++ tests/minimal_init.vim | 6 ++++++ 3 files changed, 42 insertions(+) create mode 100644 Makefile create mode 100644 tests/init_spec.lua create mode 100644 tests/minimal_init.vim diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9bf4a56 --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +PLENARY-DIR=../plenary.nvim +PLENARY-REPO=https://github.com/nvim-lua/plenary.nvim.git + +.PHONY: test +test: + nvim --headless --noplugin -u tests/minimal_init.vim -c "lua require('plenary.test_harness').test_directory('tests/', { minimal_init = 'tests/minimal_init.vim', sequential = true, timeout = 120000 })" + +.PHONY: test-file +test-file: + nvim --headless --noplugin -u tests/minimal_init.vim -c "lua require('plenary.busted').run(vim.loop.cwd()..'/'..[[$(FILE)]])" + + +.PHONY: plenary +plenary: + @if [ ! -d $(PLENARY-DIR) ] ;\ + then \ + echo "Cloning plenary.nvim..."; \ + git clone $(PLENARY-REPO) $(PLENARY-DIR); \ + else \ + echo "Updating plenary.nvim..."; \ + git -C $(PLENARY-DIR) pull; \ + fi diff --git a/tests/init_spec.lua b/tests/init_spec.lua new file mode 100644 index 0000000..1b5d614 --- /dev/null +++ b/tests/init_spec.lua @@ -0,0 +1,14 @@ +local fn = vim.fn +local api = vim.api + +local fzf = require("fzf-lua") + +describe("FzfLua", function() + describe("configuration", function() + it("initial setup", function() + fzf.setup({}) + _G.dump(assert.is) + assert.is.truthy(fzf) + end) + end) +end) diff --git a/tests/minimal_init.vim b/tests/minimal_init.vim new file mode 100644 index 0000000..d2e1188 --- /dev/null +++ b/tests/minimal_init.vim @@ -0,0 +1,6 @@ +set hidden +set noswapfile + +set rtp+=../plenary.nvim +set rtp+=../fzf-lua +runtime! plugin/plenary.vim