From b0ca38bc98f240e208edd08009856ab6de62c227 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 11 Jul 2026 23:52:49 -0500 Subject: refactor(gallery): rename generated tokens.el to gallery-tokens.el The generated file declares (provide 'gallery-tokens), but `require` resolves a feature by filename, so as tokens.el it could never load from a load-path. The name now matches the feature. gen_tokens.py, the renderer's load, and the README follow. --- tests/gallery-tokens/test_gen_tokens.py | 12 +++++++++++- tests/gallery-widgets/test-gallery-widget.el | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/gallery-tokens/test_gen_tokens.py b/tests/gallery-tokens/test_gen_tokens.py index 414194e..b9fbb50 100644 --- a/tests/gallery-tokens/test_gen_tokens.py +++ b/tests/gallery-tokens/test_gen_tokens.py @@ -210,6 +210,16 @@ class RealTokensJson(unittest.TestCase): self.assertIn("pulse-rate", self.tokens["timing"]) +class DefaultElispFilename(unittest.TestCase): + """The default elisp target must be gallery-tokens.el so that the file's + (provide 'gallery-tokens) matches its name and `require` can resolve it + from a load-path. A tokens.el/gallery-tokens feature mismatch is a trap.""" + + def test_default_elisp_path_matches_provided_feature(self): + self.assertEqual( + os.path.basename(gt.DEFAULT_ELISP_NAME), "gallery-tokens.el") + + class MainIntegration(unittest.TestCase): """main() rewrites the html :root and writes the waybar + elisp files.""" @@ -218,7 +228,7 @@ class MainIntegration(unittest.TestCase): self.html = os.path.join(self.tmp, "gallery.html") self.tokens_path = os.path.join(self.tmp, "tokens.json") self.waybar = os.path.join(self.tmp, "tokens-waybar.css") - self.elisp = os.path.join(self.tmp, "tokens.el") + self.elisp = os.path.join(self.tmp, "gallery-tokens.el") with open(self.tokens_path, "w") as f: json.dump(FIXTURE, f) with open(self.html, "w") as f: diff --git a/tests/gallery-widgets/test-gallery-widget.el b/tests/gallery-widgets/test-gallery-widget.el index ec484bb..166cd59 100644 --- a/tests/gallery-widgets/test-gallery-widget.el +++ b/tests/gallery-widgets/test-gallery-widget.el @@ -2,7 +2,7 @@ ;;; Commentary: ;; Tests for the svg.el proof-of-concept renderer in docs/prototypes/. -;; gallery-widget.el reads the generated tokens.el (same source of truth as +;; gallery-widget.el reads the generated gallery-tokens.el (same source of truth as ;; the web gallery and the waybar CSS) and renders gallery widgets as SVG. ;; These tests exercise the REAL module (loaded by path, not a copy): ;; token resolution, needle-angle math (normal/boundary/error), and the -- cgit v1.2.3