Skip to content

Commit ebdf8bb

Browse files
committed
♻️ Refactor test suite to use Neovim runtime
Simplify test framework to run inside actual Neovim instead of mocked environment - Remove legacy color fallback from palette.lua and delegate to variants - Update Makefile test command to run via nvim --headless - Delete minimal_init.vim file (no longer needed) - Simplify test runner to use actual vim API instead of mocks - Remove complex color output and test result tracking - Update test README to reflect simplified architecture - Modify palette tests to work with real module loading - Remove mock vim API and color utility functions from test runner Tests now run in real Neovim environment with full API access, eliminating need for mocking and improving test reliability.
1 parent aeaf8c7 commit ebdf8bb

File tree

6 files changed

+62
-378
lines changed

6 files changed

+62
-378
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test:
6262
@echo ""
6363
@echo "$(PURPLE)$(ARROW)$(RESET) $(PINK)$(BOLD)Running Tests$(RESET)"
6464
@echo ""
65-
@cd $(shell pwd) && lua tests/run.lua
65+
@cd $(shell pwd) && nvim --headless -u NONE -c "luafile tests/run.lua" 2>&1
6666

6767
# Run linters
6868
lint:

lua/silkcircuit/palette.lua

Lines changed: 7 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -7,117 +7,16 @@ function M.get_colors()
77
return variants.get_colors(variant_name)
88
end
99

10-
-- Legacy support - will be removed in future versions
11-
M.colors = M.get_colors()
12-
or {
13-
-- Base colors
14-
bg = "#1e1a2e", -- Primary background - Deep purple base
15-
bg_dark = "#16131f", -- Darker variant for contrast
16-
bg_highlight = "#3b2d4f", -- Secondary background - Rich purple
17-
bg_visual = "#44475a", -- Selection background - Purple tinted
18-
19-
fg = "#f8f8f2", -- Primary foreground - Slightly warmer
20-
fg_dark = "#e9d5ff", -- Default text - Light purple tint
21-
fg_light = "#ffffff", -- Light accent text
22-
fg_gutter = "#6272a4", -- Line numbers - Purple-blue
23-
24-
-- Primary syntax colors
25-
purple = "#e135ff", -- Keywords - NEON PURPLE
26-
purple_bright = "#ff6bff", -- Bright purple
27-
purple_dark = "#b45bcf", -- Deep purple - More vibrant
28-
purple_muted = "#9580ff", -- Muted purple - Still vibrant for comments
29-
30-
cyan = "#80ffea", -- Neon cyan - More green tinted
31-
cyan_bright = "#5fffff", -- Electric cyan
32-
cyan_dark = "#40a8c4", -- Dark cyan
33-
cyan_light = "#9ffcf9", -- Light neon cyan
34-
35-
green = "#f1fa8c", -- Strings, variables - More yellow-green
36-
green_light = "#d9f5dd", -- Light green
37-
green_bright = "#50fa7b", -- Bright green
38-
39-
blue = "#82AAFF", -- Constants, function calls
40-
blue_bright = "#82b1ff", -- Bright blue
41-
blue_light = "#8EACE3", -- Light blue
42-
blue_gray = "#5f7e97", -- Blue gray
43-
44-
pink = "#ff00ff", -- PURE NEON MAGENTA
45-
pink_bright = "#ff69ff", -- Hot pink - Maximum vibrance
46-
pink_soft = "#ff99ff", -- Soft pink - like glow mode strings
47-
48-
coral = "#F78C6C", -- Numbers
49-
red = "#ff6363", -- CSS selectors
50-
red_dark = "#d3423e", -- Dark red
51-
red_error = "#ec5f67", -- Error red
52-
53-
orange = "#ff6ac1", -- Pink-orange for classes
54-
yellow = "#ffff80", -- Neon yellow
55-
yellow_bright = "#ffffa5", -- Electric yellow
56-
yellow_dark = "#d4d464", -- Dark yellow
57-
yellow_light = "#ffffcc", -- Soft neon yellow
58-
59-
-- UI colors
60-
selection = "#1d3b53",
61-
selection_highlight = "#5f7e97",
62-
selection_inactive = "#7e57c2",
63-
word_highlight = "#32374D",
64-
word_highlight_strong = "#2E3250",
65-
white = "#ffffff",
66-
black = "#000000",
67-
border = "#44475a",
68-
comment = "#6272a4",
69-
70-
-- Special colors
71-
diff_add = "#50fa7b",
72-
diff_change = "#ff79c6",
73-
diff_delete = "#ff5555",
74-
diff_text = "#44475a",
75-
76-
-- Glow effects (for special highlights)
77-
glow_pink = "#ff00ff",
78-
glow_purple = "#e135ff",
79-
glow_cyan = "#00ffff",
80-
81-
-- Additional grays
82-
gray = "#637777",
83-
gray_light = "#d7dbe0",
84-
gray_dark = "#5f7e97",
85-
86-
-- Terminal colors (matching Warp theme)
87-
terminal_black = "#1e1a2e",
88-
terminal_red = "#ff79c6",
89-
terminal_green = "#f1fa8c",
90-
terminal_yellow = "#ffff80",
91-
terminal_blue = "#e135ff",
92-
terminal_magenta = "#ff00ff",
93-
terminal_cyan = "#80ffea",
94-
terminal_white = "#f8f8f2",
95-
terminal_bright_black = "#6272a4",
96-
terminal_bright_red = "#ff5555",
97-
terminal_bright_green = "#50fa7b",
98-
terminal_bright_yellow = "#ffffa5",
99-
terminal_bright_blue = "#bd93f9",
100-
terminal_bright_magenta = "#ff69ff",
101-
terminal_bright_cyan = "#5fffff",
102-
terminal_bright_white = "#ffffff",
103-
104-
-- Diagnostic colors
105-
error = "#ff5874",
106-
warning = "#ecc48d",
107-
info = "#82AAFF",
108-
hint = "#7fdbca",
109-
110-
-- Git colors
111-
git_add = "#addb67",
112-
git_change = "#82AAFF",
113-
git_delete = "#ff5874",
114-
115-
none = "NONE",
116-
}
10+
-- Get current colors (delegated to variants)
11+
M.colors = nil
11712

