Skip to content

Commit c8c1e09

Browse files
committed
test: add compiler tests
1 parent 40b5489 commit c8c1e09

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

lua/github-theme/_test/util.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local M = {}
1+
local M = { unique_hlgroup = '____0' }
22
local api = vim.api
33

44
function M.await_VimEnter()
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
local assert = require('luassert')
2+
local t_util = require('github-theme._test.util')
3+
local uniqgrp = t_util.unique_hlgroup
4+
5+
if vim.fn.has('nvim-0.9.0') == 0 or vim.fn.has('nvim-0.9.0') == false then
6+
return
7+
end
8+
9+
describe('compiler', function()
10+
before_each(function()
11+
require('github-theme.util.reload')(true)
12+
end)
13+
14+
it('should consider previously-set overrides (1)', function()
15+
local same_opts = {}
16+
require('github-theme').setup(same_opts)
17+
require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } }
18+
require('github-theme').setup(same_opts)
19+
vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } })
20+
assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true))
21+
end)
22+
23+
it('should consider previously-set overrides (2)', function()
24+
require('github-theme').setup({})
25+
require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } }
26+
vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } })
27+
assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true))
28+
end)
29+
end)

test/minimal_init.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ lua <<
33
vim.loader.disable()
44
end
55
.
6-
set rtp+=.
7-
set rtp+=./test/plenary
6+
set rtp^=.
7+
set rtp^=./test/plenary
88
runtime! plugin/plenary.vim

0 commit comments

Comments
 (0)