aboutsummaryrefslogtreecommitdiff
path: root/tests/test-keybindings-tty-mirror.el
blob: f63024c0b3093a8ac0ffaf0afde688990e38fdc3 (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
;;; test-keybindings-tty-mirror.el --- TTY mirror prefix for the C-; family -*- lexical-binding: t; -*-

;;; Commentary:
;; The personal prefix C-; is GUI-only — terminals can't encode Control-semicolon,
;; so the whole custom command family is unreachable in a TTY frame (emacs -nw,
;; emacsclient -nw, Emacs inside vterm/tmux).  keybindings.el binds the single
;; `cj/custom-keymap' under a TTY-safe mirror prefix C-c ; alongside C-;, so the
;; same leaf keys reach the identical map in both GUI and terminal.  These tests
;; pin that load-time global binding.

;;; Code:

(require 'ert)

(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(require 'keybindings)

(ert-deftest test-keybindings-tty-mirror-gui-prefix-resolves ()
  "Normal: the GUI prefix C-; resolves to cj/custom-keymap globally."
  (should (eq (keymap-lookup (current-global-map) "C-;") cj/custom-keymap)))

(ert-deftest test-keybindings-tty-mirror-tty-prefix-resolves ()
  "Normal: the TTY mirror C-c ; resolves to the same cj/custom-keymap."
  (should (eq (keymap-lookup (current-global-map) "C-c ;") cj/custom-keymap)))

(ert-deftest test-keybindings-tty-mirror-both-prefixes-share-one-map ()
  "Boundary: both prefixes point at the identical keymap object, so a leaf
key registered once is reachable under either prefix."
  (should (eq (keymap-lookup (current-global-map) "C-;")
              (keymap-lookup (current-global-map) "C-c ;"))))

(provide 'test-keybindings-tty-mirror)
;;; test-keybindings-tty-mirror.el ends here