11813
-- Update semantic mappings when colors change
11914
function M.update_semantic(colors)
120-
colors = colors or M.colors
15+
colors = colors or M.get_colors()
16+
if not colors then
17+
-- Can't create semantic mappings without colors
18+
return
19+
end
12120
M.semantic = {
12221
-- Syntax (consistent across all languages)
12322
keyword = colors.purple,

tests/README.md

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,32 @@
1-
# SilkCircuit Theme Tests
1+
# SilkCircuit Tests
22

3-
This directory contains the test suite for the SilkCircuit Neovim theme.
3+
Simple, clean test suite that runs inside actual Neovim.
44

55
## Running Tests
66

77
```bash
8-
# Run all tests
98
make test
109
```
1110

1211
## Test Structure
1312

14-
### Unit Tests
13+
Tests are organized in `unit/` directory:
1514

16-
- **Color Utilities** (`unit/test_colors.lua`)
17-
- Tests color conversion functions (hex/rgb)
18-
- Tests color blending and manipulation
19-
- Tests WCAG contrast validation
20-
- Tests luminance calculations
15+
- `test_colors.lua` - Color utility functions
16+
- `test_config.lua` - Configuration system
17+
- `test_palette.lua` - Color palette and variants
2118

22-
- **Palette** (`unit/test_palette.lua`)
23-
- Tests variant color loading
24-
- Tests semantic color mappings
25-
- Tests color presence and naming
19+
## Writing Tests
2620

27-
- **Configuration** (`unit/test_config.lua`)
28-
- Tests default configuration values
29-
- Tests setup and option merging
30-
- Tests configuration getters
31-
32-
### Test Runner
33-
34-
The test suite uses a simple custom test runner (`run.lua`) that:
35-
36-
- Runs in plain Lua without requiring Neovim
37-
- Provides minimal test framework with `describe` and `it` functions
38-
- Outputs colorful test results
39-
- Tracks pass/fail statistics
40-
41-
## Writing New Tests
42-
43-
Tests follow a simple structure:
21+
Tests use a minimal test framework built into `run.lua`:
4422

4523
```lua
46-
describe("Feature Name", function()
47-
it("should do something", function()
48-
local result = some_function()
49-
assert(result == expected_value, "Error message if fails")
24+
describe("Feature", function()
25+
it("does something", function()
26+
assert(condition, "Error message")
5027
end)
5128
end)
5229
```
5330

54-
## Test Coverage
55-
56-
Current test coverage includes:
57-
58-
- ✅ Color manipulation utilities (7 tests)
59-
- ✅ Palette loading and variants (3 tests)
60-
- ✅ Configuration management (2 tests)
61-
62-
## Notes
63-
64-
- Tests run in isolation without user configuration
65-
- Mock vim API is provided for testing Neovim-specific code
66-
- Tests are designed to be fast and reliable
31+
All tests run inside Neovim with full access to the vim API.
32+
No mocking required!

tests/minimal_init.vim

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)