Skip to content

Commit

Permalink
test: add compiler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmillr committed Jul 16, 2024
1 parent 40b5489 commit c8c1e09
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/github-theme/_test/util.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local M = {}
local M = { unique_hlgroup = '____0' }
local api = vim.api

function M.await_VimEnter()
Expand Down
29 changes: 29 additions & 0 deletions test/github-theme/config/compiler_spec.lua
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions test/minimal_init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c8c1e09

Please sign in to comment.