diff options
| author | Ellison <ellisonleao@gmail.com> | 2025-06-25 16:12:29 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-25 16:12:29 -0300 |
| commit | 7ac6439e479e67f7c6f4c43af486fc34b7cd1f75 (patch) | |
| tree | 3a717d662d52612633a2eeb86bcc0203ada0da4b /tests | |
| parent | 00e38a379bab3389e187b3953566d67d494dfddd (diff) | |
| parent | a38d3d9a294f08d21ab8733234e9f398821a95d9 (diff) | |
| download | gruvbox-7ac6439e479e67f7c6f4c43af486fc34b7cd1f75.tar.gz gruvbox-7ac6439e479e67f7c6f4c43af486fc34b7cd1f75.tar.xz | |
Merge pull request #407 from ellisonleao/fix/issue-402-independent-setup-calls
Make multiple calls to setup() independent
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gruvbox/gruvbox_spec.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/gruvbox/gruvbox_spec.lua b/tests/gruvbox/gruvbox_spec.lua index d73d832..e391670 100644 --- a/tests/gruvbox/gruvbox_spec.lua +++ b/tests/gruvbox/gruvbox_spec.lua @@ -157,4 +157,33 @@ describe("tests", function() vim.opt.background = "light" assert.are.same(vim.g.terminal_color_0, colors.light0) end) + + it("multiple calls to setup() are independent", function() + -- First call to setup + gruvbox.setup({ + contrast = "soft", + overrides = { CursorLine = { bg = "#FF0000" } }, + }) + assert.are.same(gruvbox.config.contrast, "soft") + assert.are.same(gruvbox.config.overrides.CursorLine.bg, "#FF0000") + + -- Second call to setup + gruvbox.setup({ contrast = "hard" }) + assert.are.same(gruvbox.config.contrast, "hard") + -- Check that overrides from the first call are not present + assert.is_nil(gruvbox.config.overrides.CursorLine) + + -- Third call to setup with different overrides + gruvbox.setup({ + overrides = { Normal = { fg = "#00FF00" } }, + }) + assert.are.same(gruvbox.config.contrast, "") -- Contrast should be reset to default (empty string) + assert.is_nil(gruvbox.config.overrides.CursorLine) -- Still no CursorLine override + assert.are.same(gruvbox.config.overrides.Normal.fg, "#00FF00") -- New override is present + + -- Call setup with no arguments to reset to defaults + gruvbox.setup() + assert.are.same(gruvbox.config.contrast, "") + assert.is_nil(gruvbox.config.overrides.Normal) + end) end) |
