From bdf9a71ab7baa2b1de9abcfd5df1a9107a55d141 Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Sun, 5 Jul 2026 01:19:30 -0400 Subject: add a bunch of emacs packages HELP --- .../test/evil-collection-magit-tests.el | 112 +++++++++++++++++++++ .../evil-collection/test/evil-collection-test.el | 41 ++++++++ .../emacs/lisp/evil-collection/test/test-helper.el | 9 ++ 3 files changed, 162 insertions(+) create mode 100644 .config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el create mode 100644 .config/emacs/lisp/evil-collection/test/evil-collection-test.el create mode 100644 .config/emacs/lisp/evil-collection/test/test-helper.el (limited to '.config/emacs/lisp/evil-collection/test') diff --git a/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el b/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el new file mode 100644 index 0000000..9b4c892 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/test/evil-collection-magit-tests.el @@ -0,0 +1,112 @@ +;;; evil-collection-magit-tests.el --- evil-based key bindings for magit + +;; Copyright (C) 2015-2016 Justin Burkett + +;; Author: Justin Burkett +;; Homepage: https://github.com/emacs-evil/evil-collection + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation; either version 3, or (at your +;; option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; For a full copy of the GNU General Public License +;; see . +(require 'evil-collection) +(evil-collection-require 'magit) + +(ert-deftest evil-collection-magit-mode-map-tests () + "Test that original bindings in `evil-collection-magit-mode-map-bindings' +are correct." + (dolist (binding evil-collection-magit-mode-map-bindings) + (when (nth 4 binding) + (should (eq (lookup-key (symbol-value (nth 1 binding)) (kbd (nth 4 binding))) + (nth 3 binding))))) + (dolist (binding evil-collection-magit-minor-mode-map-bindings) + (when (nth 4 binding) + (should (eq (lookup-key (symbol-value (nth 1 binding)) (kbd (nth 4 binding))) + (nth 3 binding)))))) + +(ert-deftest evil-collection-magit-section-map-tests () + "Test that original bindings in +`evil-collection-magit-original-section-bindings' are correct." + (dolist (binding evil-collection-magit-original-section-bindings) + (should (eq (lookup-key (nth 0 binding) (nth 1 binding)) + (nth 2 binding))))) + +;; (ert-deftest evil-collection-magit-popup-action-tests () +;; "Test that bindings are as expected in popups." +;; (when evil-collection-magit-popup-keys-changed +;; (dolist (change evil-collection-magit-popup-changes) +;; (let ((alist (plist-get (symbol-value (nth 0 change)) (nth 1 change)))) +;; (should +;; (eq (nth 2 (assoc (string-to-char (nth 3 change)) alist)) +;; (nth 4 change))))))) + +(defun evil-collection-magit-collect-magit-section-maps () + (let (res) + (mapatoms + (lambda (sym) + (when (string-match-p "^magit-.*-section-map$" (symbol-name sym)) + (push sym res)))) + res)) + +(setq evil-collection-magit-section-maps-test (evil-collection-magit-collect-magit-section-maps)) +;; (setq evil-collection-magit-commands-in-section-maps +;; (let (res) +;; (dolist (map evil-collection-magit-section-maps-test) +;; (when (and (boundp map) (keymapp (symbol-value map))) +;; (map-keymap +;; (lambda (_ def) +;; (when (commandp def) +;; (if res +;; (add-to-list 'res def) +;; (setq res (list def))))) +;; (symbol-value map)))) +;; res)) + +(ert-deftest evil-collection-magit-section-maps-accounted-for () + "Check that `evil-collection-magit-section-maps' includes all section-maps +we can find." + (dolist (map evil-collection-magit-section-maps-test) + (when (and (boundp map) (keymapp (symbol-value map))) + (should (memq map evil-collection-magit-section-maps))))) + +(defun evil-collection-magit-collect-git-magit-modes () + (let (res) + (mapatoms + (lambda (sym) + (when (and (or (boundp sym) + (fboundp sym)) + (string-match-p "^\\(git\\|magit\\)-.*-mode$" (symbol-name sym))) + (push sym res)))) + res)) + +(ert-deftest evil-collection-magit-all-modes-accounted-for () + "Check that mode lists include all modes we can find." + (let ((modes (evil-collection-magit-collect-git-magit-modes)) + res) + (dolist (mode modes) + (when (boundp mode) + (should (memq mode + (append + evil-collection-magit-emacs-to-default-state-modes + evil-collection-magit-emacs-to-evil-collection-magit-state-modes + evil-collection-magit-default-to-evil-collection-magit-state-modes + evil-collection-magit-untouched-modes + evil-collection-magit-ignored-modes))))))) + +(ert-deftest evil-collection-magit-expand-region-arg-number () + "Check that the number of args accepted by +`evil-visual-expand-region' does not change." + (should-not (evil-visual-expand-region)) + (should-not (evil-visual-expand-region t)) + (should-error (evil-visual-expand-region t t) :type + 'wrong-number-of-arguments)) + +;;; evil-collection-magit-tests.el ends here diff --git a/.config/emacs/lisp/evil-collection/test/evil-collection-test.el b/.config/emacs/lisp/evil-collection/test/evil-collection-test.el new file mode 100644 index 0000000..a88fce4 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/test/evil-collection-test.el @@ -0,0 +1,41 @@ +;;; evil-collection-test.el --- Tests for evil-collection -*- lexical-binding: t -*- +(require 'evil-collection) + +(ert-deftest evil-collection-zero-test () + "Zero check blank test." + (should (equal 0 0))) + +(ert-deftest evil-collection-filtering-states-test () + "Test `evil-collection--filter-states'." + (let ((evil-collection-state-denylist '()) + (evil-collection-state-passlist '())) + (should + (equal nil + (evil-collection--filter-states nil))) + (should + (equal '(normal) + (evil-collection--filter-states 'normal))) + (should + (equal '(normal) + (evil-collection--filter-states '(normal))))) + (let ((evil-collection-state-denylist '(insert)) + (evil-collection-state-passlist '())) + (should + (equal '() + (evil-collection--filter-states 'insert))) + (should + (equal '(visual) + (evil-collection--filter-states '(visual insert))))) + (let ((evil-collection-state-denylist '(insert)) + (evil-collection-state-passlist '(normal visual))) + (should + (equal '() + (evil-collection--filter-states '()))) + (should + (equal '(visual) + (evil-collection--filter-states '(insert visual)))) + (should + (seq-set-equal-p '(visual normal) + (evil-collection--filter-states '(motion normal visual insert)))))) + +;;; evil-collection-test.el ends here diff --git a/.config/emacs/lisp/evil-collection/test/test-helper.el b/.config/emacs/lisp/evil-collection/test/test-helper.el new file mode 100644 index 0000000..b5d9e63 --- /dev/null +++ b/.config/emacs/lisp/evil-collection/test/test-helper.el @@ -0,0 +1,9 @@ +;;; test-helper.el --- Helpers for evil-collection-test.el -*- lexical-binding: t -*- +(require 'ert) + +;; FIXME: Adding `f' as a dependency just for this line. +(require 'f) +(let ((evil-collection-dir (f-parent (f-dirname (f-this-file))))) + (add-to-list 'load-path evil-collection-dir)) +(require 'evil-collection) +;;; test-helper.el ends here -- cgit v1.2.3