mirror of
https://github.com/maxmx03/solarized.nvim.git
synced 2026-09-10 07:26:26 -04:00
fix: prevent error when user pass a nil value to setup
added more tests and makefile
This commit is contained in:
parent
01d8c0afe1
commit
3ae785b553
|
|
@ -1,8 +1,3 @@
|
|||
services:
|
||||
solarized:
|
||||
build: .
|
||||
volumes:
|
||||
- solarized:/solarized
|
||||
|
||||
volumes:
|
||||
solarized:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ local M = {}
|
|||
M.config = require 'solarized.config'
|
||||
|
||||
M.setup = function(config)
|
||||
M.config = vim.tbl_deep_extend('force', M.config, config)
|
||||
M.config = vim.tbl_deep_extend('force', M.config, config or {})
|
||||
|
||||
if M.config.styles.enabled == false then
|
||||
M.config.styles = {
|
||||
|
|
|
|||
|
|
@ -46,4 +46,27 @@ describe('solarized.setup', function()
|
|||
assert.True(strings.italic)
|
||||
assert.True(comments.bold)
|
||||
end)
|
||||
|
||||
test('styles.enabled', function()
|
||||
local solarized = require 'solarized'
|
||||
solarized.setup {
|
||||
styles = {
|
||||
enabled = false,
|
||||
strings = { italic = true },
|
||||
comments = { bold = true },
|
||||
},
|
||||
}
|
||||
vim.cmd 'colorscheme solarized'
|
||||
|
||||
local strings = nvim_get_hl 'String'
|
||||
local comments = nvim_get_hl 'Comment'
|
||||
assert.Nil(strings.italic)
|
||||
assert.Nil(comments.bold)
|
||||
end)
|
||||
|
||||
test('nil config', function()
|
||||
local solarized = require 'solarized'
|
||||
solarized.setup()
|
||||
vim.cmd 'colorscheme solarized'
|
||||
end)
|
||||
end)
|
||||
|
|
|
|||
Loading…
Reference in a new issue