summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/verify-against-core.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/verify-against-core.lua b/scripts/verify-against-core.lua
new file mode 100644
index 0000000..f66bb74
--- /dev/null
+++ b/scripts/verify-against-core.lua
@@ -0,0 +1,50 @@
+-- Run this with the real Panto interpreter from pantograph:
+-- panto lua scripts/verify-against-core.lua
+--
+-- Compare the extension's computed snapshots directly with core so mismatches
+-- remain visible even when activation skips names already owned by core.
+
+local source = debug.getinfo(1, "S").source
+local scripts_dir = source:match("^@(.*)/[^/]+$") or "."
+local root = scripts_dir .. "/.."
+package.path = root .. "/?.lua;" .. package.path
+
+local panto = require("panto")
+local roles = {
+ "dim", "assistant", "user", "tool", "footer", "tool_text",
+ "tool_pending", "tool_success", "tool_error", "compaction_header",
+ "thinking_header", "cursor", "err", "welcome", "waiting_peak",
+ "waiting_near", "waiting_far", "err_diff", "add_diff", "thinking",
+ "compaction", "user_bg", "tool_pending_bg", "tool_success_bg",
+ "tool_error_bg", "diff_remove_bg", "diff_add_bg", "user_text",
+ "tool_header", "canvas_fg", "canvas_bg", "syntax_base",
+ "syntax_comment", "syntax_string", "syntax_number", "syntax_keyword",
+ "syntax_function", "syntax_type", "syntax_variable", "syntax_tag",
+ "reset",
+}
+local moved = {
+ "Tokyo Night", "Catppuccin Mocha", "Gruvbox Dark", "Solarized Light",
+ "Solarized Dark", "Nord", "Dracula", "Tokyo Storm", "Tokyo Moon",
+ "Tokyo Day", "Catppuccin Latte", "Catppuccin Frappe",
+ "Catppuccin Macchiato", "Gruvbox Dark Hard", "Gruvbox Dark Soft",
+ "Gruvbox Light", "Gruvbox Light Hard", "Gruvbox Light Soft",
+ "Dracula Soft",
+}
+local entry = require("panto-popular-themes.init")
+assert(entry.name == "themes.popular", "wrong extension entry")
+assert(type(entry.values) == "function", "missing extension values")
+
+-- Activation skips names already owned by core or another extension, so
+-- compare the generated snapshots directly instead of relying on a conflict.
+for _, name in ipairs(moved) do
+ local expected = panto.ext.style(name)
+ local actual = entry.values(name)
+ assert(actual, "extension has no theme " .. name)
+ for _, role in ipairs(roles) do
+ if expected[role] ~= actual[role] then
+ error("theme " .. name .. " role " .. role .. " mismatch", 0)
+ end
+ end
+end
+
+entry.activate()