aboutsummaryrefslogtreecommitdiff
path: root/tests/test-gloss--add-finish-internal.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-gloss--add-finish-internal.el')
-rw-r--r--tests/test-gloss--add-finish-internal.el47
1 files changed, 19 insertions, 28 deletions
diff --git a/tests/test-gloss--add-finish-internal.el b/tests/test-gloss--add-finish-internal.el
index 688d6f2..bb7e4ee 100644
--- a/tests/test-gloss--add-finish-internal.el
+++ b/tests/test-gloss--add-finish-internal.el
@@ -15,47 +15,38 @@
(require 'gloss)
(require 'testutil-gloss)
-(ert-deftest test-gloss-add-finish-internal-saves-and-shows ()
- "Normal: a fresh term + body is saved with source `manual' and shown."
+(ert-deftest test-gloss-add-finish-internal-saves-with-manual-source ()
+ "Normal: a fresh term + body is saved with source `manual'.
+Display is the caller's responsibility, not this function's."
(gloss-test--with-missing-glossary
- (let (shown)
- (cl-letf (((symbol-function 'gloss-display-show-entry)
- (lambda (term body) (setq shown (list term body)))))
- (gloss--add-finish-internal "newterm" "A new definition.")
- (let ((saved (gloss-core-lookup "newterm")))
- (should saved)
- (should (equal (plist-get saved :body) "A new definition."))
- (should (eq (plist-get saved :source) 'manual)))
- (should (equal shown '("newterm" "A new definition.")))))))
+ (let ((saved (gloss--add-finish-internal "newterm" "A new definition.")))
+ (should saved)
+ (should (equal (plist-get saved :body) "A new definition."))
+ (should (eq (plist-get saved :source) 'manual))
+ (should (equal (gloss-core-lookup "newterm") saved)))))
(ert-deftest test-gloss-add-finish-internal-empty-term-raises ()
"Error: empty TERM raises `user-error'."
(gloss-test--with-missing-glossary
- (cl-letf (((symbol-function 'gloss-display-show-entry)
- (lambda (_ _) nil)))
- (should-error (gloss--add-finish-internal "" "Body.")
- :type 'user-error)
- (should-error (gloss--add-finish-internal " " "Body.")
- :type 'user-error))))
+ (should-error (gloss--add-finish-internal "" "Body.")
+ :type 'user-error)
+ (should-error (gloss--add-finish-internal " " "Body.")
+ :type 'user-error)))
(ert-deftest test-gloss-add-finish-internal-empty-body-raises ()
"Error: empty BODY raises `user-error'."
(gloss-test--with-missing-glossary
- (cl-letf (((symbol-function 'gloss-display-show-entry)
- (lambda (_ _) nil)))
- (should-error (gloss--add-finish-internal "term" "")
- :type 'user-error)
- (should-error (gloss--add-finish-internal "term" " \n ")
- :type 'user-error))))
+ (should-error (gloss--add-finish-internal "term" "")
+ :type 'user-error)
+ (should-error (gloss--add-finish-internal "term" " \n ")
+ :type 'user-error)))
(ert-deftest test-gloss-add-finish-internal-trims-body-whitespace ()
"Boundary: leading/trailing whitespace in BODY is trimmed before save."
(gloss-test--with-missing-glossary
- (cl-letf (((symbol-function 'gloss-display-show-entry)
- (lambda (_ _) nil)))
- (gloss--add-finish-internal "term" " Body content.\n\n")
- (let ((saved (gloss-core-lookup "term")))
- (should (equal (plist-get saved :body) "Body content."))))))
+ (gloss--add-finish-internal "term" " Body content.\n\n")
+ (let ((saved (gloss-core-lookup "term")))
+ (should (equal (plist-get saved :body) "Body content.")))))
(provide 'test-gloss--add-finish-internal)
;;; test-gloss--add-finish-internal.el ends here