From 0fb3ae438277146a1167cc46ed6c3218a14281ff Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 30 Apr 2026 08:29:42 -0500 Subject: test(config-utilities): cover with-timer, compile-buffer, summary, info commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four new test files extending the existing coverage of cj/emacs-build--format-build-time. The interactive heavyweights (cj/recompile-emacs-home, cj/delete-emacs-home-compiled-files, cj/benchmark-this-method, cj/validate-org-agenda-timestamps) are out of scope for this pass — each needs an internal/wrapper split first before tests can exercise the logic without UI. - with-timer macro: 4 tests asserting it returns the FORMS' value, evaluates the body exactly once, emits both announce and done messages, and returns the last form when given multiple. - cj/compile-this-elisp-buffer: 6 tests dispatching across native-async, native-sync, and byte-compile fallbacks, plus the not-elisp / no-buffer-file-name error paths and the sync-native error catch. - cj/emacs-build--summary-string: 5 tests asserting the shape of the multi-line report (Version, System, Build date, Capabilities section, yes/no flag rendering) without locking exact wording. - info-commands smoke: 5 tests exercising cj/info-emacs-build, cj/info-loaded-packages, cj/info-loaded-features, cj/reload-init-file, and cj/org-alert-list-timers via boundary-mocked pop-to-buffer and load-file, asserting buffer creation, content shape, or echo-area message as appropriate. 20 new tests, all passing. Full suite green. --- tests/test-config-utilities--summary-string.el | 54 ++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/test-config-utilities--summary-string.el (limited to 'tests/test-config-utilities--summary-string.el') diff --git a/tests/test-config-utilities--summary-string.el b/tests/test-config-utilities--summary-string.el new file mode 100644 index 000000000..cd9ae77a8 --- /dev/null +++ b/tests/test-config-utilities--summary-string.el @@ -0,0 +1,54 @@ +;;; test-config-utilities--summary-string.el --- Tests for cj/emacs-build--summary-string -*- lexical-binding: t; -*- + +;;; Commentary: +;; Tests for `cj/emacs-build--summary-string'. The function returns a +;; multi-line string covering Emacs version, system, build metadata, +;; and capability flags. Tests assert that key sections are present +;; without locking to exact wording. + +;;; Code: + +(require 'ert) + +(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory)) +(require 'config-utilities) + +(ert-deftest test-config-utilities-summary-string-includes-version-line () + "Normal: summary string includes a Version line with `emacs-version'." + (let ((text (cj/emacs-build--summary-string))) + (should (string-match-p (regexp-quote (format "Version: %s" emacs-version)) + text)))) + +(ert-deftest test-config-utilities-summary-string-includes-system-line () + "Normal: summary string includes the System: line." + (should (string-match-p "^System: " (cj/emacs-build--summary-string)))) + +(ert-deftest test-config-utilities-summary-string-includes-build-date-line () + "Normal: summary string includes Build date." + (should (string-match-p "^Build date: " (cj/emacs-build--summary-string)))) + +(ert-deftest test-config-utilities-summary-string-includes-capabilities-section () + "Normal: summary string includes the Capabilities section with the +known capability lines (native compilation, dynamic modules, GnuTLS, +libxml2, ImageMagick, SQLite)." + (let ((text (cj/emacs-build--summary-string))) + (should (string-match-p "Capabilities:" text)) + (dolist (cap '("Native compilation" + "Dynamic modules" + "GnuTLS" + "libxml2" + "ImageMagick" + "SQLite")) + (should (string-match-p (regexp-quote cap) text))))) + +(ert-deftest test-config-utilities-summary-string-renders-yes-or-no-flags () + "Boundary: each capability line ends in either \"yes\" or \"no\"." + (let ((text (cj/emacs-build--summary-string))) + (dolist (cap '("Native compilation" "Dynamic modules" + "GnuTLS" "libxml2" + "ImageMagick" "SQLite")) + (let ((re (concat "^- " (regexp-quote cap) ": \\(yes\\|no\\)"))) + (should (string-match-p re text)))))) + +(provide 'test-config-utilities--summary-string) +;;; test-config-utilities--summary-string.el ends here -- cgit v1.2.3