-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add rudimentary smoke tests to check for errors
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
local M = {} | ||
local api = vim.api | ||
|
||
function M.await_VimEnter() | ||
if vim.v.vim_did_enter == 0 then | ||
local co = assert(coroutine.running(), 'test is not running in coroutine') | ||
|
||
api.nvim_create_autocmd('VimEnter', { | ||
pattern = '*', | ||
once = true, | ||
nested = true, | ||
callback = vim.schedule_wrap(function() | ||
coroutine.resume(co) | ||
end), | ||
}) | ||
|
||
coroutine.yield() | ||
end | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local assert = require('luassert') | ||
local t_util = require('github-theme._test.util') | ||
|
||
describe('(smoke test)', function() | ||
describe('setting colorscheme during startup', function() | ||
it('should not error', function() | ||
assert.does_not_error(function() | ||
vim.cmd('colorscheme github_dark_dimmed') | ||
end) | ||
|
||
assert.is.equal('', vim.v.errmsg or '') | ||
end) | ||
end) | ||
|
||
describe('setting/switching colorscheme post-startup', function() | ||
it('should not error', function() | ||
t_util.await_VimEnter() | ||
|
||
for _, cs in ipairs({ | ||
'default', | ||
'github_dark_dimmed', | ||
'github_dark_dimmed', | ||
'github_light', | ||
}) do | ||
assert.does_not_error(function() | ||
vim.cmd('colorscheme ' .. cs) | ||
end) | ||
|
||
assert.is.equal('', vim.v.errmsg or '') | ||
end | ||
end) | ||
end) | ||
end) |