summaryrefslogtreecommitdiff
path: root/lua/clever_f/testing
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:35:32 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:35:32 +0200
commit753f248eb30350eb9ba6ca108e466be8e54a51c8 (patch)
tree373abf23474eb6276432686a76d5154639363948 /lua/clever_f/testing
parent0809f1eb0c73648cae15806cf8a43ad35f445f7c (diff)
Apply missing default label fallback
Diffstat (limited to 'lua/clever_f/testing')
-rw-r--r--lua/clever_f/testing/memory_host.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/lua/clever_f/testing/memory_host.lua b/lua/clever_f/testing/memory_host.lua
index 459c9a8..0f8fc2d 100644
--- a/lua/clever_f/testing/memory_host.lua
+++ b/lua/clever_f/testing/memory_host.lua
@@ -663,6 +663,38 @@ function MemoryHost:highlight_groups()
return copy(self._highlight_groups)
end
+function MemoryHost:define_highlight_group(name, definition, options)
+ if type(name) ~= "string" or name == "" then
+ error("highlight group name must be a nonempty string", 2)
+ end
+ if type(definition) ~= "table" then
+ error("highlight group definition must be a table", 2)
+ end
+ options = options or {}
+ if type(options) ~= "table" then
+ error("highlight group options must be a table", 2)
+ end
+ if options.default ~= nil and type(options.default) ~= "boolean" then
+ error("highlight group default option must be a Boolean", 2)
+ end
+ if options.force ~= nil and type(options.force) ~= "boolean" then
+ error("highlight group force option must be a Boolean", 2)
+ end
+
+ local exists = self._highlight_groups[name] ~= nil
+ local applied = not (exists and options.default)
+ if applied then
+ self._highlight_groups[name] = copy(definition)
+ end
+ self:_record("define_highlight_group", {
+ name = name,
+ definition = definition,
+ options = options,
+ applied = applied,
+ })
+ return applied
+end
+
function MemoryHost:create_highlight(specification)
if type(specification) ~= "table" then
error("highlight specification must be a table", 2)