diff options
| author | Craig Jennings <c@cjennings.net> | 2026-08-26 12:21:29 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-08-26 12:21:29 -0600 |
| commit | 0afff24b6e0e80bc5b83ab233ada822caef728a6 (patch) | |
| tree | 0ee4611865738add12e6873dcda4c89a918fcbb6 /tests | |
| parent | 9b102d6fb23074bebc626bfe4e61c677c006ae37 (diff) | |
| download | dotemacs-0afff24b6e0e80bc5b83ab233ada822caef728a6.tar.gz dotemacs-0afff24b6e0e80bc5b83ab233ada822caef728a6.zip | |
fix(init): declare malyon and 2048-game so a fresh machine installs them
a8571eff moved games-config behind with-eval-after-load 'malyon and deleted the two use-package forms, which were the only thing that ever installed malyon and 2048-game. The old elpa directories masked that until the 2026-08-13 reinstall rebuilt elpa from declarations and both packages came up absent. I declared them in init.el's entertainment section with :defer t and :commands, so use-package-always-ensure installs them while the module stays command-loaded. They live in init.el rather than games-config because that module only loads once malyon has, so it can't be what installs malyon.
The new test checks that init.el declares both packages in forms use-package would install, and rejects :ensure nil and :load-path forms.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-init-defer-games.el | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test-init-defer-games.el b/tests/test-init-defer-games.el index f3ec94de..4f349908 100644 --- a/tests/test-init-defer-games.el +++ b/tests/test-init-defer-games.el @@ -42,5 +42,36 @@ load failed to define malyon." (should (featurep 'games-config)) (should (equal malyon-stories-directory "/tmp/games-defer-test/text.games/")))) +(defun test-init-defer-games--declaration-installs-p (init package) + "Return non-nil when INIT (init.el's text) declares PACKAGE in an installing form. +A `use-package' form that carries `:ensure nil' or `:load-path' does not +install (use-package suppresses `use-package-always-ensure' for both), so +the check rejects those rather than accepting any form that names the package." + (and (string-match (format "^(use-package %s\\b\\([^\n]*\\))[ \t]*$" + (regexp-quote package)) + init) + (let ((args (match-string 1 init))) + (not (string-match-p ":ensure nil\\|:load-path" args))))) + +(ert-deftest test-init-defer-games-init-declares-both-packages () + "Normal: init.el declares malyon and 2048-game in forms that install them. +`use-package-always-ensure' is the installer for these two. a8571eff dropped +the declarations along with the eager require, and both packages silently +vanished on the next rebuild while every other test still passed." + (let ((init (with-temp-buffer + (insert-file-contents (expand-file-name "init.el" default-directory)) + (buffer-string)))) + (should (test-init-defer-games--declaration-installs-p init "malyon")) + (should (test-init-defer-games--declaration-installs-p init "2048-game")))) + +(ert-deftest test-init-defer-games-declaration-check-rejects-non-installing-forms () + "Boundary: the declaration check refuses forms use-package would not install." + (should-not (test-init-defer-games--declaration-installs-p + "(use-package malyon :ensure nil :defer t)\n" "malyon")) + (should-not (test-init-defer-games--declaration-installs-p + "(use-package malyon :load-path \"~/x\" :defer t)\n" "malyon")) + (should (test-init-defer-games--declaration-installs-p + "(use-package malyon :defer t :commands (malyon))\n" "malyon"))) + (provide 'test-init-defer-games) ;;; test-init-defer-games.el ends here |
