mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-03 14:10:47 -08:00
* test/src/regex-emacs-tests.el (regex-tests-compare): (regex-tests-compare): (regex-tests-match): * test/lisp/xml-tests.el (xml-parse-tests--qnames): * test/lisp/mh-e/mh-thread-tests.el (mh-thread-tests-before-from): * test/lisp/cedet/srecode-utest-template.el (srecode-utest-map-reset): * test/lisp/calc/calc-tests.el (calc-tests-equal): * lisp/window.el (get-lru-window): (get-mru-window): (get-largest-window): (quit-restore-window): (display-buffer): * lisp/vc/vc-rcs.el (vc-rcs-consult-headers): * lisp/url/url-auth.el (url-digest-auth-build-response): * lisp/tutorial.el (tutorial--find-changed-keys): * lisp/transient.el (transient-suffix-object): * lisp/textmodes/rst.el (rst-insert-list-new-item): * lisp/textmodes/bibtex.el (bibtex-clean-entry): * lisp/tab-bar.el (tab-bar--key-to-number): (toggle-frame-tab-bar): * lisp/ses.el (ses-recalculate-cell): (ses-define-local-printer): (ses-prin1): * lisp/progmodes/xref.el (xref--find-ignores-arguments): * lisp/progmodes/verilog-mode.el (verilog-single-declaration-end): * lisp/progmodes/tcl.el (tcl-mode-hook): * lisp/progmodes/gdb-mi.el (gdb-get-buffer-create): * lisp/progmodes/elisp-mode.el (elisp--xref-make-xref): * lisp/play/dunnet.el (dun-room-objects): * lisp/outline.el (outline--cycle-state): * lisp/org/ox-publish.el (org-publish-find-property): * lisp/org/ox-html.el (org-html--unlabel-latex-environment): * lisp/org/org-table.el (org-table-collapse-header): * lisp/org/org-plot.el (org--plot/prime-factors): * lisp/org/org-agenda.el (org-agenda--mark-blocked-entry): (org-agenda-set-restriction-lock): * lisp/org/ob-lua.el (org-babel-lua-read-string): * lisp/org/ob-julia.el (org-babel-julia-evaluate-external-process): (org-babel-julia-evaluate-session): * lisp/org/ob-core.el (org-babel-default-header-args): * lisp/obsolete/mouse-sel.el (mouse-select): (mouse-select-secondary): * lisp/net/tramp.el (tramp-methods): * lisp/net/eww.el (eww-accept-content-types): * lisp/net/dictionary-connection.el (dictionary-connection-status): * lisp/minibuffer.el (completion-flex--make-flex-pattern): * lisp/mh-e/mh-mime.el (mh-have-file-command): * lisp/mh-e/mh-limit.el (mh-subject-to-sequence): (mh-subject-to-sequence-threaded): (mh-subject-to-sequence-unthreaded): * lisp/mail/feedmail.el (feedmail-queue-buffer-file-name): (feedmail-vm-mail-mode): * lisp/ls-lisp.el (ls-lisp--sanitize-switches): * lisp/keymap.el (key-valid-p): * lisp/international/ccl.el (ccl-compile-branch-blocks): * lisp/image/image-converter.el (image-convert): * lisp/gnus/spam.el (spam-backend-check): * lisp/gnus/nnselect.el (nnselect-generate-artlist): * lisp/gnus/nnmairix.el (nnmairix-widget-other): * lisp/gnus/message.el (message-mailto): * lisp/gnus/gnus-sum.el (gnus-collect-urls-from-article): * lisp/gnus/gnus-search.el (gnus-search-prepare-query): * lisp/frame.el (frame-size-history): * lisp/eshell/esh-var.el (eshell-parse-variable-ref): * lisp/eshell/em-dirs.el (eshell-expand-multiple-dots): * lisp/erc/erc-backend.el (erc-bounds-of-word-at-point): * lisp/emulation/cua-rect.el (cua--rectangle-operation): * lisp/emacs-lisp/text-property-search.el (text-property-search-forward): * lisp/emacs-lisp/package.el (package-desc-suffix): * lisp/emacs-lisp/faceup.el (faceup-test-explain): * lisp/emacs-lisp/comp.el (comp-curr-allocation-class): (comp-alloc-class-to-container): (comp-add-cstrs): (comp-remove-type-hints-func): (batch-byte+native-compile): * lisp/emacs-lisp/cl-macs.el (cl--optimize): * lisp/elec-pair.el (electric-pair--syntax-ppss): * lisp/doc-view.el (doc-view-doc-type): * lisp/cedet/semantic/symref.el (semantic-symref-tool-alist): (semantic-symref-hit-to-tag-via-db): (semantic-symref-hit-to-tag-via-buffer): * lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-get-overlay): * lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map): * lisp/cedet/semantic/find.el (semantic-brute-find-tag-by-function): * lisp/cedet/semantic/db.el (semanticdb-project-predicate-functions): * lisp/cedet/semantic.el (semantic-working-type): * lisp/cedet/ede/files.el (ede-flush-directory-hash): * lisp/calc/calc.el (calc--header-line): * lisp/auth-source.el (auth-source-pick-first-password): (auth-source--decode-octal-string): * etc/themes/modus-themes.el (modus-themes--paren): (modus-themes--agenda-habit): * admin/cus-test.el (cus-test-vars-with-changed-state): Fix quoting in doc strings. In code examples, the ' character is quoted with \\=, and regularize 'foo to `foo', and quote strings like "foo" instead of 'foo'.
131 lines
5.7 KiB
EmacsLisp
131 lines
5.7 KiB
EmacsLisp
;;; mh-thread-tests.el --- tests for mh-thread.el -*- lexical-binding: t -*-
|
|
|
|
;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs 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 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs 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.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Code:
|
|
|
|
(require 'ert)
|
|
(require 'mh-thread)
|
|
(eval-when-compile (require 'cl-lib))
|
|
|
|
(defun mh-thread-tests-before-from ()
|
|
"Generate the fields of a scan line up to where the \"From\" field would start.
|
|
The exact contents are not important, but the number of characters is."
|
|
(concat (make-string mh-cmd-note ?9)
|
|
(make-string mh-scan-cmd-note-width ?A)
|
|
(make-string mh-scan-destination-width ?t)
|
|
(make-string mh-scan-date-width ?/)
|
|
(make-string mh-scan-date-flag-width ?*)))
|
|
|
|
;;; Tests of support routines
|
|
|
|
(ert-deftest mh-thread-current-indentation-level ()
|
|
"Test that `mh-thread-current-indentation-level' identifies the level."
|
|
(with-temp-buffer
|
|
(insert (mh-thread-tests-before-from) "[Sender One] Subject of msg 1\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Two] Subject of msg 2\n")
|
|
(goto-char (point-min))
|
|
(should (equal 0 (mh-thread-current-indentation-level)))
|
|
(forward-line)
|
|
(should (equal 2 (mh-thread-current-indentation-level)))))
|
|
|
|
(ert-deftest mh-thread-find-children ()
|
|
"Test `mh-thread-find-children'."
|
|
(let (expected-start expected-end)
|
|
(with-temp-buffer
|
|
(insert (mh-thread-tests-before-from) "[Sender One] line 1\n")
|
|
(setq expected-start (point))
|
|
(insert (mh-thread-tests-before-from) " [Sender Two] line 2\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Three] line 3\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Four] line 4\n")
|
|
(setq expected-end (1- (point)))
|
|
(insert (mh-thread-tests-before-from) " [Sender Five] line 5\n")
|
|
(goto-char (1+ expected-start))
|
|
(should (equal (list expected-start expected-end)
|
|
(mh-thread-find-children))))))
|
|
|
|
(ert-deftest mh-thread-immediate-ancestor ()
|
|
"Test that `mh-thread-immediate-ancestor' moves to the correct message."
|
|
(with-temp-buffer
|
|
(insert (mh-thread-tests-before-from) "[Sender Other] line 1\n")
|
|
(insert (mh-thread-tests-before-from) "[Sender One] line 2\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Two] line 3\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Three] line 4\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Four] line 5\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Five] line 6\n")
|
|
(forward-line -1)
|
|
(should (equal (line-number-at-pos) 6))
|
|
(mh-thread-immediate-ancestor)
|
|
(should (equal (line-number-at-pos) 4)) ;skips over sibling
|
|
(mh-thread-immediate-ancestor)
|
|
(should (equal (line-number-at-pos) 3)) ;goes up only one level at a time
|
|
(mh-thread-immediate-ancestor)
|
|
(should (equal (line-number-at-pos) 2))
|
|
(mh-thread-immediate-ancestor)
|
|
(should (equal (line-number-at-pos) 2)))) ;no further motion at thread root
|
|
|
|
;;; Tests of MH-Folder Commands
|
|
|
|
(ert-deftest mh-thread-sibling-and-ancestor ()
|
|
"Test motion by `mh-thread-ancestor' and `mh-thread-next-sibling'."
|
|
(with-temp-buffer
|
|
(insert (mh-thread-tests-before-from) "[Sender Other] line 1\n")
|
|
(insert (mh-thread-tests-before-from) "[Sender One] line 2\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Two] line 3\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Three] line 4\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Four] line 5\n")
|
|
(insert (mh-thread-tests-before-from) " [Sender Five] line 6\n")
|
|
(forward-line -1)
|
|
(let ((mh-view-ops '(unthread))
|
|
(show-count 0))
|
|
(cl-letf (((symbol-function 'mh-maybe-show)
|
|
(lambda ()
|
|
(setq show-count (1+ show-count)))))
|
|
(should (equal (line-number-at-pos) 6))
|
|
;; test mh-thread-ancestor
|
|
(mh-thread-ancestor)
|
|
(should (equal (line-number-at-pos) 4)) ;skips over sibling
|
|
(should (equal show-count 1))
|
|
(mh-thread-ancestor t)
|
|
(should (equal (line-number-at-pos) 2)) ;root flag skips to root
|
|
(should (equal show-count 2))
|
|
(mh-thread-ancestor)
|
|
(should (equal (line-number-at-pos) 2)) ;do not move from root
|
|
(should (equal show-count 2)) ;do not re-show at root
|
|
;; test mh-thread-sibling
|
|
(mh-thread-next-sibling)
|
|
(should (equal (line-number-at-pos) 2)) ;no next sibling, no motion
|
|
(should (equal show-count 2)) ;no sibling, no show
|
|
(mh-thread-next-sibling t)
|
|
(should (equal (line-number-at-pos) 1))
|
|
(should (equal show-count 3))
|
|
(mh-thread-next-sibling t)
|
|
(should (equal (line-number-at-pos) 1)) ;no previous sibling
|
|
(should (equal show-count 3))
|
|
(goto-char (point-max))
|
|
(forward-line -1)
|
|
(should (equal (line-number-at-pos) 6))
|
|
(mh-thread-next-sibling t)
|
|
(should (equal (line-number-at-pos) 5))
|
|
(should (equal show-count 4))
|
|
(mh-thread-next-sibling t)
|
|
(should (equal (line-number-at-pos) 5)) ;no previous sibling
|
|
(should (equal show-count 4))
|
|
))))
|
|
|
|
;;; mh-thread-tests.el ends here
|