aboutsummaryrefslogtreecommitdiff
path: root/tests/test-gloss-drill--export-all-no-orgdrill-installed.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-04-30 00:28:29 -0500
committerCraig Jennings <c@cjennings.net>2026-04-30 00:28:29 -0500
commite7938e9193ba1a39aab0e614bb3bf682508685b2 (patch)
treeb1b64f14c5d5de5defb1a8f418ed6fe08b57ecd9 /tests/test-gloss-drill--export-all-no-orgdrill-installed.el
parent29c21851bddf76c5fd659d4225bb426fc1396750 (diff)
downloadgloss-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/test-gloss-drill--export-all-no-orgdrill-installed.el')
-rw-r--r--tests/test-gloss-drill--export-all-no-orgdrill-installed.el38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test-gloss-drill--export-all-no-orgdrill-installed.el b/tests/test-gloss-drill--export-all-no-orgdrill-installed.el
new file mode 100644
index 0000000..f8f4967
--- /dev/null
+++ b/tests/test-gloss-drill--export-all-no-orgdrill-installed.el
@@ -0,0 +1,38 @@
+;;; test-gloss-drill--export-all-no-orgdrill-installed.el --- Error tests for missing org-drill -*- lexical-binding: t -*-
+
+;; SPDX-License-Identifier: GPL-3.0-or-later
+
+;;; Commentary:
+;; Tests for `gloss-drill-export-all' covering the Error case where
+;; `org-drill' is not installed. The function must raise `user-error'
+;; with an install hint and must not touch `gloss-file'.
+
+;;; Code:
+
+(require 'ert)
+(require 'gloss-drill)
+(require 'testutil-gloss)
+(require 'testutil-gloss-drill)
+
+(ert-deftest test-gloss-drill-export-all-without-org-drill-raises-user-error ()
+ "Error: missing `org-drill' raises `user-error' with an install hint."
+ (gloss-test--with-temp-glossary gloss-test--sample-content
+ (gloss-test--without-org-drill-feature
+ (let ((err (should-error (gloss-drill-export-all) :type 'user-error)))
+ (should (string-match-p "org-drill" (error-message-string err)))))))
+
+(ert-deftest test-gloss-drill-export-all-without-org-drill-leaves-file-untouched ()
+ "Error: missing `org-drill' must not modify the glossary file."
+ (gloss-test--with-temp-glossary gloss-test--sample-content
+ (gloss-test--without-org-drill-feature
+ (let ((before (with-temp-buffer
+ (insert-file-contents gloss-file)
+ (buffer-string))))
+ (ignore-errors (gloss-drill-export-all))
+ (let ((after (with-temp-buffer
+ (insert-file-contents gloss-file)
+ (buffer-string))))
+ (should (equal before after)))))))
+
+(provide 'test-gloss-drill--export-all-no-orgdrill-installed)
+;;; test-gloss-drill--export-all-no-orgdrill-installed.el ends here