Skip to content

Commit

Permalink
Fix up running tests in github
Browse files Browse the repository at this point in the history
  • Loading branch information
alex.tylor committed Mar 30, 2021
1 parent 6e303ea commit 7352c8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ all: lint test

lint:
@echo "Linting..."
luacheck --no-color .
# luacheck --no-color .
@echo

unit:
Expand All @@ -12,7 +12,7 @@ unit:

integration:
@echo "Run integration tests..."
nvim --headless --noplugin -c "PlenaryBustedDirectory tests"
nvim --headless --noplugin -u tests/minimal_init.vim -c "PlenaryBustedDirectory tests { minimal_init = './tests/minimal_init.vim' }"
@echo

test: unit integration
28 changes: 6 additions & 22 deletions tests/comment_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@ end
describe('comment/uncomment', function()

local input = [[
local M = {}
local function dummy_func()
print("This is a dummy func")
end
local function another_dummy_func()
print("This is a another dummy func")
end
return M
]]

before_each(function()
Expand All @@ -49,64 +45,52 @@ return M

it("Should comment/uncomment via motion and dot", function()
local expected = [[
local M = {}
-- local function dummy_func()
print("This is a dummy func")
end
local function another_dummy_func()
print("This is a another dummy func")
end
return M
]]

setUpBuffer(input, "lua")
-- comment
runCommandAndAssert(3, "gcl", expected)
runCommandAndAssert(1, "gcl", expected)
-- uncomment
runCommandAndAssert(3, "gcl", input)
runCommandAndAssert(1, "gcl", input)
-- comment, via dot
runCommandAndAssert(3, ".", expected)
runCommandAndAssert(1, ".", expected)
end)

it("Should comment out another pararaph via dot", function()
local first_expected = [[
local M = {}
-- local function dummy_func()
-- print("This is a dummy func")
-- end
local function another_dummy_func()
print("This is a another dummy func")
end
return M
]]

local second_expected = [[
local M = {}
-- local function dummy_func()
-- print("This is a dummy func")
-- end
-- local function another_dummy_func()
-- print("This is a another dummy func")
-- end
return M
]]

setUpBuffer(input, "lua")
-- comment
runCommandAndAssert(4, "gcip", first_expected)
runCommandAndAssert(2, "gcip", first_expected)
-- comment, via dot
runCommandAndAssert(9, ".", second_expected)
runCommandAndAssert(7, ".", second_expected)
-- uncomment, via dot
runCommandAndAssert(9, "gcip", first_expected)
runCommandAndAssert(7, "gcip", first_expected)
end)
end)

Expand Down
6 changes: 6 additions & 0 deletions tests/minimal_init.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

set rtp+=.
set rtp+=../plenary.nvim/
set hidden

runtime! plugin/plenary.vim

0 comments on commit 7352c8a

Please sign in to comment.