From e7938e9193ba1a39aab0e614bb3bf682508685b2 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 30 Apr 2026 00:28:29 -0500 Subject: test: add gloss-drill test suite (red phase) Four test files plus a small testutil for toggling the `org-drill' feature flag. All 10 tests fail at this commit because the implementation is still a stub. The suite covers Normal (untagged entries get the tag and property), Boundary (empty file, idempotency, untag never-tagged), and Error (org-drill not installed). The error path also asserts the file is left untouched. Untag-all is tested under both feature states because the user might want to remove tags after uninstalling org-drill. --- tests/testutil-gloss-drill.el | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/testutil-gloss-drill.el (limited to 'tests/testutil-gloss-drill.el') diff --git a/tests/testutil-gloss-drill.el b/tests/testutil-gloss-drill.el new file mode 100644 index 0000000..721922c --- /dev/null +++ b/tests/testutil-gloss-drill.el @@ -0,0 +1,40 @@ +;;; testutil-gloss-drill.el --- Shared test fixtures for gloss-drill -*- lexical-binding: t -*- + +;; SPDX-License-Identifier: GPL-3.0-or-later + +;;; Commentary: + +;; Fixtures used across `gloss-drill' test files. Provides: +;; - `gloss-test--with-org-drill-feature' macro to register `org-drill' +;; as a feature for the duration of BODY (without actually loading it). + +;;; Code: + +(defmacro gloss-test--with-org-drill-feature (&rest body) + "Run BODY with `org-drill' provided as a feature. +Restores the prior feature state on exit so tests can both assert +\"org-drill present\" and \"org-drill absent\" behaviour without leaking +state across the suite." + (declare (indent 0) (debug t)) + `(let ((had-org-drill (featurep 'org-drill))) + (unwind-protect + (progn + (provide 'org-drill) + ,@body) + (unless had-org-drill + (setq features (delq 'org-drill features)))))) + +(defmacro gloss-test--without-org-drill-feature (&rest body) + "Run BODY with `org-drill' un-registered as a feature. +Restores the prior feature state on exit." + (declare (indent 0) (debug t)) + `(let ((had-org-drill (featurep 'org-drill))) + (unwind-protect + (progn + (setq features (delq 'org-drill features)) + ,@body) + (when had-org-drill + (provide 'org-drill))))) + +(provide 'testutil-gloss-drill) +;;; testutil-gloss-drill.el ends here -- cgit v1.2.3