aboutsummaryrefslogtreecommitdiff
path: root/tests/test-debug-wttrin-disable.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-debug-wttrin-disable.el')
-rw-r--r--tests/test-debug-wttrin-disable.el43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test-debug-wttrin-disable.el b/tests/test-debug-wttrin-disable.el
new file mode 100644
index 0000000..dc560c3
--- /dev/null
+++ b/tests/test-debug-wttrin-disable.el
@@ -0,0 +1,43 @@
+;;; test-debug-wttrin-disable.el --- Tests for debug-wttrin-disable -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2025-2026 Craig Jennings
+
+;;; Commentary:
+
+;; Unit tests for debug-wttrin-disable. Verifies the interactive command
+;; clears `wttrin-debug' and is idempotent when already disabled.
+
+;;; 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-disable-normal-flips-from-t-to-nil ()
+ "Calling disable when wttrin-debug is t sets it to nil."
+ (let ((wttrin-debug t))
+ (debug-wttrin-disable)
+ (should-not wttrin-debug)))
+
+(ert-deftest test-debug-wttrin-disable-normal-idempotent-when-already-disabled ()
+ "Calling disable when wttrin-debug is already nil leaves it nil."
+ (let ((wttrin-debug nil))
+ (debug-wttrin-disable)
+ (should-not wttrin-debug)))
+
+;;; Boundary Cases
+
+(ert-deftest test-debug-wttrin-disable-boundary-clears-non-boolean-truthy-value ()
+ "Calling disable replaces any truthy value with nil."
+ (let ((wttrin-debug 'verbose))
+ (debug-wttrin-disable)
+ (should-not wttrin-debug)))
+
+(provide 'test-debug-wttrin-disable)
+;;; test-debug-wttrin-disable.el ends here