diff --git a/lua/github-theme/_test/util.lua b/lua/github-theme/_test/util.lua index 7bf1181..d9a9e32 100644 --- a/lua/github-theme/_test/util.lua +++ b/lua/github-theme/_test/util.lua @@ -1,4 +1,4 @@ -local M = {} +local M = { unique_hlgroup = '____0' } local api = vim.api function M.await_VimEnter() diff --git a/test/github-theme/config/compiler_spec.lua b/test/github-theme/config/compiler_spec.lua new file mode 100644 index 0000000..20ec6c9 --- /dev/null +++ b/test/github-theme/config/compiler_spec.lua @@ -0,0 +1,29 @@ +local assert = require('luassert') +local t_util = require('github-theme._test.util') +local uniqgrp = t_util.unique_hlgroup + +if vim.fn.has('nvim-0.9.0') == 0 or vim.fn.has('nvim-0.9.0') == false then + return +end + +describe('compiler', function() + before_each(function() + require('github-theme.util.reload')(true) + end) + + it('should consider previously-set overrides (1)', function() + local same_opts = {} + require('github-theme').setup(same_opts) + require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } } + require('github-theme').setup(same_opts) + vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } }) + assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true)) + end) + + it('should consider previously-set overrides (2)', function() + require('github-theme').setup({}) + require('github-theme.override').groups = { all = { Normal = { link = uniqgrp } } } + vim.cmd.colorscheme({ args = { 'github_dark_dimmed' } }) + assert.same({ link = uniqgrp }, t_util.get_hl('Normal', true)) + end) +end) diff --git a/test/minimal_init.vim b/test/minimal_init.vim index 6aa2d4e..974ccdd 100644 --- a/test/minimal_init.vim +++ b/test/minimal_init.vim @@ -3,6 +3,6 @@ lua << vim.loader.disable() end . -set rtp+=. -set rtp+=./test/plenary +set rtp^=. +set rtp^=./test/plenary runtime! plugin/plenary.vim