aboutsummaryrefslogtreecommitdiff
path: root/tests/test-debug-wttrin-enable.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-debug-wttrin-enable.el')
-rw-r--r--tests/test-debug-wttrin-enable.el43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test-debug-wttrin-enable.el b/tests/test-debug-wttrin-enable.el
new file mode 100644
index 0000000..569547d
--- /dev/null
+++ b/tests/test-debug-wttrin-enable.el
@@ -0,0 +1,43 @@
+;;; test-debug-wttrin-enable.el --- Tests for debug-wttrin-enable -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2025-2026 Craig Jennings
+
+;;; Commentary:
+
+;; Unit tests for debug-wttrin-enable. Verifies the interactive command
+;; flips `wttrin-debug' to t and is idempotent when already enabled.
+
+;;; Code:
+
+(require 'ert)
+(require 'wttrin)
+(require 'testutil-wttrin)
+
+(require 'wttrin-debug
+ (expand-file-name "wttrin-debug.el"
+ (file-name-directory (locate-library "wttrin"))))
+
+;;; Normal Cases
+
+(ert-deftest test-debug-wttrin-enable-normal-flips-from-nil-to-t ()
+ "Calling enable when wttrin-debug is nil sets it to t."
+ (let ((wttrin-debug nil))
+ (debug-wttrin-enable)
+ (should (eq wttrin-debug t))))
+
+(ert-deftest test-debug-wttrin-enable-normal-idempotent-when-already-enabled ()
+ "Calling enable when wttrin-debug is already t leaves it t."
+ (let ((wttrin-debug t))
+ (debug-wttrin-enable)
+ (should (eq wttrin-debug t))))
+
+;;; Boundary Cases
+
+(ert-deftest test-debug-wttrin-enable-boundary-overrides-non-boolean-truthy-value ()
+ "Calling enable replaces a non-boolean truthy value with t."
+ (let ((wttrin-debug 'verbose))
+ (debug-wttrin-enable)
+ (should (eq wttrin-debug t))))
+
+(provide 'test-debug-wttrin-enable)
+;;; test-debug-wttrin-enable.el ends here