aboutsummaryrefslogtreecommitdiff
path: root/tests/test-wttrin-debug-disable.el
blob: f6fc5db415b63cf2ab9cb14d17dee5504fbea5fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
;;; test-wttrin-debug-disable.el --- Tests for wttrin-debug-disable -*- lexical-binding: t; -*-

;; Copyright (C) 2025-2026 Craig Jennings

;;; Commentary:

;; Unit tests for wttrin-debug-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-wttrin-debug-disable-normal-flips-from-t-to-nil ()
  "Calling disable when wttrin-debug is t sets it to nil."
  (let ((wttrin-debug t))
    (wttrin-debug-disable)
    (should-not wttrin-debug)))

(ert-deftest test-wttrin-debug-disable-normal-idempotent-when-already-disabled ()
  "Calling disable when wttrin-debug is already nil leaves it nil."
  (let ((wttrin-debug nil))
    (wttrin-debug-disable)
    (should-not wttrin-debug)))

;;; Boundary Cases

(ert-deftest test-wttrin-debug-disable-boundary-clears-non-boolean-truthy-value ()
  "Calling disable replaces any truthy value with nil."
  (let ((wttrin-debug 'verbose))
    (wttrin-debug-disable)
    (should-not wttrin-debug)))

(provide 'test-wttrin-debug-disable)
;;; test-wttrin-debug-disable.el ends here