aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/test_generate.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-04 11:35:22 -0500
committerCraig Jennings <c@cjennings.net>2026-07-04 11:35:22 -0500
commit0be572e43f8118f6c678a536b3d97d7e976e840f (patch)
tree17719837151de42a3ff9a494a1c953898dc29fd7 /scripts/theme-studio/test_generate.py
parenteb923ab475394069b3d0bcb6343bf7aa4d108d6a (diff)
downloaddotemacs-0be572e43f8118f6c678a536b3d97d7e976e840f.tar.gz
dotemacs-0be572e43f8118f6c678a536b3d97d7e976e840f.zip
fix(theme-studio): persist regexp/doc/negation/warning syntax faces
Five syntax categories (rxgb, rxgc, dmark, neg, warn) rendered as editable rows but had no COLS entry, so build_syntax never gave them a SYNTAX slot. They exported nothing and re-imported nothing, so every saved theme dropped them. I added the five to COLS, where the default-face seed fills their real colors and they round-trip through save and import. A regression test now asserts every editable category has a COLS slot.
Diffstat (limited to 'scripts/theme-studio/test_generate.py')
-rw-r--r--scripts/theme-studio/test_generate.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/theme-studio/test_generate.py b/scripts/theme-studio/test_generate.py
index 0415d04f..ac225ce2 100644
--- a/scripts/theme-studio/test_generate.py
+++ b/scripts/theme-studio/test_generate.py
@@ -932,5 +932,20 @@ class BespokePreviewFaceCoverage(unittest.TestCase):
self.assertEqual(missing, [])
+class SyntaxCategoriesPersist(unittest.TestCase):
+ """Every editable syntax category (CATS) must have a persistable slot.
+
+ build_syntax keys SYNTAX off COLS (plus the specially-added bg), and both
+ export (dumps SYNTAX) and import (iterates CATS reading d.syntax[k]) rely on
+ that slot existing. A category in CATS but absent from COLS renders as an
+ editable row whose value never saves and never re-imports -- the drift that
+ dropped rxgb/rxgc/dmark/neg/warn from every saved theme."""
+
+ def test_every_cats_category_has_a_cols_slot(self):
+ cats = {c[0] for c in generate.CATS}
+ slots = set(generate.COLS) | {"bg"}
+ self.assertEqual(cats - slots, set())
+
+
if __name__ == "__main__":
unittest.main()