diff options
| author | Craig Jennings <c@cjennings.net> | 2026-04-30 00:28:29 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-04-30 00:28:29 -0500 |
| commit | e7938e9193ba1a39aab0e614bb3bf682508685b2 (patch) | |
| tree | b1b64f14c5d5de5defb1a8f418ed6fe08b57ecd9 /tests/testutil-gloss-drill.el | |
| parent | 29c21851bddf76c5fd659d4225bb426fc1396750 (diff) | |
| download | gloss-e7938e9193ba1a39aab0e614bb3bf682508685b2.tar.gz gloss-e7938e9193ba1a39aab0e614bb3bf682508685b2.zip | |
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.
Diffstat (limited to 'tests/testutil-gloss-drill.el')
| -rw-r--r-- | tests/testutil-gloss-drill.el | 40 |
1 files changed, 40 insertions, 0 deletions
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 |
