diff options
author | Yuan Fu <casouri@gmail.com> | 2022-11-21 12:54:35 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-11-21 12:54:35 -0800 |
commit | aaeaa310f0391f5a5193e1a3d6e026986c4f2c0c (patch) | |
tree | 67765b95359bfc462e95606043e6b0cea3bb7c49 /test | |
parent | b2ea38ab03e801859163b74a292aa75008e36541 (diff) | |
parent | f176a36f4629b56c9fd9e3fc15aebd04a168c4f5 (diff) | |
download | emacs-aaeaa310f0391f5a5193e1a3d6e026986c4f2c0c.tar.gz |
Merge remote-tracking branch 'savannah/master' into feature/tree-sitter
Diffstat (limited to 'test')
86 files changed, 14471 insertions, 386 deletions
diff --git a/test/lisp/apropos-tests.el b/test/lisp/apropos-tests.el index 289700abf70..917c08b9114 100644 --- a/test/lisp/apropos-tests.el +++ b/test/lisp/apropos-tests.el @@ -120,14 +120,15 @@ (should (apropos-true-hit "foo bar baz" '("foo" "bar")))) (ert-deftest apropos-tests-format-plist () - (setplist 'foo '(a 1 b (2 3) c nil)) - (apropos-parse-pattern '("b")) - (should (equal (apropos-format-plist 'foo ", ") - "a 1, b (2 3), c nil")) - (should (equal (apropos-format-plist 'foo ", " t) - "b (2 3)")) - (apropos-parse-pattern '("d")) - (should-not (apropos-format-plist 'foo ", " t))) + (let ((foo (make-symbol "foo"))) + (setplist foo '(a 1 b (2 3) c nil)) + (apropos-parse-pattern '("b")) + (should (equal (apropos-format-plist foo ", ") + "a 1, b (2 3), c nil")) + (should (equal (apropos-format-plist foo ", " t) + "b (2 3)")) + (apropos-parse-pattern '("d")) + (should-not (apropos-format-plist foo ", " t)))) (provide 'apropos-tests) ;;; apropos-tests.el ends here diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el index f5147a7ce07..6e6671efca5 100644 --- a/test/lisp/auth-source-pass-tests.el +++ b/test/lisp/auth-source-pass-tests.el @@ -25,7 +25,7 @@ ;;; Code: -(require 'ert) +(require 'ert-x) (require 'auth-source-pass) @@ -59,7 +59,7 @@ "Contains a list of all messages passed to `auth-source-do-debug'.") (defun auth-source-pass--have-message-matching (regexp) - "Return non-nil iff at least one `auth-source-do-debug' match REGEXP." + "Return non-nil if at least one `auth-source-do-debug' match REGEXP." (seq-find (lambda (message) (string-match regexp message)) auth-source-pass--debug-log)) @@ -109,7 +109,7 @@ ENTRY, HOSTNAME, USER and PORT are the same as in (put 'auth-source-pass-match-entry-p 'ert-explainer #'auth-source-pass--explain-match-entry-p) (defun auth-source-pass--includes-sorted-entries (entries hostname &optional user port) - "Return non-nil iff ENTRIES matching the parameters are found in store. + "Return non-nil if ENTRIES matching the parameters are found in store. ENTRIES should be sorted from most specific to least specific. HOSTNAME, USER and PORT are passed unchanged to @@ -157,7 +157,7 @@ result is ordered the same way as the suffixes." (auth-source-pass--generate-entry-suffixes hostname user port)))) (defun auth-source-pass-match-entry-p (entry hostname &optional user port) - "Return non-nil iff an ENTRY matching the parameters is found in store. + "Return non-nil if an ENTRY matching the parameters is found in store. HOSTNAME, USER and PORT are passed unchanged to `auth-source-pass--matching-entries'." @@ -166,7 +166,7 @@ HOSTNAME, USER and PORT are passed unchanged to (auth-source-pass--matching-entries hostname user port))) (defun auth-source-pass-match-any-entry-p (hostname &optional user port) - "Return non-nil iff there is at least one entry matching the parameters. + "Return non-nil if there is at least one entry matching the parameters. HOSTNAME, USER and PORT are passed unchanged to `auth-source-pass--matching-entries'." @@ -466,7 +466,10 @@ HOSTNAME, USER and PORT are passed unchanged to (ert-deftest auth-source-pass-can-start-from-auth-source-search () (auth-source-pass--with-store '(("gitlab.com" ("user" . "someone"))) (auth-source-pass-enable) - (let ((result (car (auth-source-search :host "gitlab.com")))) + ;; This also asserts an aspect of traditional search behavior + ;; relative to `auth-source-pass-extra-query-keywords'. + (let* ((auth-source-pass-extra-query-keywords nil) + (result (car (auth-source-search :host "gitlab.com")))) (should (equal (plist-get result :user) "someone")) (should (equal (plist-get result :host) "gitlab.com"))))) @@ -488,6 +491,266 @@ HOSTNAME, USER and PORT are passed unchanged to (should (auth-source-pass--have-message-matching "found 2 entries matching \"gitlab.com\": (\"a/gitlab.com\" \"b/gitlab.com\")")))) + +;;;; Option `auth-source-pass-extra-query-keywords' (bug#58985) + +;; No entry has the requested port, but a result is still returned. + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-miss-netrc () + (ert-with-temp-file netrc-file + :text "\ +machine x.com password a +machine x.com port 42 password b +" + (let* ((auth-sources (list netrc-file)) + (auth-source-do-cache nil) + (results (auth-source-search :host "x.com" :port 22 :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results '((:host "x.com" :secret "a"))))))) + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-miss () + (auth-source-pass--with-store '(("x.com" (secret . "a")) + ("x.com:42" (secret . "b"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host "x.com" :port 22 :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results '((:host "x.com" :secret "a"))))))) + +;; One of two entries has the requested port, both returned. + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-hit-netrc () + (ert-with-temp-file netrc-file + :text "\ +machine x.com password a +machine x.com port 42 password b +" + (let* ((auth-sources (list netrc-file)) + (auth-source-do-cache nil) + (results (auth-source-search :host "x.com" :port 42 :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results '((:host "x.com" :secret "a") + (:host "x.com" :port "42" :secret "b"))))))) + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-hit () + (auth-source-pass--with-store '(("x.com" (secret . "a")) + ("x.com:42" (secret . "b"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host "x.com" :port 42 :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "x.com" :secret "a") + (:host "x.com" :port 42 :secret "b"))))))) + +;; No entry has the requested port, but :port is required, so search fails. + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-req-miss-netrc () + (ert-with-temp-file netrc-file + :text "\ +machine x.com password a +machine x.com port 42 password b +" + (let* ((auth-sources (list netrc-file)) + (auth-source-do-cache nil) + (results (auth-source-search + :host "x.com" :port 22 :require '(:port) :max 2))) + (should-not results)))) + +(ert-deftest auth-source-pass-extra-query-keywords--wild-port-req-miss () + (let ((auth-source-pass-extra-query-keywords t)) + (auth-source-pass--with-store '(("x.com" (secret . "a")) + ("x.com:42" (secret . "b"))) + (auth-source-pass-enable) + (should-not (auth-source-search + :host "x.com" :port 22 :require '(:port) :max 2))))) + +;; Specifying a :host without a :user finds a lone entry and does not +;; include extra fields (i.e., :port nil) in the result. +;; https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg00130.html + +(ert-deftest auth-source-pass-extra-query-keywords--netrc-akib () + (ert-with-temp-file netrc-file + :text "\ +machine x.com password a +machine disroot.org user akib password b +machine z.com password c +" + (let* ((auth-sources (list netrc-file)) + (auth-source-do-cache nil) + (results (auth-source-search :host "disroot.org" :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "disroot.org" :user "akib" :secret "b"))))))) + +(ert-deftest auth-source-pass-extra-query-keywords--akib () + (auth-source-pass--with-store '(("x.com" (secret . "a")) + ("akib@disroot.org" (secret . "b")) + ("z.com" (secret . "c"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host "disroot.org" :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "disroot.org" :user "akib" :secret "b"))))))) + +;; Searches for :host are case-sensitive, and a returned host isn't +;; normalized. + +(ert-deftest auth-source-pass-extra-query-keywords--netrc-host () + (ert-with-temp-file netrc-file + :text "\ +machine libera.chat password a +machine Libera.Chat password b +" + (let* ((auth-sources (list netrc-file)) + (auth-source-do-cache nil) + (results (auth-source-search :host "Libera.Chat" :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results '((:host "Libera.Chat" :secret "b"))))))) + +(ert-deftest auth-source-pass-extra-query-keywords--host () + (auth-source-pass--with-store '(("libera.chat" (secret . "a")) + ("Libera.Chat" (secret . "b"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host "Libera.Chat" :max 2))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "Libera.Chat" :secret "b"))))))) + + +;; A retrieved store entry mustn't be nil regardless of whether its +;; path contains port or user components. + +(ert-deftest auth-source-pass-extra-query-keywords--baseline () + (let ((auth-source-pass-extra-query-keywords t)) + (auth-source-pass--with-store '(("x.com")) + (auth-source-pass-enable) + (should-not (auth-source-search :host "x.com"))))) + +;; Output port type (int or string) matches that of input parameter. + +(ert-deftest auth-source-pass-extra-query-keywords--port-type () + (let ((auth-source-pass-extra-query-keywords t) + (f (lambda (r) (setf (plist-get r :secret) (auth-info-password r)) r))) + (auth-source-pass--with-store '(("x.com:42" (secret . "a"))) + (auth-source-pass-enable) + (should (equal (mapcar f (auth-source-search :host "x.com" :port 42)) + '((:host "x.com" :port 42 :secret "a"))))) + (auth-source-pass--with-store '(("x.com:42" (secret . "a"))) + (auth-source-pass-enable) + (should (equal (mapcar f (auth-source-search :host "x.com" :port "42")) + '((:host "x.com" :port "42" :secret "a"))))))) + +;; Match precision sometimes takes a back seat to the traversal +;; ordering. Specifically, the :host (h1, ...) args hold greater sway +;; over the output because they determine the first coordinate in the +;; sequence of (host, user, port) combinations visited. (Taking a +;; tree-wise view, these become the depth-1 nodes in a DFS.) + +;; Note that all trailing /user forms are demoted for the sake of +;; predictability (see tests further below for details). This means +;; that, in the following test, /bar is held in limbo, followed by +;; /foo, but they both retain priority over "gnu.org", as noted above. + +(ert-deftest auth-source-pass-extra-query-keywords--hosts-first () + (auth-source-pass--with-store '(("x.com:42/bar" (secret . "a")) + ("gnu.org" (secret . "b")) + ("x.com" (secret . "c")) + ("fake.com" (secret . "d")) + ("x.com/foo" (secret . "e"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host '("x.com" "gnu.org") :max 3))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + ;; Notice gnu.org is never considered ^ + '((:host "x.com" :secret "c") + (:host "x.com" :user "bar" :port "42" :secret "a") + (:host "x.com" :user "foo" :secret "e"))))))) + +;; This is another example given in the bug thread. + +(ert-deftest auth-source-pass-extra-query-keywords--ambiguous-user-host () + (auth-source-pass--with-store '(("foo.com/bar.org" (secret . "a")) + ("foo.com" (secret . "b")) + ("bar.org" (secret . "c")) + ("fake.com" (secret . "d"))) + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host "bar.org" :max 3))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results '((:host "bar.org" :secret "c"))))))) + +;; This conveys the same idea as `user-priorities', just below, but +;; with slightly more realistic and less legible values. + +(ert-deftest auth-source-pass-extra-query-keywords--suffixed-user () + (let ((store (sort (copy-sequence '(("x.com:42/bar" (secret . "a")) + ("bar@x.com" (secret . "b")) + ("x.com" (secret . "?")) + ("bar@y.org" (secret . "c")) + ("fake.com" (secret . "?")) + ("fake.com/bar" (secret . "d")) + ("y.org/bar" (secret . "?")) + ("bar@fake.com" (secret . "e")))) + (lambda (&rest _) (zerop (random 2)))))) + (auth-source-pass--with-store store + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host '("x.com" "fake.com" "y.org") + :user "bar" + :require '(:user) :max 5))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "x.com" :user "bar" :secret "b") + (:host "x.com" :user "bar" :port "42" :secret "a") + (:host "fake.com" :user "bar" :secret "e") + (:host "fake.com" :user "bar" :secret "d") + (:host "y.org" :user "bar" :secret "c")))))))) + +;; This is a more distilled version of `suffixed-user', above. It +;; better illustrates that search order takes precedence over "/user" +;; demotion because otherwise * and ** would be swapped, below. It +;; follows that omitting the :port 2, gets you {u@h:1, u@h:2, h:1/u, +;; h:2/u, u@g:1}. + +(ert-deftest auth-source-pass-extra-query-keywords--user-priorities () + (let ((store (sort (copy-sequence '(("h:1/u" (secret . "/")) + ("h:2/u" (secret . "/")) + ("u@h:1" (secret . "@")) + ("u@h:2" (secret . "@")) + ("g:1/u" (secret . "/")) + ("g:2/u" (secret . "/")) + ("u@g:1" (secret . "@")) + ("u@g:2" (secret . "@")))) + (lambda (&rest _) (zerop (random 2)))))) + (auth-source-pass--with-store store + (auth-source-pass-enable) + (let* ((auth-source-pass-extra-query-keywords t) + (results (auth-source-search :host '("h" "g") + :port 2 + :max 5))) + (dolist (result results) + (setf (plist-get result :secret) (auth-info-password result))) + (should (equal results + '((:host "h" :user "u" :port 2 :secret "@") + (:host "h" :user "u" :port 2 :secret "/") ; * + (:host "g" :user "u" :port 2 :secret "@") ; ** + (:host "g" :user "u" :port 2 :secret "/")))))))) + (provide 'auth-source-pass-tests) ;;; auth-source-pass-tests.el ends here diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el index 4bbff6d0578..568820ec42c 100644 --- a/test/lisp/autorevert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -507,7 +507,7 @@ This expects `auto-revert--messages' to be bound by (should (equal (auto-revert-test--buffer-string buf-1) "1-a")) (auto-revert-test--write-file "1-b" file-1) ;; Since the file is deleted, it needs at least - ;; `autorevert-interval' to recognize the new file, + ;; `auto-revert-interval' to recognize the new file, ;; while polling. So increase the timeout. (auto-revert-test--wait-for-buffer-text buf-1 "1-b" (* 2 (auto-revert--timeout))) diff --git a/test/lisp/calendar/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el index 7f8cd479146..2e9353a09b8 100644 --- a/test/lisp/calendar/icalendar-tests.el +++ b/test/lisp/calendar/icalendar-tests.el @@ -1310,7 +1310,7 @@ SUMMARY:and diary-anniversary "import-real-world-2003-05-29.diary-european" "import-real-world-2003-05-29.diary-american") - ;; created with http://apps.marudot.com/ical/ + ;; created with https://apps.marudot.com/ical/ (icalendar-tests--test-import "import-real-world-no-dst.ics" nil "import-real-world-no-dst.diary-european" diff --git a/test/lisp/cedet/semantic-utest.el b/test/lisp/cedet/semantic-utest.el index 24a467474b9..b577b198089 100644 --- a/test/lisp/cedet/semantic-utest.el +++ b/test/lisp/cedet/semantic-utest.el @@ -609,7 +609,6 @@ INSERTME is the text to be inserted after the deletion." (semantic-utest-generic (semantic-utest-fname "phptest.php") semantic-utest-PHP-buffer-contents semantic-utest-PHP-name-contents '("fun1") "fun2" "%^@") ) -;look at http://mfgames.com/linux/csharp-mode (ert-deftest semantic-utest-Csharp() ;; hmm i don't even know how to edit a scharp file. need a csharp mode implementation i suppose (skip-unless (featurep 'csharp-mode)) (semantic-utest-generic (semantic-utest-fname "csharptest.cs") semantic-utest-Csharp-buffer-contents semantic-utest-Csharp-name-contents '("fun2") "//1" "//deleted line") diff --git a/test/lisp/cedet/srecode/fields-tests.el b/test/lisp/cedet/srecode/fields-tests.el index 292ac4e3b5e..c9e0d4601b9 100644 --- a/test/lisp/cedet/srecode/fields-tests.el +++ b/test/lisp/cedet/srecode/fields-tests.el @@ -66,7 +66,7 @@ It is filled with some text." (when (and (overlayp (oref f overlay)) (not (overlay-get (oref f overlay) 'srecode-init-only))) - (error "Field creation overlay is not tagged w/ init flag")) + (error "Field creation overlay is not tagged with init flag")) (srecode-overlaid-activate f) diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el index 09becc7fe7a..18b0257e01a 100644 --- a/test/lisp/dired-tests.el +++ b/test/lisp/dired-tests.el @@ -354,6 +354,17 @@ (should (equal "subdir" (dired-get-filename 'local t))))))) +(ert-deftest dired-test-bug59047 () + "Test for https://debbugs.gnu.org/59047 ." + (dired (list (expand-file-name "src" source-directory) + "cygw32.c" "alloc.c" "w32xfns.c" "xdisp.c")) + (dired-hide-all) + (dired-hide-all) + (dired-next-line 1) + (should (equal 'dired-hide-details-detail + (get-text-property + (1+ (line-beginning-position)) 'invisible)))) + (defmacro dired-test-with-temp-dirs (just-empty-dirs &rest body) "Helper macro for Bug#27940 test." (declare (indent 1) (debug body)) diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el index 67b660fc124..bdadc0f2801 100644 --- a/test/lisp/dnd-tests.el +++ b/test/lisp/dnd-tests.el @@ -416,7 +416,7 @@ This function only tries to handle strings." ;; system specific test is in x-dnd-tests.el. When running this ;; interactively, keep in mind that there are only two file managers ;; which are known to implement XDS correctly: System G (see - ;; http://nps-systemg.sourceforge.net), and Emacs itself. GTK file + ;; https://nps-systemg.sourceforge.net), and Emacs itself. GTK file ;; managers such as Nautilus will not work, since they prefer the ;; `text/uri-list' selection target to `XdndDirectSave0', contrary ;; to the XDS specification. diff --git a/test/lisp/elide-head-tests.el b/test/lisp/elide-head-tests.el index 6f351170f1d..429ef266572 100644 --- a/test/lisp/elide-head-tests.el +++ b/test/lisp/elide-head-tests.el @@ -3,7 +3,6 @@ ;; Copyright (C) 2020-2022 Free Software Foundation, Inc. ;; Author: Simen Heggestøyl <simenheg@gmail.com> -;; Keywords: ;; This file is part of GNU Emacs. @@ -20,10 +19,6 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. -;;; Commentary: - -;; - ;;; Code: (require 'elide-head) @@ -169,6 +164,22 @@ ***************************************************************************/ " "This program is distributed in the hope that") +;; from mentor.el [no "/" in the gnu.org URL] +(elide-head--add-test gpl3-5 "\ +;; Mentor 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. +;; +;; Mentor 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 Mentor. If not, see <https://www.gnu.org/licenses>. +" "Mentor is distributed in the hope that") + ;;; GPLv2 diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el index 0c03c51e2ef..2abf714852f 100644 --- a/test/lisp/emacs-lisp/bindat-tests.el +++ b/test/lisp/emacs-lisp/bindat-tests.el @@ -252,7 +252,24 @@ (should (equal (bindat-unpack spec "abc\0") "abc")) ;; Missing null terminator. (should-error (bindat-unpack spec "")) - (should-error (bindat-unpack spec "a")))) + (should-error (bindat-unpack spec "a"))) + + (ert-deftest bindat-test--strz-array-unpack () + (should (equal (bindat-unpack spec [#x61 #x62 #x63 #x00]) "abc")))) + +(let ((spec (bindat-type str 3))) + (ert-deftest bindat-test--str-simple-array-unpack () + (should (equal (bindat-unpack spec [#x61 #x62 #x63]) "abc")))) + +(let ((spec (bindat-type + (first u8) + (string str 3) + (last uint 16)))) + (ert-deftest bindat-test--str-combined-array-unpack () + (let ((unpacked (bindat-unpack spec [#xff #x63 #x62 #x61 #xff #xff]))) + (should (equal (bindat-get-field unpacked 'string) "cba")) + (should (equal (bindat-get-field unpacked 'first) (- (expt 2 8) 1))) + (should (equal (bindat-get-field unpacked 'last) (- (expt 2 16) 1)))))) (let ((spec '((x strz 2)))) (ert-deftest bindat-test--strz-legacy-fixedlen-len () diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 37470f863f3..e666fe0a4c2 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el @@ -351,11 +351,18 @@ (let ((f (let ((d 51695)) (lambda (data) (interactive (progn (setq d (1+ d)) (list d))) - (list (called-interactively-p 'any) data))))) - (should (equal (list (call-interactively f) - (funcall f 51695) - (call-interactively f)) - '((t 51696) (nil 51695) (t 51697)))))) + (list (called-interactively-p 'any) data)))) + (f-interp + (eval '(let ((d 51695)) + (lambda (data) + (interactive (progn (setq d (1+ d)) (list d))) + (list (called-interactively-p 'any) data))) + t))) + (dolist (f (list f f-interp)) + (should (equal (list (call-interactively f) + (funcall f 51695) + (call-interactively f)) + '((t 51696) (nil 51695) (t 51697))))))) (provide 'cconv-tests) ;;; cconv-tests.el ends here diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el index 297e413d858..6a34cd681ec 100644 --- a/test/lisp/emacs-lisp/cl-extra-tests.el +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -32,8 +32,28 @@ (ert-deftest cl-getf () (let ((plist '(x 1 y nil))) (should (eq (cl-getf plist 'x) 1)) - (should (eq (cl-getf plist 'y :none) nil)) - (should (eq (cl-getf plist 'z :none) :none)))) + (should-not (cl-getf plist 'y :none)) + (should (eq (cl-getf plist 'z :none) :none)) + (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3)) + (should (equal plist '(x 3 y nil))) + (should-error (cl-incf (cl-getf plist 'y 10) 4) :type 'wrong-type-argument) + (should (equal plist '(x 3 y nil))) + (should (eq (cl-incf (cl-getf plist 'z 10) 5) 15)) + (should (equal plist '(z 15 x 3 y nil)))) + (let ((plist '(x 1 y))) + (should (eq (cl-getf plist 'x) 1)) + (should (eq (cl-getf plist 'y :none) :none)) + (should (eq (cl-getf plist 'z :none) :none)) + (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3)) + (should (equal plist '(x 3 y))) + (should (eq (cl-incf (cl-getf plist 'y 10) 4) 14)) + (should (equal plist '(y 14 x 3 y)))) + (let ((plist '(x 1 y . 2))) + (should (eq (cl-getf plist 'x) 1)) + (should (eq (cl-incf (cl-getf plist 'x 10) 2) 3)) + (should (equal plist '(x 3 y . 2))) + (should-error (cl-getf plist 'y :none) :type 'wrong-type-argument) + (should-error (cl-getf plist 'z :none) :type 'wrong-type-argument))) (ert-deftest cl-extra-test-mapc () (let ((lst '(a b c)) diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el index 56b766769ea..8e807b15915 100644 --- a/test/lisp/emacs-lisp/cl-generic-tests.el +++ b/test/lisp/emacs-lisp/cl-generic-tests.el @@ -297,5 +297,27 @@ Edebug symbols (Bug#42672)." (intern "cl-defgeneric/edebug/method/2 (number)") 'cl-defgeneric/edebug/method/2)))))) +(cl-defgeneric cl-generic-tests--acc (x &optional y) + (declare (advertised-calling-convention (x) "671.2"))) + +(cl-defmethod cl-generic-tests--acc ((x float)) (+ x 5.0)) + +(ert-deftest cl-generic-tests--advertised-calling-convention-bug58563 () + (should (equal (get-advertised-calling-convention + (indirect-function 'cl-generic-tests--acc)) + '(x))) + (should + (condition-case err + (let ((lexical-binding t) + (byte-compile-debug t) + (byte-compile-error-on-warn t)) + (byte-compile '(cl-defmethod cl-generic-tests--acc ((x list)) + (declare (advertised-calling-convention (y) "1.1")) + (cons x '(5 5 5 5 5)))) + nil) + (error + (and (eq 'error (car err)) + (string-match "Stray.*declare" (cadr err))))))) + (provide 'cl-generic-tests) ;;; cl-generic-tests.el ends here diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el b/test/lisp/emacs-lisp/cl-macs-tests.el index f742637ee35..160ac591130 100644 --- a/test/lisp/emacs-lisp/cl-macs-tests.el +++ b/test/lisp/emacs-lisp/cl-macs-tests.el @@ -803,4 +803,10 @@ See Bug#57915." (macroexpand form) (should (string-empty-p messages)))))))) +(ert-deftest cl-&key-arguments () + (cl-flet ((fn (&key x) x)) + (should-error (fn :x)) + (should (eq (fn :x :a) :a)))) + + ;;; cl-macs-tests.el ends here diff --git a/test/lisp/emacs-lisp/comp-tests.el b/test/lisp/emacs-lisp/comp-tests.el new file mode 100644 index 00000000000..082b641fe30 --- /dev/null +++ b/test/lisp/emacs-lisp/comp-tests.el @@ -0,0 +1,77 @@ +;;; comp-tests.el --- Tests for comp.el -*- lexical-binding:t -*- + +;; Copyright (C) 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/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'ert-x) +(require 'comp) + +(defvar comp-native-version-dir) +(defvar native-comp-eln-load-path) + +(defmacro with-test-native-compile-prune-cache (&rest body) + (declare (indent 0) (debug t)) + `(ert-with-temp-directory testdir + (setq testdir (expand-file-name "eln-cache" testdir)) + (make-directory testdir) + (let* ((c1 (expand-file-name "29.0.50-cur" testdir)) + (c2 (expand-file-name "29.0.50-old" testdir)) + (native-comp-eln-load-path (list testdir)) + (comp-native-version-dir "29.0.50-cur")) + (dolist (d (list c1 c2)) + (make-directory d) + (with-temp-file (expand-file-name "some.eln" d) (insert "foo")) + (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo"))) + ,@body))) + +(ert-deftest test-native-compile-prune-cache () + (skip-unless (featurep 'native-compile)) + (with-test-native-compile-prune-cache + (native-compile-prune-cache) + (should (file-directory-p c1)) + (should (file-regular-p (expand-file-name "some.eln" c1))) + (should (file-regular-p (expand-file-name "some.eln.tmp" c1))) + (should-not (file-directory-p c2)) + (should-not (file-regular-p (expand-file-name "some.eln" c2))) + (should-not (file-regular-p (expand-file-name "some.eln.tmp" c2))))) + +(ert-deftest test-native-compile-prune-cache/delete-only-eln () + (skip-unless (featurep 'native-compile)) + (with-test-native-compile-prune-cache + (with-temp-file (expand-file-name "keep1.txt" c1) (insert "foo")) + (with-temp-file (expand-file-name "keep2.txt" c2) (insert "foo")) + (native-compile-prune-cache) + (should (file-regular-p (expand-file-name "keep1.txt" c1))) + (should (file-regular-p (expand-file-name "keep2.txt" c2))))) + +(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache () + (skip-unless (featurep 'native-compile)) + (with-test-native-compile-prune-cache + (let ((f1 (expand-file-name "../some.eln" testdir)) + (f2 (expand-file-name "some.eln" testdir))) + (with-temp-file f1 (insert "foo")) + (with-temp-file f2 (insert "foo")) + (native-compile-prune-cache) + (should (file-regular-p f1)) + (should (file-regular-p f2))))) + +;;; comp-tests.el ends here diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el index 0757e3c7aa5..69a7bcf7dd4 100644 --- a/test/lisp/emacs-lisp/gv-tests.el +++ b/test/lisp/emacs-lisp/gv-tests.el @@ -157,55 +157,42 @@ its getter (Bug#41853)." (push 123 (gv-setter-edebug-get 'gv-setter-edebug 'gv-setter-edebug-prop)))) (print form (current-buffer))) - ;; Only check whether evaluation works in general. - (eval-buffer))) + ;; Silence "Edebug: foo" messages. + (let ((inhibit-message t)) + ;; Only check whether evaluation works in general. + (eval-buffer)))) (should (equal (get 'gv-setter-edebug 'gv-setter-edebug-prop) '(123)))) (ert-deftest gv-plist-get () - (require 'cl-lib) - - ;; Simple setf usage for plist-get. - (should (equal (let ((target '(:a "a" :b "b" :c "c"))) - (setf (plist-get target :b) "modify") - target) - '(:a "a" :b "modify" :c "c"))) - - ;; Other function (cl-rotatef) usage for plist-get. - (should (equal (let ((target '(:a "a" :b "b" :c "c"))) - (cl-rotatef (plist-get target :b) (plist-get target :c)) - target) - '(:a "a" :b "c" :c "b"))) - - ;; Add new key value pair at top of list if setf for missing key. - (should (equal (let ((target '(:a "a" :b "b" :c "c"))) - (setf (plist-get target :d) "modify") - target) - '(:d "modify" :a "a" :b "b" :c "c"))) + ;; Simple `setf' usage for `plist-get'. + (let ((target (list :a "a" :b "b" :c "c"))) + (setf (plist-get target :b) "modify") + (should (equal target '(:a "a" :b "modify" :c "c"))) + (setf (plist-get target ":a" #'string=) "mogrify") + (should (equal target '(:a "mogrify" :b "modify" :c "c")))) + + ;; Other function (`cl-rotatef') usage for `plist-get'. + (let ((target (list :a "a" :b "b" :c "c"))) + (cl-rotatef (plist-get target :b) (plist-get target :c)) + (should (equal target '(:a "a" :b "c" :c "b"))) + (cl-rotatef (plist-get target ":a" #'string=) + (plist-get target ":b" #'string=)) + (should (equal target '(:a "c" :b "a" :c "b")))) + + ;; Add new key value pair at top of list if `setf' for missing key. + (let ((target (list :a "a" :b "b" :c "c"))) + (setf (plist-get target :d) "modify") + (should (equal target '(:d "modify" :a "a" :b "b" :c "c"))) + (setf (plist-get target :e #'string=) "mogrify") + (should (equal target '(:e "mogrify" :d "modify" :a "a" :b "b" :c "c")))) ;; Rotate with missing value. ;; The value corresponding to the missing key is assumed to be nil. - (should (equal (let ((target '(:a "a" :b "b" :c "c"))) - (cl-rotatef (plist-get target :b) (plist-get target :d)) - target) - '(:d "b" :a "a" :b nil :c "c"))) - - ;; Simple setf usage for plist-get. (symbol plist) - (should (equal (let ((target '(a "a" b "b" c "c"))) - (setf (plist-get target 'b) "modify") - target) - '(a "a" b "modify" c "c"))) - - ;; Other function (cl-rotatef) usage for plist-get. (symbol plist) - (should (equal (let ((target '(a "a" b "b" c "c"))) - (cl-rotatef (plist-get target 'b) (plist-get target 'c)) - target) - '(a "a" b "c" c "b")))) - -;; `ert-deftest' messes up macroexpansion when the test file itself is -;; compiled (see Bug #24402). - -;; Local Variables: -;; no-byte-compile: t -;; End: + (let ((target (list :a "a" :b "b" :c "c"))) + (cl-rotatef (plist-get target :b) (plist-get target :d)) + (should (equal target '(:d "b" :a "a" :b nil :c "c"))) + (cl-rotatef (plist-get target ":e" #'string=) + (plist-get target ":d" #'string=)) + (should (equal target '(":e" "b" :d nil :a "a" :b nil :c "c"))))) ;;; gv-tests.el ends here diff --git a/test/lisp/emacs-lisp/hierarchy-tests.el b/test/lisp/emacs-lisp/hierarchy-tests.el index 41d3f2f3ccf..97a0f7ba52c 100644 --- a/test/lisp/emacs-lisp/hierarchy-tests.el +++ b/test/lisp/emacs-lisp/hierarchy-tests.el @@ -552,5 +552,148 @@ (hierarchy-sort organisms) (should (equal (hierarchy-roots organisms) '(animal plant))))) +(defun hierarchy-examples-delayed--find-number (num) + "Find a number, NUM, by adding 1s together until you reach it. +This is entire contrived and mostly meant to be purposefully inefficient to +not be possible on a large scale. +Running the number 200 causes this function to crash; running this function in +`hierarchy-add-tree' with a root of 80 and no delayed children causes that to + crash. +If generating hierarchy children is not delayed, tests for that functionality +should fail as this function will crash." + + (funcall (lambda (funct) (funcall funct 1 funct)) + (lambda (n funct) + (if (< n num) + (+ 1 (funcall funct (+ 1 n) funct)) + 1)))) + +(defun hierarchy-examples-delayed--childrenfn (hier-elem) + "Return the children of HIER-ELEM. +Basially, feed the number, minus 1, to `hierarchy-examples-delayed--find-number' +and then create a list of the number plus 0.0–0.9." + + (when (> hier-elem 1) + (let ((next (hierarchy-examples-delayed--find-number (1- hier-elem)))) + (mapcar (lambda (dec) (+ next dec)) '(.0 .1 .2 .3 .4 .5 .6 .7 .8 .9))))) + +(ert-deftest hierarchy-delayed-add-one-root () + (let ((parentfn (lambda (_) nil)) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(190))))) + +(ert-deftest hierarchy-delayed-add-one-item-with-parent () + (let ((parentfn (lambda (item) + (cl-case item + (190 191)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 190) '())))) + +(ert-deftest hierarchy-delayed-add-one-item-with-parent-and-grand-parent () + (let ((parentfn (lambda (item) + (cl-case item + (190 191) + (191 192)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(192))) + (should (equal (hierarchy-children hierarchy 192) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 190) '())))) + +(ert-deftest hierarchy-delayed-add-same-root-twice () + (let ((parentfn (lambda (_) nil)) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(190))))) + +(ert-deftest hierarchy-delayed-add-same-child-twice () + (let ((parentfn (lambda (item) + (cl-case item + (190 191)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 190) '())))) + +(ert-deftest hierarchy-delayed-add-item-and-its-parent () + (let ((parentfn (lambda (item) + (cl-case item + (190 191)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 191 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 190) '())))) + +(ert-deftest hierarchy-delayed-add-item-and-its-child () + (let ((parentfn (lambda (item) + (cl-case item + (190 191)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 191 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 190) '())))) + +(ert-deftest hierarchy-delayed-add-two-items-sharing-parent () + (let ((parentfn (lambda (item) + (cl-case item + (190 191) + (190.5 191)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 190.5 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(191))) + (should (equal (hierarchy-children hierarchy 191) '(190 190.5))))) + +(ert-deftest hierarchy-delayed-add-two-hierarchies () + (let ((parentfn (lambda (item) + (cl-case item + (190 191) + (circle 'shape)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-tree hierarchy 190 parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (hierarchy-add-tree hierarchy 'circle parentfn) + (should (equal (hierarchy-roots hierarchy) '(191 shape))) + (should (equal (hierarchy-children hierarchy 191) '(190))) + (should (equal (hierarchy-children hierarchy 'shape) '(circle))))) + +(ert-deftest hierarchy-delayed-add-trees () + (let ((parentfn (lambda (item) + (cl-case item + (190 '191) + (190.5 '191) + (191 '192)))) + (hierarchy (hierarchy-new))) + (hierarchy-add-trees hierarchy '(190 190.5) parentfn + #'hierarchy-examples-delayed--childrenfn nil t) + (should (equal (hierarchy-roots hierarchy) '(192))) + (should (equal (hierarchy-children hierarchy '192) '(191))) + (should (equal (hierarchy-children hierarchy '191) '(190 190.5))))) + (provide 'hierarchy-tests) ;;; hierarchy-tests.el ends here diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index 314a1c9e302..75ebe594313 100644 --- a/test/lisp/emacs-lisp/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el @@ -29,10 +29,13 @@ (require 'ert) (require 'map) +(eval-when-compile + (require 'cl-lib)) + (defmacro with-maps-do (var &rest body) "Successively bind VAR to an alist, plist, vector, and hash-table. Each map is built from the following alist data: - \\='((0 . 3) (1 . 4) (2 . 5)). + ((0 . 3) (1 . 4) (2 . 5)) Evaluate BODY for each created map." (declare (indent 1) (debug (symbolp body))) (let ((alist (make-symbol "alist")) @@ -84,18 +87,96 @@ Evaluate BODY for each created map." (with-empty-maps-do map (should (= 5 (map-elt map 0 5))))) -(ert-deftest test-map-elt-testfn () +(ert-deftest test-map-elt-testfn-alist () + "Test the default alist predicate of `map-elt'." (let* ((a (string ?a)) (map `((,a . 0) (,(string ?b) . 1)))) - (should (= (map-elt map a) 0)) - (should (= (map-elt map "a") 0)) - (should (= (map-elt map (string ?a)) 0)) - (should (= (map-elt map "b") 1)) - (should (= (map-elt map (string ?b)) 1)))) + (should (= 0 (map-elt map a))) + (should (= 0 (map-elt map "a"))) + (should (= 0 (map-elt map (string ?a)))) + (should (= 1 (map-elt map "b"))) + (should (= 1 (map-elt map (string ?b)))) + (with-suppressed-warnings ((callargs map-elt)) + (should (= 0 (map-elt map 'a nil #'string=))) + (should (= 1 (map-elt map 'b nil #'string=)))))) + +(ert-deftest test-map-elt-testfn-plist () + "Test the default plist predicate of `map-elt'." + (let* ((a (string ?a)) + (map `(,a 0 "b" 1))) + (should-not (map-elt map "a")) + (should-not (map-elt map "b")) + (should-not (map-elt map (string ?a))) + (should-not (map-elt map (string ?b))) + (should (= 0 (map-elt map a))) + (with-suppressed-warnings ((callargs map-elt)) + (should (= 0 (map-elt map a nil #'equal))) + (should (= 0 (map-elt map "a" nil #'equal))) + (should (= 0 (map-elt map (string ?a) nil #'equal))) + (should (= 1 (map-elt map "b" nil #'equal))) + (should (= 1 (map-elt map (string ?b) nil #'equal)))))) + +(ert-deftest test-map-elt-gv () + "Test the generalized variable `map-elt'." + (let ((sort (lambda (map) (sort (map-pairs map) #'car-less-than-car)))) + (with-empty-maps-do map + ;; Empty map, without default. + (should-error (cl-incf (map-elt map 1)) :type 'wrong-type-argument) + (with-suppressed-warnings ((callargs map-elt)) + (should-error (cl-incf (map-elt map 1.0 nil #'=)) + :type 'wrong-type-argument)) + (should (map-empty-p map)) + ;; Empty map, with default. + (if (vectorp map) + (progn + (should-error (cl-incf (map-elt map 1 3)) :type 'args-out-of-range) + (with-suppressed-warnings ((callargs map-elt)) + (should-error (cl-incf (map-elt map 1 3 #'=)) + :type 'args-out-of-range)) + (should (map-empty-p map))) + (should (= (cl-incf (map-elt map 1 3) 10) 13)) + (with-suppressed-warnings ((callargs map-elt)) + (should (= (cl-incf (map-elt map 2.0 5 #'=) 12) 17))) + (should (equal (funcall sort map) '((1 . 13) (2.0 . 17)))))) + (with-maps-do map + ;; Nonempty map, without predicate. + (should (= (cl-incf (map-elt map 1 3) 10) 14)) + (should (equal (funcall sort map) '((0 . 3) (1 . 14) (2 . 5)))) + ;; Nonempty map, with predicate. + (with-suppressed-warnings ((callargs map-elt)) + (pcase-exhaustive map + ((pred consp) + (should (= (cl-incf (map-elt map 2.0 6 #'=) 12) 17)) + (should (equal (funcall sort map) '((0 . 3) (1 . 14) (2 . 17)))) + (should (= (cl-incf (map-elt map 0 7 #'=) 13) 16)) + (should (equal (funcall sort map) '((0 . 16) (1 . 14) (2 . 17))))) + ((pred vectorp) + (should-error (cl-incf (map-elt map 2.0 6 #'=)) + :type 'wrong-type-argument) + (should (equal (funcall sort map) '((0 . 3) (1 . 14) (2 . 5)))) + (should (= (cl-incf (map-elt map 2 6 #'=) 12) 17)) + (should (equal (funcall sort map) '((0 . 3) (1 . 14) (2 . 17)))) + (should (= (cl-incf (map-elt map 0 7 #'=) 13) 16)) + (should (equal (funcall sort map) '((0 . 16) (1 . 14) (2 . 17))))) + ((pred hash-table-p) + (should (= (cl-incf (map-elt map 2.0 6 #'=) 12) 18)) + (should (member (funcall sort map) + '(((0 . 3) (1 . 14) (2 . 5) (2.0 . 18)) + ((0 . 3) (1 . 14) (2.0 . 18) (2 . 5))))) + (should (= (cl-incf (map-elt map 0 7 #'=) 13) 16)) + (should (member (funcall sort map) + '(((0 . 16) (1 . 14) (2 . 5) (2.0 . 18)) + ((0 . 16) (1 . 14) (2.0 . 18) (2 . 5))))))))))) (ert-deftest test-map-elt-with-nil-value () (should-not (map-elt '((a . 1) (b)) 'b 2))) +(ert-deftest test-map-elt-signature () + "Test that `map-elt' has the right advertised signature. +See bug#58531#25 and bug#58563." + (should (equal (get-advertised-calling-convention (symbol-function 'map-elt)) + '(map key &optional default)))) + (ert-deftest test-map-put! () (with-maps-do map (setf (map-elt map 2) 'hello) @@ -144,6 +225,24 @@ Evaluate BODY for each created map." (should (equal map '(("a" . 1)))) (should-error (map-put! map (string ?a) val #'eq) :type 'map-not-inplace))) +(ert-deftest test-map-put!-plist () + "Test `map-put!' predicate on plists." + (let* ((a (string ?a)) + (map (list a 0))) + (map-put! map a -1) + (should (equal map '("a" -1))) + (map-put! map 'a 2) + (should (equal map '("a" -1 a 2))) + (with-suppressed-warnings ((callargs map-put!)) + (map-put! map 'a -3 #'string=)) + (should (equal map '("a" -3 a 2))))) + +(ert-deftest test-map-put!-signature () + "Test that `map-put!' has the right advertised signature. +See bug#58531#25 and bug#58563." + (should (equal (get-advertised-calling-convention (symbol-function 'map-put!)) + '(map key value)))) + (ert-deftest test-map-put-alist-new-key () "Regression test for Bug#23105." (let ((alist (list (cons 0 'a)))) @@ -395,13 +494,23 @@ Evaluate BODY for each created map." (alist '(("a" . 1) (a . 2)))) (should (map-contains-key alist 'a)) (should (map-contains-key plist 'a)) + ;; FIXME: Why is no warning emitted for these (bug#58563#13)? (should (map-contains-key alist 'a #'eq)) (should (map-contains-key plist 'a #'eq)) (should (map-contains-key alist key)) + (should (map-contains-key alist "a")) + (should (map-contains-key plist (string ?a) #'equal)) (should-not (map-contains-key plist key)) (should-not (map-contains-key alist key #'eq)) (should-not (map-contains-key plist key #'eq)))) +(ert-deftest test-map-contains-key-signature () + "Test that `map-contains-key' has the right advertised signature. +See bug#58531#25 and bug#58563." + (should (equal (get-advertised-calling-convention + (symbol-function 'map-contains-key)) + '(map key)))) + (ert-deftest test-map-some () (with-maps-do map (should (eq (map-some (lambda (k _v) (and (= k 1) 'found)) map) @@ -515,19 +624,19 @@ Evaluate BODY for each created map." (should (equal alist '((key . value)))))) (ert-deftest test-map-setf-alist-overwrite-key () - (let ((alist '((key . value1)))) + (let ((alist (list (cons 'key 'value1)))) (should (equal (setf (map-elt alist 'key) 'value2) 'value2)) (should (equal alist '((key . value2)))))) (ert-deftest test-map-setf-plist-insert-key () - (let ((plist '(key value))) + (let ((plist (list 'key 'value))) (should (equal (setf (map-elt plist 'key2) 'value2) 'value2)) (should (equal plist '(key value key2 value2))))) (ert-deftest test-map-setf-plist-overwrite-key () - (let ((plist '(key value))) + (let ((plist (list 'key 'value))) (should (equal (setf (map-elt plist 'key) 'value2) 'value2)) (should (equal plist '(key value2))))) @@ -535,14 +644,14 @@ Evaluate BODY for each created map." (ert-deftest test-hash-table-setf-insert-key () (let ((ht (make-hash-table))) (should (equal (setf (map-elt ht 'key) 'value) - 'value)) + 'value)) (should (equal (map-elt ht 'key) 'value)))) (ert-deftest test-hash-table-setf-overwrite-key () (let ((ht (make-hash-table))) (puthash 'key 'value1 ht) (should (equal (setf (map-elt ht 'key) 'value2) - 'value2)) + 'value2)) (should (equal (map-elt ht 'key) 'value2)))) (ert-deftest test-setf-map-with-function () @@ -551,8 +660,79 @@ Evaluate BODY for each created map." (setf (map-elt map 'foo) (funcall (lambda () (cl-incf num)))) + (should (equal map '((foo . 1)))) ;; Check that the function is only called once. (should (= num 1)))) +(ert-deftest test-map-plist-member () + "Test `map--plist-member' and `map--plist-member-1'." + (dolist (mem '(map--plist-member map--plist-member-1)) + ;; Lambda exercises Lisp implementation. + (dolist (= `(nil ,(lambda (a b) (eq a b)))) + (should-not (funcall mem () 'a =)) + (should-not (funcall mem '(a) 'b =)) + (should-not (funcall mem '(a 1) 'b =)) + (should (equal (funcall mem '(a) 'a =) '(a))) + (should (equal (funcall mem '(a . 1) 'a =) '(a . 1))) + (should (equal (funcall mem '(a 1 . b) 'a =) '(a 1 . b))) + (should (equal (funcall mem '(a 1 b) 'a =) '(a 1 b))) + (should (equal (funcall mem '(a 1 b) 'b =) '(b))) + (should (equal (funcall mem '(a 1 b . 2) 'a =) '(a 1 b . 2))) + (should (equal (funcall mem '(a 1 b . 2) 'b =) '(b . 2))) + (should (equal (funcall mem '(a 1 b 2) 'a =) '(a 1 b 2))) + (should (equal (funcall mem '(a 1 b 2) 'b =) '(b 2))) + (should (equal (should-error (funcall mem '(a . 1) 'b =)) + '(wrong-type-argument plistp (a . 1)))) + (should (equal (should-error (funcall mem '(a 1 . b) 'b =)) + '(wrong-type-argument plistp (a 1 . b))))) + (should (equal (funcall mem '(a 1 b 2) "a" #'string=) '(a 1 b 2))) + (should (equal (funcall mem '(a 1 b 2) "b" #'string=) '(b 2))))) + +(ert-deftest test-map-plist-put () + "Test `map--plist-put' and `map--plist-put-1'." + (dolist (put '(map--plist-put map--plist-put-1)) + ;; Lambda exercises Lisp implementation. + (dolist (= `(nil ,(lambda (a b) (eq a b)))) + (let ((l ())) + (should (equal (funcall put l 'a 1 =) '(a 1))) + (should-not l)) + (let ((l (list 'a))) + (dolist (key '(a b)) + (should (equal (should-error (funcall put l key 1 =)) + '(wrong-type-argument plistp (a))))) + (should (equal l '(a)))) + (let ((l (cons 'a 1))) + (dolist (key '(a b)) + (should (equal (should-error (funcall put l key 1 =)) + '(wrong-type-argument plistp (a . 1))))) + (should (equal l '(a . 1)))) + (let ((l (cons 'a (cons 1 'b)))) + (should (equal (funcall put l 'a 2 =) '(a 2 . b))) + (dolist (key '(b c)) + (should (equal (should-error (funcall put l key 3 =)) + '(wrong-type-argument plistp (a 2 . b))))) + (should (equal l '(a 2 . b)))) + (let ((l (list 'a 1 'b))) + (should (equal (funcall put l 'a 2 =) '(a 2 b))) + (dolist (key '(b c)) + (should (equal (should-error (funcall put l key 3 =)) + '(wrong-type-argument plistp (a 2 b))))) + (should (equal l '(a 2 b)))) + (let ((l (cons 'a (cons 1 (cons 'b 2))))) + (should (equal (funcall put l 'a 3 =) '(a 3 b . 2))) + (dolist (key '(b c)) + (should (equal (should-error (funcall put l key 4 =)) + '(wrong-type-argument plistp (a 3 b . 2))))) + (should (equal l '(a 3 b . 2)))) + (let ((l (list 'a 1 'b 2))) + (should (equal (funcall put l 'a 3 =) '(a 3 b 2))) + (should (equal (funcall put l 'b 4 =) '(a 3 b 4))) + (should (equal (funcall put l 'c 5 =) '(a 3 b 4 c 5))) + (should (equal l '(a 3 b 4 c 5))))) + (let ((l (list 'a 1 'b 2))) + (should (equal (funcall put l "a" 3 #'string=) '(a 3 b 2))) + (should (equal (funcall put l "b" 4 #'string=) '(a 3 b 4))) + (should (equal (funcall put l "c" 5 #'string=) '(a 3 b 4 "c" 5)))))) + (provide 'map-tests) ;;; map-tests.el ends here diff --git a/test/lisp/emacs-lisp/package-resources/elpa-packages.eld b/test/lisp/emacs-lisp/package-resources/elpa-packages.eld new file mode 100644 index 00000000000..7884aac278e --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/elpa-packages.eld @@ -0,0 +1,3 @@ +;; Dummy elpa-package.eld + +(() :version 1) diff --git a/test/lisp/emacs-lisp/package-resources/newer-versions/elpa-packages.eld b/test/lisp/emacs-lisp/package-resources/newer-versions/elpa-packages.eld new file mode 100644 index 00000000000..7884aac278e --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/newer-versions/elpa-packages.eld @@ -0,0 +1,3 @@ +;; Dummy elpa-package.eld + +(() :version 1) diff --git a/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld b/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld new file mode 100644 index 00000000000..7884aac278e --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld @@ -0,0 +1,3 @@ +;; Dummy elpa-package.eld + +(() :version 1) diff --git a/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld.sig b/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld.sig Binary files differnew file mode 100644 index 00000000000..39202ca75e0 --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/signed/elpa-packages.eld.sig diff --git a/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh index 30e74156c01..ddd96748ec1 100755 --- a/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh +++ b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh @@ -30,4 +30,5 @@ rm $KEYRING #$GPG --export-secret-keys -armor > "../key.sec" $GPG --import ../key.sec $GPG --detach-sign --sign "./archive-contents" +$GPG --detach-sign --sign "./elpa-packages.eld" $GPG --detach-sign --sign "./signed-good-1.0.el" diff --git a/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar Binary files differnew file mode 100644 index 00000000000..009c4fc420c --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/ustar-withsub-0.1.tar diff --git a/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar Binary files differnew file mode 100644 index 00000000000..16c79e529f4 --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/v7-withsub-0.1.tar diff --git a/test/lisp/emacs-lisp/package-resources/with-nil-entry/elpa-packages.eld b/test/lisp/emacs-lisp/package-resources/with-nil-entry/elpa-packages.eld new file mode 100644 index 00000000000..7884aac278e --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/with-nil-entry/elpa-packages.eld @@ -0,0 +1,3 @@ +;; Dummy elpa-package.eld + +(() :version 1) diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el index b903cd781ba..ffe4d7cd5fd 100644 --- a/test/lisp/emacs-lisp/package-tests.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -275,11 +275,31 @@ Must called from within a `tar-mode' buffer." (let* ((pkg-el "multi-file-0.2.3.tar") (source-file (expand-file-name pkg-el (ert-resource-directory)))) - (package-initialize) (should-not (package-installed-p 'multie-file)) (package-install-file source-file) (should (package-installed-p 'multi-file)) - (package-delete (cadr (assq 'multi-file package-alist)))) + (package-delete (cadr (assq 'multi-file package-alist)))))) + +(ert-deftest package-test-bug58367 () + "Check variations in tarball formats." + (with-package-test (:basedir (ert-resource-directory)) + (package-initialize) + + ;; A package whose first entry is the main dir but without trailing /. + (let* ((pkg-el "ustar-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'ustar-withsub)) + (package-install-file source-file) + (should (package-installed-p 'ustar-withsub)) + (package-delete (cadr (assq 'ustar-withsub package-alist)))) + + ;; A package whose first entry is a file in a subdir. + (let* ((pkg-el "v7-withsub-0.1.tar") + (source-file (expand-file-name pkg-el (ert-resource-directory)))) + (should-not (package-installed-p 'v7-withsub)) + (package-install-file source-file) + (should (package-installed-p 'v7-withsub)) + (package-delete (cadr (assq 'v7-withsub package-alist)))) )) (ert-deftest package-test-install-file-EOLs () diff --git a/test/lisp/emacs-lisp/syntax-tests.el b/test/lisp/emacs-lisp/syntax-tests.el index f266db5c702..d8fc5c4fa82 100644 --- a/test/lisp/emacs-lisp/syntax-tests.el +++ b/test/lisp/emacs-lisp/syntax-tests.el @@ -56,7 +56,7 @@ "\\(?2:[abc]+\\)foo\\(\\2\\)" 2) "\\(?4:[abc]+\\)foo\\(\\4\\)")) ;; Emacs supports only the back-references \1,...,\9, so when a - ;; shift would result in \10 or more, an error must be signalled. + ;; shift would result in \10 or more, an error must be signaled. (should-error (syntax-propertize--shift-groups-and-backrefs "\\(a\\)\\3" 7))) diff --git a/test/lisp/erc/erc-dcc-tests.el b/test/lisp/erc/erc-dcc-tests.el index a1dfbab9dc5..74cbb7d9476 100644 --- a/test/lisp/erc/erc-dcc-tests.el +++ b/test/lisp/erc/erc-dcc-tests.el @@ -20,8 +20,9 @@ ;;; Commentary: ;;; Code: -(require 'ert) +(require 'ert-x) (require 'erc-dcc) +(require 'erc-pcomplete) (ert-deftest erc-dcc-ctcp-query-send-regexp () (let ((s "DCC SEND \"file name\" 2130706433 9899 1405135128")) @@ -164,4 +165,121 @@ (should (eq t (plist-get (car erc-dcc-list) :turbo))) (should (equal (pop calls) (list elt "foo.bin" proc)))))))) +(defun erc-dcc-tests--pcomplete-common (test-fn) + (with-current-buffer (get-buffer-create "*erc-dcc-do-GET-command*") + (let* ((inhibit-message noninteractive) + (proc (start-process "fake" (current-buffer) "sleep" "10")) + (elt (list :nick "tester!~tester@fake.irc" + :type 'GET + :peer nil + :parent proc + :ip "127.0.0.1" + :port "9899" + :file "foo.bin" + :size 1405135128)) + ;; + erc-accidental-paste-threshold-seconds + erc-insert-modify-hook erc-send-completed-hook + erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook) + (erc-mode) + (pcomplete-erc-setup) + (add-hook 'erc-complete-functions #'erc-pcompletions-at-point 0 t) + (setq erc-server-process proc + erc-input-marker (make-marker) + erc-insert-marker (make-marker) + erc-server-current-nick "dummy") + (setq-local erc-dcc-list (list elt)) ; for interactive noodling + (set-process-query-on-exit-flag proc nil) + (goto-char (point-max)) + (set-marker erc-insert-marker (point-max)) + (erc-display-prompt) + (goto-char erc-input-marker) + (funcall test-fn)) + (when noninteractive + (kill-buffer)))) + +(ert-deftest pcomplete/erc-mode/DCC--get-basic () + (erc-dcc-tests--pcomplete-common + (lambda () + (insert "/dcc get ") + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get tester" nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get tester foo.bin" nil t)))))) + +(ert-deftest pcomplete/erc-mode/DCC--get-1flag () + (erc-dcc-tests--pcomplete-common + (lambda () + (goto-char erc-input-marker) + (delete-region (point) (point-max)) + (insert "/dcc get -") + (call-interactively #'completion-at-point) + (with-current-buffer (get-buffer "*Completions*") + (goto-char (point-min)) + (search-forward "-s") + (search-forward "-t")) + (insert "s ") + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -s tester" nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -s tester foo.bin" nil t)))))) + +(ert-deftest pcomplete/erc-mode/DCC--get-2flags () + (erc-dcc-tests--pcomplete-common + (lambda () + (goto-char erc-input-marker) + (delete-region (point) (point-max)) + (insert "/dcc get -") + (call-interactively #'completion-at-point) + (with-current-buffer (get-buffer "*Completions*") + (goto-char (point-min)) + (search-forward "-s") + (search-forward "-t")) + (insert "s -") + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -s -t " nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -s -t tester" nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -s -t tester foo.bin" nil t)))))) + +(ert-deftest pcomplete/erc-mode/DCC--get-2flags-reverse () + (erc-dcc-tests--pcomplete-common + (lambda () + (goto-char erc-input-marker) + (delete-region (point) (point-max)) + (insert "/dcc get -") + (call-interactively #'completion-at-point) + (with-current-buffer (get-buffer "*Completions*") + (goto-char (point-min)) + (search-forward "-s") + (search-forward "-t")) + (insert "t -") + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -t -s " nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -t -s tester" nil t))) + (call-interactively #'completion-at-point) + (save-excursion + (beginning-of-line) + (should (search-forward "/dcc get -t -s tester foo.bin" nil t)))))) + ;;; erc-dcc-tests.el ends here diff --git a/test/lisp/erc/erc-networks-tests.el b/test/lisp/erc/erc-networks-tests.el index 66a334b7091..fc12bf7ce37 100644 --- a/test/lisp/erc/erc-networks-tests.el +++ b/test/lisp/erc/erc-networks-tests.el @@ -20,7 +20,7 @@ ;;; Code: (require 'ert-x) ; cl-lib -(require 'erc-networks) +(require 'erc) (defun erc-networks-tests--create-dead-proc (&optional buf) (let ((p (start-process "true" (or buf (current-buffer)) "true"))) @@ -1704,4 +1704,21 @@ (erc-networks-tests--clean-bufs)) +(ert-deftest erc-networks--determine () + (should (eq (erc-networks--determine "irc.libera.chat") 'Libera.Chat)) + (should (eq (erc-networks--determine "irc.oftc.net") 'OFTC)) + (should (eq (erc-networks--determine "irc.dal.net") 'DALnet)) + + (let ((erc-server-announced-name "zirconium.libera.chat")) + (should (eq (erc-networks--determine) 'Libera.Chat))) + (let ((erc-server-announced-name "weber.oftc.net")) + (should (eq (erc-networks--determine) 'OFTC))) + (let ((erc-server-announced-name "redemption.ix.us.dal.net")) + (should (eq (erc-networks--determine) 'DALnet))) + + ;; Failure + (let ((erc-server-announced-name "irc-us2.alphachat.net")) + (should (eq (erc-networks--determine) + erc-networks--name-missing-sentinel)))) + ;;; erc-networks-tests.el ends here diff --git a/test/lisp/erc/erc-scenarios-base-reconnect.el b/test/lisp/erc/erc-scenarios-base-reconnect.el index 49298dc5942..8762f33b303 100644 --- a/test/lisp/erc/erc-scenarios-base-reconnect.el +++ b/test/lisp/erc/erc-scenarios-base-reconnect.el @@ -224,4 +224,50 @@ (with-current-buffer "#chan" (funcall expect 10 "here comes the lady"))))) + +(ert-deftest erc-scenarios-base-cancel-reconnect () + :tags '(:expensive-test) + (erc-scenarios-common-with-cleanup + ((erc-scenarios-common-dialog "base/reconnect") + (dumb-server (erc-d-run "localhost" t 'timer 'timer 'timer-last)) + (port (process-contact dumb-server :service)) + (expect (erc-d-t-make-expecter)) + (erc-server-auto-reconnect t) + erc-autojoin-channels-alist + erc-server-buffer) + + (ert-info ("Connect to foonet") + (setq erc-server-buffer (erc :server "127.0.0.1" + :port port + :nick "tester" + :password "changeme" + :full-name "tester")) + (with-current-buffer erc-server-buffer + (should (string= (buffer-name) (format "127.0.0.1:%d" port))))) + + (ert-info ("Two connection attempts, all stymied") + (with-current-buffer erc-server-buffer + (ert-info ("First two attempts behave normally") + (dotimes (n 2) + (ert-info ((format "Initial attempt %d" (1+ n))) + (funcall expect 3 "Opening connection") + (funcall expect 2 "Password incorrect") + (funcall expect 2 "Connection failed!") + (funcall expect 2 "Re-establishing connection")))) + (ert-info ("/RECONNECT cancels timer but still attempts to connect") + (erc-cmd-RECONNECT) + (funcall expect 2 "Canceled") + (funcall expect 3 "Opening connection") + (funcall expect 2 "Password incorrect") + (funcall expect 2 "Connection failed!") + (funcall expect 2 "Re-establishing connection")) + (ert-info ("Explicitly cancel timer") + (erc-cmd-RECONNECT "cancel") + (funcall expect 2 "Canceled") + (erc-d-t-absent-for 1 "Opening connection" (point))))) + + (ert-info ("Server buffer is unique and temp name is absent") + (should (equal (list (get-buffer (format "127.0.0.1:%d" port))) + (erc-scenarios-common-buflist "127.0.0.1")))))) + ;;; erc-scenarios-base-reconnect.el ends here diff --git a/test/lisp/erc/erc-scenarios-misc.el b/test/lisp/erc/erc-scenarios-misc.el index ded620ccc1d..8557a779069 100644 --- a/test/lisp/erc/erc-scenarios-misc.el +++ b/test/lisp/erc/erc-scenarios-misc.el @@ -177,4 +177,32 @@ (erc-scenarios-common-say "Hi") (funcall expect 10 "Hola"))))) +(defvar url-irc-function) + +(ert-deftest erc-scenarios-handle-irc-url () + :tags '(:expensive-test) + (erc-scenarios-common-with-cleanup + ((erc-scenarios-common-dialog "join/legacy") + (dumb-server (erc-d-run "localhost" t 'foonet)) + (port (process-contact dumb-server :service)) + (expect (erc-d-t-make-expecter)) + (url-irc-function 'url-irc-erc) + (erc-url-connect-function + (lambda (scheme &rest r) + (ert-info ("Connect to foonet") + (should (equal scheme "irc")) + (with-current-buffer (apply #'erc `(:full-name "tester" ,@r)) + (should (string= (buffer-name) + (format "127.0.0.1:%d" port))) + (current-buffer)))))) + + (with-temp-buffer + (insert (format ";; irc://tester:changeme@127.0.0.1:%d/#chan" port)) + (goto-char 10) + (browse-url-at-point)) + + (ert-info ("Connected") + (with-current-buffer (erc-d-t-wait-for 10 (get-buffer "#chan")) + (funcall expect 10 "welcome"))))) + ;;; erc-scenarios-misc.el ends here diff --git a/test/lisp/erc/erc-services-tests.el b/test/lisp/erc/erc-services-tests.el index 8e2b8d29273..7ff2e36e77c 100644 --- a/test/lisp/erc/erc-services-tests.el +++ b/test/lisp/erc/erc-services-tests.el @@ -469,15 +469,11 @@ (list (assoc 'secret (cdr found))))) (defvar erc-join-tests--auth-source-pass-entries - '(("irc.gnu.org:irc/#chan" - ("port" . "irc") ("user" . "#chan") (secret . "bar")) - ("my.gnu.org:irc/#chan" - ("port" . "irc") ("user" . "#chan") (secret . "baz")) - ("GNU.chat:irc/#chan" - ("port" . "irc") ("user" . "#chan") (secret . "foo")))) + '(("irc.gnu.org:irc/#chan" (secret . "bar")) + ("my.gnu.org:irc/#chan" (secret . "baz")) + ("GNU.chat:irc/#chan" (secret . "foo")))) (ert-deftest erc--auth-source-search--pass-standard () - (ert-skip "Pass backend not yet supported") (let ((store erc-join-tests--auth-source-pass-entries) (auth-sources '(password-store)) (auth-source-do-cache nil)) @@ -490,7 +486,6 @@ (erc-services-tests--auth-source-standard #'erc-auth-source-search)))) (ert-deftest erc--auth-source-search--pass-announced () - (ert-skip "Pass backend not yet supported") (let ((store erc-join-tests--auth-source-pass-entries) (auth-sources '(password-store)) (auth-source-do-cache nil)) @@ -503,19 +498,13 @@ (erc-services-tests--auth-source-announced #'erc-auth-source-search)))) (ert-deftest erc--auth-source-search--pass-overrides () - (ert-skip "Pass backend not yet supported") (let ((store `(,@erc-join-tests--auth-source-pass-entries - ("GNU.chat:6697/#chan" - ("port" . "6697") ("user" . "#chan") (secret . "spam")) - ("my.gnu.org:irc/#fsf" - ("port" . "irc") ("user" . "#fsf") (secret . "42")) - ("irc.gnu.org:6667" - ("port" . "6667") (secret . "sesame")) - ("MyHost:irc" - ("port" . "irc") (secret . "456")) - ("MyHost:6667" - ("port" . "6667") (secret . "123")))) + ("GNU.chat:6697/#chan" (secret . "spam")) + ("my.gnu.org:irc/#fsf" (secret . "42")) + ("irc.gnu.org:6667" (secret . "sesame")) + ("MyHost:irc" (secret . "456")) + ("MyHost:6667" (secret . "123")))) (auth-sources '(password-store)) (auth-source-do-cache nil)) diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index b2ed29e80ec..ff5d8026973 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el @@ -24,7 +24,6 @@ (require 'ert-x) (require 'erc) (require 'erc-ring) -(require 'erc-networks) (ert-deftest erc--read-time-period () (cl-letf (((symbol-function 'read-string) (lambda (&rest _) ""))) @@ -48,27 +47,6 @@ (cl-letf (((symbol-function 'read-string) (lambda (&rest _) "1d"))) (should (equal (erc--read-time-period "foo: ") 86400)))) -(ert-deftest erc--meta--backend-dependencies () - (with-temp-buffer - (insert-file-contents-literally - (concat (file-name-sans-extension (symbol-file 'erc)) ".el")) - (let ((beg (search-forward ";; Defined in erc-backend")) - (end (search-forward "\n\n")) - vars) - (save-excursion - (save-restriction - (narrow-to-region beg end) - (goto-char (point-min)) - (with-syntax-table lisp-data-mode-syntax-table - (condition-case _ - (while (push (cadr (read (current-buffer))) vars)) - (end-of-file))))) - (should (= (point) end)) - (dolist (var vars) - (setq var (concat "\\_<" (symbol-name var) "\\_>")) - (ert-info (var) - (should (save-excursion (search-forward-regexp var nil t)))))))) - (ert-deftest erc-with-all-buffers-of-server () (let (proc-exnet proc-onet @@ -975,4 +953,229 @@ (kill-buffer "ExampleNet") (kill-buffer "#chan"))) +(defvar erc-tests--ipv6-examples + '("1:2:3:4:5:6:7:8" + "::ffff:10.0.0.1" "::ffff:1.2.3.4" "::ffff:0.0.0.0" + "1:2:3:4:5:6:77:88" "::ffff:255.255.255.255" + "fe08::7:8" "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" + "1:2:3:4:5:6:7:8" "1::" "1:2:3:4:5:6:7::" "1::8" + "1:2:3:4:5:6::8" "1:2:3:4:5:6::8" "1::7:8" "1:2:3:4:5::7:8" + "1:2:3:4:5::8" "1::6:7:8" "1:2:3:4::6:7:8" "1:2:3:4::8" + "1::5:6:7:8" "1:2:3::5:6:7:8" "1:2:3::8" "1::4:5:6:7:8" + "1:2::4:5:6:7:8" "1:2::8" "1::3:4:5:6:7:8" "1::3:4:5:6:7:8" + "1::8" "::2:3:4:5:6:7:8" "::2:3:4:5:6:7:8" "::8" + "::" "fe08::7:8%eth0" "fe08::7:8%1" "::255.255.255.255" + "::ffff:255.255.255.255" "::ffff:0:255.255.255.255" + "2001:db8:3:4::192.0.2.33" "64:ff9b::192.0.2.33")) + +(ert-deftest erc--server-connect-dumb-ipv6-regexp () + (dolist (a erc-tests--ipv6-examples) + (should-not (string-match erc--server-connect-dumb-ipv6-regexp a)) + (should (string-match erc--server-connect-dumb-ipv6-regexp + (concat "[" a "]"))))) + +(ert-deftest erc-select-read-args () + + (ert-info ("Defaults to TLS") + (should (equal (ert-simulate-keys "\r\r\r\r" + (erc-select-read-args)) + (list :server "irc.libera.chat" + :port 6697 + :nick (user-login-name) + :password nil)))) + + (ert-info ("Override default TLS") + (should (equal (ert-simulate-keys "irc://irc.libera.chat\r\r\r\r" + (erc-select-read-args)) + (list :server "irc.libera.chat" + :port 6667 + :nick (user-login-name) + :password nil)))) + + (ert-info ("Address includes port") + (should (equal (ert-simulate-keys + "localhost:6667\rnick\r\r" + (erc-select-read-args)) + (list :server "localhost" + :port 6667 + :nick "nick" + :password nil)))) + + (ert-info ("Address includes nick, password skipped via option") + (should (equal (ert-simulate-keys "nick@localhost:6667\r" + (let (erc-prompt-for-password) + (erc-select-read-args))) + (list :server "localhost" + :port 6667 + :nick "nick" + :password nil)))) + + (ert-info ("Address includes nick and password") + (should (equal (ert-simulate-keys "nick:sesame@localhost:6667\r" + (erc-select-read-args)) + (list :server "localhost" + :port 6667 + :nick "nick" + :password "sesame")))) + + (ert-info ("IPv6 address plain") + (should (equal (ert-simulate-keys "::1\r\r\r\r" + (erc-select-read-args)) + (list :server "[::1]" + :port 6667 + :nick (user-login-name) + :password nil)))) + + (ert-info ("IPv6 address with port") + (should (equal (ert-simulate-keys "[::1]:6667\r\r\r" + (erc-select-read-args)) + (list :server "[::1]" + :port 6667 + :nick (user-login-name) + :password nil)))) + + (ert-info ("IPv6 address includes nick") + (should (equal (ert-simulate-keys "nick@[::1]:6667\r\r" + (erc-select-read-args)) + (list :server "[::1]" + :port 6667 + :nick "nick" + :password nil))))) + +(ert-deftest erc-tls () + (let (calls) + (cl-letf (((symbol-function 'user-login-name) + (lambda (&optional _) "tester")) + ((symbol-function 'erc-open) + (lambda (&rest r) (push r calls)))) + + (ert-info ("Defaults") + (erc-tls) + (should (equal (pop calls) + '("irc.libera.chat" 6697 "tester" "unknown" t + nil nil nil nil nil "user" nil)))) + + (ert-info ("Full") + (erc-tls :server "irc.gnu.org" + :port 7000 + :user "bobo" + :nick "bob" + :full-name "Bob's Name" + :password "bob:changeme" + :client-certificate t + :id 'GNU.org) + (should (equal (pop calls) + '("irc.gnu.org" 7000 "bob" "Bob's Name" t + "bob:changeme" nil nil nil t "bobo" GNU.org)))) + + ;; Values are often nil when called by lisp code, which leads to + ;; null params. This is why `erc-open' recomputes almost + ;; everything. + (ert-info ("Fallback") + (let ((erc-nick "bob") + (erc-server "irc.gnu.org") + (erc-email-userid "bobo") + (erc-user-full-name "Bob's Name")) + (erc-tls :server nil + :port 7000 + :nick nil + :password "bob:changeme")) + (should (equal (pop calls) + '(nil 7000 nil "Bob's Name" t + "bob:changeme" nil nil nil nil "bobo" nil))))))) + +(defun erc-tests--make-server-buf (name) + (with-current-buffer (get-buffer-create name) + (erc-mode) + (setq erc-server-process (start-process "sleep" (current-buffer) + "sleep" "1") + erc-session-server (concat "irc." name ".org") + erc-session-port 6667 + erc-network (intern name)) + (set-process-query-on-exit-flag erc-server-process nil) + (current-buffer))) + +(defun erc-tests--make-client-buf (server name) + (unless (bufferp server) + (setq server (get-buffer server))) + (with-current-buffer (get-buffer-create name) + (erc-mode) + (setq erc--target (erc--target-from-string name)) + (dolist (v '(erc-server-process + erc-session-server + erc-session-port + erc-network)) + (set v (buffer-local-value v server))) + (current-buffer))) + +(ert-deftest erc-handle-irc-url () + (let* (calls + rvbuf + erc-networks-alist + erc-kill-channel-hook erc-kill-server-hook erc-kill-buffer-hook + (erc-url-connect-function + (lambda (&rest r) + (push r calls) + (if (functionp rvbuf) (funcall rvbuf) rvbuf)))) + + (cl-letf (((symbol-function 'erc-cmd-JOIN) + (lambda (&rest r) (push r calls)))) + + (with-current-buffer (erc-tests--make-server-buf "foonet") + (setq rvbuf (current-buffer))) + (erc-tests--make-server-buf "barnet") + (erc-tests--make-server-buf "baznet") + + (ert-info ("Unknown network") + (erc-handle-irc-url "irc.foonet.org" 6667 "#chan" nil nil "irc") + (should (equal '("#chan" nil) (pop calls))) + (should-not calls)) + + (ert-info ("Unknown network, no port") + (erc-handle-irc-url "irc.foonet.org" nil "#chan" nil nil "irc") + (should (equal '("#chan" nil) (pop calls))) + (should-not calls)) + + (ert-info ("Known network, no port") + (setq erc-networks-alist '((foonet "irc.foonet.org"))) + (erc-handle-irc-url "irc.foonet.org" nil "#chan" nil nil "irc") + (should (equal '("#chan" nil) (pop calls))) + (should-not calls)) + + (ert-info ("Known network, different port") + (erc-handle-irc-url "irc.foonet.org" 6697 "#chan" nil nil "irc") + (should (equal '("#chan" nil) (pop calls))) + (should-not calls)) + + (ert-info ("Known network, existing chan with key") + (erc-tests--make-client-buf "foonet" "#chan") + (erc-handle-irc-url "irc.foonet.org" nil "#chan?sec" nil nil "irc") + (should (equal '("#chan" "sec") (pop calls))) + (should-not calls)) + + (ert-info ("Unknown network, connect, no chan") + (erc-handle-irc-url "irc.gnu.org" nil nil nil nil "irc") + (should (equal '("irc" :server "irc.gnu.org") (pop calls))) + (should-not calls)) + + (ert-info ("Unknown network, connect, chan") + (with-current-buffer "foonet" + (should-not (local-variable-p 'erc-after-connect))) + (setq rvbuf (lambda () (erc-tests--make-server-buf "gnu"))) + (erc-handle-irc-url "irc.gnu.org" nil "#spam" nil nil "irc") + (should (equal '("irc" :server "irc.gnu.org") (pop calls))) + (should-not calls) + (with-current-buffer "gnu" + (should (local-variable-p 'erc-after-connect)) + (funcall (car erc-after-connect)) + (should (equal '("#spam" nil) (pop calls))) + (should-not (local-variable-p 'erc-after-connect))) + (should-not calls)))) + + (when noninteractive + (kill-buffer "foonet") + (kill-buffer "barnet") + (kill-buffer "baznet") + (kill-buffer "#chan"))) + ;;; erc-tests.el ends here diff --git a/test/lisp/erc/resources/erc-d/erc-d-tests.el b/test/lisp/erc/resources/erc-d/erc-d-tests.el index a4befd96b5e..8dd5cef7aa2 100644 --- a/test/lisp/erc/resources/erc-d/erc-d-tests.el +++ b/test/lisp/erc/resources/erc-d/erc-d-tests.el @@ -562,6 +562,7 @@ DUMB-SERVER-VAR are bound accordingly in BODY." ;; (erc-server-flood-penalty 0.05) erc-autojoin-channels-alist + erc-after-connect erc-server-auto-reconnect) (should-not erc-d--slow-mo) (with-current-buffer "*erc-d-server*" (erc-d-t-search-for 4 "Starting")) diff --git a/test/lisp/erc/resources/erc-scenarios-common.el b/test/lisp/erc/resources/erc-scenarios-common.el index bc2cb68cd86..ef65125241f 100644 --- a/test/lisp/erc/resources/erc-scenarios-common.el +++ b/test/lisp/erc/resources/erc-scenarios-common.el @@ -73,7 +73,7 @@ (require 'erc-d-t) (require 'erc-d))) -(require 'erc-backend) +(require 'erc) (eval-when-compile (require 'erc-join) (require 'erc-services)) @@ -125,6 +125,7 @@ (erc-auth-source-parameters-join-function nil) (erc-autojoin-channels-alist nil) (erc-server-auto-reconnect nil) + (erc-after-connect nil) (erc-d-linger-secs 10) ,@bindings))) diff --git a/test/lisp/erc/resources/join/legacy/foonet.eld b/test/lisp/erc/resources/join/legacy/foonet.eld index 344ba7c1daf..4025094a59c 100644 --- a/test/lisp/erc/resources/join/legacy/foonet.eld +++ b/test/lisp/erc/resources/join/legacy/foonet.eld @@ -1,5 +1,5 @@ ;; -*- mode: lisp-data; -*- -((pass 1 "PASS :changeme")) +((pass 10 "PASS :changeme")) ((nick 1 "NICK tester")) ((user 1 "USER user 0 * :tester") (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester") diff --git a/test/lisp/eshell/em-tramp-tests.el b/test/lisp/eshell/em-tramp-tests.el index 8969c1e2294..6cc35ecdb1b 100644 --- a/test/lisp/eshell/em-tramp-tests.el +++ b/test/lisp/eshell/em-tramp-tests.el @@ -85,4 +85,79 @@ `(,(format "/sudo:USER@%s:%s" tramp-default-host default-directory) ("echo" ("-u" "hi"))))))) +(ert-deftest em-tramp-test/sudo-shell () + "Test Eshell `sudo' command with -s/--shell option." + (dolist (args '(("--shell") + ("-s"))) + (should (equal + (catch 'eshell-replace-command (apply #'eshell/sudo args)) + `(eshell-trap-errors + (eshell-named-command + "cd" + (list ,(format "/sudo:root@%s:%s" + tramp-default-host default-directory)))))))) + +(ert-deftest em-tramp-test/sudo-user-shell () + "Test Eshell `sudo' command with -s and -u options." + (should (equal + (catch 'eshell-replace-command (eshell/sudo "-u" "USER" "-s")) + `(eshell-trap-errors + (eshell-named-command + "cd" + (list ,(format "/sudo:USER@%s:%s" + tramp-default-host default-directory))))))) + +(ert-deftest em-tramp-test/doas-basic () + "Test Eshell `doas' command with default user." + (cl-letf (((symbol-function 'eshell-named-command) + #'mock-eshell-named-command)) + (should (equal + (catch 'eshell-external (eshell/doas "echo" "hi")) + `(,(format "/doas:root@%s:%s" + tramp-default-host default-directory) + ("echo" ("hi"))))) + (should (equal + (catch 'eshell-external (eshell/doas "echo" "-u" "hi")) + `(,(format "/doas:root@%s:%s" + tramp-default-host default-directory) + ("echo" ("-u" "hi"))))))) + +(ert-deftest em-tramp-test/doas-user () + "Test Eshell `doas' command with specified user." + (cl-letf (((symbol-function 'eshell-named-command) + #'mock-eshell-named-command)) + (should (equal + (catch 'eshell-external (eshell/doas "-u" "USER" "echo" "hi")) + `(,(format "/doas:USER@%s:%s" + tramp-default-host default-directory) + ("echo" ("hi"))))) + (should (equal + (catch 'eshell-external + (eshell/doas "-u" "USER" "echo" "-u" "hi")) + `(,(format "/doas:USER@%s:%s" + tramp-default-host default-directory) + ("echo" ("-u" "hi"))))))) + +(ert-deftest em-tramp-test/doas-shell () + "Test Eshell `doas' command with -s/--shell option." + (dolist (args '(("--shell") + ("-s"))) + (should (equal + (catch 'eshell-replace-command (apply #'eshell/doas args)) + `(eshell-trap-errors + (eshell-named-command + "cd" + (list ,(format "/doas:root@%s:%s" + tramp-default-host default-directory)))))))) + +(ert-deftest em-tramp-test/doas-user-shell () + "Test Eshell `doas' command with -s and -u options." + (should (equal + (catch 'eshell-replace-command (eshell/doas "-u" "USER" "-s")) + `(eshell-trap-errors + (eshell-named-command + "cd" + (list ,(format "/doas:USER@%s:%s" + tramp-default-host default-directory))))))) + ;;; em-tramp-tests.el ends here diff --git a/test/lisp/eshell/esh-ext-tests.el b/test/lisp/eshell/esh-ext-tests.el new file mode 100644 index 00000000000..54191e9409e --- /dev/null +++ b/test/lisp/eshell/esh-ext-tests.el @@ -0,0 +1,76 @@ +;;; esh-ext-tests.el --- esh-ext test suite -*- lexical-binding:t -*- + +;; Copyright (C) 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/>. + +;;; Commentary: + +;; Tests for Eshell's external command handling. + +;;; Code: + +(require 'ert) +(require 'esh-mode) +(require 'esh-ext) +(require 'eshell) + +(require 'eshell-tests-helpers + (expand-file-name "eshell-tests-helpers" + (file-name-directory (or load-file-name + default-directory)))) + +;;; Tests: + +(ert-deftest esh-ext-test/addpath/end () + "Test that \"addpath\" adds paths to the end of $PATH." + (with-temp-eshell + (let ((eshell-path-env-list '("/some/path" "/other/path")) + (expected-path (string-join '("/some/path" "/other/path" "/new/path" + "/new/path2") + (path-separator)))) + (eshell-match-command-output "addpath /new/path /new/path2" + (concat expected-path "\n")) + (eshell-match-command-output "echo $PATH" + (concat expected-path "\n"))))) + +(ert-deftest esh-ext-test/addpath/begin () + "Test that \"addpath -b\" adds paths to the beginning of $PATH." + (with-temp-eshell + (let ((eshell-path-env-list '("/some/path" "/other/path")) + (expected-path (string-join '("/new/path" "/new/path2" "/some/path" + "/other/path") + (path-separator)))) + (eshell-match-command-output "addpath -b /new/path /new/path2" + (concat expected-path "\n")) + (eshell-match-command-output "echo $PATH" + (concat expected-path "\n"))))) + +(ert-deftest esh-ext-test/addpath/set-locally () + "Test adding to the path temporarily in a subcommand." + (let* ((eshell-path-env-list '("/some/path" "/other/path")) + (original-path (string-join eshell-path-env-list (path-separator))) + (local-path (string-join (append eshell-path-env-list '("/new/path")) + (path-separator)))) + (with-temp-eshell + (eshell-match-command-output + "{ addpath /new/path; env }" + (format "PATH=%s\n" (regexp-quote local-path))) + ;; After the last command, the previous $PATH value should be restored. + (eshell-match-command-output "echo $PATH" + (concat original-path "\n"))))) + +;; esh-ext-tests.el ends here diff --git a/test/lisp/eshell/esh-util-tests.el b/test/lisp/eshell/esh-util-tests.el new file mode 100644 index 00000000000..1cbd015999f --- /dev/null +++ b/test/lisp/eshell/esh-util-tests.el @@ -0,0 +1,57 @@ +;;; esh-util-tests.el --- esh-util test suite -*- lexical-binding:t -*- + +;; Copyright (C) 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 'esh-util) + +;;; Tests: + +(ert-deftest esh-util-test/eshell-stringify/string () + "Test that `eshell-stringify' preserves the value of strings." + (should (equal (eshell-stringify "hello") "hello"))) + +(ert-deftest esh-util-test/eshell-stringify/number () + "Test that `eshell-stringify' converts numbers to strings." + (should (equal (eshell-stringify 42) "42")) + (should (equal (eshell-stringify 4.2) "4.2"))) + +(ert-deftest esh-util-test/eshell-stringify/t () + "Test that `eshell-stringify' treats `t' according to `eshell-stringify-t'." + (let ((eshell-stringify-t t)) + (should (equal (eshell-stringify t) "t"))) + (let ((eshell-stringify-t nil)) + (should (equal (eshell-stringify t) nil)))) + +(ert-deftest esh-util-test/eshell-stringify/nil () + "Test that `eshell-stringify' converts nil to a string." + (should (equal (eshell-stringify nil) "nil"))) + +(ert-deftest esh-util-test/eshell-stringify/list () + "Test that `eshell-stringify' correctly stringifies lists." + (should (equal (eshell-stringify '(1 2 3)) "(1 2 3)")) + (should (equal (eshell-stringify '((1 2) (3 . 4))) + "((1 2)\n (3 . 4))"))) + +(ert-deftest esh-util-test/eshell-stringify/complex () + "Test that `eshell-stringify' correctly stringifies complex objects." + (should (equal (eshell-stringify (list 'quote 'hello)) "'hello"))) + +;;; esh-util-tests.el ends here diff --git a/test/lisp/eshell/esh-var-tests.el b/test/lisp/eshell/esh-var-tests.el index cb5b1766bb5..245a8e6a26b 100644 --- a/test/lisp/eshell/esh-var-tests.el +++ b/test/lisp/eshell/esh-var-tests.el @@ -23,8 +23,10 @@ ;;; Code: +(require 'tramp) (require 'ert) (require 'esh-mode) +(require 'esh-var) (require 'eshell) (require 'eshell-tests-helpers @@ -440,6 +442,152 @@ inside double-quotes" "000")) +;; Variable-related commands + +(ert-deftest esh-var-test/set/env-var () + "Test that `set' with a string variable name sets an environment variable." + (with-temp-eshell + (eshell-match-command-output "set VAR hello" "hello\n") + (should (equal (getenv "VAR") "hello"))) + (should-not (equal (getenv "VAR") "hello"))) + +(ert-deftest esh-var-test/set/symbol () + "Test that `set' with a symbol variable name sets a Lisp variable." + (let (eshell-test-value) + (eshell-command-result-equal "set #'eshell-test-value hello" + "hello") + (should (equal eshell-test-value "hello")))) + +(ert-deftest esh-var-test/unset/env-var () + "Test that `unset' with a string variable name unsets an env var." + (let ((process-environment (cons "VAR=value" process-environment))) + (with-temp-eshell + (eshell-match-command-output "unset VAR" "\\`\\'") + (should (equal (getenv "VAR") nil))) + (should (equal (getenv "VAR") "value")))) + +(ert-deftest esh-var-test/unset/symbol () + "Test that `unset' with a symbol variable name unsets a Lisp variable." + (let ((eshell-test-value "value")) + (eshell-command-result-equal "unset #'eshell-test-value" nil) + (should (equal eshell-test-value nil)))) + +(ert-deftest esh-var-test/setq () + "Test that `setq' sets Lisp variables." + (let (eshell-test-value) + (eshell-command-result-equal "setq eshell-test-value hello" + "hello") + (should (equal eshell-test-value "hello")))) + +(ert-deftest esh-var-test/export () + "Test that `export' sets environment variables." + (with-temp-eshell + (eshell-match-command-output "export VAR=hello" "\\`\\'") + (should (equal (getenv "VAR") "hello")))) + +(ert-deftest esh-var-test/local-variables () + "Test that \"VAR=value command\" temporarily sets variables." + (with-temp-eshell + (push "VAR=value" process-environment) + (eshell-match-command-output "VAR=hello env" "VAR=hello\n") + (should (equal (getenv "VAR") "value")))) + + +;; Variable aliases + +(ert-deftest esh-var-test/alias/function () + "Test using a variable alias defined as a function." + (let ((text-quoting-style 'grave)) + (with-temp-eshell + (push `("ALIAS" ,(lambda () "value") nil t) eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "value\n") + (eshell-match-command-output "set ALIAS hello" + "Variable `ALIAS' is not settable\n" + nil t)))) + +(ert-deftest esh-var-test/alias/function-pair () + "Test using a variable alias defined as a pair of getter/setter functions." + (with-temp-eshell + (let ((eshell-test-value "value")) + (push `("ALIAS" (,(lambda () eshell-test-value) + . (lambda (_ value) + (setq eshell-test-value (upcase value)))) + nil t) + eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "value\n") + (eshell-match-command-output "set ALIAS hello" "HELLO\n") + (should (equal eshell-test-value "HELLO"))))) + +(ert-deftest esh-var-test/alias/string () + "Test using a variable alias defined as a string. +This should get/set the aliased environment variable." + (with-temp-eshell + (let ((eshell-test-value "lisp-value")) + (push "eshell-test-value=env-value" process-environment) + (push `("ALIAS" "eshell-test-value") eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "env-value\n") + (eshell-match-command-output "set ALIAS hello" "hello\n") + (should (equal (getenv "eshell-test-value") "hello")) + (should (equal eshell-test-value "lisp-value"))))) + +(ert-deftest esh-var-test/alias/string/prefer-lisp () + "Test using a variable alias defined as a string. +This sets `eshell-prefer-lisp-variables' to t and should get/set +the aliased Lisp variable." + (with-temp-eshell + (let ((eshell-test-value "lisp-value") + (eshell-prefer-lisp-variables t)) + (push "eshell-test-value=env-value" process-environment) + (push `("ALIAS" "eshell-test-value") eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "lisp-value\n") + (eshell-match-command-output "set ALIAS hello" "hello\n") + (should (equal (car process-environment) "eshell-test-value=env-value")) + (should (equal eshell-test-value "hello"))))) + +(ert-deftest esh-var-test/alias/symbol () + "Test using a variable alias defined as a symbol. +This should get/set the value bound to the symbol." + (with-temp-eshell + (let ((eshell-test-value "value")) + (push '("ALIAS" eshell-test-value) eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "value\n") + (eshell-match-command-output "set ALIAS hello" "hello\n") + (should (equal eshell-test-value "hello"))))) + +(ert-deftest esh-var-test/alias/symbol-pair () + "Test using a variable alias defined as a pair of symbols. +This should get the value bound to the symbol, but fail to set +it, since the setter is nil." + (with-temp-eshell + (let ((eshell-test-value "value") + (text-quoting-style 'grave)) + (push '("ALIAS" (eshell-test-value . nil)) eshell-variable-aliases-list) + (eshell-match-command-output "echo $ALIAS" "value\n") + (eshell-match-command-output "set ALIAS hello" + "Variable `ALIAS' is not settable\n" + nil t)))) + +(ert-deftest esh-var-test/alias/export () + "Test that `export' properly sets variable aliases." + (with-temp-eshell + (let ((eshell-test-value "value")) + (push `("ALIAS" (,(lambda () eshell-test-value) + . (lambda (_ value) (setq eshell-test-value value))) + nil t) + eshell-variable-aliases-list) + (eshell-match-command-output "export ALIAS=hello" "\\`\\'") + (should (equal eshell-test-value "hello"))))) + +(ert-deftest esh-var-test/alias/local-variables () + "Test that \"VAR=value cmd\" temporarily sets read-only variable aliases." + (with-temp-eshell + (let ((eshell-test-value "value")) + (push `("ALIAS" ,(lambda () eshell-test-value) t t) + eshell-variable-aliases-list) + (eshell-match-command-output "ALIAS=hello env" "ALIAS=hello\n") + (should (equal eshell-test-value "value"))))) + + ;; Built-in variables (ert-deftest esh-var-test/lines-var () @@ -465,6 +613,65 @@ inside double-quotes" (eshell-match-command-output "echo $INSIDE_EMACS[, 1]" "eshell"))) +(ert-deftest esh-var-test/path-var/local-directory () + "Test using $PATH in a local directory." + (let ((expected-path (string-join (eshell-get-path t) (path-separator)))) + (with-temp-eshell + (eshell-match-command-output "echo $PATH" (regexp-quote expected-path))))) + +(ert-deftest esh-var-test/path-var/remote-directory () + "Test using $PATH in a remote directory." + (skip-unless (eshell-tests-remote-accessible-p)) + (let* ((default-directory ert-remote-temporary-file-directory) + (expected-path (string-join (eshell-get-path t) (path-separator)))) + (with-temp-eshell + (eshell-match-command-output "echo $PATH" (regexp-quote expected-path))))) + +(ert-deftest esh-var-test/path-var/set () + "Test setting $PATH." + (let* ((path-to-set-list '("/some/path" "/other/path")) + (path-to-set (string-join path-to-set-list (path-separator)))) + (with-temp-eshell + (eshell-match-command-output (concat "set PATH " path-to-set) + (concat path-to-set "\n")) + (eshell-match-command-output "echo $PATH" (concat path-to-set "\n")) + (should (equal (eshell-get-path t) path-to-set-list))))) + +(ert-deftest esh-var-test/path-var/set-locally () + "Test setting $PATH temporarily for a single command." + (let* ((path-to-set-list '("/some/path" "/other/path")) + (path-to-set (string-join path-to-set-list (path-separator)))) + (with-temp-eshell + (eshell-match-command-output (concat "set PATH " path-to-set) + (concat path-to-set "\n")) + (eshell-match-command-output "PATH=/local/path env" + "PATH=/local/path\n") + ;; After the last command, the previous $PATH value should be restored. + (eshell-match-command-output "echo $PATH" (concat path-to-set "\n")) + (should (equal (eshell-get-path t) path-to-set-list))))) + +(ert-deftest esh-var-test/path-var/preserve-across-hosts () + "Test that $PATH can be set independently on multiple hosts." + (let ((local-directory default-directory) + local-path remote-path) + (with-temp-eshell + ;; Set the $PATH on localhost. + (eshell-insert-command "set PATH /local/path") + (setq local-path (eshell-last-output)) + ;; `cd' to a remote host and set the $PATH there too. + (eshell-insert-command + (format "cd %s" ert-remote-temporary-file-directory)) + (eshell-insert-command "set PATH /remote/path") + (setq remote-path (eshell-last-output)) + ;; Return to localhost and check that $PATH is the value we set + ;; originally. + (eshell-insert-command (format "cd %s" local-directory)) + (eshell-match-command-output "echo $PATH" (regexp-quote local-path)) + ;; ... and do the same for the remote host. + (eshell-insert-command + (format "cd %s" ert-remote-temporary-file-directory)) + (eshell-match-command-output "echo $PATH" (regexp-quote remote-path))))) + (ert-deftest esh-var-test/last-status-var-lisp-command () "Test using the \"last exit status\" ($?) variable with a Lisp command" (with-temp-eshell @@ -472,9 +679,8 @@ inside double-quotes" "t\n0\n") (eshell-match-command-output "zerop 1; echo $?" "0\n") - (let ((debug-on-error nil)) - (eshell-match-command-output "zerop foo; echo $?" - "1\n")))) + (eshell-match-command-output "zerop foo; echo $?" + "1\n" nil t))) (ert-deftest esh-var-test/last-status-var-lisp-form () "Test using the \"last exit status\" ($?) variable with a Lisp form" @@ -484,9 +690,8 @@ inside double-quotes" "t\n0\n") (eshell-match-command-output "(zerop 1); echo $?" "2\n") - (let ((debug-on-error nil)) - (eshell-match-command-output "(zerop \"foo\"); echo $?" - "1\n"))))) + (eshell-match-command-output "(zerop \"foo\"); echo $?" + "1\n" nil t)))) (ert-deftest esh-var-test/last-status-var-lisp-form-2 () "Test using the \"last exit status\" ($?) variable with a Lisp form. @@ -497,9 +702,8 @@ This tests when `eshell-lisp-form-nil-is-failure' is nil." "0\n") (eshell-match-command-output "(zerop 0); echo $?" "0\n") - (let ((debug-on-error nil)) - (eshell-match-command-output "(zerop \"foo\"); echo $?" - "1\n"))))) + (eshell-match-command-output "(zerop \"foo\"); echo $?" + "1\n" nil t)))) (ert-deftest esh-var-test/last-status-var-ext-cmd () "Test using the \"last exit status\" ($?) variable with an external command" diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el index 73abfcbb557..1d9674070c0 100644 --- a/test/lisp/eshell/eshell-tests-helpers.el +++ b/test/lisp/eshell/eshell-tests-helpers.el @@ -31,11 +31,22 @@ (require 'eshell) (defvar eshell-history-file-name nil) +(defvar eshell-last-dir-ring-file-name nil) (defvar eshell-test--max-subprocess-time 5 "The maximum amount of time to wait for a subprocess to finish, in seconds. See `eshell-wait-for-subprocess'.") +(defun eshell-tests-remote-accessible-p () + "Return if a test involving remote files can proceed. +If using this function, be sure to load `tramp' near the +beginning of the test file." + (ignore-errors + (and + (file-remote-p ert-remote-temporary-file-directory) + (file-directory-p ert-remote-temporary-file-directory) + (file-writable-p ert-remote-temporary-file-directory)))) + (defmacro with-temp-eshell (&rest body) "Evaluate BODY in a temporary Eshell buffer." `(save-current-buffer @@ -44,6 +55,7 @@ See `eshell-wait-for-subprocess'.") ;; back on $HISTFILE. (process-environment (cons "HISTFILE" process-environment)) (eshell-history-file-name nil) + (eshell-last-dir-ring-file-name nil) (eshell-buffer (eshell t))) (unwind-protect (with-current-buffer eshell-buffer @@ -83,26 +95,39 @@ After inserting, call FUNC. If FUNC is nil, instead call (insert-and-inherit command) (funcall (or func 'eshell-send-input))) +(defun eshell-last-input () + "Return the input of the last Eshell command." + (buffer-substring-no-properties + eshell-last-input-start eshell-last-input-end)) + +(defun eshell-last-output () + "Return the output of the last Eshell command." + (buffer-substring-no-properties + (eshell-beginning-of-output) (eshell-end-of-output))) + (defun eshell-match-output (regexp) "Test whether the output of the last command matches REGEXP." - (string-match-p - regexp (buffer-substring-no-properties - (eshell-beginning-of-output) (eshell-end-of-output)))) + (string-match-p regexp (eshell-last-output))) (defun eshell-match-output--explainer (regexp) "Explain the result of `eshell-match-output'." `(mismatched-output - (command ,(buffer-substring-no-properties - eshell-last-input-start eshell-last-input-end)) - (output ,(buffer-substring-no-properties - (eshell-beginning-of-output) (eshell-end-of-output))) + (command ,(eshell-last-input)) + (output ,(eshell-last-output)) (regexp ,regexp))) (put 'eshell-match-output 'ert-explainer #'eshell-match-output--explainer) -(defun eshell-match-command-output (command regexp &optional func) - "Insert a COMMAND at the end of the buffer and match the output with REGEXP." - (eshell-insert-command command func) +(defun eshell-match-command-output (command regexp &optional func + ignore-errors) + "Insert a COMMAND at the end of the buffer and match the output with REGEXP. +FUNC is the function to call after inserting the text (see +`eshell-insert-command'). + +If IGNORE-ERRORS is non-nil, ignore any errors signaled when +inserting the command." + (let ((debug-on-error (and (not ignore-errors) debug-on-error))) + (eshell-insert-command command func)) (eshell-wait-for-subprocess) (should (eshell-match-output regexp))) diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el index 7ee2f0c1a65..b1555a02664 100644 --- a/test/lisp/files-x-tests.el +++ b/test/lisp/files-x-tests.el @@ -23,6 +23,7 @@ (require 'ert) (require 'files-x) +(require 'tramp-integration) (defconst files-x-test--variables1 '((remote-shell-file-name . "/bin/bash") @@ -35,16 +36,20 @@ '((remote-null-device . "/dev/null"))) (defconst files-x-test--variables4 '((remote-null-device . "null"))) +(defconst files-x-test--variables5 + '((remote-lazy-var . nil) + (remote-null-device . "/dev/null"))) (defvar remote-null-device) +(defvar remote-lazy-var nil) (put 'remote-shell-file-name 'safe-local-variable #'identity) (put 'remote-shell-command-switch 'safe-local-variable #'identity) (put 'remote-shell-interactive-switch 'safe-local-variable #'identity) (put 'remote-shell-login-switch 'safe-local-variable #'identity) (put 'remote-null-device 'safe-local-variable #'identity) -(defconst files-x-test--application '(:application 'my-application)) +(defconst files-x-test--application '(:application my-application)) (defconst files-x-test--another-application - '(:application 'another-application)) + '(:application another-application)) (defconst files-x-test--protocol '(:protocol "my-protocol")) (defconst files-x-test--user '(:user "my-user")) (defconst files-x-test--machine '(:machine "my-machine")) @@ -91,6 +96,28 @@ (connection-local-get-profile-variables 'remote-nullfile) files-x-test--variables4)))) +(ert-deftest files-x-test-connection-local-update-profile-variables () + "Test updating connection-local profile variables." + + ;; Declare (PROFILE VARIABLES) objects. + (let (connection-local-profile-alist connection-local-criteria-alist) + (connection-local-set-profile-variables + 'remote-bash (copy-alist files-x-test--variables1)) + (should + (equal + (connection-local-get-profile-variables 'remote-bash) + files-x-test--variables1)) + + ;; Updating overwrites only the values specified in this call, but + ;; retains all the other values from previous calls. + (connection-local-update-profile-variables + 'remote-bash files-x-test--variables2) + (should + (equal + (connection-local-get-profile-variables 'remote-bash) + (cons (car files-x-test--variables2) + (cdr files-x-test--variables1)))))) + (ert-deftest files-x-test-connection-local-set-profiles () "Test setting connection-local profiles." @@ -233,9 +260,12 @@ (nreverse (copy-tree files-x-test--variables2))))) ;; The variables exist also as local variables. (should (local-variable-p 'remote-shell-file-name)) + (should (local-variable-p 'remote-null-device)) ;; The proper variable value is set. (should - (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")))) + (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")) + (should + (string-equal (symbol-value 'remote-null-device) "/dev/null")))) ;; The third test case. Both criteria `files-x-test--criteria1' ;; and `files-x-test--criteria2' apply, but there are no double @@ -274,13 +304,11 @@ (should-not (local-variable-p 'remote-shell-file-name)) (should-not (boundp 'remote-shell-file-name)))))) -(defvar tramp-connection-local-default-shell-variables) -(defvar tramp-connection-local-default-system-variables) - (ert-deftest files-x-test-with-connection-local-variables () "Test setting connection-local variables." - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((connection-local-profile-alist connection-local-profile-alist) + (connection-local-criteria-alist connection-local-criteria-alist)) (connection-local-set-profile-variables 'remote-bash files-x-test--variables1) (connection-local-set-profile-variables @@ -292,29 +320,6 @@ nil 'remote-ksh 'remote-nullfile) (with-temp-buffer - (let ((enable-connection-local-variables t)) - (hack-connection-local-variables-apply nil) - - ;; All connection-local variables are set. They apply in - ;; reverse order in `connection-local-variables-alist'. - (should - (equal connection-local-variables-alist - (append - (nreverse (copy-tree files-x-test--variables3)) - (nreverse (copy-tree files-x-test--variables2))))) - ;; The variables exist also as local variables. - (should (local-variable-p 'remote-shell-file-name)) - (should (local-variable-p 'remote-null-device)) - ;; The proper variable values are set. - (should - (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")) - (should - (string-equal (symbol-value 'remote-null-device) "/dev/null")) - - ;; A candidate connection-local variable is not bound yet. - (should-not (local-variable-p 'remote-shell-command-switch)))) - - (with-temp-buffer ;; Use the macro. We need a remote `default-directory'. (let ((enable-connection-local-variables t) (default-directory "/method:host:") @@ -331,18 +336,18 @@ (with-connection-local-variables ;; All connection-local variables are set. They apply in ;; reverse order in `connection-local-variables-alist'. - ;; Since we ha a remote default directory, Tramp's settings + ;; Since we have a remote default directory, Tramp's settings ;; are appended as well. (should (equal connection-local-variables-alist (append - (nreverse (copy-tree files-x-test--variables3)) - (nreverse (copy-tree files-x-test--variables2)) (nreverse (copy-tree tramp-connection-local-default-shell-variables)) (nreverse - (copy-tree tramp-connection-local-default-system-variables))))) + (copy-tree tramp-connection-local-default-system-variables)) + (nreverse (copy-tree files-x-test--variables3)) + (nreverse (copy-tree files-x-test--variables2))))) ;; The variables exist also as local variables. (should (local-variable-p 'remote-shell-file-name)) (should (local-variable-p 'remote-null-device)) @@ -352,15 +357,21 @@ (should (string-equal (symbol-value 'remote-null-device) "/dev/null")) - ;; Run another instance of `with-connection-local-variables' - ;; with a different application. - (let ((connection-local-default-application (cadr files-x-test--application))) - (with-connection-local-variables - ;; The proper variable values are set. - (should - (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash")) - (should - (string-equal (symbol-value 'remote-null-device) "/dev/null")))) + ;; Run `with-connection-local-application-variables' to use a + ;; different application. + (with-connection-local-application-variables + (cadr files-x-test--application) + (should + (equal + connection-local-variables-alist + (append + (nreverse (copy-tree files-x-test--variables3)) + (nreverse (copy-tree files-x-test--variables1))))) + ;; The proper variable values are set. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash")) + (should + (string-equal (symbol-value 'remote-null-device) "/dev/null"))) ;; The variable values are reset. (should (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")) @@ -376,5 +387,60 @@ (should-not (boundp 'remote-shell-file-name)) (should (string-equal (symbol-value 'remote-null-device) "null")))))) +(defun files-x-test--get-lazy-var () + "Get the connection-local value of `remote-lazy-var'. +If it's not initialized yet, initialize it." + (with-connection-local-application-variables + (cadr files-x-test--application) + (or remote-lazy-var + (setq-connection-local remote-lazy-var + (or (file-remote-p default-directory 'host) + "local"))))) + +(defun files-x-test--set-lazy-var (value) + "Set the connection-local value of `remote-lazy-var'" + (with-connection-local-application-variables + (cadr files-x-test--application) + (setq-connection-local remote-lazy-var value))) + +(ert-deftest files-x-test-setq-connection-local () + "Test dynamically setting connection local variables." + (let (connection-local-profile-alist connection-local-criteria-alist) + (connection-local-set-profile-variables + 'remote-lazy files-x-test--variables5) + (connection-local-set-profiles + files-x-test--application + 'remote-lazy) + + ;; Test the initial local value. + (should (equal (files-x-test--get-lazy-var) "local")) + + ;; Set the local value and make sure it retains the value we set. + (should (equal (files-x-test--set-lazy-var "here") "here")) + (should (equal (files-x-test--get-lazy-var) "here")) + + (let ((default-directory "/method:host:")) + ;; Test the initial remote value. + (should (equal (files-x-test--get-lazy-var) "host")) + + ;; Set the remote value and make sure it retains the value we set. + (should (equal (files-x-test--set-lazy-var "there") "there")) + (should (equal (files-x-test--get-lazy-var) "there")) + ;; Set another connection-local variable. + (with-connection-local-application-variables + (cadr files-x-test--application) + (setq-connection-local remote-null-device "null"))) + + ;; Make sure we get the local value we set above. + (should (equal (files-x-test--get-lazy-var) "here")) + (should-not (boundp 'remote-null-device)) + + ;; Make sure we get the remote values we set above. + (let ((default-directory "/method:host:")) + (should (equal (files-x-test--get-lazy-var) "there")) + (with-connection-local-application-variables + (cadr files-x-test--application) + (should (equal remote-null-device "null")))))) + (provide 'files-x-tests) ;;; files-x-tests.el ends here diff --git a/test/lisp/image/wallpaper-tests.el b/test/lisp/image/wallpaper-tests.el index 52011fe7973..a5d3343bd4d 100644 --- a/test/lisp/image/wallpaper-tests.el +++ b/test/lisp/image/wallpaper-tests.el @@ -23,6 +23,104 @@ (require 'ert-x) (require 'wallpaper) +(ert-deftest wallpaper--find-setter () + (skip-unless (executable-find "touch")) + (let (wallpaper--current-setter + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" "/tmp/touched")))) + (should (wallpaper--find-setter)))) + +(ert-deftest wallpaper--find-setter/call-predicate () + (skip-unless (executable-find "touch")) + (let* ( wallpaper--current-setter called + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" "/tmp/touched" + :predicate (lambda () (setq called t)))))) + (should-not called) + (wallpaper--find-setter) + (should called))) + +(ert-deftest wallpaper--find-setter/set-current-setter () + (skip-unless (executable-find "touch")) + (let (wallpaper--current-setter + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" "/tmp/touched")))) + (wallpaper--find-setter) + (should wallpaper--current-setter))) + +(ert-deftest wallpaper-set/runs-command () + (skip-unless (executable-find "touch")) + (ert-with-temp-file fil-jpg + :suffix ".jpg" + (ert-with-temp-file fil + (let* ( wallpaper--current-setter + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" fil))) + (wallpaper-command (wallpaper--find-command)) + (wallpaper-command-args (wallpaper--find-command-args))) + (delete-file fil) + (let ((process (wallpaper-set fil-jpg))) + (while (process-live-p process) + (sit-for 0.001)) + ;; Touch has recreated the file: + (should (file-exists-p fil))))))) + +(ert-deftest wallpaper-set/runs-command/detach () + (skip-unless (executable-find "touch")) + (ert-with-temp-file fil-jpg + :suffix ".jpg" + (ert-with-temp-file fil + (let* ( wallpaper--current-setter + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" fil + :detach t))) + (wallpaper-command (wallpaper--find-command)) + (wallpaper-command-args (wallpaper--find-command-args))) + (delete-file fil) + (wallpaper-set fil-jpg) + (while (not (file-exists-p fil)) + (sit-for 0.001)) + ;; Touch has recreated the file: + (should (file-exists-p fil)))))) + +(ert-deftest wallpaper-set/calls-init-action () + (skip-unless (executable-find "touch")) + (ert-with-temp-file fil-jpg + :suffix ".jpg" + (ert-with-temp-file fil + (let* ( wallpaper--current-setter called + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" fil + :init-action (lambda () (setq called t))))) + (wallpaper-command (wallpaper--find-command)) + (wallpaper-command-args (wallpaper--find-command-args)) + process) + (should (functionp (wallpaper-setter-init-action wallpaper--current-setter))) + (setq process (wallpaper-set fil-jpg)) + ;; Wait for "touch" process to exit so temp file is removed. + (accept-process-output process 3) + (should called))))) + +(ert-deftest wallpaper-set/calls-wallpaper-set-function () + (skip-unless (executable-find "touch")) + (ert-with-temp-file fil-jpg + :suffix ".jpg" + (let* ( wallpaper--current-setter called + (wallpaper--default-setters + (wallpaper--default-methods-create + ("touch" "touch" "foo"))) + (wallpaper-set-function + (lambda (file) (setq called file)))) + (wallpaper--find-setter) + (wallpaper-set fil-jpg) + (should (equal called fil-jpg))))) + (ert-deftest wallpaper--find-command/return-string () (should (or (not (wallpaper--find-command)) (stringp (wallpaper--find-command))))) diff --git a/test/lisp/international/textsec-tests.el b/test/lisp/international/textsec-tests.el index 6b0773dc407..1f7fb97a6be 100644 --- a/test/lisp/international/textsec-tests.el +++ b/test/lisp/international/textsec-tests.el @@ -77,7 +77,7 @@ (should (eq (textsec-restriction-level "切foo") 'highly-restrictive)) (should (eq (textsec-restriction-level "հfoo") - 'moderately-retrictive)) + 'moderately-restrictive)) (should (eq (textsec-restriction-level "Сirсlе") 'unrestricted))) diff --git a/test/lisp/net/browse-url-tests.el b/test/lisp/net/browse-url-tests.el index 1c993958b81..dc819768211 100644 --- a/test/lisp/net/browse-url-tests.el +++ b/test/lisp/net/browse-url-tests.el @@ -56,6 +56,15 @@ 'browse-url--man)) (should-not (browse-url-select-handler "man:ls" 'external))) +(ert-deftest browse-url-tests-select-handler-irc () + (should (eq (browse-url-select-handler "irc://localhost" 'internal) + 'browse-url--irc)) + (should-not (browse-url-select-handler "irc://localhost" 'external)) + (should (eq (browse-url-select-handler "irc6://localhost") + 'browse-url--irc)) + (should (eq (browse-url-select-handler "ircs://tester@irc.gnu.org/#chan") + 'browse-url--irc))) + (ert-deftest browse-url-tests-select-handler-file () (should (eq (browse-url-select-handler "file://foo.txt") 'browse-url-emacs)) diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el index 76318429181..c808e6350ea 100644 --- a/test/lisp/net/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -407,7 +407,7 @@ :session dbus--test-service '(:array (:dict-entry :string "string" :boolean t :boolean t))) :type 'wrong-type-argument) - ;; The first element ist not of a basic type. + ;; The first element is not of a basic type. (should-error (dbus-check-arguments :session dbus--test-service @@ -1093,7 +1093,7 @@ is in progress." (dbus-unregister-service :session dbus--test-service))) (ert-deftest dbus-test06-register-property-emits-signal () - "Check property registration for an own service, including signalling." + "Check property registration for an own service, including signaling." (skip-unless dbus--test-enabled-session-bus) (dbus-ignore-errors (dbus-unregister-service :session dbus--test-service)) @@ -1136,7 +1136,7 @@ is in progress." dbus--test-interface property) "foo")) - ;; Set property. The new value shall be signalled. + ;; Set property. The new value shall be signaled. (setq dbus--test-signal-received nil) (should (equal diff --git a/test/lisp/net/eudc-resources/bbdb b/test/lisp/net/eudc-resources/bbdb new file mode 100644 index 00000000000..b730bb51cc9 --- /dev/null +++ b/test/lisp/net/eudc-resources/bbdb @@ -0,0 +1,3 @@ +;; -*- mode: Emacs-Lisp; coding: utf-8; -*- +;;; file-format: 9 +["Emacs" "ERT3" nil nil nil nil nil ("emacs-ert-test-3@bbdb.gnu.org") ((notes . " ")) "c8bd3a63-3a83-48a7-a95b-be118a923e00" "2022-11-19 16:36:04 +0000" "2022-11-19 16:36:04 +0000" nil] diff --git a/test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif b/test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif new file mode 100644 index 00000000000..9db4be20280 --- /dev/null +++ b/test/lisp/net/eudc-resources/dc=gnu,dc=org.ldif @@ -0,0 +1,15 @@ +# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. +# CRC32 12f0e8c3 +dn: dc=gnu +objectClass: dcObject +objectClass: organization +dc: gnu +o: The ldap.gnu.org organization +description: An organization for the following person +structuralObjectClass: organization +entryUUID: 43dd74ec-fc0d-103c-8d5c-7dbac5615d14 +creatorsName: +createTimestamp: 20221119042038Z +entryCSN: 20221119042038.100000Z#000000#000#000000 +modifiersName: +modifyTimestamp: 20221119042038Z diff --git a/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-1.ldif b/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-1.ldif new file mode 100644 index 00000000000..7828f179df2 --- /dev/null +++ b/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-1.ldif @@ -0,0 +1,17 @@ +# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. +# CRC32 a33c0168 +dn: cn=emacs-ert-test-1 +objectClass: OpenLDAPperson +cn: emacs-ert-test-1 +description:: RW1hY3Mg +uid: 1 +sn: ERT1 +givenName: Emacs +mail: emacs-ert-test-1@ldap.gnu.org +structuralObjectClass: OpenLDAPperson +entryUUID: 43dd805e-fc0d-103c-8d5d-7dbac5615d14 +creatorsName: +createTimestamp: 20221119042038Z +entryCSN: 20221119042038.100350Z#000000#000#000000 +modifiersName: +modifyTimestamp: 20221119042038Z diff --git a/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-2.ldif b/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-2.ldif new file mode 100644 index 00000000000..d3de3d81c71 --- /dev/null +++ b/test/lisp/net/eudc-resources/dc=gnu,dc=org/cn=emacs-ert-test-2.ldif @@ -0,0 +1,17 @@ +# AUTO-GENERATED FILE - DO NOT EDIT!! Use ldapmodify. +# CRC32 56119237 +dn: cn=emacs-ert-test-2 +objectClass: OpenLDAPperson +cn: emacs-ert-test-2 +description:: RW1hY3Mg +uid: 2 +sn: ERT2 +givenName: Emacs +mail: emacs-ert-test-2@ldap.gnu.org +structuralObjectClass: OpenLDAPperson +entryUUID: 43dd92b0-fc0d-103c-8d5e-7dbac5615d14 +creatorsName: +createTimestamp: 20221119042038Z +entryCSN: 20221119042038.100819Z#000000#000#000000 +modifiersName: +modifyTimestamp: 20221119042038Z diff --git a/test/lisp/net/eudc-resources/ecompleterc b/test/lisp/net/eudc-resources/ecompleterc new file mode 100644 index 00000000000..9019b26c9f3 --- /dev/null +++ b/test/lisp/net/eudc-resources/ecompleterc @@ -0,0 +1,7 @@ +((mail + ("larsi@gnus.org" 38154 1516109510 "Lars Ingebrigtsen <larsi@ecomplete.org>") + ("kfogel@red-bean.com" 10 1516065455 "Karl Fogel <kfogel@ecomplete.com>") + ("behse@ecomplete.org" 10 1516065455 "behse@ecomplete.org")) + (phone + ("Lars Ingebrigtsen" 0 0 "+1 234 5678 9012") + ("Karl Fogel" 0 0 "+33 701 4567 8901"))) diff --git a/test/lisp/net/eudc-resources/mailrc b/test/lisp/net/eudc-resources/mailrc new file mode 100644 index 00000000000..c565f718372 --- /dev/null +++ b/test/lisp/net/eudc-resources/mailrc @@ -0,0 +1,3 @@ +alias lars "Lars Ingebrigtsen <larsi@mail-abbrev.com>" +alias karl "Karl Fogel <kfogel@mail-abbrev.com>" +alias emacsheroes lars karl diff --git a/test/lisp/net/eudc-resources/slapd.conf b/test/lisp/net/eudc-resources/slapd.conf new file mode 100644 index 00000000000..9afafe76764 --- /dev/null +++ b/test/lisp/net/eudc-resources/slapd.conf @@ -0,0 +1,7 @@ +include /etc/ldap/schema/core.schema +include /etc/ldap/schema/cosine.schema +include /etc/ldap/schema/inetorgperson.schema +include /etc/ldap/schema/openldap.schema +database ldif +directory eudc-resources +suffix "dc=gnu,dc=org" diff --git a/test/lisp/net/eudc-tests.el b/test/lisp/net/eudc-tests.el new file mode 100644 index 00000000000..212db65cb26 --- /dev/null +++ b/test/lisp/net/eudc-tests.el @@ -0,0 +1,311 @@ +;;; eudc-tests.el --- tests for eudc.el -*- lexical-binding: t -*- + +;; Copyright (C) 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 'eudc) + +(ert-deftest eudc--plist-member () + "Test `eudc--plist-member' behavior." + (dolist (obj '(a (a . a) (a a . a))) + (should-error (eudc--plist-member obj nil) :type 'wrong-type-argument)) + (dolist (plist '((nil) (a) (a a a))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc--plist-member plist key))))))) + (let ((-nil (string ?n ?i ?l)) + (-a (string ?a))) + (should-not (eudc--plist-member () nil)) + (should-not (eudc--plist-member () 'a)) + (should-not (eudc--plist-member '(nil nil) 'a)) + (should-not (eudc--plist-member '(nil a) 'a)) + (should-not (eudc--plist-member '(a nil) nil)) + (should-not (eudc--plist-member '(a a) nil)) + (should-not (eudc--plist-member '("nil" a) nil)) + (should-not (eudc--plist-member '("nil" a) -nil)) + (should-not (eudc--plist-member '("a" a) nil)) + (should-not (eudc--plist-member '("a" a) -a)) + (should-not (eudc--plist-member '(nil a nil a) 'a)) + (should-not (eudc--plist-member '(nil a "a" a) -a)) + (should (equal (eudc--plist-member '(nil nil) nil) '(nil nil))) + (should (equal (eudc--plist-member '(nil a) nil) '(nil a))) + (should (equal (eudc--plist-member '(a nil) 'a) '(a nil))) + (should (equal (eudc--plist-member '(a a) 'a) '(a a))) + (should (equal (eudc--plist-member '(nil nil a nil) 'a) '(a nil))) + (should (equal (eudc--plist-member '(nil a a a) 'a) '(a a))) + (should (equal (eudc--plist-member '(a a a a) 'a) '(a a a a))))) + +(ert-deftest eudc-plist-member () + "Test `eudc-plist-member' behavior." + (dolist (obj '(a (a . a) (a a . a))) + (should-error (eudc-plist-member obj nil) :type 'wrong-type-argument)) + (dolist (plist '((nil) (a) (a a a))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-plist-member plist key))))))) + (let ((-nil (string ?n ?i ?l)) + (-a (string ?a))) + (should-not (eudc-plist-member () nil)) + (should-not (eudc-plist-member () 'a)) + (should-not (eudc-plist-member '(nil nil) 'a)) + (should-not (eudc-plist-member '(nil a) 'a)) + (should-not (eudc-plist-member '(a nil) nil)) + (should-not (eudc-plist-member '(a a) nil)) + (should-not (eudc-plist-member '("nil" a) nil)) + (should-not (eudc-plist-member '("nil" a) -nil)) + (should-not (eudc-plist-member '("a" a) nil)) + (should-not (eudc-plist-member '("a" a) -a)) + (should-not (eudc-plist-member '(nil a nil a) 'a)) + (should-not (eudc-plist-member '(nil a "a" a) -a)) + (should (eq t (eudc-plist-member '(nil nil) nil))) + (should (eq t (eudc-plist-member '(nil a) nil))) + (should (eq t (eudc-plist-member '(a nil) 'a))) + (should (eq t (eudc-plist-member '(a a) 'a))) + (should (eq t (eudc-plist-member '(nil nil a nil) 'a))) + (should (eq t (eudc-plist-member '(nil a a a) 'a))) + (should (eq t (eudc-plist-member '(a a a a) 'a))))) + +(ert-deftest eudc-plist-get () + "Test `eudc-plist-get' behavior." + (dolist (obj '(a (a . a) (a a . a))) + (should-error (eudc-plist-get obj nil) :type 'wrong-type-argument)) + (dolist (plist '((nil) (a) (a a a))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-plist-get plist key))))))) + (let ((-nil (string ?n ?i ?l)) + (-a (string ?a))) + (should-not (eudc-plist-get () nil)) + (should-not (eudc-plist-get () 'a)) + (should-not (eudc-plist-get '(nil nil) nil)) + (should-not (eudc-plist-get '(nil nil) 'a)) + (should-not (eudc-plist-get '(nil a) 'a)) + (should-not (eudc-plist-get '(a nil) nil)) + (should-not (eudc-plist-get '(a nil) 'a)) + (should-not (eudc-plist-get '(a a) nil)) + (should-not (eudc-plist-get '("nil" a) nil)) + (should-not (eudc-plist-get '("nil" a) -nil)) + (should-not (eudc-plist-get '("a" a) nil)) + (should-not (eudc-plist-get '("a" a) -a)) + (should-not (eudc-plist-get '(nil nil nil a) nil)) + (should-not (eudc-plist-get '(nil a nil a) 'a)) + (should-not (eudc-plist-get '(nil a "a" a) -a)) + (should-not (eudc-plist-get '(a nil a a) 'a)) + (should (eq 'a (eudc-plist-get '(nil a) nil))) + (should (eq 'a (eudc-plist-get '(a a) 'a))) + (should (eq 'a (eudc-plist-get '(a a a nil) 'a))) + (should (eq 'b (eudc-plist-get () nil 'b))) + (should (eq 'b (eudc-plist-get () 'a 'b))) + (should (eq 'b (eudc-plist-get '(nil a "a" a) -a 'b))) + (should (eq 'b (eudc-plist-get '(a nil "nil" nil) -nil 'b))))) + +(ert-deftest eudc-lax-plist-get () + "Test `eudc-lax-plist-get' behavior." + (dolist (obj '(a (a . a) (a a . a))) + (should-error (eudc-lax-plist-get obj nil) :type 'wrong-type-argument)) + (dolist (plist '((nil) (a) (a a a))) + (let ((err `(wrong-type-argument plistp ,(copy-sequence plist)))) + (dolist (key '(nil a)) + (should (equal err (should-error (eudc-lax-plist-get plist key))))))) + (let ((-nil (string ?n ?i ?l)) + (-a (string ?a))) + (should-not (eudc-lax-plist-get () nil)) + (should-not (eudc-lax-plist-get () 'a)) + (should-not (eudc-lax-plist-get '(nil nil) nil)) + (should-not (eudc-lax-plist-get '(nil nil) 'a)) + (should-not (eudc-lax-plist-get '(nil a) 'a)) + (should-not (eudc-lax-plist-get '(a nil) nil)) + (should-not (eudc-lax-plist-get '(a nil) 'a)) + (should-not (eudc-lax-plist-get '(a a) nil)) + (should-not (eudc-lax-plist-get '("nil" a) nil)) + (should-not (eudc-lax-plist-get '("nil" a) 'a)) + (should-not (eudc-lax-plist-get '("a" a) nil)) + (should-not (eudc-lax-plist-get '("a" a) 'a)) + (should-not (eudc-lax-plist-get '(nil nil nil a) nil)) + (should-not (eudc-lax-plist-get '(nil a nil a) 'a)) + (should-not (eudc-lax-plist-get '(nil a "a" a) 'a)) + (should-not (eudc-lax-plist-get '(a nil a a) 'a)) + (should (eq 'a (eudc-lax-plist-get '(nil a) nil))) + (should (eq 'a (eudc-lax-plist-get '(a a) 'a))) + (should (eq 'a (eudc-lax-plist-get '(a a a nil) 'a))) + (should (eq 'b (eudc-lax-plist-get () nil 'b))) + (should (eq 'b (eudc-lax-plist-get () 'a 'b))) + (should (eq 'a (eudc-lax-plist-get '("nil" a) -nil))) + (should (eq 'a (eudc-lax-plist-get '("a" a) -a))) + (should (eq 'a (eudc-lax-plist-get '(nil a "a" a) -a))) + (should (eq 'b (eudc-lax-plist-get '(nil a "a" a) 'a 'b))) + (should (eq 'b (eudc-lax-plist-get '(a nil "nil" nil) nil 'b))))) + +;; eudc-rfc5322-quote-phrase (string) +(ert-deftest eudc-test-rfc5322-quote-phrase () + "Tests for RFC5322 compliant phrase quoting." + ;; atext-token "[:alpha:][:digit:]!#$%&'*+/=?^_`{|}~-" + (should (equal (eudc-rfc5322-quote-phrase "Foo Bar !#$%&'*+/=?^_`{|}~-") + "Foo Bar !#$%&'*+/=?^_`{|}~-")) + (should (equal (eudc-rfc5322-quote-phrase "Foo, Bar !#$%&'*+/=?^_`{|}~-") + "\"Foo, Bar !#$%&'*+/=?^_`{|}~-\""))) + +;; eudc-rfc5322-valid-comment-p (string) +(ert-deftest eudc-test-rfc5322-valid-comment-p () + "Tests for RFC5322 compliant comments." + ;; cctext-token "\u005D-\u007E\u002A-\u005B\u0021-\u0027" + fwsp-token (TAB, LF, SPC) + ;; Printable US-ASCII characters not including "(", ")", or "\". + (let ((good-chars (append (number-sequence #x09 #x0a) + (number-sequence #x20 #x20) + (number-sequence #x21 #x27) + (number-sequence #x2a #x5b) + (number-sequence #x5d #x7e))) + (bad-chars (append (number-sequence #x00 #x08) + (number-sequence #x0b #x1f) + (number-sequence #x28 #x29) + (number-sequence #x5c #x5c) + (number-sequence #x7f #xff)))) + (dolist (gc good-chars) + (should (eq (eudc-rfc5322-valid-comment-p (format "%c" gc)) t))) + (dolist (bc bad-chars) + (should (eq (eudc-rfc5322-valid-comment-p (format "%c" bc)) nil))))) + +;; eudc-rfc5322-make-address (address &optional firstname name comment) +(ert-deftest eudc-test-make-address () + "Tests for RFC5322 compliant email address formatting." + (should (equal (eudc-rfc5322-make-address "") + nil)) + (should (equal (eudc-rfc5322-make-address nil) + nil)) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org") + "j.sixpack@example.org")) + (should (equal (eudc-rfc5322-make-address "<j.sixpack@example.org>") + "<j.sixpack@example.org>")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + "Joey") + "Joey <j.sixpack@example.org>")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + "Joey" + "Sixpack") + "Joey Sixpack <j.sixpack@example.org>")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + "Joey" + "Sixpack" + "ten-packs are fine, too") + "Joey Sixpack <j.sixpack@example.org> \ +(ten-packs are fine, too)")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + "" + "Sixpack, Joey") + "\"Sixpack, Joey\" <j.sixpack@example.org>")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + nil + "Sixpack, Joey") + "\"Sixpack, Joey\" <j.sixpack@example.org>")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + nil + nil + "Duh!") + "j.sixpack@example.org (Duh!)")) + (should (equal (eudc-rfc5322-make-address "j.sixpack@example.org" + nil + nil + "Duh\\!") + "j.sixpack@example.org"))) + +(require 'ert-x) ; ert-with-temp-directory + +(defvar ecomplete-database-file (ert-resource-file "ecompleterc")) + +(ert-deftest eudcb-ecomplete () + "Test the ecomplete back-end." + (ert-with-temp-directory home + (with-environment-variables (("HOME" home)) + (let ((eudc-ignore-options-file t)) + (should (equal (eudc-ecomplete-query-internal '((mail . "brigts"))) + '(((mail . "Lars Ingebrigtsen <larsi@ecomplete.org>"))))) + (should (equal (eudc-ecomplete-query-internal '((mail . "karl"))) + '(((mail . "Karl Fogel <kfogel@ecomplete.com>"))))) + (should (equal (eudc-ecomplete-query-internal '((mail . "behs"))) + '(((mail . "behse@ecomplete.org"))))) + (should (equal (eudc-ecomplete-query-internal '((mail . "louie"))) + nil)))))) + +(ert-with-temp-directory + home + (ert-deftest eudcb-mailabbrev () + "Test the mailabbrev back-end." + (with-environment-variables + (("HOME" home)) + (let ((mail-personal-alias-file (ert-resource-file "mailrc")) + (eudc-ignore-options-file t)) + (should (equal (eudc-mailabbrev-query-internal '((email . "lars"))) + '(((email . "larsi@mail-abbrev.com") + (name . "Lars Ingebrigtsen"))))) + (should (equal (eudc-mailabbrev-query-internal '((name . "lars"))) + '(((email . "larsi@mail-abbrev.com") + (name . "Lars Ingebrigtsen"))))) + (should (equal (eudc-mailabbrev-query-internal '((phone . "lars"))) + nil)) + (should (equal (eudc-mailabbrev-query-internal '((firstname . "karl"))) + '(((email . "kfogel@mail-abbrev.com") + (name . "Karl Fogel"))))) + (should (equal (eudc-mailabbrev-query-internal '((email . "louie"))) + nil)) + (should (equal (eudc-mailabbrev-query-internal '((name . "emacsheroes"))) + '(((email . "Lars Ingebrigtsen <larsi@mail-abbrev.com>, \ +Karl Fogel <kfogel@mail-abbrev.com"))))))))) + +(require 'ldap) +(ert-deftest eudcb-ldap () + "Test the LDAP back-end." + (skip-unless (and (file-exists-p "/usr/sbin/slapd") + (file-exists-p "/usr/bin/ldapsearch"))) + (cd (concat (ert-resource-directory) "..")) + (let ((ldap-process + (start-process "slapd" "*slapd*" "/usr/sbin/slapd" + "-h" "ldap://127.0.0.1:3899" "-d" "0" "-4" + "-f" (ert-resource-file "slapd.conf"))) + (ldap-host-parameters-alist '(("ldap://localhost:3899" + base "dc=gnu,dc=org" auth simple))) + (eudc-server-hotlist '(("ldap://localhost:3899" . ldap))) + (eudc-ignore-options-file t)) + (sleep-for 1) ; Wait for slapd to start. + (should (equal (with-temp-buffer + (insert "emacs-ert-test-1") + (eudc-expand-try-all) + (buffer-string)) + "Emacs ERT1 <emacs-ert-test-1@ldap.gnu.org>")) + (kill-process ldap-process))) + +(eval-and-compile + (push (expand-file-name "../elpa/packages/bbdb/lisp" source-directory) + load-path) + (defvar bbdb-file) + (require 'bbdb nil t)) + +(ert-deftest eudcb-bbdb () + "Test the BBDB back-end." + (skip-unless (featurep 'bbdb)) + (let ((bbdb-file (ert-resource-file "bbdb")) + (eudc-server-hotlist '(("" . bbdb))) + (eudc-ignore-options-file t)) + (should (equal (with-temp-buffer + (insert "emacs-ert-test-3") + (eudc-expand-try-all) + (buffer-string)) + "Emacs ERT3 <emacs-ert-test-3@bbdb.gnu.org>")))) + +(provide 'eudc-tests) +;;; eudc-tests.el ends here diff --git a/test/lisp/net/mailcap-tests.el b/test/lisp/net/mailcap-tests.el index 9e60a243b3d..04462dbc8ba 100644 --- a/test/lisp/net/mailcap-tests.el +++ b/test/lisp/net/mailcap-tests.el @@ -125,7 +125,7 @@ (ert-deftest mailcap-view-file () (with-pristine-mailcap - ;; Try using a lambda as viewer and check wether + ;; Try using a lambda as viewer and check whether ;; `mailcap-view-file' works correctly. (let* ((mailcap-mime-extensions '((".test" . "test/test")))) (mailcap-add "test/test" 'mailcap--test-viewer) diff --git a/test/lisp/net/puny-resources/IdnaTestV2.txt b/test/lisp/net/puny-resources/IdnaTestV2.txt index ed2f32e129f..4b8d5984a7c 100644 --- a/test/lisp/net/puny-resources/IdnaTestV2.txt +++ b/test/lisp/net/puny-resources/IdnaTestV2.txt @@ -2,12 +2,12 @@ # Date: 2021-08-17, 19:34:01 GMT # © 2021 Unicode®, Inc. # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. -# For terms of use, see http://www.unicode.org/terms_of_use.html +# For terms of use, see https://www.unicode.org/terms_of_use.html # # Unicode IDNA Compatible Preprocessing for UTS #46 # Version: 14.0.0 # -# For documentation and usage, see http://www.unicode.org/reports/tr46 +# For documentation and usage, see https://www.unicode.org/reports/tr46 # # Test cases for verifying UTS #46 conformance. # diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 2db44494388..a5bae46a583 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -140,10 +140,11 @@ A resource file is in the resource directory as per ((eq system-type 'windows-nt) null-device) (t (add-to-list 'tramp-methods - '("mock" - (tramp-login-program "sh") + `("mock" + (tramp-login-program ,tramp-default-remote-shell) (tramp-login-args (("-i"))) - (tramp-remote-shell "/bin/sh") + (tramp-direct-async ("-c")) + (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-args ("-c")) (tramp-connection-timeout 10))) (add-to-list @@ -4616,10 +4617,13 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (load tmp-name 'noerror 'nomessage)) (should-not (featurep 'tramp-test-load)) (write-region "(provide 'tramp-test-load)" nil tmp-name) - ;; `load' in lread.c does not pass `must-suffix'. Why? - ;;(should-error - ;; (load tmp-name nil 'nomessage 'nosuffix 'must-suffix) - ;; :type 'file-error) + ;; `load' in lread.c passes `must-suffix' since Emacs 29. + ;; In Ange-FTP, `must-suffix' is ignored. + (when (and (tramp--test-emacs29-p) + (not (tramp--test-ange-ftp-p))) + (should-error + (load tmp-name nil 'nomessage 'nosuffix 'must-suffix) + :type 'file-error)) (load tmp-name nil 'nomessage 'nosuffix) (should (featurep 'tramp-test-load))) diff --git a/test/lisp/progmodes/cperl-mode-resources/here-docs.pl b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl index bb3d4871a91..13d879bf762 100644 --- a/test/lisp/progmodes/cperl-mode-resources/here-docs.pl +++ b/test/lisp/progmodes/cperl-mode-resources/here-docs.pl @@ -140,4 +140,70 @@ HERE . 'indent-level'; # Continuation, should be indented +=head2 Test case 7 + +An indented HERE document using a bare identifier. + +=cut + +## test case + +$text = <<~HERE; +look-here +HERE + +$noindent = "New statement in this line"; + +=head2 Test case 8 + +A HERE document as an argument to print when printing to a filehandle. + +=cut + +## test case + +print $fh <<~HERE; +look-here +HERE + +$noindent = "New statement in this line"; + +=head2 Test case 9 + +A HERE document as a hash value. + +=cut + +my %foo = ( + text => <<~HERE +look-here +HERE + ); + +$noindent = "New statement in this line"; + +=head2 Test case 10 + +A HERE document as an argument to die. + +=cut + +1 or die <<HERE; +look-here +HERE + +$noindent = "New statement in this line"; + +=head2 Test case 11 + +A HERE document as an argument to warn. + +=cut + +1 or warn <<HERE; +look-here +HERE + +$noindent = "New statement in this line"; + __END__ diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index fdaedb5fd7a..f871b7bc7d9 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -43,6 +43,34 @@ always located at the beginning of buffer." (goto-char (point-min)) ,@body))) +(defun python-tests-shell-wait-for-prompt () + "Wait for the prompt in the shell buffer." + (python-shell-with-shell-buffer + (while (not (python-util-comint-end-of-output-p)) + (sit-for 0.1)))) + +(defmacro python-tests-with-temp-buffer-with-shell (contents &rest body) + "Create a `python-mode' enabled temp buffer with CONTENTS and `run-python'. +BODY is code to be executed within the temp buffer. Point is +always located at the beginning of buffer. Native completion is +turned off. Shell buffer will be killed on exit." + (declare (indent 1) (debug t)) + `(with-temp-buffer + (let ((python-indent-guess-indent-offset nil) + (python-shell-completion-native-enable nil)) + (python-mode) + (unwind-protect + (progn + (run-python nil t) + (insert ,contents) + (goto-char (point-min)) + (python-tests-shell-wait-for-prompt) + ,@body) + (when (python-shell-get-buffer) + (python-shell-with-shell-buffer + (let (kill-buffer-hook kill-buffer-query-functions) + (kill-buffer)))))))) + (defmacro python-tests-with-temp-file (contents &rest body) "Create a `python-mode' enabled file with CONTENTS. BODY is code to be executed within the temp buffer. Point is @@ -4365,6 +4393,32 @@ def foo(): (python-shell-interpreter "/some/path/to/bin/pypy")) (should (python-shell-completion-native-interpreter-disabled-p)))) +(ert-deftest python-shell-completion-at-point-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + "" + (python-shell-with-shell-buffer + (insert "import abc") + (comint-send-input) + (python-tests-shell-wait-for-prompt) + (insert "abc.") + (should (nth 2 (python-shell-completion-at-point))) + (end-of-line 0) + (should-not (nth 2 (python-shell-completion-at-point)))))) + +(ert-deftest python-shell-completion-at-point-native-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + "" + (python-shell-completion-native-turn-on) + (python-shell-with-shell-buffer + (insert "import abc") + (comint-send-input) + (python-tests-shell-wait-for-prompt) + (insert "abc.") + (should (nth 2 (python-shell-completion-at-point))) + (end-of-line 0) + (should-not (nth 2 (python-shell-completion-at-point)))))) @@ -4373,6 +4427,134 @@ def foo(): ;;; Symbol completion +(ert-deftest python-completion-at-point-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point)) + (insert "A") + (should (completion-at-point))))) + +(ert-deftest python-completion-at-point-2 () + "Should work regardless of the point in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (python-shell-with-shell-buffer + (goto-char (point-min))) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point))))) + +(ert-deftest python-completion-at-point-pdb-1 () + "Should not complete PDB commands in Python buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import pdb + +pdb.set_trace() +print('Hello') +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (goto-char (point-max)) + (insert "u") + (should-not (nth 2 (python-completion-at-point)))))) + +(ert-deftest python-completion-at-point-while-running-1 () + "Should not try to complete when a program is running in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import time + +time.sleep(3) +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (goto-char (point-max)) + (insert "time.") + (should-not (with-timeout (1 t) (completion-at-point)))))) + +(ert-deftest python-completion-at-point-native-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-completion-native-turn-on) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point)) + (insert "A") + (should (completion-at-point))))) + +(ert-deftest python-completion-at-point-native-2 () + "Should work regardless of the point in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-completion-native-turn-on) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (python-shell-with-shell-buffer + (goto-char (point-min))) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point))))) + +(ert-deftest python-completion-at-point-native-with-ffap-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-completion-native-turn-on) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (goto-char (point-max)) + (insert "abc.") + ;; This is called when FFAP is enabled and a find-file function is called. + (python-ffap-module-path "abc.") + (should (completion-at-point))))) + +(ert-deftest python-completion-at-point-native-with-eldoc-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-completion-native-turn-on) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (goto-char (point-max)) + (insert "abc.") + ;; This is called by idle-timer when ElDoc is enabled. + (python-eldoc-function) + (should (completion-at-point))))) + ;;; Fill paragraph @@ -4382,6 +4564,31 @@ def foo(): ;;; FFAP +(ert-deftest python-ffap-module-path-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (should (file-exists-p (python-ffap-module-path "abc")))))) + +(ert-deftest python-ffap-module-path-while-running-1 () + "Should not get module path when a program is running in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +import time + +time.sleep(3) +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (should-not (with-timeout (1 t) (python-ffap-module-path "abc")))))) + ;;; Code check @@ -4445,6 +4652,32 @@ some_symbol some_other_symbol (should (string= (python-eldoc--get-symbol-at-point) "some_symbol")))) +(ert-deftest python-eldoc--get-doc-at-point-1 () + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import time +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (python-tests-look-at "time") + (should (python-eldoc--get-doc-at-point))))) + +(ert-deftest python-eldoc--get-doc-at-point-while-running-1 () + "Should not get documentation when a program is running in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import time + +time.sleep(3) +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-look-at "time") + (should-not (with-timeout (1 t) (python-eldoc--get-doc-at-point)))))) + ;;; Imenu @@ -5359,6 +5592,23 @@ else: (equal (list (python-tests-look-at "else:" -1 t)) (python-info-dedenter-opening-block-positions))))) +(ert-deftest python-info-dedenter-opening-block-positions-6 () + "Test multiline block start." + (python-tests-with-temp-buffer + " +def func(): + if ( + cond1 or + cond2 + ): + something() + else +" + (python-tests-look-at "else\n") + (should + (equal (list (python-tests-look-at "if (" -1 t)) + (python-info-dedenter-opening-block-positions))))) + (ert-deftest python-info-dedenter-opening-block-message-1 () "Test dedenters inside strings are ignored." (python-tests-with-temp-buffer diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb index 0c206b1e0c2..f39489071ec 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb @@ -177,11 +177,11 @@ qux :+, b = $: c = ?? -# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html +# Example from https://ruby-doc.com/docs/ProgrammingRuby/ d = 4 + 5 + # no '\' needed 6 + 7 -# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html +# Example from https://www.ruby-doc.org/docs/ProgrammingRuby/ e = 8 + 9 \ + 10 # '\' needed diff --git a/test/lisp/server-tests.el b/test/lisp/server-tests.el new file mode 100644 index 00000000000..351b8ef8d12 --- /dev/null +++ b/test/lisp/server-tests.el @@ -0,0 +1,41 @@ +;;; server-tests.el --- Emacs server test suite -*- lexical-binding:t -*- + +;; Copyright (C) 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 'server) + +;;; Tests: + +(ert-deftest server-test/server-start-sets-minor-mode () + "Ensure that calling `server-start' also sets `server-mode' properly." + (server-start) + (unwind-protect + (progn + ;; Make sure starting the server activates the minor mode. + (should (eq server-mode t)) + (should (memq 'server-mode global-minor-modes))) + ;; Always stop the server, even if the above checks fail. + (server-start t)) + ;; Make sure stopping the server deactivates the minor mode. + (should (eq server-mode nil)) + (should-not (memq 'server-mode global-minor-modes))) + +;;; server-tests.el ends here diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 97f425f6f48..6e48f11fc02 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -73,6 +73,30 @@ (should (= (count-lines (point) (point)) 0)))) +;;; `execute-extended-command' + +(ert-deftest simple-execute-extended-command--shorter () + ;; This test can be flaky with completion frameworks other than the + ;; default, so just skip it in interactive sessions. + (skip-unless noninteractive) + (should (equal (execute-extended-command--shorter + "display-line-numbers-mode" + "display-line") + "di-n"))) + +(ert-deftest simple-execute-extended-command--describe-binding-msg () + (let ((text-quoting-style 'grave)) + (should (equal (execute-extended-command--describe-binding-msg + 'foo "m" nil) + "You can run the command `foo' with m")) + (should (equal (execute-extended-command--describe-binding-msg + 'foo [14] nil) + "You can run the command `foo' with C-n")) + (should (equal (execute-extended-command--describe-binding-msg + 'display-line-numbers-mode nil "di-n") + "You can run the command `display-line-numbers-mode' with M-x di-n")))) + + ;;; `transpose-sexps' (defmacro simple-test--transpositions (&rest body) (declare (indent 0) diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 347981e8185..e22d1c7be0e 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -1106,7 +1106,7 @@ final or penultimate step during initialization.")) (ert-deftest test-keymap-parse-macros () (should (equal (key-parse "C-x ( C-d C-x )") [24 40 4 24 41])) - (should (equal (kbd "C-x ( C-d C-x )") "")) + (should (equal (kbd "C-x ( C-d C-x )") "\^D")) (should (equal (kbd "C-x ( C-x )") ""))) (defvar subr-test--global) @@ -1139,7 +1139,10 @@ final or penultimate step during initialization.")) (should-not (plistp '(1 . 2))) (should (plistp '(1 2 3 4))) (should-not (plistp '(1 2 3))) - (should-not (plistp '(1 2 3 . 4)))) + (should-not (plistp '(1 2 3 . 4))) + (let ((cycle (list 1 2 3))) + (nconc cycle cycle) + (should-not (plistp cycle)))) (defun subr-tests--butlast-ref (list &optional n) "Reference implementation of `butlast'." diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el index b6d0b1446a3..67dd00104b0 100644 --- a/test/lisp/thingatpt-tests.el +++ b/test/lisp/thingatpt-tests.el @@ -44,6 +44,9 @@ ;; Non alphanumeric characters can be found in URIs ("ftp://example.net/~foo!;#bar=baz&goo=bob" 3 url "ftp://example.net/~foo!;#bar=baz&goo=bob") ("bzr+ssh://user@example.net:5/a%20d,5" 34 url "bzr+ssh://user@example.net:5/a%20d,5") + ;; IPv6 brackets enclosed in [markup] + ("[http://[::1]:8000/foo]" 10 url "http://[::1]:8000/foo") + ("[http://[fe08::7:8%eth0]]" 10 url "http://[fe08::7:8%eth0]") ;; <url:...> markup ("Url: <url:foo://1.example.com>..." 8 url "foo://1.example.com") ("Url: <url:foo://2.example.com>..." 30 url "foo://2.example.com") diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el index 55e37b71d80..1b5ef04436d 100644 --- a/test/lisp/time-stamp-tests.el +++ b/test/lisp/time-stamp-tests.el @@ -89,11 +89,11 @@ (iter-defun time-stamp-test-pattern-sequential () "Iterate through each possibility for a part of `time-stamp-pattern'." (let ((pattern-value-parts - '(("4/" "10/" "-4/" "0/" "") ;0: line limit + '(("4/" "10/" "-9/" "0/" "") ;0: line limit ("stamp<" "") ;1: start - ("%-d" "%_H" "%^a" "%#Z" "%:A" "%02H" "%%" "") ;2: format part 1 + ("%-d" "%_H" "%^a" "%#Z" "%:A" "%09z" "%%" "") ;2: format part 1 (" " "x" ":" "\n" "") ;3: format part 2 - ("%-d" "%_H" "%^a" "%#Z" "%:A" "%02H" "%%") ;4: format part 3 + ("%-d" "%_H" "%^a" "%#Z" "%:A" "%09z" "%%") ;4: format part 3 (">end" "")))) ;5: end (dotimes (cur (length pattern-value-parts)) (dotimes (cur-index (length (nth cur pattern-value-parts))) @@ -118,7 +118,7 @@ (iter-defun time-stamp-test-pattern-multiply () "Iterate through every combination of parts of `time-stamp-pattern'." (let ((line-limit-values '("" "4/")) - (start-values '("" "stamp<")) + (start-values '("" "/stamp/")) (format-values '("%%" "%m")) (end-values '("" ">end"))) ;; yield all combinations of the above diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index dc4d3af6999..13248a36509 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el @@ -127,7 +127,7 @@ Don't set it globally, the functions should be let-bound.") (defun vc-test--create-repo-function (backend) "Run the `vc-create-repo' backend function. -For backends which dont support it, it is emulated." +For backends which don't support it, it is emulated." (cond ((eq backend 'CVS) diff --git a/test/manual/image-circular-tests.el b/test/manual/image-circular-tests.el index 1299970f827..d2187cbbadc 100644 --- a/test/manual/image-circular-tests.el +++ b/test/manual/image-circular-tests.el @@ -27,8 +27,11 @@ (require 'ert) +(declare-function image-size "image.c" (spec &optional pixels frame)) + (ert-deftest image-test-duplicate-keywords () "Test that duplicate keywords in an image spec lead to rejection." + (skip-unless (display-images-p)) (should-error (image-size `(image :type xbm :type xbm :data-width 1 :data-height 1 :data ,(bool-vector t)) @@ -36,33 +39,37 @@ (ert-deftest image-test-circular-plist () "Test that a circular image spec is rejected." - (should-error - (let ((l `(image :type xbm :data-width 1 :data-height 1 - :data ,(bool-vector t)))) - (setcdr (last l) '#1=(:invalid . #1#)) - (image-size l t)))) + (skip-unless (display-images-p)) + (let ((spec `(image :type xbm :data-width 1 :data-height 1 + :data ,(bool-vector t) + . ,'#1=(:invalid . #1#)))) + (should-error (image-size spec t)))) (ert-deftest image-test-:type-property-value () "Test that :type is allowed as a property value in an image spec." + (skip-unless (display-images-p)) (should (equal (image-size `(image :dummy :type :type xbm :data-width 1 :data-height 1 :data ,(bool-vector t)) t) - (cons 1 1)))) + '(1 . 1)))) (ert-deftest image-test-circular-specs () - "Test that circular image spec property values do not cause infinite recursion." - (should - (let* ((circ1 (cons :dummy nil)) - (circ2 (cons :dummy nil)) - (spec1 `(image :type xbm :data-width 1 :data-height 1 - :data ,(bool-vector 1) :ignored ,circ1)) - (spec2 `(image :type xbm :data-width 1 :data-height 1 + "Test with circular image spec property values. +In particular, test that they do not cause infinite recursion." + :expected-result :failed ;; FIXME: bug#36403#63. + (skip-unless (display-images-p)) + ;; Two copies needed to warm up image cache. + (let* ((circ1 (list :dummy)) + (circ2 (list :dummy)) + (spec1 `(image :type xbm :data-width 1 :data-height 1 + :data ,(bool-vector 1) :ignored ,circ1)) + (spec2 `(image :type xbm :data-width 1 :data-height 1 :data ,(bool-vector 1) :ignored ,circ2))) - (setcdr circ1 circ1) - (setcdr circ2 circ2) - (and (equal (image-size spec1 t) (cons 1 1)) - (equal (image-size spec2 t) (cons 1 1)))))) + (setcdr circ1 circ1) + (setcdr circ2 circ2) + (should (equal (image-size spec1 t) '(1 . 1))) + (should (equal (image-size spec2 t) '(1 . 1))))) (provide 'image-circular-tests) ;;; image-circular-tests.el ends here. diff --git a/test/manual/noverlay/.gitignore b/test/manual/noverlay/.gitignore new file mode 100644 index 00000000000..ca7fc452b84 --- /dev/null +++ b/test/manual/noverlay/.gitignore @@ -0,0 +1 @@ +itree-tests diff --git a/test/manual/noverlay/Makefile.in b/test/manual/noverlay/Makefile.in new file mode 100644 index 00000000000..3c8dba1ce1f --- /dev/null +++ b/test/manual/noverlay/Makefile.in @@ -0,0 +1,47 @@ +### @configure_input@ + +# Copyright (C) 2017-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/>. + +PROGRAM = itree-tests +PACKAGES = check +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ +CPPFLAGS += -I $(top_srcdir)/src +CFLAGS += -O0 -g3 $(shell pkg-config --cflags $(PACKAGES)) +LDLIBS += $(shell pkg-config --libs $(PACKAGES)) -lm +OBJECTS = itree-tests.o +CC = gcc +EMACS ?= $(top_builddir)/src/emacs + +.PHONY: all check clean distclean perf + +all: check + +check: $(PROGRAM) + ./check-sanitize.sh ./$(PROGRAM) + +itree-tests.o: emacs-compat.h $(top_srcdir)/src/itree.c $(top_srcdir)/src/itree.h + +perf: + -$(EMACS) -Q -l ./overlay-perf.el -f perf-run-batch + +clean: + rm -f -- $(OBJECTS) $(PROGRAM) + +distclean: clean + rm -f -- Makefile diff --git a/test/manual/noverlay/check-sanitize.sh b/test/manual/noverlay/check-sanitize.sh new file mode 100755 index 00000000000..9a67818dc8f --- /dev/null +++ b/test/manual/noverlay/check-sanitize.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +### check-sanitize.sh - strip confusing parts of Check error output + +## Copyright (C) 2017-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/>. + +set -o pipefail + +prog=$1 +shift + +[ -z "$prog" ] && { + echo "usage:$(basename $0) CHECK_PROGRAM"; + exit 1; +} + +# FIXME: This would be unnecessary if +# compilation-error-regexp-alist-alist understood libcheck OOTB. +"$prog" "$@" | sed -e 's/^\([^:]\+\):\([0-9]\+\):\([PFE]\):\([^:]*\):\([^:]*\):[^:]*:\(.*\)/\1:\2:\3:\4:\5:\6/' diff --git a/test/manual/noverlay/emacs-compat.h b/test/manual/noverlay/emacs-compat.h new file mode 100644 index 00000000000..d2448b12db3 --- /dev/null +++ b/test/manual/noverlay/emacs-compat.h @@ -0,0 +1,76 @@ +/* Mock necessary parts of lisp.h. + +Copyright (C) 2017-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/>. */ + +#ifndef TEST_COMPAT_H +#define TEST_COMPAT_H + +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> + +typedef int Lisp_Object; + +void * +xmalloc (size_t size) +{ + return malloc (size); +} + +void +xfree (void *ptr) +{ + free (ptr); +} + +void * +xrealloc (void *block, size_t size) +{ + return realloc (block, size); +} + +void +emacs_abort () +{ + fprintf (stderr, "Aborting...\n"); + exit (EXIT_FAILURE); +} + +#ifndef eassert +#define eassert(cond) \ + do { \ + if (! (cond)) { \ + fprintf (stderr, "%s:%d:eassert condition failed: %s\n", \ + __FILE__, __LINE__ , # cond); \ + exit (EXIT_FAILURE); \ + } \ + } while (0) +#endif + +#ifndef eassume +#define eassume eassert +#endif + +#ifndef max +#define max(x,y) ((x) >= (y) ? (x) : (y)) +#endif +#ifndef min +#define min(x,y) ((x) <= (y) ? (x) : (y)) +#endif + +#endif /* TEST_COMPAT_H */ diff --git a/test/manual/noverlay/itree-tests.c b/test/manual/noverlay/itree-tests.c new file mode 100644 index 00000000000..278e65f9bf7 --- /dev/null +++ b/test/manual/noverlay/itree-tests.c @@ -0,0 +1,1289 @@ +/* Test the interval data-structure in itree.c. + +Copyright (c) 2017-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/>. */ + +#include <config.h> + +#include <stdarg.h> +#include <stdlib.h> + +#include <check.h> +#include "emacs-compat.h" + +#define EMACS_LISP_H /* lisp.h inclusion guard */ +#define ITREE_DEBUG 1 +#define ITREE_TESTING +#include "itree.c" + +/* Globals. */ + +static struct itree_tree tree; +static struct itree_node A, B, C, D, E; +static struct itree_node N_05, N_10, N_15, N_20, N_30, N_40; +static struct itree_node N_50, N_70, N_80, N_90, N_85, N_95; + +/* Basic tests of the itree_tree data-structure. */ + +/* +===================================================================================+ + * | Insert + * +===================================================================================+ */ + +/* The graphs below display the trees after each insertion (as they + should be). See the source code for the different cases + applied. */ + +static void +test_insert1_setup (void) +{ + enum { N = 6 }; + const int values[N] = {50, 30, 20, 10, 15, 5}; + struct itree_node *nodes[N] = {&N_50, &N_30, &N_20, &N_10, &N_15, &N_05}; + interval_tree_init (&tree); + for (int i = 0; i < N; ++i) + { + nodes[i]->begin = nodes[i]->end = values[i]; + nodes[i]->otick = tree.otick; + } +} + +START_TEST (test_insert_1) +{ + /* + * [50] + */ + + interval_tree_insert (&tree, &N_50); + ck_assert (! N_50.red); + ck_assert_ptr_eq (&N_50, tree.root); +} +END_TEST + +START_TEST (test_insert_2) +{ + /* + * [50] + * / + * (30) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_30); + ck_assert (! N_50.red); + ck_assert (N_30.red); + ck_assert_ptr_eq (&N_50, tree.root); + ck_assert_ptr_eq (N_30.parent, &N_50); + ck_assert_ptr_eq (N_50.left, &N_30); + ck_assert_ptr_null (N_50.right); + ck_assert_ptr_null (N_30.left); + ck_assert_ptr_null (N_30.right); +} +END_TEST + +START_TEST (test_insert_3) +{ + /* case 3.a + * [30] + * / \ + * (20) (50) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_30); + interval_tree_insert (&tree, &N_20); + ck_assert (N_50.red); + ck_assert (! N_30.red); + ck_assert (N_20.red); + ck_assert_ptr_eq (&N_30, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_30); + ck_assert_ptr_eq (N_30.right, &N_50); + ck_assert_ptr_eq (N_30.left, &N_20); + ck_assert_ptr_null (N_20.left); + ck_assert_ptr_null (N_20.right); + ck_assert_ptr_eq (N_20.parent, &N_30); +} +END_TEST + +START_TEST (test_insert_4) +{ + /* 1.a + * [30] + * / \ + * [20] [50] + * / + * (10) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_30); + interval_tree_insert (&tree, &N_20); + interval_tree_insert (&tree, &N_10); + ck_assert (! N_50.red); + ck_assert (! N_30.red); + ck_assert (! N_20.red); + ck_assert (N_10.red); + ck_assert_ptr_eq (&N_30, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_30); + ck_assert_ptr_eq (N_30.right, &N_50); + ck_assert_ptr_eq (N_30.left, &N_20); + ck_assert_ptr_eq (N_20.left, &N_10); + ck_assert_ptr_null (N_20.right); + ck_assert_ptr_eq (N_20.parent, &N_30); + ck_assert_ptr_eq (N_10.parent, &N_20); + ck_assert_ptr_eq (N_20.left, &N_10); + ck_assert_ptr_null (N_10.right); +} +END_TEST + +START_TEST (test_insert_5) +{ + /* 2.a + * [30] + * / \ + * [15] [50] + * / \ + * (10) (20) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_30); + interval_tree_insert (&tree, &N_20); + interval_tree_insert (&tree, &N_10); + interval_tree_insert (&tree, &N_15); + ck_assert (! N_50.red); + ck_assert (! N_30.red); + ck_assert (N_20.red); + ck_assert (N_10.red); + ck_assert (! N_15.red); + ck_assert_ptr_eq (&N_30, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_30); + ck_assert_ptr_eq (N_30.right, &N_50); + ck_assert_ptr_eq (N_30.left, &N_15); + ck_assert_ptr_null (N_20.left); + ck_assert_ptr_null (N_20.right); + ck_assert_ptr_eq (N_20.parent, &N_15); + ck_assert_ptr_eq (N_10.parent, &N_15); + ck_assert_ptr_null (N_20.left); + ck_assert_ptr_null (N_10.right); + ck_assert_ptr_eq (N_15.right, &N_20); + ck_assert_ptr_eq (N_15.left, &N_10); + ck_assert_ptr_eq (N_15.parent, &N_30); +} +END_TEST + +START_TEST (test_insert_6) +{ + /* 1.a + * [30] + * / \ + * (15) [50] + * / \ + * [10] [20] + * / + * (5) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_30); + interval_tree_insert (&tree, &N_20); + interval_tree_insert (&tree, &N_10); + interval_tree_insert (&tree, &N_15); + interval_tree_insert (&tree, &N_05); + ck_assert (! N_50.red); + ck_assert (! N_30.red); + ck_assert (! N_20.red); + ck_assert (! N_10.red); + ck_assert (N_15.red); + ck_assert (N_05.red); + ck_assert_ptr_eq (&N_30, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_30); + ck_assert_ptr_eq (N_30.right, &N_50); + ck_assert_ptr_eq (N_30.left, &N_15); + ck_assert_ptr_null (N_20.left); + ck_assert_ptr_null (N_20.right); + ck_assert_ptr_eq (N_20.parent, &N_15); + ck_assert_ptr_eq (N_10.parent, &N_15); + ck_assert_ptr_null (N_20.left); + ck_assert_ptr_null (N_10.right); + ck_assert_ptr_eq (N_15.right, &N_20); + ck_assert_ptr_eq (N_15.left, &N_10); + ck_assert_ptr_eq (N_15.parent, &N_30); + ck_assert_ptr_eq (N_05.parent, &N_10); + ck_assert_ptr_eq (N_10.left, &N_05); + ck_assert_ptr_null (N_05.right); +} +END_TEST + + + +/* These are the mirror cases to the above ones. */ + +static void +test_insert2_setup (void) +{ + enum { N = 6 }; + const int values[] = {50, 70, 80, 90, 85, 95}; + struct itree_node *nodes[N] = {&N_50, &N_70, &N_80, &N_90, &N_85, &N_95}; + interval_tree_init (&tree); + for (int i = 0; i < N; ++i) + { + nodes[i]->begin = nodes[i]->end = values[i]; + nodes[i]->otick = tree.otick; + } +} + +START_TEST (test_insert_7) +{ + /* + * [50] + */ + + interval_tree_insert (&tree, &N_50); + ck_assert (! N_50.red); + ck_assert_ptr_eq (&N_50, tree.root); +} +END_TEST + +START_TEST (test_insert_8) +{ + /* + * [50] + * \ + * (70) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_70); + ck_assert (! N_50.red); + ck_assert (N_70.red); + ck_assert_ptr_eq (&N_50, tree.root); + ck_assert_ptr_eq (N_70.parent, &N_50); + ck_assert_ptr_eq (N_50.right, &N_70); + ck_assert_ptr_null (N_50.left); + ck_assert_ptr_null (N_70.right); + ck_assert_ptr_null (N_70.left); +} +END_TEST + +START_TEST (test_insert_9) +{ + /* 3.a + * [70] + * / \ + * (50) (80) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_70); + interval_tree_insert (&tree, &N_80); + ck_assert (N_50.red); + ck_assert (! N_70.red); + ck_assert (N_80.red); + ck_assert_ptr_eq (&N_70, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_70); + ck_assert_ptr_eq (N_70.right, &N_80); + ck_assert_ptr_eq (N_70.left, &N_50); + ck_assert_ptr_null (N_80.right); + ck_assert_ptr_null (N_80.left); + ck_assert_ptr_eq (N_80.parent, &N_70); +} +END_TEST + +START_TEST (test_insert_10) +{ + /* 1.b + * [70] + * / \ + * [50] [80] + * \ + * (90) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_70); + interval_tree_insert (&tree, &N_80); + interval_tree_insert (&tree, &N_90); + ck_assert (! N_50.red); + ck_assert (! N_70.red); + ck_assert (! N_80.red); + ck_assert (N_90.red); + ck_assert_ptr_eq (&N_70, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_70); + ck_assert_ptr_eq (N_70.right, &N_80); + ck_assert_ptr_eq (N_70.left, &N_50); + ck_assert_ptr_eq (N_80.right, &N_90); + ck_assert_ptr_null (N_80.left); + ck_assert_ptr_eq (N_80.parent, &N_70); + ck_assert_ptr_eq (N_90.parent, &N_80); + ck_assert_ptr_eq (N_80.right, &N_90); + ck_assert_ptr_null (N_90.left); +} +END_TEST + +START_TEST (test_insert_11) +{ + /* 2.b + * [70] + * / \ + * [50] [85] + * / \ + * (80) (90) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_70); + interval_tree_insert (&tree, &N_80); + interval_tree_insert (&tree, &N_90); + interval_tree_insert (&tree, &N_85); + ck_assert (! N_50.red); + ck_assert (! N_70.red); + ck_assert (N_80.red); + ck_assert (N_90.red); + ck_assert (! N_85.red); + ck_assert_ptr_eq (&N_70, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_70); + ck_assert_ptr_eq (N_70.right, &N_85); + ck_assert_ptr_eq (N_70.left, &N_50); + ck_assert_ptr_null (N_80.right); + ck_assert_ptr_null (N_80.left); + ck_assert_ptr_eq (N_80.parent, &N_85); + ck_assert_ptr_eq (N_90.parent, &N_85); + ck_assert_ptr_null (N_80.right); + ck_assert_ptr_null (N_90.left); + ck_assert_ptr_eq (N_85.right, &N_90); + ck_assert_ptr_eq (N_85.left, &N_80); + ck_assert_ptr_eq (N_85.parent, &N_70); + +} +END_TEST + +START_TEST (test_insert_12) +{ + /* 1.b + * [70] + * / \ + * [50] (85) + * / \ + * [80] [90] + * \ + * (95) + */ + + interval_tree_insert (&tree, &N_50); + interval_tree_insert (&tree, &N_70); + interval_tree_insert (&tree, &N_80); + interval_tree_insert (&tree, &N_90); + interval_tree_insert (&tree, &N_85); + interval_tree_insert (&tree, &N_95); + ck_assert (! N_50.red); + ck_assert (! N_70.red); + ck_assert (! N_80.red); + ck_assert (! N_90.red); + ck_assert (N_85.red); + ck_assert (N_95.red); + ck_assert_ptr_eq (&N_70, tree.root); + ck_assert_ptr_eq (N_50.parent, &N_70); + ck_assert_ptr_eq (N_70.right, &N_85); + ck_assert_ptr_eq (N_70.left, &N_50); + ck_assert_ptr_null (N_80.right); + ck_assert_ptr_null (N_80.left); + ck_assert_ptr_eq (N_80.parent, &N_85); + ck_assert_ptr_eq (N_90.parent, &N_85); + ck_assert_ptr_null (N_80.right); + ck_assert_ptr_null (N_90.left); + ck_assert_ptr_eq (N_85.right, &N_90); + ck_assert_ptr_eq (N_85.left, &N_80); + ck_assert_ptr_eq (N_85.parent, &N_70); + ck_assert_ptr_eq (N_95.parent, &N_90); + ck_assert_ptr_eq (N_90.right, &N_95); + ck_assert_ptr_null (N_95.left); +} +END_TEST + +START_TEST (test_insert_13) +{ + enum { N = 4 }; + const int values[N] = {10, 20, 30, 40}; + struct itree_node *nodes[N] = {&N_10, &N_20, &N_30, &N_40}; + interval_tree_init (&tree); + for (int i = 0; i < N; ++i) + itree_insert (&tree, nodes[i], values[i], values[i]); + + ck_assert_ptr_eq (tree.root, &N_20); + ck_assert_ptr_eq (N_20.left, &N_10); + ck_assert_ptr_eq (N_20.right, &N_30); + ck_assert_ptr_eq (N_30.right, &N_40); + ck_assert (! N_10.red); + ck_assert (! N_20.red); + ck_assert (! N_30.red); + ck_assert (N_40.red); +} +END_TEST + +START_TEST (test_insert_14) +{ + enum { N = 3 }; + struct itree_node nodes[N]; + interval_tree_init (&tree); + + for (int i = 0; i < N; ++i) + itree_insert (&tree, &nodes[i], 10, 10); + for (int i = 0; i < N; ++i) + ck_assert (interval_tree_contains (&tree, &nodes[i])); +} +END_TEST + + +/* +===================================================================================+ + * | Remove + * +===================================================================================+ */ + +/* Creating proper test trees for the formal tests via insertions is + way too tedious, so we just fake it and only test the + fix-routine. */ +static void +test_remove1_setup (void) +{ + interval_tree_init (&tree); + tree.root = &B; + A.parent = &B; B.parent = NULL; C.parent = &D; D.parent = &B; E.parent = &D; + A.left = A.right = C.left = C.right = E.left = E.right = NULL; + B.left = &A; B.right = &D; + D.left = &C; D.right = &E; + A.offset = B.offset = C.offset = D.offset = E.offset = 0; + A.otick = B.otick = C.otick = D.otick = E.otick = tree.otick; +} + +/* 1.a -> 2.a + * [B] + * / \ + * [A] (D) + * / \ + * [C] [E] + */ + +START_TEST (test_remove_1) +{ + B.red = A.red = C.red = E.red = false; + D.red = true; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.left, &A); + ck_assert_ptr_eq (B.right, &C); + ck_assert_ptr_eq (C.parent, &B); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (D.right, &E); + ck_assert_ptr_eq (D.left, &B); + ck_assert_ptr_eq (tree.root, &D); +} +END_TEST + +/* 2.a */ +START_TEST (test_remove_2) +{ + B.red = D.red = A.red = C.red = E.red = false; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (! C.red); + ck_assert (D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.left, &A); + ck_assert_ptr_eq (B.right, &D); + ck_assert_ptr_eq (C.parent, &D); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (tree.root, &B); +} +END_TEST + +/* 3.a -> 4.a */ +START_TEST (test_remove_3) +{ + D.red = A.red = E.red = false; + B.red = C.red = true; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (! C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.left, &A); + ck_assert_ptr_null (B.right); + ck_assert_ptr_eq (&C, tree.root); + ck_assert_ptr_eq (C.left, &B); + ck_assert_ptr_eq (C.right, &D); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_null (D.left); +} +END_TEST + +/* 4.a */ +START_TEST (test_remove_4) +{ + B.red = C.red = E.red = true; + A.red = D.red = false; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.left, &A); + ck_assert_ptr_eq (B.right, &C); + ck_assert_ptr_eq (C.parent, &B); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (tree.root, &D); +} +END_TEST + + + +/* These are the mirrored cases. */ + +static void +test_remove2_setup (void) +{ + interval_tree_init (&tree); + tree.root = &B; + A.parent = &B; B.parent = NULL; C.parent = &D; D.parent = &B; E.parent = &D; + A.right = A.left = C.right = C.left = E.right = E.left = NULL; + B.right = &A; B.left = &D; + D.right = &C; D.left = &E; +} + +/* 1.b -> 2.b + * [B] + * / \ + * [A] (D) + * / \ + * [C] [E] + */ + +START_TEST (test_remove_5) +{ + B.red = A.red = C.red = E.red = false; + D.red = true; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.right, &A); + ck_assert_ptr_eq (B.left, &C); + ck_assert_ptr_eq (C.parent, &B); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (D.left, &E); + ck_assert_ptr_eq (D.right, &B); + ck_assert_ptr_eq (tree.root, &D); +} +END_TEST + +/* 2.b */ +START_TEST (test_remove_6) +{ + B.red = D.red = A.red = C.red = E.red = false; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (! C.red); + ck_assert (D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.right, &A); + ck_assert_ptr_eq (B.left, &D); + ck_assert_ptr_eq (C.parent, &D); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (tree.root, &B); +} +END_TEST + +/* 3.b -> 4.b */ +START_TEST (test_remove_7) +{ + D.red = A.red = E.red = false; + B.red = C.red = true; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (! C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.right, &A); + ck_assert_ptr_null (B.left); + ck_assert_ptr_eq (&C, tree.root); + ck_assert_ptr_eq (C.right, &B); + ck_assert_ptr_eq (C.left, &D); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_null (D.right); +} +END_TEST + +/* 4.b */ +START_TEST (test_remove_8) +{ + B.red = C.red = E.red = true; + A.red = D.red = false; + interval_tree_remove_fix (&tree, &A, &B); + + ck_assert (! A.red); + ck_assert (! B.red); + ck_assert (C.red); + ck_assert (! D.red); + ck_assert (! E.red); + ck_assert_ptr_eq (A.parent, &B); + ck_assert_ptr_eq (B.right, &A); + ck_assert_ptr_eq (B.left, &C); + ck_assert_ptr_eq (C.parent, &B); + ck_assert_ptr_eq (E.parent, &D); + ck_assert_ptr_eq (tree.root, &D); +} +END_TEST + +START_TEST (test_remove_9) +{ + enum { N = 4 }; + const int values[N] = {10, 20, 30, 40}; + struct itree_node *nodes[N] = {&N_10, &N_20, &N_30, &N_40}; + interval_tree_init (&tree); + for (int i = 0; i < N; ++i) + itree_insert (&tree, nodes[i], values[i], values[i]); + + ck_assert (tree.root == &N_20); + ck_assert (N_20.left == &N_10); + ck_assert (N_20.right == &N_30); + ck_assert (N_30.right == &N_40); + ck_assert (! N_20.red); + ck_assert (! N_10.red); + ck_assert (! N_30.red); + ck_assert (N_40.red); + + itree_remove (&tree, &N_10); + + ck_assert_ptr_eq (tree.root, &N_30); + ck_assert_ptr_null (N_30.parent); + ck_assert_ptr_eq (N_30.left, &N_20); + ck_assert_ptr_eq (N_30.right, &N_40); + ck_assert (! N_20.red); + ck_assert (! N_30.red); + ck_assert (! N_40.red); +} +END_TEST + +static void +shuffle (int *index, int n) +{ + for (int i = n - 1; i >= 0; --i) + { + int j = random () % (i + 1); + int h = index[j]; + index[j] = index[i]; + index[i] = h; + } +} + +START_TEST (test_remove_10) +{ + enum { N = 3 }; + int index[N]; + for (int i = 0; i < N; ++i) + index[i] = i; + srand (42); + shuffle (index, N); + + interval_tree_init (&tree); + struct itree_node nodes[N]; + for (int i = 0; i < N; ++i) + { + ptrdiff_t pos = (i + 1) * 10; + itree_insert (&tree, &nodes[index[i]], pos, pos + 1); + } + + shuffle (index, N); + for (int i = 0; i < N; ++i) + { + ck_assert (interval_tree_contains (&tree, &nodes[index[i]])); + itree_remove (&tree, &nodes[index[i]]); + } + ck_assert_ptr_null (tree.root); + ck_assert_int_eq (tree.size, 0); +} +END_TEST + + +/* +===================================================================================+ + * | Generator + * +===================================================================================+ */ + +START_TEST (test_generator_1) +{ + struct itree_node node, *n; + struct itree_iterator *g; + interval_tree_init (&tree); + + itree_insert (&tree, &node, 10, 20); + g = itree_iterator_start (&tree, 0, 30, ITREE_ASCENDING, NULL, 0); + n = itree_iterator_next (g); + ck_assert_ptr_eq (n, &node); + ck_assert_int_eq (n->begin, 10); + ck_assert_int_eq (n->end, 20); + ck_assert_ptr_null (itree_iterator_next (g)); + ck_assert_ptr_null (itree_iterator_next (g)); + ck_assert_ptr_null (itree_iterator_next (g)); + itree_iterator_finish (g); + + g = itree_iterator_start (&tree, 30, 50, ITREE_ASCENDING, NULL, 0); + ck_assert_ptr_null (itree_iterator_next (g)); + ck_assert_ptr_null (itree_iterator_next (g)); + ck_assert_ptr_null (itree_iterator_next (g)); + itree_iterator_finish (g); +} +END_TEST + +static void +test_check_generator (struct itree_tree *tree, + ptrdiff_t begin, ptrdiff_t end, + int n, ...) +{ + va_list ap; + struct itree_iterator *g = + itree_iterator_start (tree, begin, end, ITREE_ASCENDING, NULL, 0); + + va_start (ap, n); + for (int i = 0; i < n; ++i) + { + struct itree_node *node = itree_iterator_next (g); + ck_assert_ptr_nonnull (node); + ck_assert_int_eq (node->begin, va_arg (ap, ptrdiff_t)); + } + va_end (ap); + ck_assert_ptr_null (itree_iterator_next (g)); + ck_assert_ptr_null (itree_iterator_next (g)); + itree_iterator_finish (g); +} + +START_TEST (test_generator_2) +{ + interval_tree_init (&tree); + struct itree_node nodes[3]; + for (int i = 0; i < 3; ++i) + itree_insert (&tree, &nodes[i], 10 * (i + 1), 10 * (i + 2)); + + test_check_generator (&tree, 0, 50, 3, + 10, 20, 30); + test_check_generator (&tree, 0, 10, 0); + test_check_generator (&tree, 40, 50, 0); + test_check_generator (&tree, 15, 35, 3, + 10, 20, 30); + test_check_generator (&tree, -100, -50, 0); + test_check_generator (&tree, -100, -50, 0); + test_check_generator (&tree, 100, 50, 0); + test_check_generator (&tree, 100, 150, 0); + test_check_generator (&tree, 0, 0, 0); + test_check_generator (&tree, 40, 40, 0); + test_check_generator (&tree, 30, 30, 0); + test_check_generator (&tree, 35, 35, 1, + 30); +} +END_TEST + +static void +test_create_tree (struct itree_node *nodes, int n, bool doshuffle) +{ + int *index = calloc (n, sizeof (int)); + for (int i = 0; i < n; ++i) + index[i] = i; + if (doshuffle) + { + srand (42); + shuffle (index, n); + } + + interval_tree_init (&tree); + for (int i = 0; i < n; ++i) + { + struct itree_node *node = &nodes[index[i]]; + itree_insert (&tree, node, node->begin, node->end); + } + free (index); +} + +START_TEST (test_generator_3) +{ + enum { N = 3 }; + struct itree_node nodes[N] = {{.begin = 10, .end = 10}, + {.begin = 10, .end = 10}, + {.begin = 10, .end = 10}}; + test_create_tree (nodes, N, true); + test_check_generator (&tree, 0, 10, 0); + test_check_generator (&tree, 10, 10, 3, + 10, 10, 10); + test_check_generator (&tree, 10, 20, 3, + 10, 10, 10); +} +END_TEST + +START_TEST (test_generator_5) +{ + enum { N = 4 }; + struct itree_node nodes[N] = {{.begin = 10, .end = 30}, + {.begin = 20, .end = 40}, + {.begin = 30, .end = 50}, + {.begin = 40, .end = 60}}; + test_create_tree (nodes, N, false); + struct itree_iterator *g = + itree_iterator_start (&tree, 0, 100, ITREE_PRE_ORDER, NULL, 0); + for (int i = 0; i < N; ++i) + { + struct itree_node *n = itree_iterator_next (g); + ck_assert_ptr_nonnull (n); + switch (i) + { + case 0: ck_assert_int_eq (20, n->begin); break; + case 1: ck_assert_int_eq (10, n->begin); break; + case 2: ck_assert_int_eq (30, n->begin); break; + case 3: ck_assert_int_eq (40, n->begin); break; + } + } + itree_iterator_finish (g); +} +END_TEST + +START_TEST (test_generator_6) +{ + enum { N = 4 }; + struct itree_node nodes[N] = {{.begin = 10, .end = 30}, + {.begin = 20, .end = 40}, + {.begin = 30, .end = 50}, + {.begin = 40, .end = 60}}; + test_create_tree (nodes, N, true); + struct itree_iterator *g = + itree_iterator_start (&tree, 0, 100, ITREE_ASCENDING, NULL, 0); + for (int i = 0; i < N; ++i) + { + struct itree_node *n = itree_iterator_next (g); + ck_assert_ptr_nonnull (n); + switch (i) + { + case 0: ck_assert_int_eq (10, n->begin); break; + case 1: ck_assert_int_eq (20, n->begin); break; + case 2: ck_assert_int_eq (30, n->begin); break; + case 3: ck_assert_int_eq (40, n->begin); break; + } + } + itree_iterator_finish (g); +} +END_TEST + +START_TEST (test_generator_7) +{ + enum { N = 4 }; + struct itree_node nodes[N] = {{.begin = 10, .end = 30}, + {.begin = 20, .end = 40}, + {.begin = 30, .end = 50}, + {.begin = 40, .end = 60}}; + test_create_tree (nodes, N, true); + struct itree_iterator *g = + itree_iterator_start (&tree, 0, 100, ITREE_DESCENDING, NULL, 0); + for (int i = 0; i < N; ++i) + { + struct itree_node *n = itree_iterator_next (g); + ck_assert_ptr_nonnull (n); + switch (i) + { + case 0: ck_assert_int_eq (40, n->begin); break; + case 1: ck_assert_int_eq (30, n->begin); break; + case 2: ck_assert_int_eq (20, n->begin); break; + case 3: ck_assert_int_eq (10, n->begin); break; + } + } + itree_iterator_finish (g); +} +END_TEST + +START_TEST (test_generator_8) +{ + enum { N = 2 }; + struct itree_node nodes[N] = {{.begin = 20, .end = 30}, + {.begin = 40, .end = 50}}; + test_create_tree (nodes, N, false); + struct itree_iterator *g = + itree_iterator_start (&tree, 1, 60, ITREE_DESCENDING, NULL, 0); + struct itree_node *n = itree_iterator_next (g); + ck_assert_int_eq (n->begin, 40); + itree_iterator_narrow (g, 50, 60); + n = itree_iterator_next (g); + ck_assert_ptr_null (n); + itree_iterator_finish (g); +} +END_TEST + +START_TEST (test_generator_9) +{ + enum { N = 2 }; + struct itree_node nodes[N] = {{.begin = 25, .end = 25}, + {.begin = 20, .end = 30}}; + test_create_tree (nodes, N, false); + struct itree_iterator *g = + itree_iterator_start (&tree, 1, 30, ITREE_DESCENDING, NULL, 0); + struct itree_node *n = itree_iterator_next (g); + ck_assert_int_eq (n->begin, 25); + itree_iterator_narrow (g, 25, 30); + n = itree_iterator_next (g); + ck_assert_int_eq (n->begin, 20); + itree_iterator_finish (g); +} +END_TEST + + +/* +===================================================================================+ + * | Insert Gap + * +===================================================================================+ */ + +static struct itree_tree gap_tree; +static struct itree_node gap_node; + +#define N_BEG (itree_node_begin (&gap_tree, &gap_node)) +#define N_END (itree_node_end (&gap_tree, &gap_node)) + +static void +test_setup_gap_node (ptrdiff_t begin, ptrdiff_t end, + bool front_advance, bool rear_advance) +{ + interval_tree_init (&gap_tree); + gap_node.front_advance = front_advance; + gap_node.rear_advance = rear_advance; + itree_insert (&gap_tree, &gap_node, begin, end); +} + +static void +test_setup_gap_node_noadvance (ptrdiff_t begin, ptrdiff_t end) +{ + test_setup_gap_node (begin, end, false, false); +} + +START_TEST (test_gap_insert_1) +{ + test_setup_gap_node_noadvance (100, 200); + itree_insert_gap (&gap_tree, 100 + 10, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200 + 20); +} +END_TEST + +START_TEST (test_gap_insert_2) +{ + test_setup_gap_node_noadvance (100, 200); + itree_insert_gap (&gap_tree, 300, 10, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200); +} +END_TEST + +START_TEST (test_gap_insert_3) +{ + test_setup_gap_node_noadvance (100, 200); + itree_insert_gap (&gap_tree, 0, 15, false); + ck_assert_int_eq (N_BEG, 100 + 15); + ck_assert_int_eq (N_END, 200 + 15); +} +END_TEST + +START_TEST (test_gap_insert_4) +{ + test_setup_gap_node (100, 200, true, false); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100 + 20); + ck_assert_int_eq (N_END, 200 + 20); + +} +END_TEST + +START_TEST (test_gap_insert_5) +{ + test_setup_gap_node_noadvance (100, 200); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200 + 20); + +} +END_TEST + +START_TEST (test_gap_insert_6) +{ + test_setup_gap_node (100, 200, false, true); + itree_insert_gap (&gap_tree, 200, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200 + 20); + +} +END_TEST + +START_TEST (test_gap_insert_7) +{ + test_setup_gap_node_noadvance (100, 200); + itree_insert_gap (&gap_tree, 200, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200); + +} +END_TEST + +START_TEST (test_gap_insert_8) +{ + test_setup_gap_node (100, 100, true, true); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100 + 20); + ck_assert_int_eq (N_END, 100 + 20); + +} +END_TEST + +START_TEST (test_gap_insert_9) +{ + test_setup_gap_node (100, 100, false, true); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 100 + 20); + +} +END_TEST + +START_TEST (test_gap_insert_10) +{ + test_setup_gap_node (100, 100, true, false); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 100); + +} +END_TEST + +START_TEST (test_gap_insert_11) +{ + test_setup_gap_node_noadvance (100, 100); + itree_insert_gap (&gap_tree, 100, 20, false); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 100); + +} +END_TEST + + +/* +===================================================================================+ + * | Delete Gap + * +===================================================================================+ */ + +START_TEST (test_gap_delete_1) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 100 + 10, 20); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200 - 20); + +} +END_TEST + +START_TEST (test_gap_delete_2) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 200 + 10, 20); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200); + +} +END_TEST + +START_TEST (test_gap_delete_3) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 200, 20); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 200); + +} +END_TEST + +START_TEST (test_gap_delete_4) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 100 - 20, 20); + ck_assert_int_eq (N_BEG, 100 - 20); + ck_assert_int_eq (N_END, 200 - 20); + +} +END_TEST + +START_TEST (test_gap_delete_5) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 70, 20); + ck_assert_int_eq (N_BEG, 100 - 20); + ck_assert_int_eq (N_END, 200 - 20); + +} +END_TEST + +START_TEST (test_gap_delete_6) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 80, 100); + ck_assert_int_eq (N_BEG, 80); + ck_assert_int_eq (N_END, 100); +} +END_TEST + +START_TEST (test_gap_delete_7) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 120, 100); + ck_assert_int_eq (N_BEG, 100); + ck_assert_int_eq (N_END, 120); +} +END_TEST + +START_TEST (test_gap_delete_8) +{ + test_setup_gap_node_noadvance (100, 200); + itree_delete_gap (&gap_tree, 100 - 20, 200 + 20); + ck_assert_int_eq (N_BEG, 100 - 20); + ck_assert_int_eq (N_END, 100 - 20); + +} +END_TEST + + + +static Suite * +basic_suite () +{ + Suite *s = suite_create ("basic"); + + TCase *tc = tcase_create ("insert1"); + tcase_add_checked_fixture (tc, test_insert1_setup, NULL); + tcase_add_test (tc, test_insert_1); + tcase_add_test (tc, test_insert_2); + tcase_add_test (tc, test_insert_3); + tcase_add_test (tc, test_insert_4); + tcase_add_test (tc, test_insert_5); + tcase_add_test (tc, test_insert_6); + suite_add_tcase (s, tc); + + tc = tcase_create ("insert2"); + tcase_add_checked_fixture (tc, test_insert2_setup, NULL); + tcase_add_test (tc, test_insert_7); + tcase_add_test (tc, test_insert_8); + tcase_add_test (tc, test_insert_9); + tcase_add_test (tc, test_insert_10); + tcase_add_test (tc, test_insert_11); + tcase_add_test (tc, test_insert_12); + suite_add_tcase (s, tc); + + tc = tcase_create ("insert3"); + tcase_add_test (tc, test_insert_13); + tcase_add_test (tc, test_insert_14); + suite_add_tcase (s, tc); + + tc = tcase_create ("remove1"); + tcase_add_checked_fixture (tc, test_remove1_setup, NULL); + tcase_add_test (tc, test_remove_1); + tcase_add_test (tc, test_remove_2); + tcase_add_test (tc, test_remove_3); + tcase_add_test (tc, test_remove_4); + suite_add_tcase (s, tc); + + tc = tcase_create ("remove2"); + tcase_add_checked_fixture (tc, test_remove2_setup, NULL); + tcase_add_test (tc, test_remove_5); + tcase_add_test (tc, test_remove_6); + tcase_add_test (tc, test_remove_7); + tcase_add_test (tc, test_remove_8); + suite_add_tcase (s, tc); + + tc = tcase_create ("remove3"); + tcase_add_test (tc, test_remove_9); + tcase_add_test (tc, test_remove_10); + suite_add_tcase (s, tc); + + tc = tcase_create ("generator"); + tcase_add_test (tc, test_generator_1); + tcase_add_test (tc, test_generator_2); + tcase_add_test (tc, test_generator_3); + tcase_add_test (tc, test_generator_5); + tcase_add_test (tc, test_generator_6); + tcase_add_test (tc, test_generator_7); + tcase_add_test (tc, test_generator_8); + tcase_add_test (tc, test_generator_9); + suite_add_tcase (s, tc); + + tc = tcase_create ("insert_gap"); + tcase_add_test (tc, test_gap_insert_1); + tcase_add_test (tc, test_gap_insert_2); + tcase_add_test (tc, test_gap_insert_3); + tcase_add_test (tc, test_gap_insert_4); + tcase_add_test (tc, test_gap_insert_5); + tcase_add_test (tc, test_gap_insert_6); + tcase_add_test (tc, test_gap_insert_7); + tcase_add_test (tc, test_gap_insert_8); + tcase_add_test (tc, test_gap_insert_9); + tcase_add_test (tc, test_gap_insert_10); + tcase_add_test (tc, test_gap_insert_11); + suite_add_tcase (s, tc); + + tc = tcase_create ("delete_gap"); + tcase_add_test (tc, test_gap_delete_1); + tcase_add_test (tc, test_gap_delete_2); + tcase_add_test (tc, test_gap_delete_3); + tcase_add_test (tc, test_gap_delete_4); + tcase_add_test (tc, test_gap_delete_5); + tcase_add_test (tc, test_gap_delete_6); + tcase_add_test (tc, test_gap_delete_7); + tcase_add_test (tc, test_gap_delete_8); + suite_add_tcase (s, tc); + + return s; +} + +int +main (void) +{ + Suite *s = basic_suite (); + SRunner *sr = srunner_create (s); + + init_itree (); + srunner_run_all (sr, CK_ENV); + int nfailed = srunner_ntests_failed (sr); + srunner_free (sr); + return (nfailed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/test/manual/noverlay/many-errors.py b/test/manual/noverlay/many-errors.py new file mode 100644 index 00000000000..fa4ef5f98d1 --- /dev/null +++ b/test/manual/noverlay/many-errors.py @@ -0,0 +1,2480 @@ +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass +def a(x, y, y): + return t; pass diff --git a/test/manual/noverlay/overlay-perf.el b/test/manual/noverlay/overlay-perf.el new file mode 100644 index 00000000000..4d79254a538 --- /dev/null +++ b/test/manual/noverlay/overlay-perf.el @@ -0,0 +1,764 @@ +;; -*- lexical-binding:t -*- +(require 'cl-lib) +(require 'subr-x) +(require 'seq) +(require 'hi-lock) + + +;; +===================================================================================+ +;; | Framework +;; +===================================================================================+ + +(defmacro perf-define-constant-test (name &optional doc &rest body) + (declare (indent 1) (debug (symbol &optional string &rest form))) + `(progn + (put ',name 'perf-constant-test t) + (defun ,name nil ,doc ,@body))) + +(defmacro perf-define-variable-test (name args &optional doc &rest body) + (declare (indent 2) (debug defun)) + (unless (and (consp args) + (= (length args) 1)) + (error "Function %s should accept exactly one argument." name)) + `(progn + (put ',name 'perf-variable-test t) + (defun ,name ,args ,doc ,@body))) + +(defmacro perf-define-test-suite (name &rest tests) + (declare (indent 1)) + `(put ',name 'perf-test-suite + ,(cons 'list tests))) + +(defun perf-constant-test-p (test) + (get test 'perf-constant-test)) + +(defun perf-variable-test-p (test) + (get test 'perf-variable-test)) + +(defun perf-test-suite-p (suite) + (not (null (perf-test-suite-elements suite)))) + +(defun perf-test-suite-elements (suite) + (get suite 'perf-test-suite)) + +(defun perf-expand-suites (test-and-suites) + (apply #' append (mapcar (lambda (elt) + (if (perf-test-suite-p elt) + (perf-test-suite-elements elt) + (list elt))) + test-and-suites))) +(defun perf-test-p (symbol) + (or (perf-variable-test-p symbol) + (perf-constant-test-p symbol))) + +(defun perf-all-tests () + (let (result) + (mapatoms (lambda (symbol) + (when (and (fboundp symbol) + (perf-test-p symbol)) + (push symbol result)))) + (sort result #'string-lessp))) + +(defvar perf-default-test-argument 4096) + +(defun perf-run-1 (&optional k n &rest tests) + "Run TESTS K times using N as argument for non-constant ones. + +Return test-total elapsed time." + (random "") + (when (and n (not (numberp n))) + (push k tests) + (push n tests) + (setq n nil k nil)) + (when (and k (not (numberp k))) + (push k tests) + (setq k nil)) + (let* ((k (or k 1)) + (n (or n perf-default-test-argument)) + (tests (perf-expand-suites (or tests + (perf-all-tests)))) + (variable-tests (seq-filter #'perf-variable-test-p tests)) + (constant-tests (seq-filter #'perf-constant-test-p tests)) + (max-test-string-width (perf-max-symbol-length tests))) + (unless (seq-every-p #'perf-test-p tests) + (error "Some of these are not tests: %s" tests)) + (cl-labels ((format-result (result) + (cond + ((numberp result) (format "%.2f" result)) + ((stringp result) result) + ((null result) "N/A"))) + (format-test (fn) + (concat (symbol-name fn) + (make-string + (+ (- max-test-string-width + (length (symbol-name fn))) + 1) + ?\s))) + (format-summary (results _total) + (let ((min (apply #'min results)) + (max (apply #'max results)) + (avg (/ (apply #'+ results) (float (length results))))) + (format "n=%d min=%.2f avg=%.2f max=%.2f" (length results) min avg max))) + (run-test (fn) + (let ((total 0) results) + (dotimes (_ (max 0 k)) + (garbage-collect) + (princ (concat " " (format-test fn))) + (let ((result (condition-case-unless-debug err + (cond + ((perf-variable-test-p fn) + (random "") (car (funcall fn n))) + ((perf-constant-test-p fn) + (random "") (car (funcall fn))) + (t "skip")) + (error (error-message-string err))))) + (when (numberp result) + (cl-incf total result) + (push result results)) + (princ (format-result result)) + (terpri))) + (when (> (length results) 1) + (princ (concat "#" (format-test fn) + (format-summary results total))) + (terpri))))) + (when variable-tests + (terpri) + (dolist (fn variable-tests) + (run-test fn) + (terpri))) + (when constant-tests + (dolist (fn constant-tests) + (run-test fn) + (terpri)))))) + +(defun perf-run (&optional k n &rest tests) + (interactive + (let* ((n (if current-prefix-arg + (prefix-numeric-value current-prefix-arg) + perf-default-test-argument)) + (tests (mapcar #'intern + (completing-read-multiple + (format "Run tests (n=%d): " n) + (perf-all-tests) nil t nil 'perf-test-history)))) + (cons 1 (cons n tests)))) + (with-current-buffer (get-buffer-create "*perf-results*") + (let ((inhibit-read-only t) + (standard-output (current-buffer))) + (erase-buffer) + (apply #'perf-run-1 k n tests) + (display-buffer (current-buffer))))) + + +(defun perf-batch-parse-command-line (args) + (let ((k 1) + (n perf-default-test-argument) + tests) + (while args + (cond ((string-match-p "\\`-[cn]\\'" (car args)) + (unless (and (cdr args) + (string-match-p "\\`[0-9]+\\'" (cadr args))) + (error "%s expects a natnum argument" (car args))) + (if (equal (car args) "-c") + (setq k (string-to-number (cadr args))) + (setq n (string-to-number (cadr args)))) + (setq args (cddr args))) + (t (push (intern (pop args)) tests)))) + (list k n tests))) + + +(defun perf-run-batch () + "Runs tests from `command-line-args-left' and kill emacs." + (let ((standard-output #'external-debugging-output)) + (condition-case err + (cl-destructuring-bind (k n tests) + (perf-batch-parse-command-line command-line-args-left) + (apply #'perf-run-1 k n tests) + (save-buffers-kill-emacs)) + (error + (princ (error-message-string err)) + (save-buffers-kill-emacs))))) + +(defconst perf-number-of-columns 70) + +(defun perf-insert-lines (n) + "Insert N lines into the current buffer." + (dotimes (i n) + (insert (make-string 70 (if (= (% i 2) 0) + ?. + ?O)) + ?\n))) + +(defun perf-switch-to-buffer-scroll-random (n &optional buffer) + (interactive) + (set-window-buffer nil (or buffer (current-buffer))) + (goto-char (point-min)) + (redisplay t) + (dotimes (_ n) + (goto-char (random (point-max))) + (recenter) + (redisplay t))) + +(defun perf-insert-overlays (n &optional create-callback random-p) + (if random-p + (perf-insert-overlays-random n create-callback) + (perf-insert-overlays-sequential n create-callback))) + +(defun perf-insert-overlays-sequential (n &optional create-callback) + "Insert an overlay every Nth line." + (declare (indent 1)) + (let ((i 0) + (create-callback (or create-callback #'ignore))) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (= 0 (% i n)) + (let ((ov (make-overlay (point-at-bol) (point-at-eol)))) + (funcall create-callback ov) + (overlay-put ov 'priority (random (buffer-size))))) + (cl-incf i) + (forward-line))))) + +(defun perf-insert-overlays-random (n &optional create-callback) + "Insert an overlay every Nth line." + (declare (indent 1)) + (let ((create-callback (or create-callback #'ignore))) + (save-excursion + (while (>= (cl-decf n) 0) + (let* ((beg (1+ (random (point-max)))) + (ov (make-overlay beg (+ beg (random 70))))) + (funcall create-callback ov) + (overlay-put ov 'priority (random (buffer-size)))))))) + +(defun perf-insert-overlays-hierarchical (n &optional create-callback) + (let ((create-callback (or create-callback #'ignore))) + (save-excursion + (goto-char (point-min)) + (let ((spacing (floor (/ (/ (count-lines (point-min) (point-max)) + (float 3)) + n)))) + (when (< spacing 1) + (error "Hierarchical overlay overflow !!")) + (dotimes (i n) + (funcall create-callback + (make-overlay (point) + (save-excursion + (goto-char (point-max)) + (forward-line (- (* spacing i))) + (point)))) + + (when (eobp) + (error "End of buffer in hierarchical overlays")) + (forward-line spacing)))))) + +(defun perf-overlay-ascii-chart (&optional buffer width) + (interactive) + (save-current-buffer + (when buffer (set-buffer buffer)) + (unless width (setq width 100)) + (let* ((ovl (sort (overlays-in (point-min) (point-max)) + (lambda (ov1 ov2) + (or (<= (overlay-start ov1) + (overlay-start ov2)) + (and + (= (overlay-start ov1) + (overlay-start ov2)) + (< (overlay-end ov1) + (overlay-end ov2))))))) + (ov-width (apply #'max (mapcar (lambda (ov) + (- (overlay-end ov) + (overlay-start ov))) + ovl))) + (ov-min (apply #'min (mapcar #'overlay-start ovl))) + (ov-max (apply #'max (mapcar #'overlay-end ovl))) + (scale (/ (float width) (+ ov-min ov-width)))) + (with-current-buffer (get-buffer-create "*overlay-ascii-chart*") + (let ((inhibit-read-only t)) + (erase-buffer) + (buffer-disable-undo) + (insert (format "%06d%s%06d\n" ov-min (make-string (- width 12) ?\s) ov-max)) + (dolist (ov ovl) + (let ((length (round (* scale (- (overlay-end ov) + (overlay-start ov)))))) + (insert (make-string (round (* scale (overlay-start ov))) ?\s)) + (cl-case length + (0 (insert "O")) + (1 (insert "|")) + (t (insert (format "|%s|" (make-string (- length 2) ?-))))) + (insert "\n"))) + (goto-char (point-min))) + (read-only-mode 1) + (pop-to-buffer (current-buffer)))))) + +(defconst perf-overlay-faces (mapcar #'intern (seq-take hi-lock-face-defaults 3))) + +(defun perf-overlay-face-callback (ov) + (overlay-put ov 'face (nth (random (length perf-overlay-faces)) + perf-overlay-faces))) + +(defun perf-overlay-invisible-callback (ov) + (overlay-put ov 'invisble (= 1 (random 2)))) + +(defun perf-overlay-display-callback (ov) + (overlay-put ov 'display (make-string 70 ?*))) + +(defmacro perf-define-display-test (overlay-type property-type scroll-type) + (let ((name (intern (format "perf-display-%s/%s/%s" + overlay-type property-type scroll-type))) + (arg (make-symbol "n"))) + + `(perf-define-variable-test ,name (,arg) + (with-temp-buffer + (perf-insert-lines ,arg) + (overlay-recenter (point-max)) + ,@(perf-define-display-test-1 arg overlay-type property-type scroll-type))))) + +(defun perf-define-display-test-1 (arg overlay-type property-type scroll-type) + (list (append (cl-case overlay-type + (sequential + (list 'perf-insert-overlays-sequential 2)) + (hierarchical + `(perf-insert-overlays-hierarchical (/ ,arg 10))) + (random + `(perf-insert-overlays-random (/ ,arg 2))) + (t (error "Invalid insert type: %s" overlay-type))) + (list + (cl-case property-type + (display '#'perf-overlay-display-callback) + (face '#'perf-overlay-face-callback) + (invisible '#'perf-overlay-invisible-callback) + (t (error "Invalid overlay type: %s" overlay-type))))) + (list 'benchmark-run 1 + (cl-case scroll-type + (scroll '(perf-switch-to-buffer-scroll-up-and-down)) + (random `(perf-switch-to-buffer-scroll-random (/ ,arg 50))) + (t (error "Invalid scroll type: %s" overlay-type)))))) + +(defun perf-max-symbol-length (symbols) + "Return the longest symbol in SYMBOLS, or -1 if symbols is nil." + (if (null symbols) + -1 + (apply #'max (mapcar + (lambda (elt) + (length (symbol-name elt))) + symbols)))) + +(defun perf-insert-text (n) + "Insert N character into the current buffer." + (let ((ncols 68) + (char ?.)) + (dotimes (_ (/ n ncols)) + (insert (make-string (1- ncols) char) ?\n)) + (when (> (% n ncols) 0) + (insert (make-string (1- (% n ncols)) char) ?\n)))) + +(defconst perf-insert-overlays-default-length 24) + +(defun perf-insert-overlays-scattered (n &optional length) + "Insert N overlays of max length 24 randomly." + (dotimes (_ n) + (let ((begin (random (1+ (point-max))))) + (make-overlay + begin (+ begin (random (1+ (or length perf-insert-overlays-default-length 0)))))))) + +(defvar perf-marker-gc-protection nil) + +(defun perf-insert-marker-scattered (n) + "Insert N marker randomly." + (setq perf-marker-gc-protection nil) + (dotimes (_ n) + (push (copy-marker (random (1+ (point-max)))) + perf-marker-gc-protection))) + +(defun perf-switch-to-buffer-scroll-up-and-down (&optional buffer) + (interactive) + (set-window-buffer nil (or buffer (current-buffer))) + (goto-char (point-min)) + (redisplay t) + (while (condition-case nil + (progn (scroll-up) t) + (end-of-buffer nil)) + (redisplay t)) + (while (condition-case nil + (progn (scroll-down) t) + (beginning-of-buffer nil)) + (redisplay t))) + +(defun perf-emacs-lisp-setup () + (add-to-list 'imenu-generic-expression + '(nil "^\\s-*(perf-define\\(?:\\w\\|\\s_\\)*\\s-*\\(\\(?:\\w\\|\\s_\\)+\\)" 1))) + +(add-hook 'emacs-lisp-mode 'perf-emacs-lisp-setup) + + +;; +===================================================================================+ +;; | Basic performance tests +;; +===================================================================================+ + +(perf-define-variable-test perf-make-overlay (n) + (with-temp-buffer + (overlay-recenter (point-min)) + (benchmark-run 1 + (dotimes (_ n) + (make-overlay 1 1))))) + +(perf-define-variable-test perf-make-overlay-continuous (n) + (with-temp-buffer + (perf-insert-text n) + (overlay-recenter (point-max)) + (benchmark-run 1 + (dotimes (i n) + (make-overlay i (1+ i)))))) + +(perf-define-variable-test perf-make-overlay-scatter (n) + (with-temp-buffer + (perf-insert-text n) + (benchmark-run 1 + (perf-insert-overlays-scattered n)))) + +(perf-define-variable-test perf-delete-overlay (n) + (with-temp-buffer + (let ((ovls (cl-loop for i from 1 to n + collect (make-overlay 1 1)))) + (overlay-recenter (point-min)) + (benchmark-run 1 + (mapc #'delete-overlay ovls))))) + +(perf-define-variable-test perf-delete-overlay-continuous (n) + (with-temp-buffer + (perf-insert-text n) + (let ((ovls (cl-loop for i from 1 to n + collect (make-overlay i (1+ i))))) + (overlay-recenter (point-min)) + (benchmark-run 1 + (mapc #'delete-overlay ovls))))) + +(perf-define-variable-test perf-delete-overlay-scatter (n) + (with-temp-buffer + (perf-insert-text n) + (let ((ovls (progn (perf-insert-overlays-scattered n) + (overlays-in (point-min) (point-max))))) + (benchmark-run 1 + (mapc #'delete-overlay ovls))))) + +(perf-define-variable-test perf-overlays-at (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (benchmark-run 1 + (dotimes (i (point-max)) + (overlays-at i))))) + +(perf-define-variable-test perf-overlays-in (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (let ((len perf-insert-overlays-default-length)) + (benchmark-run 1 + (dotimes (i (- (point-max) len)) + (overlays-in i (+ i len))))))) + +(perf-define-variable-test perf-insert-before (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char 1) + (overlay-recenter (point-min)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (insert ?X))))) + +(perf-define-variable-test perf-insert-before-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-insert-before n))) +(perf-define-variable-test perf-insert-after-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-insert-after n))) +(perf-define-variable-test perf-insert-scatter-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-insert-scatter n))) +(perf-define-variable-test perf-delete-before-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-delete-before n))) +(perf-define-variable-test perf-delete-after-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-delete-after n))) +(perf-define-variable-test perf-delete-scatter-empty (n) + (let ((perf-insert-overlays-default-length 0)) + (perf-delete-scatter n))) + +(defmacro perf-define-marker-test (type where) + (let ((name (intern (format "perf-%s-%s-marker" type where)))) + `(perf-define-variable-test ,name (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-marker-scattered n) + (goto-char ,(cl-case where + (after (list 'point-max)) + (t (list 'point-min)))) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + ,@(when (eq where 'scatter) + (list '(goto-char (max 1 (random (point-max)))))) + ,(cl-case type + (insert (list 'insert ?X)) + (delete (list 'delete-char (if (eq where 'after) -1 1)))))))))) + +(perf-define-test-suite perf-marker-suite + (perf-define-marker-test insert before) + (perf-define-marker-test insert after) + (perf-define-marker-test insert scatter) + (perf-define-marker-test delete before) + (perf-define-marker-test delete after) + (perf-define-marker-test delete scatter)) + +(perf-define-variable-test perf-insert-after (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char (point-max)) + (overlay-recenter (point-max)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (insert ?X))))) + +(perf-define-variable-test perf-insert-scatter (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char (point-max)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (goto-char (1+ (random (point-max)))) + (insert ?X))))) + +(perf-define-variable-test perf-delete-before (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char 1) + (overlay-recenter (point-min)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (delete-char 1))))) + +(perf-define-variable-test perf-delete-after (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char (point-max)) + (overlay-recenter (point-max)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (delete-char -1))))) + +(perf-define-variable-test perf-delete-scatter (n) + (with-temp-buffer + (perf-insert-text n) + (perf-insert-overlays-scattered n) + (goto-char (point-max)) + (benchmark-run 1 + (dotimes (_ (/ n 2)) + (goto-char (max 1 (random (point-max)))) + (delete-char 1))))) + +(perf-define-test-suite perf-insert-delete-suite + 'perf-insert-before + 'perf-insert-after + 'perf-insert-scatter + 'perf-delete-before + 'perf-delete-after + 'perf-delete-scatter + ) + + +;; +===================================================================================+ +;; | Redisplay (new) +;; +===================================================================================+ + +;; 5000 +;; 25000 +;; 75000 + +;; Number of Overlays = N / 2 +;; +;; (except for the hierarchical case, where it is divided by 10.) + + ;; . scrolling through a buffer with lots of overlays that affect faces + ;; of characters in the buffer text + ;; . scrolling through a buffer with lots of overlays that define + ;; 'display' properties which are strings + ;; . scrolling through a buffer with lots of overlays that define + ;; 'invisible' properties + +(perf-define-test-suite perf-display-suite + (perf-define-display-test sequential display scroll) + (perf-define-display-test sequential display random) + (perf-define-display-test sequential face scroll) + (perf-define-display-test sequential face random) + (perf-define-display-test sequential invisible scroll) + (perf-define-display-test sequential invisible random) + (perf-define-display-test random display scroll) + (perf-define-display-test random display random) + (perf-define-display-test random face scroll) + (perf-define-display-test random face random) + (perf-define-display-test random invisible scroll) + (perf-define-display-test random invisible random)) + +;; |------------| +;; |--------| +;; |----| +(perf-define-display-test hierarchical face scroll) + + + + +;; +===================================================================================+ +;; | Real World +;; +===================================================================================+ + +(require 'python) + +(defconst perf-many-errors-file + (expand-file-name "many-errors.py" + (and load-file-name (file-name-directory load-file-name)))) + +(perf-define-constant-test perf-realworld-flycheck + (interactive) + (package-initialize) + (when (and (require 'flycheck nil t) + (file-exists-p perf-many-errors-file) + (or (executable-find "pylint") + (executable-find "flake8"))) + (setq flycheck-python-pylint-executable + (executable-find "pylint")) + (setq flycheck-python-flake8-executable + (executable-find "flake8")) + (setq python-indent-guess-indent-offset-verbose nil) + (setq flycheck-check-syntax-automatically nil) + (setq flycheck-checker-error-threshold nil) + (setq flycheck-display-errors-function nil) + (with-current-buffer (find-file-noselect perf-many-errors-file) + (let* ((done) + (flycheck-after-syntax-check-hook + (list (lambda () (setq done t))))) + (flycheck-mode 1) + (flycheck-buffer) + (benchmark-run 1 + (while (not done) + (accept-process-output)) + (perf-switch-to-buffer-scroll-up-and-down) + (flycheck-mode -1)))))) + +;; https://lists.gnu.org/archive/html/emacs-devel/2009-04/msg00242.html +(defun make-lines-invisible (regexp &optional arg) + "Make all lines matching a regexp invisible and intangible. +With a prefix arg, make it visible again. It is not necessary +that REGEXP matches the whole line; if a hit is found, the +affected line gets automatically selected. + +This command affects the whole buffer." + (interactive "MRegexp: \nP") + (let (ov + ovs + count) + (cond + ((equal arg '(4)) + (setq ovs (overlays-in (point-min) (point-max))) + (mapc (lambda (o) + (if (overlay-get o 'make-lines-invisible) + (delete-overlay o))) + ovs)) + (t + (save-excursion + (goto-char (point-min)) + (setq count 0) + (while (re-search-forward regexp nil t) + (setq count (1+ count)) + (if (= (% count 100) 0) + (message "%d" count)) + (setq ov (make-overlay (line-beginning-position) + (1+ (line-end-position)))) + (overlay-put ov 'make-lines-invisible t) + (overlay-put ov 'invisible t) + (overlay-put ov 'intangible t) + (goto-char (line-end-position)))))))) + +(perf-define-constant-test perf-realworld-make-lines-invisible + (with-temp-buffer + (insert-file-contents "/usr/share/dict/words") + (set-window-buffer nil (current-buffer)) + (redisplay t) + (overlay-recenter (point-max)) + (benchmark-run 1 + (make-lines-invisible "a")))) + +(perf-define-constant-test perf-realworld-line-numbering + (interactive) + (with-temp-buffer + (insert-file-contents "/usr/share/dict/words") + (overlay-recenter (point-max)) + (goto-char (point-min)) + (let* ((nlines (count-lines (point-min) (point-max))) + (line 1) + (width 0)) + (dotimes (i nlines) ;;-with-progress-reporter "Creating overlays" + (let ((ov (make-overlay (point) (point))) + (str (propertize (format "%04d" line) 'face 'shadow))) + (overlay-put ov 'before-string + (propertize " " 'display `((margin left-margin) ,str))) + (setq width (max width (length str))) + (cl-incf line) + (forward-line))) + (benchmark-run 1 + (let ((left-margin-width width)) + (perf-switch-to-buffer-scroll-up-and-down)))))) + +(perf-define-test-suite perf-realworld-suite + 'perf-realworld-flycheck + 'perf-realworld-make-lines-invisible + 'perf-realworld-line-numbering) + + +;; +===================================================================================+ +;; | next-overlay-change +;; +===================================================================================+ + +(perf-define-variable-test perf-noc-hierarchical/forward/linear (n) + "Search linear for the next change on every line." + (with-temp-buffer + (perf-insert-lines (* 3 n)) + (perf-insert-overlays-hierarchical n) + (goto-char (point-min)) + (benchmark-run 1 + (while (not (eobp)) + (next-overlay-change (point)) + (forward-line))))) + +(perf-define-variable-test perf-noc-sequential/forward/linear (n) + "Search linear for the next change on every line." + (with-temp-buffer + (perf-insert-lines (* 3 n)) + (perf-insert-overlays-sequential n) + (goto-char (point-min)) + (benchmark-run 1 + (while (not (eobp)) + (next-overlay-change (point)) + (forward-line))))) + +(perf-define-variable-test perf-noc-hierarchical/forward/backnforth (n) + "Search back and forth for the next change from `point-min' to `point-max'." + (with-temp-buffer + (perf-insert-lines (* 3 n)) + (overlay-recenter (point-max)) + (perf-insert-overlays-hierarchical n) + (goto-char (point-min)) + (benchmark-run 1 + (while (not (eobp)) + (next-overlay-change (point)) + (next-overlay-change (+ (point) 2)) + (forward-char))))) + +(perf-define-test-suite perf-noc-suite + 'perf-noc-hierarchical/forward/linear + 'perf-noc-hierarchical/forward/backnforth + 'perf-noc-hierarchical/forward/backnforth) diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 558d05de14a..0e6d717cbb0 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) +(require 'seq) (require 'ert-x) (require 'cl-lib) (require 'let-alist) @@ -41,7 +42,6 @@ recorded calls conveniently." overlay hooks-property (list (lambda (ov &rest args) - (message " %S called on %S with args %S" hooks-property ov args) (should inhibit-modification-hooks) (should (eq ov overlay)) (push (list hooks-property args) @@ -174,47 +174,41 @@ properties." (t 1 2 0)) (insert-behind-hooks (t 1 2 0))))))) - (message "BEGIN overlay-modification-hooks test-case %S" test-case) - - ;; All three hooks ignore the overlay's `front-advance' and - ;; `rear-advance' option, so test both ways while expecting the same - ;; result. - (dolist (advance '(nil t)) - (message " advance is %S" advance) - (let-alist test-case - (with-temp-buffer - ;; Set up the temporary buffer and overlay as specified by - ;; the test case. - (insert (or .buffer-text "1234")) - (let ((overlay (make-overlay - (or .overlay-beg 2) - (or .overlay-end 4) - nil - advance advance))) - (message " (buffer-string) is %S" (buffer-string)) - (message " overlay is %S" overlay) - (overlay-tests-start-recording-modification-hooks overlay) - - ;; Modify the buffer, possibly inducing calls to the - ;; overlay's modification hooks. - (should (or .insert-at .replace)) - (when .insert-at - (goto-char .insert-at) - (insert "x") - (message " inserted \"x\" at %S, buffer-string now %S" - .insert-at (buffer-string))) - (when .replace - (goto-char (point-min)) - (search-forward .replace) - (replace-match "x") - (message " replaced %S with \"x\"" .replace)) - - ;; Verify that the expected and actual modification hook - ;; calls match. - (should (equal - .expected-calls - (overlay-tests-get-recorded-modification-hooks - overlay))))))))) + (ert-info ((format "test-case: %S" test-case)) + ;; All three hooks ignore the overlay's `front-advance' and + ;; `rear-advance' option, so test both ways while expecting the same + ;; result. + (dolist (advance '(nil t)) + (ert-info ((format "advance is %S" advance)) + (let-alist test-case + (with-temp-buffer + ;; Set up the temporary buffer and overlay as specified by + ;; the test case. + (insert (or .buffer-text "1234")) + (let ((overlay (make-overlay + (or .overlay-beg 2) + (or .overlay-end 4) + nil + advance advance))) + (overlay-tests-start-recording-modification-hooks overlay) + + ;; Modify the buffer, possibly inducing calls to the + ;; overlay's modification hooks. + (should (or .insert-at .replace)) + (when .insert-at + (goto-char .insert-at) + (insert "x")) + (when .replace + (goto-char (point-min)) + (search-forward .replace) + (replace-match "x")) + + ;; Verify that the expected and actual modification hook + ;; calls match. + (should (equal + .expected-calls + (overlay-tests-get-recorded-modification-hooks + overlay))))))))))) (ert-deftest overlay-modification-hooks-message-other-buf () "Test for bug#21824. @@ -274,6 +268,62 @@ with parameters from the *Messages* buffer modification." (with-temp-buffer (should (eq (buffer-base-buffer (current-buffer)) nil)))) +(ert-deftest buffer-tests--overlays-indirect-bug58928 () + (with-temp-buffer + (insert "hello world") + (let* ((base (current-buffer)) + (ol1 (make-overlay (+ 2 (point-min)) (+ 8 (point-min)))) + (ib (make-indirect-buffer + base (generate-new-buffer-name "bug58928"))) + (ol2 (with-current-buffer ib + (make-overlay (+ 2 (point-min)) (+ 8 (point-min)))))) + (should (equal (overlay-start ol1) (overlay-start ol2))) + (should (equal (overlay-end ol1) (overlay-end ol2))) + (goto-char (+ 3 (point-min))) + (insert "a") (delete-char 2) + (should (equal (overlay-start ol1) (overlay-start ol2))) + (should (equal (overlay-end ol1) (overlay-end ol2))) + (with-current-buffer ib + (goto-char (+ 4 (point-min))) + (insert "a") (delete-char 2)) + (should (equal (overlay-start ol1) (overlay-start ol2))) + (should (equal (overlay-end ol1) (overlay-end ol2)))))) + +(ert-deftest buffer-tests--overlays-indirect-evaporate () + "Verify that deleting text evaporates overlays in every related buffer. + +Deleting characters from either a base or an indirect buffer +should evaporate overlays in both." + ;; Loop twice, erasing from the base buffer the first time and the + ;; indirect buffer the second. + (dolist (erase-where '(base indirect)) + (ert-info ((format "erase-where %S" erase-where)) + (with-temp-buffer + (insert "xxx") + (let* ((beg 2) + (end 3) + (base (current-buffer)) + (base-overlay (make-overlay beg end base)) + (indirect (make-indirect-buffer + base + (generate-new-buffer-name + (concat (buffer-name base) "-indirect")))) + (indirect-overlay (make-overlay beg end indirect))) + (overlay-put base-overlay 'evaporate t) + (overlay-put indirect-overlay 'evaporate t) + (with-current-buffer (pcase-exhaustive erase-where + (`base base) + (`indirect indirect)) + (delete-region beg end)) + (ert-info ((prin1-to-string + `(,base ,base-overlay ,indirect ,indirect-overlay))) + (should (not (buffer-live-p (overlay-buffer base-overlay)))) + (should (not (buffer-live-p (overlay-buffer indirect-overlay)))) + (should (equal nil (with-current-buffer base + (overlays-in (point-min) (point-max))))) + (should (equal nil (with-current-buffer indirect + (overlays-in (point-min) (point-max))))))))))) + (ert-deftest overlay-evaporation-after-killed-buffer () (let* ((ols (with-temp-buffer (insert "toto") @@ -859,6 +909,33 @@ with parameters from the *Messages* buffer modification." (should-length 1 (overlays-at 15)) (should-length 1 (overlays-at (point-max)))))) +(defun sorted-overlays (overlays) + (sort + (mapcar (lambda (overlay) + (list (overlay-start overlay) + (overlay-end overlay))) + overlays) + (lambda (first second) + (cl-loop for a in first + for b in second + thereis (< a b) + until (> a b))))) + +(defun sorted-overlays-at (pos) + (sorted-overlays (overlays-at pos))) + +(defun sorted-overlays-in (beg end) + (sorted-overlays (overlays-in beg end))) + +(ert-deftest test-overlays-at-narrow-to-region-end () + ;; See bug#58703. + (with-temp-buffer + (insert (make-string 30 ?x)) + (make-overlay 10 11) + (narrow-to-region 10 10) + (should (equal + '((10 11)) + (sorted-overlays-at 10))))) ;; +==========================================================================+ ;; | overlay-in @@ -936,6 +1013,39 @@ with parameters from the *Messages* buffer modification." (deftest-overlays-in-1 ae 9 11 (a) (a 10 10)) (deftest-overlays-in-1 af 10 11 (a) (a 10 10)) +;; behavior for empty range +(ert-deftest test-overlays-in-empty-range () + (with-temp-buffer + (insert (make-string 4 ?x)) + (cl-loop for start from (point-min) to (point-max) + do (cl-loop for end from start to (point-max) + do (when (<= start end) + (make-overlay start end)))) + + (cl-loop for pos from (point-min) to (point-max) + do (ert-info ((format "after (overlay-recenter %d)" pos)) + (overlay-recenter pos) + (should (equal + '((1 1)) + (sorted-overlays-in (point-min) (point-min)))) + (should (equal + '((1 3) (1 4) (1 5) (2 2)) + (sorted-overlays-in 2 2))) + (should (equal + '((1 4) (1 5) (2 4) (2 5) (3 3)) + (sorted-overlays-in 3 3))) + (should (equal + '((1 5) (2 5) (3 5) (4 4)) + (sorted-overlays-in 4 4))) + (should (equal + '((5 5)) + (sorted-overlays-in (point-max) (point-max)))))))) + +(ert-deftest test-overlays-in-empty-range-bug58672 () + (with-temp-buffer + (insert (make-string 10 ?=)) + (make-overlay 5 7 nil nil t) + (should (equal nil (overlays-in 5 5))))) ;; behavior at point-max (ert-deftest test-overlays-in-2 () @@ -1048,6 +1158,49 @@ with parameters from the *Messages* buffer modification." ;; +==========================================================================+ +;; | get-pos-property +;; +==========================================================================+ + +(ert-deftest get-pos-property-overlay-beg () + "Test `get-pos-property' at the beginning of an overlay. +Regression test for bug#58706." + (with-temp-buffer + (insert (make-string 10000 ?x)) + (let ((overlay (make-overlay 9999 10001))) + (overlay-put overlay 'forty-two 42)) + (should (equal 42 (get-pos-property 9999 'forty-two))))) + +(ert-deftest get-pos-property-overlay-empty-rear-advance () + "Test `get-pos-property' at the end of an empty rear-advance overlay. +Regression test for bug#58706." + (with-temp-buffer + (insert (make-string 10000 ?x)) + (let ((overlay (make-overlay 9999 9999 nil nil t))) + (overlay-put overlay 'forty-two 42)) + (should (equal 42 (get-pos-property 9999 'forty-two))))) + +(ert-deftest get-pos-property-overlay-past-rear-advance () + "Test `get-pos-property' past the end of an empty rear-advance overlay. +Regression test for bug#58706." + (with-temp-buffer + (insert (make-string 10000 ?x)) + (let ((overlay (make-overlay 9998 9998 nil nil t))) + (overlay-put overlay 'forty-two 42)) + (should (equal nil (get-pos-property 9999 'forty-two))))) + +(ert-deftest get-pos-property-overlay-at-narrowed-end () + "Test `get-pos-property' at the end of a narrowed region. +Regression test for bug#58706." + (with-temp-buffer + (insert (make-string 11000 ?x)) + (narrow-to-region 9998 10000) + (let ((overlay (make-overlay 10000 10000 nil t nil))) + (overlay-put overlay 'forty-two 42)) + (should (equal nil (get-pos-property 9999 'forty-two))))) + +;; FIXME: add more `get-pos-property' tests + +;; +==========================================================================+ ;; | get-char-property(-and-overlay) ;; +==========================================================================+ @@ -1168,7 +1321,51 @@ with parameters from the *Messages* buffer modification." (delete-overlay left) (should (= 2 (length (overlays-in 1 (point-max)))))))) +;; +==========================================================================+ +;; | Moving overlays with insert-before-markers +;; +==========================================================================+ +(ert-deftest test-overlay-insert-before-markers-at-start () + "`insert-before-markers' always advances an overlay's start. +Test both front-advance and non-front-advance overlays." + (dolist (front-advance '(nil t)) + (ert-info ((format "front-advance %S" front-advance)) + (with-temp-buffer + (insert "1234") + (let* ((beg (1+ (point-min))) + (end (1+ beg)) + (overlay (make-overlay beg end nil front-advance nil))) + (goto-char beg) + (insert-before-markers "x") + (should (equal (1+ beg) (overlay-start overlay))) + (should (equal (1+ end) (overlay-end overlay)))))))) + +(ert-deftest test-overlay-insert-before-markers-at-end () + "`insert-before-markers' always advances an overlay's end. +Test both rear-advance and non-rear-advance overlays." + (dolist (rear-advance '(nil t)) + (ert-info ((format "rear-advance %S" rear-advance)) + (with-temp-buffer + (insert "1234") + (let* ((beg (1+ (point-min))) + (end (1+ beg)) + (overlay (make-overlay beg end nil nil rear-advance))) + (goto-char end) + (insert-before-markers "x") + (should (equal beg (overlay-start overlay))) + (should (equal (1+ end) (overlay-end overlay)))))))) + +(ert-deftest test-overlay-insert-before-markers-empty () + (dolist (advance-args '((nil nil) (t nil) (nil t) (t t))) + (ert-info ((format "advance args %S" advance-args)) + (with-temp-buffer + (insert "1234") + (let* ((pos (1+ (point-min))) + (overlay (apply #'make-overlay pos pos nil advance-args))) + (goto-char pos) + (insert-before-markers "x") + (should (equal (1+ pos) (overlay-start overlay))) + (should (equal (1+ pos) (overlay-end overlay)))))))) ;; +==========================================================================+ ;; | Moving by deletions @@ -1339,6 +1536,14 @@ with parameters from the *Messages* buffer modification." (overlay-put ov 'value i))) (should (eq 9 (get-char-property 1 'value))))) +(ert-deftest buffer-tests--overlay-bug58479 () + (with-temp-buffer + (insert "ab") + (let* ((pos (+ (point-min) 1)) + (ol (make-overlay pos pos))) + (overlay-put ol 'my-prop 'set) + (should (null (get-char-property pos 'my-prop)))))) + ;; +==========================================================================+ ;; | Other @@ -1507,6 +1712,6559 @@ with parameters from the *Messages* buffer modification." (ovshould nonempty-eob-end 4 5) (ovshould empty-eob 5 5))))) +(ert-deftest test-overlay-randomly () + "Exercise overlay code, but perform few assertions. + +This test works best when Emacs is configured with +--enable-checking=yes. This is a little bit like fuzz testing, +except this test has no way to reduce to a minimal failing test +case. Regardless, by exercising many corner cases bugs can be +found using Emacs' internal consistency assertions." + (let* ( + ;; The size and slack for the test buffer size. + (buffer-size-target 1000) + (buffer-size-slack 200) + + ;; Use up to 100 overlays. We need not use more to observe + ;; reasonable variation in the overlay data structures. + (overlay-count-limit 100) + + ;; This test maintains a vector of overlays. Each iteration + ;; may append or erase one overlay. + (overlays (make-vector overlay-count-limit nil)) + (overlay-count 0) + + ;; The test is either slowly growing or shrinking the overlay + ;; count. Deletions still occur while growing, and additions + ;; still occur while shrinking. The GROWING variable only + ;; controls the relative probability of doing one or the + ;; other. + (growing t) + + ;; Loop up to 1M times. + (iteration-count 0) + (iteration-target 100000)) + (with-temp-buffer + (while (< (buffer-size) buffer-size-target) + (insert "Sed ut perspiciatis, unde omnis iste natus error sit voluptatem +accusantium doloremque laudantium, totam rem aperiam eaque ipsa, +quae ab illo inventore veritatis et quasi architecto beatae vitae +dicta sunt, explicabo. ")) + + (while (< iteration-count iteration-target) + (cl-incf iteration-count) + + ;; Toggle GROWING if we've reached a size boundary. The idea + ;; is to initially steadily increase the overlay count, then + ;; steadily decrease it, then repeat. + (when (and growing (= overlay-count overlay-count-limit)) + (setq growing nil)) + (when (and (not growing) (= overlay-count 0)) + (setq growing t)) + + ;; Create or delete a random overlay according to a + ;; probability chosen by GROWING. + (let ((create-overlay (>= (random 100) (if growing 40 60)))) + (cond + ;; Possibly create a new overlay in a random place in the + ;; buffer. We have two easy choices. We can choose the + ;; overlay BEGIN randomly, then choose its END among the + ;; valid remaining buffer posiitions. Or we could choose + ;; the overlay width randomly, then choose a valid BEGIN. + ;; We take the former approach, because the overlay data + ;; structure is ordered primarily by BEGIN. + ((and create-overlay (< overlay-count overlay-count-limit)) + (let* ((begin (random (buffer-size))) + (end (+ begin (random (- (buffer-size) begin)))) + (ov (make-overlay begin end nil + (= 0 (random 2)) (= 0 (random 2))))) + (aset overlays overlay-count ov) + (cl-incf overlay-count))) + ((and (not create-overlay) (> overlay-count 0)) + + ;; Possibly delete a random overlay. + (let* ((last-index (1- overlay-count)) + (index (random overlay-count)) + (ov (aref overlays index))) + (when (< index last-index) + (aset overlays index (aref overlays last-index))) + (aset overlays last-index nil) + (cl-decf overlay-count) + (delete-overlay ov))))) + + ;; Modify the buffer on occasion, which exercises the + ;; insert/remove gap logic in the overlay implementation. + (when (and (< (buffer-size) (+ buffer-size-target buffer-size-slack)) + (zerop (random 10))) + (goto-char (1+ (random (buffer-size)))) + (insert (+ ?a (random 26)))) + (when (and (> (buffer-size) (- buffer-size-target buffer-size-slack)) + (zerop (random 10))) + (goto-char (1+ (random (buffer-size)))) + (delete-char 1)))))) + + + +;; +===================================================================================+ +;; | Autogenerated insert/delete/narrow tests +;; +===================================================================================+ + +(when nil ;; Let's comment these out for now. + +;; (defun test-overlay-generate-test (name) +;; (interactive) +;; (with-temp-buffer +;; (let ((forms nil) +;; (buffer-size 64) +;; (noverlays 16) +;; (nforms 32) +;; (dist '(0.5 0.4 0.1))) +;; (cl-labels ((brand () +;; (+ (point-min) +;; (random (1+ (- (point-max) (point-min))))))) +;; (cl-macrolet ((push-eval (form) +;; `(cl-destructuring-bind (&rest args) +;; (list ,@(cdr form)) +;; (push (cons ',(car form) args) forms) +;; (apply #',(car form) args)))) +;; (push-eval (insert (make-string buffer-size ?.))) +;; (dotimes (_ noverlays) +;; (push-eval (make-overlay (brand) (brand) +;; nil +;; (= 0 (random 2)) +;; (= 0 (random 2))))) +;; (dotimes (_ nforms) +;; (push-eval (goto-char (brand))) +;; (pcase (/ (random 100) 100.0) +;; ((and x (guard (< x (nth 0 dist)))) +;; (push-eval (insert (make-string (random 16) ?.)))) +;; ((and x (guard (< x (+ (nth 0 dist) (nth 1 dist))))) +;; (push-eval (delete-char (random (1+ (- (point-max) (point))))))) +;; (_ +;; (push-eval (widen)) +;; (push-eval (narrow-to-region (brand) (brand)))))) +;; `(ert-deftest ,name () +;; (with-temp-buffer +;; ,@(nreverse forms) +;; (should (equal (test-overlay-regions) +;; ',(test-overlay-regions)))))))))) + +;; (defun test-overlay-generate-tests (n) +;; (let ((namefmt "overlay-autogenerated-test-%d") +;; (standard-output (current-buffer)) +;; (print-length nil) +;; (print-level nil) +;; (print-quoted t)) +;; (dotimes (i n) +;; (pp (test-overlay-generate-test (intern (format namefmt i)))) +;; (terpri)))) + +;; (progn (random "4711") (test-overlay-generate-tests 64)) + +(ert-deftest overlay-autogenerated-test-0 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 63 7 nil t t) + (make-overlay 47 9 nil nil nil) + (make-overlay 50 43 nil nil nil) + (make-overlay 20 53 nil nil t) + (make-overlay 62 4 nil nil t) + (make-overlay 40 27 nil t t) + (make-overlay 58 44 nil t t) + (make-overlay 46 38 nil nil nil) + (make-overlay 51 28 nil t nil) + (make-overlay 12 53 nil t t) + (make-overlay 52 60 nil nil nil) + (make-overlay 13 47 nil nil nil) + (make-overlay 16 31 nil nil nil) + (make-overlay 9 48 nil t t) + (make-overlay 43 29 nil nil t) + (make-overlay 48 13 nil t nil) + (goto-char 44) + (delete-char 15) + (goto-char 19) + (widen) + (narrow-to-region 20 8) + (goto-char 9) + (delete-char 3) + (goto-char 16) + (insert "..............") + (goto-char 12) + (delete-char 15) + (goto-char 12) + (delete-char 4) + (goto-char 12) + (delete-char 0) + (goto-char 12) + (insert "......") + (goto-char 13) + (delete-char 5) + (goto-char 8) + (insert "...") + (goto-char 10) + (insert ".............") + (goto-char 14) + (insert ".......") + (goto-char 25) + (delete-char 4) + (goto-char 26) + (insert "...............") + (goto-char 27) + (insert "...") + (goto-char 29) + (delete-char 7) + (goto-char 24) + (insert "...") + (goto-char 30) + (insert "..........") + (goto-char 29) + (widen) + (narrow-to-region 34 41) + (goto-char 40) + (delete-char 0) + (goto-char 35) + (delete-char 4) + (goto-char 36) + (widen) + (narrow-to-region 80 66) + (goto-char 74) + (delete-char 5) + (goto-char 69) + (delete-char 5) + (goto-char 70) + (widen) + (narrow-to-region 50 71) + (goto-char 66) + (insert "...............") + (goto-char 54) + (insert "...............") + (goto-char 84) + (insert "....") + (goto-char 72) + (insert "...........") + (goto-char 84) + (insert "..........") + (goto-char 102) + (insert "") + (goto-char 80) + (delete-char 25) + (should + (equal + (test-overlay-regions) + '((4 . 99) + (7 . 100) + (48 . 99) + (48 . 99) + (48 . 99) + (49 . 99) + (49 . 99) + (51 . 80) + (51 . 99) + (80 . 99) + (80 . 99) + (80 . 99) + (99 . 99) + (99 . 99) + (99 . 99) + (99 . 99)))))) + +(ert-deftest overlay-autogenerated-test-1 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 17 27 nil nil nil) + (make-overlay 13 28 nil nil t) + (make-overlay 8 56 nil nil nil) + (make-overlay 34 64 nil nil nil) + (make-overlay 51 4 nil t t) + (make-overlay 1 19 nil nil nil) + (make-overlay 53 59 nil nil t) + (make-overlay 25 13 nil nil nil) + (make-overlay 19 28 nil t nil) + (make-overlay 33 23 nil t nil) + (make-overlay 10 46 nil t t) + (make-overlay 18 39 nil nil nil) + (make-overlay 1 49 nil t nil) + (make-overlay 57 21 nil t t) + (make-overlay 10 58 nil t t) + (make-overlay 39 49 nil nil t) + (goto-char 37) + (delete-char 9) + (goto-char 3) + (insert "......") + (goto-char 38) + (delete-char 14) + (goto-char 18) + (insert "..........") + (goto-char 53) + (insert "....") + (goto-char 49) + (delete-char 10) + (goto-char 11) + (delete-char 12) + (goto-char 17) + (delete-char 22) + (goto-char 8) + (insert ".") + (goto-char 16) + (insert "........") + (goto-char 16) + (delete-char 5) + (goto-char 11) + (delete-char 0) + (goto-char 22) + (insert ".......") + (goto-char 18) + (delete-char 11) + (goto-char 16) + (delete-char 0) + (goto-char 9) + (insert "...........") + (goto-char 7) + (insert "...............") + (goto-char 2) + (insert ".......") + (goto-char 21) + (delete-char 11) + (goto-char 13) + (insert "..............") + (goto-char 17) + (delete-char 3) + (goto-char 21) + (insert "......") + (goto-char 15) + (delete-char 32) + (goto-char 10) + (insert "........") + (goto-char 25) + (widen) + (narrow-to-region 15 20) + (goto-char 17) + (insert ".............") + (goto-char 22) + (insert "............") + (goto-char 21) + (delete-char 8) + (goto-char 36) + (delete-char 1) + (goto-char 32) + (delete-char 2) + (goto-char 21) + (insert ".....") + (goto-char 31) + (insert "......") + (should + (equal + (test-overlay-regions) + '((1 . 58) + (1 . 58)))))) + +(ert-deftest overlay-autogenerated-test-2 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 15 59 nil t t) + (make-overlay 56 16 nil nil nil) + (make-overlay 65 51 nil t nil) + (make-overlay 14 24 nil t nil) + (make-overlay 28 9 nil t nil) + (make-overlay 58 50 nil t t) + (make-overlay 13 32 nil t t) + (make-overlay 12 21 nil t nil) + (make-overlay 60 23 nil t nil) + (make-overlay 39 38 nil nil t) + (make-overlay 15 64 nil t nil) + (make-overlay 17 21 nil nil t) + (make-overlay 46 23 nil t t) + (make-overlay 19 40 nil t nil) + (make-overlay 13 48 nil nil t) + (make-overlay 35 11 nil t nil) + (goto-char 41) + (delete-char 19) + (goto-char 45) + (insert "......") + (goto-char 3) + (delete-char 32) + (goto-char 19) + (insert "") + (goto-char 16) + (insert "...............") + (goto-char 2) + (insert "") + (goto-char 30) + (delete-char 0) + (goto-char 18) + (delete-char 17) + (goto-char 2) + (insert "...............") + (goto-char 12) + (insert "...") + (goto-char 2) + (insert ".............") + (goto-char 16) + (insert ".......") + (goto-char 15) + (insert ".......") + (goto-char 43) + (insert "......") + (goto-char 22) + (insert ".........") + (goto-char 25) + (delete-char 1) + (goto-char 38) + (insert "...............") + (goto-char 76) + (delete-char 3) + (goto-char 12) + (delete-char 5) + (goto-char 70) + (delete-char 9) + (goto-char 36) + (delete-char 4) + (goto-char 18) + (insert "...............") + (goto-char 52) + (delete-char 14) + (goto-char 23) + (insert "..........") + (goto-char 64) + (insert "...........") + (goto-char 68) + (delete-char 21) + (goto-char 71) + (insert "........") + (goto-char 28) + (delete-char 43) + (goto-char 25) + (insert "....") + (goto-char 2) + (insert "...............") + (goto-char 40) + (insert "....") + (goto-char 56) + (delete-char 2) + (should + (equal + (test-overlay-regions) + '((51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 51) + (51 . 58)))))) + +(ert-deftest overlay-autogenerated-test-3 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 53 38 nil t nil) + (make-overlay 17 40 nil t t) + (make-overlay 64 26 nil t t) + (make-overlay 48 24 nil t nil) + (make-overlay 21 18 nil nil nil) + (make-overlay 2 20 nil nil t) + (make-overlay 43 26 nil t t) + (make-overlay 56 28 nil t nil) + (make-overlay 19 51 nil nil nil) + (make-overlay 39 61 nil t nil) + (make-overlay 59 12 nil t nil) + (make-overlay 65 7 nil t nil) + (make-overlay 41 7 nil t nil) + (make-overlay 62 50 nil t nil) + (make-overlay 7 10 nil t t) + (make-overlay 45 28 nil t nil) + (goto-char 13) + (insert "...") + (goto-char 37) + (widen) + (narrow-to-region 2 10) + (goto-char 8) + (delete-char 1) + (goto-char 3) + (delete-char 6) + (goto-char 2) + (insert "...........") + (goto-char 5) + (widen) + (narrow-to-region 55 70) + (goto-char 55) + (insert "......") + (goto-char 64) + (delete-char 12) + (goto-char 61) + (insert ".....") + (goto-char 64) + (insert "..............") + (goto-char 72) + (delete-char 6) + (goto-char 63) + (delete-char 12) + (goto-char 63) + (delete-char 2) + (goto-char 57) + (insert "..............") + (goto-char 68) + (insert "........") + (goto-char 77) + (delete-char 6) + (goto-char 77) + (insert ".............") + (goto-char 67) + (delete-char 0) + (goto-char 84) + (insert "........") + (goto-char 74) + (delete-char 12) + (goto-char 78) + (insert "...") + (goto-char 80) + (insert "............") + (goto-char 69) + (insert "......") + (goto-char 89) + (insert ".") + (goto-char 56) + (insert "....") + (goto-char 100) + (insert ".............") + (goto-char 114) + (delete-char 0) + (goto-char 61) + (widen) + (narrow-to-region 94 50) + (goto-char 55) + (insert "............") + (goto-char 53) + (insert ".............") + (goto-char 116) + (delete-char 3) + (goto-char 81) + (insert "...............") + (should + (equal + (test-overlay-regions) + '((14 . 166) + (16 . 164) + (26 . 164) + (31 . 68) + (33 . 165) + (35 . 52) + (35 . 164) + (45 . 164) + (46 . 164)))))) + +(ert-deftest overlay-autogenerated-test-4 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 25 15 nil nil t) + (make-overlay 8 13 nil nil nil) + (make-overlay 45 49 nil t t) + (make-overlay 22 13 nil t t) + (make-overlay 34 17 nil nil t) + (make-overlay 42 15 nil nil t) + (make-overlay 43 28 nil t t) + (make-overlay 3 28 nil t nil) + (make-overlay 32 61 nil nil t) + (make-overlay 30 64 nil t t) + (make-overlay 21 39 nil nil t) + (make-overlay 32 62 nil t nil) + (make-overlay 25 29 nil t nil) + (make-overlay 34 43 nil t nil) + (make-overlay 9 11 nil t nil) + (make-overlay 21 65 nil nil t) + (goto-char 21) + (delete-char 4) + (goto-char 25) + (insert "..") + (goto-char 53) + (insert "..") + (goto-char 2) + (insert "...............") + (goto-char 42) + (delete-char 36) + (goto-char 23) + (delete-char 12) + (goto-char 22) + (widen) + (narrow-to-region 30 32) + (goto-char 30) + (delete-char 0) + (goto-char 31) + (delete-char 1) + (goto-char 31) + (widen) + (narrow-to-region 28 27) + (goto-char 27) + (delete-char 1) + (goto-char 27) + (delete-char 0) + (goto-char 27) + (delete-char 0) + (goto-char 27) + (insert ".") + (goto-char 28) + (insert "......") + (goto-char 34) + (delete-char 0) + (goto-char 27) + (delete-char 5) + (goto-char 27) + (delete-char 1) + (goto-char 27) + (insert ".............") + (goto-char 30) + (insert "..............") + (goto-char 37) + (delete-char 15) + (goto-char 32) + (delete-char 2) + (goto-char 36) + (delete-char 1) + (goto-char 34) + (delete-char 0) + (goto-char 34) + (delete-char 1) + (goto-char 32) + (widen) + (narrow-to-region 24 19) + (goto-char 21) + (delete-char 1) + (goto-char 21) + (widen) + (narrow-to-region 11 38) + (goto-char 27) + (widen) + (narrow-to-region 20 22) + (goto-char 20) + (delete-char 1) + (goto-char 20) + (widen) + (narrow-to-region 36 4) + (goto-char 26) + (delete-char 9) + (should + (equal + (test-overlay-regions) + '((18 . 25) + (21 . 21) + (21 . 21) + (21 . 22) + (21 . 22) + (21 . 27) + (21 . 27) + (22 . 25) + (22 . 27) + (22 . 28) + (26 . 27)))))) + +(ert-deftest overlay-autogenerated-test-5 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 64 1 nil nil nil) + (make-overlay 38 43 nil nil nil) + (make-overlay 42 19 nil t nil) + (make-overlay 22 12 nil nil nil) + (make-overlay 12 30 nil t t) + (make-overlay 38 46 nil nil nil) + (make-overlay 18 23 nil nil nil) + (make-overlay 58 65 nil nil t) + (make-overlay 52 41 nil nil nil) + (make-overlay 12 26 nil nil nil) + (make-overlay 39 4 nil nil nil) + (make-overlay 20 1 nil nil t) + (make-overlay 36 60 nil nil nil) + (make-overlay 24 18 nil t nil) + (make-overlay 9 50 nil nil nil) + (make-overlay 19 17 nil t nil) + (goto-char 40) + (insert "") + (goto-char 64) + (insert ".............") + (goto-char 32) + (delete-char 40) + (goto-char 25) + (insert "...") + (goto-char 31) + (delete-char 1) + (goto-char 8) + (delete-char 14) + (goto-char 20) + (delete-char 5) + (goto-char 20) + (insert "...........") + (goto-char 20) + (insert ".........") + (goto-char 17) + (widen) + (narrow-to-region 11 21) + (goto-char 14) + (widen) + (narrow-to-region 9 24) + (goto-char 24) + (insert ".............") + (goto-char 30) + (widen) + (narrow-to-region 47 45) + (goto-char 47) + (insert ".") + (goto-char 46) + (widen) + (narrow-to-region 30 42) + (goto-char 32) + (delete-char 0) + (goto-char 34) + (insert ".......") + (goto-char 42) + (delete-char 4) + (goto-char 39) + (delete-char 6) + (goto-char 31) + (delete-char 6) + (goto-char 31) + (insert "............") + (goto-char 30) + (insert "......") + (goto-char 50) + (delete-char 0) + (goto-char 30) + (insert "....") + (goto-char 53) + (insert "............") + (goto-char 41) + (delete-char 12) + (goto-char 52) + (insert ".......") + (goto-char 56) + (insert "...........") + (goto-char 68) + (insert ".......") + (goto-char 52) + (insert "......") + (goto-char 71) + (delete-char 10) + (goto-char 47) + (insert "") + (should + (equal + (test-overlay-regions) + '((20 . 89)))))) + +(ert-deftest overlay-autogenerated-test-6 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 28 59 nil nil nil) + (make-overlay 36 21 nil t t) + (make-overlay 60 19 nil t nil) + (make-overlay 26 30 nil t nil) + (make-overlay 47 27 nil nil t) + (make-overlay 8 25 nil t t) + (make-overlay 57 43 nil t t) + (make-overlay 28 61 nil nil t) + (make-overlay 42 31 nil nil t) + (make-overlay 15 44 nil t nil) + (make-overlay 56 38 nil nil nil) + (make-overlay 39 44 nil nil t) + (make-overlay 50 6 nil t nil) + (make-overlay 6 19 nil t nil) + (make-overlay 50 44 nil t t) + (make-overlay 34 60 nil nil t) + (goto-char 27) + (insert "...............") + (goto-char 23) + (insert "..............") + (goto-char 50) + (widen) + (narrow-to-region 53 67) + (goto-char 60) + (delete-char 0) + (goto-char 54) + (insert "......") + (goto-char 64) + (delete-char 1) + (goto-char 66) + (delete-char 3) + (goto-char 58) + (insert ".............") + (goto-char 58) + (insert ".........") + (goto-char 76) + (insert "...........") + (goto-char 57) + (insert "....") + (goto-char 106) + (widen) + (narrow-to-region 5 45) + (goto-char 31) + (delete-char 8) + (goto-char 36) + (insert "...") + (goto-char 6) + (insert "........") + (goto-char 33) + (insert ".............") + (goto-char 38) + (delete-char 3) + (goto-char 28) + (delete-char 6) + (goto-char 42) + (widen) + (narrow-to-region 17 25) + (goto-char 19) + (insert "..............") + (goto-char 37) + (delete-char 1) + (goto-char 22) + (delete-char 9) + (goto-char 28) + (insert "..............") + (goto-char 37) + (delete-char 3) + (goto-char 18) + (insert "...............") + (goto-char 30) + (widen) + (narrow-to-region 68 25) + (goto-char 38) + (delete-char 22) + (goto-char 43) + (widen) + (narrow-to-region 47 96) + (goto-char 86) + (insert ".") + (goto-char 63) + (insert "......") + (goto-char 78) + (widen) + (narrow-to-region 61 27) + (goto-char 43) + (delete-char 8) + (should + (equal + (test-overlay-regions) + '((14 . 38) + (14 . 132) + (16 . 43) + (38 . 118) + (38 . 126) + (38 . 142) + (44 . 115) + (45 . 129)))))) + +(ert-deftest overlay-autogenerated-test-7 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 13 50 nil t nil) + (make-overlay 28 44 nil nil t) + (make-overlay 56 27 nil t nil) + (make-overlay 8 34 nil nil nil) + (make-overlay 22 8 nil nil t) + (make-overlay 8 28 nil t nil) + (make-overlay 65 31 nil nil t) + (make-overlay 44 8 nil nil nil) + (make-overlay 52 64 nil nil t) + (make-overlay 52 27 nil t t) + (make-overlay 47 32 nil nil nil) + (make-overlay 18 62 nil nil nil) + (make-overlay 18 24 nil t t) + (make-overlay 33 46 nil nil t) + (make-overlay 20 8 nil t nil) + (make-overlay 51 51 nil t nil) + (goto-char 2) + (delete-char 46) + (goto-char 12) + (delete-char 5) + (goto-char 2) + (delete-char 12) + (goto-char 2) + (insert "..") + (goto-char 2) + (widen) + (narrow-to-region 2 4) + (goto-char 4) + (insert "......") + (goto-char 4) + (widen) + (narrow-to-region 4 6) + (goto-char 5) + (insert "") + (goto-char 6) + (insert "...............") + (goto-char 9) + (insert "...") + (goto-char 7) + (delete-char 13) + (goto-char 8) + (delete-char 1) + (goto-char 9) + (insert "...............") + (goto-char 24) + (delete-char 1) + (goto-char 15) + (insert "...............") + (goto-char 16) + (insert "............") + (goto-char 17) + (delete-char 8) + (goto-char 36) + (widen) + (narrow-to-region 47 38) + (goto-char 43) + (delete-char 0) + (goto-char 46) + (delete-char 0) + (goto-char 40) + (delete-char 4) + (goto-char 39) + (insert ".......") + (goto-char 50) + (delete-char 0) + (goto-char 47) + (insert "...........") + (goto-char 45) + (insert ".....") + (goto-char 38) + (delete-char 3) + (goto-char 59) + (delete-char 1) + (goto-char 42) + (insert "...............") + (goto-char 65) + (insert "...........") + (goto-char 73) + (delete-char 13) + (goto-char 72) + (insert "....") + (goto-char 47) + (insert "..") + (should + (equal + (test-overlay-regions) + '((2 . 81) + (2 . 81) + (2 . 81) + (2 . 81) + (2 . 81) + (81 . 81) + (81 . 81)))))) + +(ert-deftest overlay-autogenerated-test-8 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 20 6 nil t nil) + (make-overlay 48 13 nil t nil) + (make-overlay 58 65 nil nil t) + (make-overlay 63 65 nil nil nil) + (make-overlay 42 40 nil t t) + (make-overlay 40 6 nil nil t) + (make-overlay 37 46 nil t nil) + (make-overlay 4 14 nil nil nil) + (make-overlay 58 44 nil t t) + (make-overlay 14 16 nil nil t) + (make-overlay 31 61 nil t nil) + (make-overlay 34 3 nil nil nil) + (make-overlay 11 16 nil t nil) + (make-overlay 19 42 nil nil t) + (make-overlay 30 9 nil nil t) + (make-overlay 63 52 nil t t) + (goto-char 57) + (delete-char 2) + (goto-char 8) + (insert "........") + (goto-char 30) + (insert "...........") + (goto-char 35) + (insert "...........") + (goto-char 66) + (insert "...............") + (goto-char 53) + (delete-char 15) + (goto-char 75) + (delete-char 10) + (goto-char 62) + (delete-char 21) + (goto-char 52) + (delete-char 10) + (goto-char 10) + (insert "............") + (goto-char 42) + (insert "...........") + (goto-char 68) + (insert ".............") + (goto-char 12) + (insert "........") + (goto-char 1) + (insert "...............") + (goto-char 89) + (insert "") + (goto-char 94) + (insert ".............") + (goto-char 57) + (insert "...........") + (goto-char 130) + (insert "...") + (goto-char 69) + (insert "..") + (goto-char 101) + (insert "......") + (goto-char 128) + (delete-char 13) + (goto-char 19) + (delete-char 100) + (goto-char 22) + (insert "..") + (goto-char 13) + (widen) + (narrow-to-region 30 16) + (goto-char 19) + (insert "..........") + (goto-char 22) + (delete-char 3) + (goto-char 19) + (insert ".........") + (goto-char 17) + (insert "..") + (goto-char 16) + (insert "............") + (goto-char 47) + (insert ".") + (goto-char 50) + (insert "..........") + (goto-char 70) + (delete-char 1) + (should + (equal + (test-overlay-regions) + '((32 . 75) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 60) + (33 . 75) + (33 . 75) + (33 . 75) + (60 . 75)))))) + +(ert-deftest overlay-autogenerated-test-9 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 58 13 nil nil nil) + (make-overlay 29 4 nil nil t) + (make-overlay 3 53 nil nil nil) + (make-overlay 31 9 nil t t) + (make-overlay 48 30 nil nil nil) + (make-overlay 43 50 nil nil nil) + (make-overlay 7 27 nil nil t) + (make-overlay 30 59 nil nil nil) + (make-overlay 42 25 nil nil t) + (make-overlay 15 13 nil t t) + (make-overlay 39 11 nil t t) + (make-overlay 21 62 nil t t) + (make-overlay 35 2 nil t nil) + (make-overlay 60 53 nil nil t) + (make-overlay 64 8 nil nil t) + (make-overlay 58 59 nil t t) + (goto-char 28) + (insert ".............") + (goto-char 28) + (insert "...............") + (goto-char 71) + (insert ".......") + (goto-char 65) + (insert "......") + (goto-char 3) + (delete-char 12) + (goto-char 79) + (delete-char 11) + (goto-char 65) + (widen) + (narrow-to-region 12 53) + (goto-char 38) + (insert ".......") + (goto-char 20) + (insert ".........") + (goto-char 27) + (insert "...........") + (goto-char 75) + (insert "........") + (goto-char 85) + (insert "............") + (goto-char 52) + (insert "..........") + (goto-char 16) + (delete-char 8) + (goto-char 15) + (insert "...............") + (goto-char 112) + (insert "") + (goto-char 61) + (insert "..") + (goto-char 29) + (delete-char 34) + (goto-char 52) + (delete-char 32) + (goto-char 43) + (insert "........") + (goto-char 45) + (insert "..") + (goto-char 35) + (insert "...........") + (goto-char 29) + (insert ".......") + (goto-char 75) + (widen) + (narrow-to-region 69 55) + (goto-char 67) + (delete-char 2) + (goto-char 66) + (delete-char 0) + (goto-char 62) + (delete-char 1) + (goto-char 61) + (delete-char 3) + (goto-char 63) + (insert ".") + (goto-char 56) + (insert ".....") + (goto-char 67) + (insert ".............") + (goto-char 76) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((2 . 90) + (3 . 90) + (3 . 90) + (3 . 99) + (3 . 117) + (3 . 117) + (3 . 120) + (9 . 118) + (13 . 102)))))) + +(ert-deftest overlay-autogenerated-test-10 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 16 60 nil nil nil) + (make-overlay 36 53 nil nil nil) + (make-overlay 44 39 nil t t) + (make-overlay 61 47 nil t t) + (make-overlay 58 39 nil nil t) + (make-overlay 23 54 nil nil t) + (make-overlay 65 59 nil t t) + (make-overlay 13 57 nil nil t) + (make-overlay 22 64 nil nil t) + (make-overlay 16 19 nil nil nil) + (make-overlay 16 1 nil nil t) + (make-overlay 28 21 nil t t) + (make-overlay 10 62 nil nil nil) + (make-overlay 12 18 nil nil t) + (make-overlay 15 5 nil nil t) + (make-overlay 36 31 nil nil t) + (goto-char 42) + (insert "...") + (goto-char 25) + (delete-char 28) + (goto-char 30) + (delete-char 10) + (goto-char 8) + (delete-char 9) + (goto-char 5) + (insert "........") + (goto-char 6) + (delete-char 2) + (goto-char 4) + (insert "") + (goto-char 21) + (insert ".............") + (goto-char 6) + (delete-char 33) + (goto-char 1) + (delete-char 1) + (goto-char 6) + (insert "..........") + (goto-char 8) + (insert "...........") + (goto-char 21) + (insert "........") + (goto-char 16) + (delete-char 18) + (goto-char 5) + (insert "...") + (goto-char 5) + (delete-char 8) + (goto-char 11) + (insert ".") + (goto-char 1) + (insert ".......") + (goto-char 9) + (delete-char 9) + (goto-char 5) + (insert "") + (goto-char 8) + (delete-char 0) + (goto-char 11) + (insert "..............") + (goto-char 12) + (insert "") + (goto-char 11) + (delete-char 8) + (goto-char 7) + (delete-char 3) + (goto-char 5) + (delete-char 3) + (goto-char 1) + (delete-char 8) + (goto-char 1) + (insert "....") + (goto-char 1) + (insert "..") + (goto-char 7) + (insert "...") + (goto-char 8) + (widen) + (narrow-to-region 9 11) + (goto-char 11) + (delete-char 0) + (should + (equal + (test-overlay-regions) + '((1 . 10) + (1 . 10) + (1 . 10) + (1 . 10) + (1 . 10) + (1 . 12) + (1 . 12) + (1 . 12) + (10 . 10) + (10 . 10) + (10 . 12)))))) + +(ert-deftest overlay-autogenerated-test-11 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 33 18 nil nil nil) + (make-overlay 56 38 nil t nil) + (make-overlay 2 45 nil nil t) + (make-overlay 19 55 nil nil t) + (make-overlay 28 42 nil t t) + (make-overlay 50 29 nil t nil) + (make-overlay 40 63 nil nil nil) + (make-overlay 13 2 nil nil t) + (make-overlay 26 7 nil t t) + (make-overlay 22 25 nil nil nil) + (make-overlay 14 14 nil t nil) + (make-overlay 15 39 nil t t) + (make-overlay 51 22 nil t t) + (make-overlay 58 5 nil t nil) + (make-overlay 16 10 nil nil nil) + (make-overlay 32 33 nil t nil) + (goto-char 40) + (delete-char 20) + (goto-char 45) + (delete-char 0) + (goto-char 6) + (insert "..") + (goto-char 45) + (insert "...") + (goto-char 26) + (insert "...............") + (goto-char 27) + (insert "...........") + (goto-char 38) + (insert "......") + (goto-char 62) + (insert "...............") + (goto-char 18) + (insert "...........") + (goto-char 99) + (widen) + (narrow-to-region 37 17) + (goto-char 29) + (delete-char 2) + (goto-char 28) + (delete-char 2) + (goto-char 17) + (insert ".....") + (goto-char 21) + (widen) + (narrow-to-region 34 96) + (goto-char 44) + (delete-char 22) + (goto-char 39) + (insert "..") + (goto-char 53) + (insert "...............") + (goto-char 58) + (insert ".............") + (goto-char 93) + (insert ".........") + (goto-char 78) + (widen) + (narrow-to-region 27 104) + (goto-char 93) + (delete-char 11) + (goto-char 59) + (insert "....") + (goto-char 59) + (insert "..............") + (goto-char 74) + (delete-char 5) + (goto-char 70) + (insert ".") + (goto-char 37) + (insert "...........") + (goto-char 34) + (delete-char 46) + (goto-char 49) + (insert "......") + (goto-char 55) + (insert "...") + (goto-char 42) + (insert "...") + (goto-char 70) + (delete-char 8) + (goto-char 48) + (delete-char 28) + (should + (equal + (test-overlay-regions) + '((2 . 62) + (5 . 62) + (9 . 34) + (22 . 61) + (33 . 55) + (33 . 62) + (34 . 34) + (34 . 62)))))) + +(ert-deftest overlay-autogenerated-test-12 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 18 50 nil nil nil) + (make-overlay 63 3 nil nil t) + (make-overlay 44 20 nil t t) + (make-overlay 58 38 nil nil t) + (make-overlay 3 17 nil t nil) + (make-overlay 31 62 nil t nil) + (make-overlay 12 17 nil t nil) + (make-overlay 17 52 nil nil nil) + (make-overlay 9 35 nil nil nil) + (make-overlay 17 38 nil nil nil) + (make-overlay 53 54 nil nil t) + (make-overlay 65 34 nil t nil) + (make-overlay 12 33 nil t nil) + (make-overlay 54 58 nil nil nil) + (make-overlay 42 26 nil t nil) + (make-overlay 2 4 nil t nil) + (goto-char 4) + (delete-char 26) + (goto-char 39) + (insert ".") + (goto-char 2) + (delete-char 14) + (goto-char 16) + (widen) + (narrow-to-region 19 1) + (goto-char 7) + (delete-char 9) + (goto-char 6) + (insert ".........") + (goto-char 6) + (insert "..........") + (goto-char 16) + (insert ".............") + (goto-char 36) + (delete-char 1) + (goto-char 4) + (insert "..........") + (goto-char 49) + (delete-char 2) + (goto-char 16) + (insert "............") + (goto-char 52) + (widen) + (narrow-to-region 36 38) + (goto-char 37) + (delete-char 1) + (goto-char 37) + (insert ".............") + (goto-char 46) + (insert ".") + (goto-char 40) + (delete-char 5) + (goto-char 45) + (delete-char 0) + (goto-char 46) + (delete-char 0) + (goto-char 40) + (insert "..........") + (goto-char 39) + (delete-char 4) + (goto-char 39) + (delete-char 3) + (goto-char 40) + (widen) + (narrow-to-region 8 9) + (goto-char 8) + (delete-char 1) + (goto-char 8) + (delete-char 0) + (goto-char 8) + (widen) + (narrow-to-region 45 15) + (goto-char 40) + (insert "...............") + (goto-char 29) + (delete-char 7) + (goto-char 30) + (delete-char 6) + (goto-char 21) + (delete-char 9) + (goto-char 22) + (insert "...............") + (goto-char 51) + (insert "..............") + (should + (equal + (test-overlay-regions) + '((2 . 92) + (2 . 92) + (2 . 93) + (2 . 96) + (2 . 97) + (2 . 99)))))) + +(ert-deftest overlay-autogenerated-test-13 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 18 30 nil t t) + (make-overlay 54 37 nil nil t) + (make-overlay 16 61 nil nil t) + (make-overlay 58 7 nil nil t) + (make-overlay 27 39 nil nil t) + (make-overlay 39 31 nil nil t) + (make-overlay 11 47 nil nil nil) + (make-overlay 47 40 nil t t) + (make-overlay 27 18 nil nil nil) + (make-overlay 33 26 nil nil t) + (make-overlay 55 4 nil t t) + (make-overlay 62 50 nil t t) + (make-overlay 47 65 nil t t) + (make-overlay 17 23 nil nil t) + (make-overlay 30 31 nil t nil) + (make-overlay 10 37 nil t nil) + (goto-char 8) + (delete-char 6) + (goto-char 56) + (delete-char 0) + (goto-char 28) + (insert ".........") + (goto-char 19) + (insert "..............") + (goto-char 4) + (delete-char 28) + (goto-char 49) + (delete-char 4) + (goto-char 2) + (insert "............") + (goto-char 10) + (delete-char 37) + (goto-char 19) + (delete-char 2) + (goto-char 20) + (delete-char 0) + (goto-char 16) + (insert "..") + (goto-char 8) + (widen) + (narrow-to-region 12 3) + (goto-char 10) + (delete-char 2) + (goto-char 9) + (insert "..") + (goto-char 12) + (insert "...............") + (goto-char 25) + (insert ".....") + (goto-char 10) + (widen) + (narrow-to-region 42 18) + (goto-char 20) + (insert ".......") + (goto-char 18) + (insert ".........") + (goto-char 55) + (delete-char 3) + (goto-char 48) + (insert ".......") + (goto-char 52) + (delete-char 6) + (goto-char 45) + (delete-char 11) + (goto-char 27) + (delete-char 13) + (goto-char 22) + (insert "...........") + (goto-char 19) + (delete-char 15) + (goto-char 20) + (delete-char 0) + (goto-char 23) + (widen) + (narrow-to-region 12 25) + (goto-char 16) + (insert "..........") + (goto-char 25) + (widen) + (narrow-to-region 2 38) + (goto-char 34) + (delete-char 0) + (goto-char 31) + (insert "...............") + (should + (equal + (test-overlay-regions) + '((12 . 12) + (12 . 12) + (12 . 12) + (12 . 12) + (12 . 53) + (12 . 53) + (12 . 53) + (12 . 53) + (12 . 53) + (12 . 53) + (12 . 55)))))) + +(ert-deftest overlay-autogenerated-test-14 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 29 37 nil t nil) + (make-overlay 15 44 nil nil nil) + (make-overlay 31 34 nil nil t) + (make-overlay 35 33 nil t t) + (make-overlay 4 27 nil t t) + (make-overlay 37 5 nil nil t) + (make-overlay 58 19 nil nil t) + (make-overlay 57 47 nil nil t) + (make-overlay 49 5 nil t t) + (make-overlay 21 59 nil t t) + (make-overlay 42 33 nil t nil) + (make-overlay 22 16 nil t t) + (make-overlay 9 51 nil t nil) + (make-overlay 20 24 nil nil t) + (make-overlay 21 7 nil t t) + (make-overlay 58 52 nil t t) + (goto-char 39) + (widen) + (narrow-to-region 55 54) + (goto-char 54) + (insert ".............") + (goto-char 55) + (insert "............") + (goto-char 66) + (delete-char 10) + (goto-char 62) + (insert "...............") + (goto-char 82) + (delete-char 2) + (goto-char 82) + (delete-char 0) + (goto-char 76) + (insert "..............") + (goto-char 60) + (insert ".............") + (goto-char 71) + (insert "...............") + (goto-char 122) + (delete-char 0) + (goto-char 93) + (delete-char 3) + (goto-char 108) + (delete-char 1) + (goto-char 121) + (insert "........") + (goto-char 92) + (insert "") + (goto-char 103) + (insert "..........") + (goto-char 85) + (delete-char 13) + (goto-char 116) + (delete-char 7) + (goto-char 103) + (widen) + (narrow-to-region 60 27) + (goto-char 28) + (delete-char 16) + (goto-char 35) + (insert ".......") + (goto-char 47) + (insert "........") + (goto-char 38) + (delete-char 1) + (goto-char 43) + (insert "..........") + (goto-char 59) + (insert "........") + (goto-char 57) + (insert "........") + (goto-char 36) + (insert "...........") + (goto-char 82) + (delete-char 11) + (goto-char 67) + (insert "..........") + (goto-char 46) + (delete-char 1) + (goto-char 47) + (insert "......") + (goto-char 69) + (delete-char 7) + (should + (equal + (test-overlay-regions) + '((5 . 28) + (5 . 33) + (9 . 35) + (15 . 28) + (19 . 154) + (21 . 155) + (28 . 28) + (28 . 28) + (28 . 28) + (28 . 28) + (31 . 153) + (58 . 154)))))) + +(ert-deftest overlay-autogenerated-test-15 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 3 19 nil t t) + (make-overlay 11 18 nil t nil) + (make-overlay 28 51 nil nil t) + (make-overlay 29 15 nil t t) + (make-overlay 46 57 nil t t) + (make-overlay 26 24 nil nil nil) + (make-overlay 29 43 nil nil nil) + (make-overlay 54 29 nil nil nil) + (make-overlay 34 52 nil t nil) + (make-overlay 10 32 nil nil nil) + (make-overlay 28 34 nil nil t) + (make-overlay 11 43 nil nil nil) + (make-overlay 18 50 nil t t) + (make-overlay 28 39 nil nil nil) + (make-overlay 62 62 nil t t) + (make-overlay 30 62 nil t nil) + (goto-char 30) + (widen) + (narrow-to-region 6 22) + (goto-char 9) + (insert "..") + (goto-char 12) + (insert ".............") + (goto-char 29) + (insert "..............") + (goto-char 47) + (insert "........") + (goto-char 46) + (insert ".............") + (goto-char 55) + (insert "..........") + (goto-char 62) + (insert "...............") + (goto-char 47) + (delete-char 49) + (goto-char 11) + (insert "...........") + (goto-char 40) + (delete-char 1) + (goto-char 27) + (insert "..............") + (goto-char 51) + (insert "......") + (goto-char 60) + (delete-char 10) + (goto-char 37) + (insert ".........") + (goto-char 69) + (insert ".") + (goto-char 36) + (insert "............") + (goto-char 75) + (insert ".............") + (goto-char 21) + (widen) + (narrow-to-region 44 21) + (goto-char 37) + (insert ".............") + (goto-char 55) + (widen) + (narrow-to-region 84 28) + (goto-char 58) + (widen) + (narrow-to-region 96 49) + (goto-char 62) + (delete-char 0) + (goto-char 72) + (delete-char 24) + (goto-char 61) + (widen) + (narrow-to-region 105 83) + (goto-char 96) + (widen) + (narrow-to-region 109 46) + (goto-char 95) + (delete-char 4) + (goto-char 81) + (insert ".") + (goto-char 51) + (delete-char 8) + (goto-char 52) + (insert ".") + (goto-char 60) + (delete-char 10) + (goto-char 50) + (insert "......") + (should + (equal + (test-overlay-regions) + '((3 . 81) + (23 . 88) + (66 . 99) + (69 . 81) + (78 . 85) + (81 . 106) + (84 . 85) + (85 . 90) + (85 . 95) + (85 . 99) + (85 . 107) + (85 . 110) + (86 . 118) + (90 . 108)))))) + +(ert-deftest overlay-autogenerated-test-16 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 3 55 nil t nil) + (make-overlay 45 47 nil nil nil) + (make-overlay 23 57 nil t t) + (make-overlay 64 55 nil nil nil) + (make-overlay 37 26 nil t t) + (make-overlay 29 38 nil nil t) + (make-overlay 33 3 nil t t) + (make-overlay 49 16 nil t nil) + (make-overlay 35 56 nil t t) + (make-overlay 9 39 nil nil nil) + (make-overlay 2 61 nil nil nil) + (make-overlay 59 26 nil nil t) + (make-overlay 5 50 nil t t) + (make-overlay 19 19 nil nil t) + (make-overlay 64 21 nil t nil) + (make-overlay 21 8 nil nil t) + (goto-char 17) + (insert ".....") + (goto-char 29) + (insert "............") + (goto-char 42) + (delete-char 38) + (goto-char 24) + (insert "") + (goto-char 9) + (delete-char 2) + (goto-char 20) + (insert "..") + (goto-char 27) + (delete-char 8) + (goto-char 25) + (delete-char 6) + (goto-char 8) + (delete-char 21) + (goto-char 9) + (insert "..............") + (goto-char 3) + (insert "....") + (goto-char 8) + (delete-char 18) + (goto-char 6) + (widen) + (narrow-to-region 5 8) + (goto-char 5) + (delete-char 3) + (goto-char 5) + (insert "...") + (goto-char 8) + (insert "..........") + (goto-char 5) + (insert "") + (goto-char 7) + (delete-char 8) + (goto-char 8) + (widen) + (narrow-to-region 2 2) + (goto-char 2) + (delete-char 0) + (goto-char 2) + (delete-char 0) + (goto-char 2) + (delete-char 0) + (goto-char 2) + (delete-char 0) + (goto-char 2) + (widen) + (narrow-to-region 10 3) + (goto-char 8) + (delete-char 2) + (goto-char 7) + (insert ".......") + (goto-char 8) + (delete-char 3) + (goto-char 12) + (insert "..") + (goto-char 9) + (delete-char 2) + (goto-char 7) + (insert "......") + (goto-char 15) + (insert "..........") + (goto-char 4) + (insert "........") + (should + (equal + (test-overlay-regions) + '((2 . 13) + (13 . 13) + (13 . 13) + (13 . 13) + (13 . 13) + (13 . 13) + (13 . 13) + (13 . 36) + (13 . 36) + (13 . 36) + (13 . 36)))))) + +(ert-deftest overlay-autogenerated-test-17 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 15 37 nil t nil) + (make-overlay 40 3 nil t t) + (make-overlay 61 19 nil t t) + (make-overlay 46 9 nil nil t) + (make-overlay 64 39 nil nil t) + (make-overlay 50 58 nil nil t) + (make-overlay 21 30 nil t nil) + (make-overlay 44 54 nil t nil) + (make-overlay 32 2 nil t nil) + (make-overlay 14 9 nil t t) + (make-overlay 41 40 nil t nil) + (make-overlay 17 26 nil t nil) + (make-overlay 57 50 nil t t) + (make-overlay 16 65 nil nil t) + (make-overlay 13 61 nil t t) + (make-overlay 39 64 nil nil t) + (goto-char 37) + (widen) + (narrow-to-region 12 1) + (goto-char 12) + (insert "......") + (goto-char 8) + (delete-char 4) + (goto-char 11) + (delete-char 3) + (goto-char 6) + (insert ".....") + (goto-char 6) + (widen) + (narrow-to-region 53 48) + (goto-char 48) + (delete-char 5) + (goto-char 48) + (widen) + (narrow-to-region 59 58) + (goto-char 59) + (delete-char 0) + (goto-char 58) + (insert "...") + (goto-char 60) + (insert "...............") + (goto-char 58) + (insert ".............") + (goto-char 67) + (insert ".....") + (goto-char 73) + (insert "") + (goto-char 68) + (insert ".....") + (goto-char 64) + (insert "....") + (goto-char 62) + (insert "..") + (goto-char 91) + (insert "..........") + (goto-char 80) + (insert "............") + (goto-char 100) + (delete-char 21) + (goto-char 74) + (insert "...") + (goto-char 60) + (delete-char 30) + (goto-char 64) + (widen) + (narrow-to-region 71 23) + (goto-char 53) + (delete-char 11) + (goto-char 23) + (delete-char 21) + (goto-char 39) + (delete-char 0) + (goto-char 35) + (insert "") + (goto-char 35) + (insert ".........") + (goto-char 30) + (insert "...........") + (goto-char 35) + (insert "..") + (goto-char 37) + (delete-char 1) + (goto-char 28) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((13 . 27) + (17 . 67) + (20 . 71) + (23 . 23) + (23 . 24) + (23 . 67) + (23 . 70) + (23 . 70) + (27 . 41) + (28 . 41) + (28 . 41)))))) + +(ert-deftest overlay-autogenerated-test-18 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 43 52 nil nil t) + (make-overlay 27 29 nil nil t) + (make-overlay 24 18 nil nil nil) + (make-overlay 39 52 nil nil nil) + (make-overlay 33 62 nil t t) + (make-overlay 16 7 nil t nil) + (make-overlay 47 39 nil nil t) + (make-overlay 59 41 nil nil nil) + (make-overlay 22 55 nil nil t) + (make-overlay 60 16 nil t t) + (make-overlay 55 20 nil nil t) + (make-overlay 25 12 nil nil t) + (make-overlay 26 2 nil nil t) + (make-overlay 17 35 nil nil t) + (make-overlay 46 41 nil t nil) + (make-overlay 57 53 nil t t) + (goto-char 52) + (insert "") + (goto-char 4) + (delete-char 21) + (goto-char 17) + (insert "") + (goto-char 35) + (insert "...............") + (goto-char 8) + (insert "...............") + (goto-char 9) + (insert "........") + (goto-char 73) + (delete-char 9) + (goto-char 62) + (insert "...............") + (goto-char 27) + (widen) + (narrow-to-region 34 84) + (goto-char 81) + (insert "...........") + (goto-char 48) + (insert "...") + (goto-char 74) + (insert ".......") + (goto-char 41) + (widen) + (narrow-to-region 37 105) + (goto-char 75) + (insert "...............") + (goto-char 47) + (insert "..........") + (goto-char 99) + (delete-char 13) + (goto-char 105) + (delete-char 4) + (goto-char 94) + (delete-char 5) + (goto-char 96) + (insert "..............") + (goto-char 74) + (insert "") + (goto-char 121) + (insert "...") + (goto-char 102) + (insert "...") + (goto-char 64) + (insert "......") + (goto-char 67) + (insert "...") + (goto-char 95) + (delete-char 19) + (goto-char 37) + (insert "..........") + (goto-char 50) + (widen) + (narrow-to-region 67 96) + (goto-char 88) + (insert "..........") + (goto-char 91) + (insert ".............") + (goto-char 70) + (delete-char 8) + (goto-char 111) + (widen) + (narrow-to-region 72 103) + (goto-char 101) + (insert "...............") + (should + (equal + (test-overlay-regions) + '((4 . 119) + (4 . 119) + (4 . 162) + (35 . 162) + (51 . 78) + (53 . 162) + (55 . 78) + (79 . 162)))))) + +(ert-deftest overlay-autogenerated-test-19 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 19 31 nil t t) + (make-overlay 40 5 nil nil nil) + (make-overlay 13 41 nil t t) + (make-overlay 41 43 nil nil t) + (make-overlay 7 60 nil t nil) + (make-overlay 40 23 nil t nil) + (make-overlay 32 15 nil t t) + (make-overlay 12 45 nil nil nil) + (make-overlay 18 1 nil nil nil) + (make-overlay 58 32 nil t t) + (make-overlay 30 3 nil t t) + (make-overlay 43 61 nil t nil) + (make-overlay 54 57 nil nil t) + (make-overlay 34 14 nil t t) + (make-overlay 26 49 nil nil t) + (make-overlay 54 49 nil nil t) + (goto-char 28) + (insert "........") + (goto-char 32) + (insert "...........") + (goto-char 78) + (delete-char 6) + (goto-char 37) + (delete-char 0) + (goto-char 49) + (insert ".........") + (goto-char 40) + (widen) + (narrow-to-region 8 30) + (goto-char 20) + (delete-char 4) + (goto-char 23) + (delete-char 1) + (goto-char 10) + (insert ".") + (goto-char 22) + (delete-char 2) + (goto-char 22) + (insert "......") + (goto-char 17) + (insert "..........") + (goto-char 34) + (delete-char 0) + (goto-char 21) + (insert "............") + (goto-char 45) + (delete-char 7) + (goto-char 39) + (insert "...............") + (goto-char 29) + (insert "........") + (goto-char 9) + (delete-char 3) + (goto-char 63) + (delete-char 1) + (goto-char 33) + (insert "........") + (goto-char 16) + (delete-char 36) + (goto-char 20) + (delete-char 2) + (goto-char 28) + (delete-char 0) + (goto-char 24) + (insert "...........") + (goto-char 43) + (insert "..........") + (goto-char 30) + (delete-char 1) + (goto-char 40) + (delete-char 13) + (goto-char 22) + (delete-char 19) + (goto-char 10) + (delete-char 8) + (goto-char 14) + (delete-char 0) + (goto-char 12) + (delete-char 2) + (goto-char 11) + (delete-char 0) + (should + (equal + (test-overlay-regions) + '((1 . 12) + (3 . 40) + (5 . 50) + (7 . 69) + (10 . 42) + (10 . 44) + (10 . 51) + (10 . 55)))))) + +(ert-deftest overlay-autogenerated-test-20 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 44 42 nil t t) + (make-overlay 47 1 nil nil nil) + (make-overlay 24 48 nil nil nil) + (make-overlay 62 50 nil nil t) + (make-overlay 54 38 nil nil nil) + (make-overlay 3 9 nil nil nil) + (make-overlay 61 28 nil t nil) + (make-overlay 33 33 nil nil t) + (make-overlay 37 37 nil t nil) + (make-overlay 20 13 nil nil t) + (make-overlay 54 36 nil t nil) + (make-overlay 18 58 nil nil t) + (make-overlay 55 3 nil nil t) + (make-overlay 23 21 nil t t) + (make-overlay 47 55 nil t t) + (make-overlay 50 12 nil nil nil) + (goto-char 11) + (delete-char 46) + (goto-char 7) + (delete-char 3) + (goto-char 14) + (delete-char 1) + (goto-char 14) + (insert "......") + (goto-char 14) + (delete-char 4) + (goto-char 12) + (widen) + (narrow-to-region 11 12) + (goto-char 11) + (insert "...") + (goto-char 13) + (delete-char 1) + (goto-char 14) + (insert ".") + (goto-char 13) + (delete-char 2) + (goto-char 11) + (delete-char 2) + (goto-char 11) + (insert "") + (goto-char 11) + (delete-char 0) + (goto-char 11) + (delete-char 0) + (goto-char 11) + (delete-char 0) + (goto-char 11) + (insert ".") + (goto-char 11) + (insert ".") + (goto-char 12) + (insert "......") + (goto-char 14) + (delete-char 2) + (goto-char 11) + (delete-char 2) + (goto-char 14) + (insert "............") + (goto-char 19) + (insert "..............") + (goto-char 29) + (insert ".....") + (goto-char 42) + (delete-char 1) + (goto-char 22) + (insert ".....") + (goto-char 19) + (insert "..............") + (goto-char 42) + (insert ".....") + (goto-char 63) + (widen) + (narrow-to-region 26 42) + (goto-char 36) + (insert "..........") + (goto-char 40) + (delete-char 11) + (goto-char 26) + (delete-char 13) + (goto-char 28) + (delete-char 0) + (should + (equal + (test-overlay-regions) + '((8 . 56)))))) + +(ert-deftest overlay-autogenerated-test-21 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 65 15 nil nil nil) + (make-overlay 52 31 nil nil nil) + (make-overlay 12 51 nil t t) + (make-overlay 42 20 nil nil t) + (make-overlay 51 48 nil nil nil) + (make-overlay 59 28 nil t t) + (make-overlay 51 53 nil t nil) + (make-overlay 50 59 nil nil t) + (make-overlay 24 40 nil t nil) + (make-overlay 51 61 nil nil nil) + (make-overlay 12 58 nil nil t) + (make-overlay 64 17 nil t t) + (make-overlay 26 38 nil t t) + (make-overlay 23 36 nil nil nil) + (make-overlay 57 50 nil nil nil) + (make-overlay 42 15 nil nil t) + (goto-char 14) + (insert "............") + (goto-char 37) + (insert ".") + (goto-char 73) + (insert "..........") + (goto-char 17) + (delete-char 31) + (goto-char 21) + (delete-char 35) + (goto-char 9) + (delete-char 0) + (goto-char 7) + (delete-char 2) + (goto-char 1) + (insert "") + (goto-char 5) + (insert ".......") + (goto-char 8) + (insert "....") + (goto-char 27) + (delete-char 0) + (goto-char 10) + (insert ".............") + (goto-char 24) + (delete-char 16) + (goto-char 14) + (insert ".............") + (goto-char 25) + (delete-char 11) + (goto-char 3) + (insert "........") + (goto-char 38) + (insert "............") + (goto-char 41) + (insert "..............") + (goto-char 56) + (delete-char 3) + (goto-char 15) + (widen) + (narrow-to-region 16 53) + (goto-char 19) + (widen) + (narrow-to-region 18 33) + (goto-char 32) + (insert "......") + (goto-char 38) + (delete-char 1) + (goto-char 19) + (widen) + (narrow-to-region 11 11) + (goto-char 11) + (insert ".........") + (goto-char 11) + (insert ".........") + (goto-char 20) + (widen) + (narrow-to-region 22 69) + (goto-char 49) + (insert ".........") + (goto-char 54) + (delete-char 22) + (goto-char 44) + (insert "........") + (goto-char 40) + (delete-char 7) + (goto-char 29) + (delete-char 22) + (should + (equal + (test-overlay-regions) + '((33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33) + (33 . 33)))))) + +(ert-deftest overlay-autogenerated-test-22 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 12 14 nil nil t) + (make-overlay 54 7 nil nil t) + (make-overlay 8 3 nil nil nil) + (make-overlay 42 32 nil nil nil) + (make-overlay 10 27 nil t t) + (make-overlay 50 28 nil t t) + (make-overlay 39 35 nil nil nil) + (make-overlay 12 4 nil t t) + (make-overlay 29 54 nil nil nil) + (make-overlay 14 52 nil t t) + (make-overlay 9 15 nil t nil) + (make-overlay 44 11 nil nil nil) + (make-overlay 46 29 nil t t) + (make-overlay 40 58 nil t t) + (make-overlay 40 61 nil t nil) + (make-overlay 13 59 nil nil t) + (goto-char 32) + (insert ".............") + (goto-char 25) + (delete-char 10) + (goto-char 3) + (insert ".............") + (goto-char 33) + (delete-char 32) + (goto-char 39) + (widen) + (narrow-to-region 41 46) + (goto-char 43) + (delete-char 2) + (goto-char 42) + (delete-char 2) + (goto-char 42) + (insert "...") + (goto-char 43) + (delete-char 1) + (goto-char 42) + (widen) + (narrow-to-region 8 46) + (goto-char 25) + (delete-char 7) + (goto-char 12) + (delete-char 10) + (goto-char 23) + (insert "...............") + (goto-char 41) + (delete-char 3) + (goto-char 17) + (insert ".........") + (goto-char 37) + (insert "...............") + (goto-char 53) + (delete-char 7) + (goto-char 53) + (delete-char 0) + (goto-char 42) + (widen) + (narrow-to-region 20 54) + (goto-char 20) + (delete-char 28) + (goto-char 23) + (insert "..........") + (goto-char 30) + (insert "......") + (goto-char 26) + (delete-char 1) + (goto-char 27) + (widen) + (narrow-to-region 40 37) + (goto-char 37) + (insert ".....") + (goto-char 41) + (widen) + (narrow-to-region 13 37) + (goto-char 29) + (insert "...........") + (goto-char 33) + (delete-char 7) + (goto-char 33) + (delete-char 8) + (goto-char 20) + (insert "") + (goto-char 23) + (delete-char 7) + (goto-char 14) + (widen) + (narrow-to-region 33 33) + (should + (equal + (test-overlay-regions) + '((15 . 39) + (16 . 38) + (16 . 39)))))) + +(ert-deftest overlay-autogenerated-test-23 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 51 32 nil t t) + (make-overlay 13 61 nil t nil) + (make-overlay 47 19 nil nil t) + (make-overlay 11 30 nil nil nil) + (make-overlay 50 26 nil t t) + (make-overlay 64 13 nil t t) + (make-overlay 29 8 nil t t) + (make-overlay 25 42 nil t t) + (make-overlay 33 28 nil t t) + (make-overlay 54 7 nil nil nil) + (make-overlay 30 59 nil nil nil) + (make-overlay 65 50 nil t t) + (make-overlay 64 15 nil t nil) + (make-overlay 16 35 nil nil nil) + (make-overlay 40 36 nil nil t) + (make-overlay 31 35 nil t nil) + (goto-char 61) + (insert "......") + (goto-char 55) + (delete-char 2) + (goto-char 20) + (insert "..............") + (goto-char 56) + (insert "............") + (goto-char 48) + (delete-char 6) + (goto-char 9) + (delete-char 54) + (goto-char 20) + (delete-char 2) + (goto-char 16) + (delete-char 12) + (goto-char 18) + (insert ".............") + (goto-char 24) + (delete-char 7) + (goto-char 5) + (delete-char 2) + (goto-char 1) + (insert ".......") + (goto-char 1) + (insert ".......") + (goto-char 33) + (insert "") + (goto-char 4) + (insert "..") + (goto-char 5) + (widen) + (narrow-to-region 17 4) + (goto-char 13) + (insert ".") + (goto-char 8) + (insert "............") + (goto-char 9) + (delete-char 3) + (goto-char 4) + (widen) + (narrow-to-region 32 32) + (goto-char 32) + (delete-char 0) + (goto-char 32) + (delete-char 0) + (goto-char 32) + (delete-char 0) + (goto-char 32) + (insert "...............") + (goto-char 43) + (delete-char 4) + (goto-char 32) + (delete-char 1) + (goto-char 40) + (widen) + (narrow-to-region 33 19) + (goto-char 27) + (insert "........") + (goto-char 38) + (delete-char 2) + (goto-char 26) + (insert "") + (goto-char 33) + (delete-char 1) + (goto-char 27) + (insert ".") + (should + (equal + (test-overlay-regions) + '((38 . 56)))))) + +(ert-deftest overlay-autogenerated-test-24 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 63 8 nil t t) + (make-overlay 10 13 nil nil t) + (make-overlay 40 38 nil nil nil) + (make-overlay 21 34 nil t t) + (make-overlay 55 29 nil nil nil) + (make-overlay 36 65 nil t t) + (make-overlay 29 12 nil t nil) + (make-overlay 41 3 nil nil t) + (make-overlay 20 9 nil t t) + (make-overlay 52 42 nil t t) + (make-overlay 21 56 nil nil t) + (make-overlay 25 65 nil nil nil) + (make-overlay 38 4 nil t t) + (make-overlay 48 23 nil t t) + (make-overlay 52 9 nil nil t) + (make-overlay 48 19 nil nil nil) + (goto-char 43) + (delete-char 8) + (goto-char 30) + (delete-char 16) + (goto-char 7) + (insert "...") + (goto-char 14) + (delete-char 5) + (goto-char 36) + (delete-char 0) + (goto-char 9) + (insert "...............") + (goto-char 13) + (delete-char 17) + (goto-char 16) + (delete-char 2) + (goto-char 9) + (insert "") + (goto-char 11) + (delete-char 5) + (goto-char 18) + (insert "........") + (goto-char 15) + (insert "....") + (goto-char 16) + (delete-char 14) + (goto-char 20) + (insert ".") + (goto-char 25) + (delete-char 1) + (goto-char 14) + (delete-char 14) + (goto-char 3) + (delete-char 7) + (goto-char 3) + (delete-char 4) + (goto-char 1) + (insert "...........") + (goto-char 9) + (insert ".......") + (goto-char 5) + (delete-char 7) + (goto-char 12) + (insert ".........") + (goto-char 2) + (delete-char 4) + (goto-char 3) + (widen) + (narrow-to-region 14 6) + (goto-char 9) + (insert "..........") + (goto-char 13) + (delete-char 8) + (goto-char 7) + (delete-char 7) + (goto-char 7) + (insert "..") + (goto-char 9) + (insert ".............") + (goto-char 9) + (insert "..........") + (goto-char 21) + (insert "...............") + (goto-char 42) + (insert ".........") + (should + (equal + (test-overlay-regions) + 'nil)))) + +(ert-deftest overlay-autogenerated-test-25 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 24 8 nil nil t) + (make-overlay 41 16 nil t nil) + (make-overlay 3 16 nil nil nil) + (make-overlay 26 42 nil nil nil) + (make-overlay 32 45 nil nil t) + (make-overlay 34 19 nil nil nil) + (make-overlay 37 54 nil nil t) + (make-overlay 44 34 nil t nil) + (make-overlay 49 40 nil t t) + (make-overlay 29 34 nil t nil) + (make-overlay 54 16 nil t t) + (make-overlay 29 4 nil t nil) + (make-overlay 44 57 nil nil nil) + (make-overlay 5 32 nil nil nil) + (make-overlay 12 33 nil nil t) + (make-overlay 38 29 nil t nil) + (goto-char 12) + (delete-char 53) + (goto-char 1) + (delete-char 6) + (goto-char 5) + (widen) + (narrow-to-region 6 1) + (goto-char 6) + (insert "......") + (goto-char 10) + (insert "...............") + (goto-char 17) + (delete-char 5) + (goto-char 7) + (insert ".....") + (goto-char 8) + (insert "...............") + (goto-char 4) + (insert ".....") + (goto-char 44) + (widen) + (narrow-to-region 18 11) + (goto-char 15) + (delete-char 1) + (goto-char 17) + (delete-char 0) + (goto-char 13) + (delete-char 3) + (goto-char 14) + (insert "..") + (goto-char 16) + (insert "..") + (goto-char 15) + (delete-char 3) + (goto-char 13) + (delete-char 0) + (goto-char 14) + (insert "..........") + (goto-char 19) + (insert ".") + (goto-char 23) + (delete-char 1) + (goto-char 12) + (widen) + (narrow-to-region 23 40) + (goto-char 35) + (insert "....") + (goto-char 33) + (insert "..........") + (goto-char 37) + (delete-char 16) + (goto-char 37) + (delete-char 0) + (goto-char 23) + (widen) + (narrow-to-region 30 8) + (goto-char 29) + (delete-char 0) + (goto-char 15) + (delete-char 15) + (goto-char 9) + (insert "...........") + (goto-char 9) + (delete-char 1) + (goto-char 22) + (delete-char 3) + (goto-char 10) + (insert ".........") + (should + (equal + (test-overlay-regions) + '((1 . 30) + (1 . 30) + (1 . 30) + (2 . 53) + (30 . 30) + (30 . 30) + (30 . 30) + (30 . 30) + (30 . 30) + (30 . 30) + (30 . 30) + (30 . 53) + (30 . 53) + (30 . 53)))))) + +(ert-deftest overlay-autogenerated-test-26 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 60 59 nil t nil) + (make-overlay 18 11 nil nil t) + (make-overlay 4 44 nil nil nil) + (make-overlay 7 22 nil nil nil) + (make-overlay 54 50 nil t nil) + (make-overlay 59 28 nil nil nil) + (make-overlay 49 23 nil nil t) + (make-overlay 21 5 nil t nil) + (make-overlay 17 39 nil t nil) + (make-overlay 16 14 nil nil nil) + (make-overlay 50 26 nil nil nil) + (make-overlay 37 14 nil nil nil) + (make-overlay 6 59 nil nil t) + (make-overlay 30 17 nil nil t) + (make-overlay 17 34 nil nil t) + (make-overlay 7 22 nil t nil) + (goto-char 35) + (delete-char 25) + (goto-char 30) + (delete-char 7) + (goto-char 25) + (widen) + (narrow-to-region 3 19) + (goto-char 6) + (insert ".........") + (goto-char 21) + (insert "...............") + (goto-char 12) + (insert ".............") + (goto-char 34) + (widen) + (narrow-to-region 64 37) + (goto-char 62) + (insert ".............") + (goto-char 50) + (widen) + (narrow-to-region 72 38) + (goto-char 66) + (insert "") + (goto-char 54) + (insert "...") + (goto-char 70) + (delete-char 4) + (goto-char 49) + (delete-char 13) + (goto-char 38) + (insert "....") + (goto-char 46) + (insert ".") + (goto-char 43) + (widen) + (narrow-to-region 74 53) + (goto-char 60) + (delete-char 10) + (goto-char 53) + (insert "..............") + (goto-char 72) + (insert "............") + (goto-char 87) + (delete-char 2) + (goto-char 73) + (insert "............") + (goto-char 81) + (insert "........") + (goto-char 106) + (insert "...") + (goto-char 95) + (widen) + (narrow-to-region 77 39) + (goto-char 43) + (insert "..........") + (goto-char 40) + (insert "...............") + (goto-char 101) + (insert "") + (goto-char 53) + (insert "....") + (goto-char 79) + (delete-char 21) + (goto-char 85) + (insert "........") + (goto-char 52) + (delete-char 41) + (goto-char 43) + (insert ".....") + (should + (equal + (test-overlay-regions) + '((4 . 90) + (5 . 57) + (6 . 90) + (29 . 57) + (29 . 57) + (33 . 57)))))) + +(ert-deftest overlay-autogenerated-test-27 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 20 12 nil t nil) + (make-overlay 3 10 nil t t) + (make-overlay 11 53 nil t nil) + (make-overlay 59 3 nil t nil) + (make-overlay 28 19 nil t t) + (make-overlay 16 30 nil t t) + (make-overlay 39 19 nil t t) + (make-overlay 33 50 nil t nil) + (make-overlay 36 54 nil nil nil) + (make-overlay 42 59 nil nil nil) + (make-overlay 30 48 nil t nil) + (make-overlay 20 13 nil nil t) + (make-overlay 63 48 nil t nil) + (make-overlay 48 12 nil t t) + (make-overlay 64 50 nil nil nil) + (make-overlay 7 7 nil nil nil) + (goto-char 20) + (widen) + (narrow-to-region 21 54) + (goto-char 40) + (insert "..........") + (goto-char 21) + (delete-char 2) + (goto-char 35) + (widen) + (narrow-to-region 70 11) + (goto-char 45) + (insert "...............") + (goto-char 74) + (insert ".") + (goto-char 28) + (widen) + (narrow-to-region 77 67) + (goto-char 72) + (insert "..........") + (goto-char 85) + (delete-char 1) + (goto-char 82) + (widen) + (narrow-to-region 83 86) + (goto-char 83) + (delete-char 0) + (goto-char 86) + (delete-char 0) + (goto-char 86) + (insert "...........") + (goto-char 97) + (insert ".......") + (goto-char 103) + (widen) + (narrow-to-region 44 68) + (goto-char 49) + (insert "..") + (goto-char 65) + (insert ".............") + (goto-char 59) + (delete-char 0) + (goto-char 57) + (insert "........") + (goto-char 55) + (delete-char 30) + (goto-char 45) + (insert "...............") + (goto-char 44) + (insert "") + (goto-char 62) + (insert "............") + (goto-char 63) + (widen) + (narrow-to-region 12 5) + (goto-char 8) + (delete-char 4) + (goto-char 6) + (delete-char 0) + (goto-char 7) + (insert "..........") + (goto-char 15) + (delete-char 0) + (goto-char 16) + (insert "............") + (goto-char 20) + (insert ".........") + (goto-char 13) + (insert "..") + (goto-char 32) + (insert "..............") + (should + (equal + (test-overlay-regions) + '((3 . 55) + (3 . 173) + (7 . 7)))))) + +(ert-deftest overlay-autogenerated-test-28 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 59 48 nil t nil) + (make-overlay 59 4 nil nil t) + (make-overlay 45 35 nil t nil) + (make-overlay 13 18 nil t t) + (make-overlay 10 7 nil t t) + (make-overlay 9 8 nil nil nil) + (make-overlay 33 47 nil nil t) + (make-overlay 1 57 nil t nil) + (make-overlay 16 59 nil nil t) + (make-overlay 43 58 nil nil t) + (make-overlay 6 11 nil nil nil) + (make-overlay 59 7 nil t nil) + (make-overlay 3 57 nil t t) + (make-overlay 61 35 nil nil nil) + (make-overlay 57 8 nil nil nil) + (make-overlay 5 32 nil t nil) + (goto-char 18) + (insert "............") + (goto-char 43) + (delete-char 2) + (goto-char 38) + (delete-char 26) + (goto-char 42) + (insert ".....") + (goto-char 52) + (insert "..........") + (goto-char 45) + (delete-char 11) + (goto-char 33) + (insert "....") + (goto-char 23) + (delete-char 14) + (goto-char 33) + (widen) + (narrow-to-region 30 33) + (goto-char 30) + (delete-char 0) + (goto-char 30) + (insert "...........") + (goto-char 30) + (delete-char 7) + (goto-char 30) + (insert ".") + (goto-char 32) + (delete-char 4) + (goto-char 34) + (delete-char 0) + (goto-char 34) + (delete-char 0) + (goto-char 32) + (insert "...............") + (goto-char 46) + (insert ".........") + (goto-char 45) + (delete-char 3) + (goto-char 49) + (delete-char 2) + (goto-char 42) + (delete-char 2) + (goto-char 32) + (insert "..........") + (goto-char 47) + (insert "....") + (goto-char 59) + (insert ".......") + (goto-char 35) + (insert ".") + (goto-char 45) + (insert "..............") + (goto-char 37) + (insert "..") + (goto-char 80) + (insert ".....") + (goto-char 30) + (insert ".............") + (goto-char 102) + (insert "............") + (goto-char 113) + (insert "") + (goto-char 66) + (widen) + (narrow-to-region 47 38) + (should + (equal + (test-overlay-regions) + '((1 . 45) + (3 . 117) + (4 . 121) + (7 . 121) + (8 . 45) + (16 . 121) + (28 . 121) + (28 . 121) + (28 . 121)))))) + +(ert-deftest overlay-autogenerated-test-29 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 5 63 nil nil t) + (make-overlay 20 28 nil t t) + (make-overlay 58 53 nil t nil) + (make-overlay 4 57 nil t t) + (make-overlay 4 16 nil nil nil) + (make-overlay 33 26 nil t nil) + (make-overlay 9 32 nil t t) + (make-overlay 11 8 nil nil nil) + (make-overlay 59 35 nil nil t) + (make-overlay 15 25 nil t t) + (make-overlay 36 16 nil nil nil) + (make-overlay 8 37 nil nil nil) + (make-overlay 65 63 nil nil t) + (make-overlay 3 20 nil nil t) + (make-overlay 44 55 nil t t) + (make-overlay 45 25 nil t nil) + (goto-char 39) + (insert "...") + (goto-char 22) + (insert "........") + (goto-char 60) + (insert ".........") + (goto-char 17) + (insert "............") + (goto-char 13) + (widen) + (narrow-to-region 79 16) + (goto-char 19) + (delete-char 11) + (goto-char 25) + (insert "........") + (goto-char 61) + (insert "....") + (goto-char 45) + (widen) + (narrow-to-region 73 66) + (goto-char 71) + (insert "............") + (goto-char 81) + (delete-char 2) + (goto-char 73) + (insert "..........") + (goto-char 74) + (insert "............") + (goto-char 82) + (delete-char 7) + (goto-char 78) + (delete-char 18) + (goto-char 75) + (insert ".........") + (goto-char 66) + (insert ".........") + (goto-char 86) + (delete-char 12) + (goto-char 77) + (widen) + (narrow-to-region 23 55) + (goto-char 43) + (insert ".") + (goto-char 50) + (insert "..") + (goto-char 25) + (delete-char 18) + (goto-char 33) + (delete-char 7) + (goto-char 26) + (insert "........") + (goto-char 29) + (insert "...........") + (goto-char 33) + (insert "...") + (goto-char 40) + (insert "..........") + (goto-char 26) + (insert "") + (goto-char 35) + (insert ".") + (goto-char 59) + (insert ".") + (goto-char 51) + (insert "..") + (goto-char 59) + (insert ".............") + (should + (equal + (test-overlay-regions) + '((4 . 130) + (5 . 136) + (8 . 82) + (9 . 82) + (15 . 25) + (16 . 82) + (21 . 77) + (25 . 105) + (75 . 82)))))) + +(ert-deftest overlay-autogenerated-test-30 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 27 65 nil t t) + (make-overlay 39 51 nil t t) + (make-overlay 53 2 nil nil nil) + (make-overlay 3 17 nil nil t) + (make-overlay 35 4 nil nil t) + (make-overlay 65 53 nil t nil) + (make-overlay 8 21 nil t t) + (make-overlay 18 62 nil t t) + (make-overlay 42 59 nil nil t) + (make-overlay 12 37 nil t t) + (make-overlay 64 31 nil t nil) + (make-overlay 39 54 nil nil t) + (make-overlay 41 24 nil t nil) + (make-overlay 10 21 nil nil t) + (make-overlay 49 15 nil t nil) + (make-overlay 49 63 nil nil t) + (goto-char 43) + (insert "..........") + (goto-char 44) + (delete-char 29) + (goto-char 32) + (insert "..") + (goto-char 13) + (insert ".") + (goto-char 42) + (insert ".........") + (goto-char 39) + (insert "..........") + (goto-char 15) + (insert "............") + (goto-char 58) + (delete-char 9) + (goto-char 63) + (insert ".........") + (goto-char 49) + (insert ".") + (goto-char 28) + (delete-char 51) + (goto-char 12) + (delete-char 6) + (goto-char 20) + (delete-char 2) + (goto-char 7) + (widen) + (narrow-to-region 2 9) + (goto-char 5) + (insert "...............") + (goto-char 18) + (delete-char 1) + (goto-char 4) + (insert ".............") + (goto-char 13) + (delete-char 22) + (goto-char 12) + (insert "") + (goto-char 3) + (insert ".............") + (goto-char 22) + (insert "...............") + (goto-char 9) + (insert "....") + (goto-char 8) + (insert "...........") + (goto-char 6) + (delete-char 34) + (goto-char 21) + (insert "....") + (goto-char 14) + (insert ".....") + (goto-char 20) + (insert ".......") + (goto-char 34) + (widen) + (narrow-to-region 3 2) + (goto-char 3) + (delete-char 0) + (goto-char 2) + (insert "..............") + (goto-char 15) + (delete-char 2) + (goto-char 11) + (insert "......") + (should + (equal + (test-overlay-regions) + '((2 . 68)))))) + +(ert-deftest overlay-autogenerated-test-31 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 54 64 nil nil nil) + (make-overlay 49 12 nil nil t) + (make-overlay 40 12 nil t nil) + (make-overlay 17 38 nil nil nil) + (make-overlay 21 36 nil t t) + (make-overlay 8 38 nil t nil) + (make-overlay 50 22 nil t nil) + (make-overlay 65 15 nil nil t) + (make-overlay 57 60 nil t t) + (make-overlay 35 11 nil nil t) + (make-overlay 49 44 nil nil t) + (make-overlay 45 31 nil nil t) + (make-overlay 51 24 nil t t) + (make-overlay 20 14 nil nil nil) + (make-overlay 6 18 nil t t) + (make-overlay 25 3 nil nil nil) + (goto-char 18) + (delete-char 10) + (goto-char 36) + (delete-char 13) + (goto-char 8) + (delete-char 4) + (goto-char 2) + (delete-char 8) + (goto-char 12) + (delete-char 10) + (goto-char 15) + (delete-char 4) + (goto-char 16) + (insert ".........") + (goto-char 17) + (insert "...............") + (goto-char 33) + (delete-char 0) + (goto-char 38) + (delete-char 0) + (goto-char 11) + (insert "...........") + (goto-char 8) + (delete-char 14) + (goto-char 32) + (insert "........") + (goto-char 40) + (widen) + (narrow-to-region 14 6) + (goto-char 10) + (delete-char 1) + (goto-char 7) + (widen) + (narrow-to-region 18 39) + (goto-char 36) + (delete-char 1) + (goto-char 34) + (widen) + (narrow-to-region 39 14) + (goto-char 22) + (widen) + (narrow-to-region 25 21) + (goto-char 23) + (delete-char 2) + (goto-char 23) + (delete-char 0) + (goto-char 23) + (insert ".........") + (goto-char 32) + (delete-char 0) + (goto-char 31) + (insert ".........") + (goto-char 32) + (insert "...") + (goto-char 30) + (widen) + (narrow-to-region 10 56) + (goto-char 10) + (insert ".........") + (goto-char 38) + (insert ".........") + (goto-char 19) + (insert "..") + (goto-char 11) + (insert "..............") + (goto-char 66) + (insert "...............") + (goto-char 13) + (insert "......") + (should + (equal + (test-overlay-regions) + '((2 . 41) + (3 . 117) + (6 . 41) + (8 . 41) + (9 . 41) + (10 . 42) + (41 . 42)))))) + +(ert-deftest overlay-autogenerated-test-32 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 35 60 nil nil t) + (make-overlay 45 46 nil nil nil) + (make-overlay 47 11 nil nil t) + (make-overlay 12 51 nil t nil) + (make-overlay 61 17 nil t nil) + (make-overlay 7 24 nil t nil) + (make-overlay 36 37 nil nil t) + (make-overlay 5 39 nil t t) + (make-overlay 5 40 nil nil t) + (make-overlay 38 40 nil t t) + (make-overlay 47 45 nil t nil) + (make-overlay 61 48 nil nil nil) + (make-overlay 23 39 nil t t) + (make-overlay 11 52 nil nil nil) + (make-overlay 37 35 nil nil nil) + (make-overlay 19 20 nil t nil) + (goto-char 43) + (insert "........") + (goto-char 7) + (insert "") + (goto-char 28) + (delete-char 41) + (goto-char 3) + (delete-char 17) + (goto-char 2) + (insert ".") + (goto-char 7) + (insert ".........") + (goto-char 21) + (delete-char 4) + (goto-char 13) + (delete-char 1) + (goto-char 2) + (insert "...............") + (goto-char 7) + (insert "") + (goto-char 14) + (insert ".....") + (goto-char 16) + (insert ".") + (goto-char 10) + (insert "..............") + (goto-char 16) + (delete-char 18) + (goto-char 1) + (delete-char 36) + (goto-char 1) + (delete-char 0) + (goto-char 1) + (delete-char 0) + (goto-char 1) + (insert ".............") + (goto-char 9) + (insert ".") + (goto-char 14) + (insert ".....") + (goto-char 9) + (delete-char 0) + (goto-char 15) + (delete-char 0) + (goto-char 6) + (delete-char 4) + (goto-char 11) + (delete-char 5) + (goto-char 5) + (insert "....") + (goto-char 5) + (insert ".....") + (goto-char 12) + (insert "") + (goto-char 13) + (insert ".......") + (goto-char 14) + (insert "......") + (goto-char 9) + (delete-char 3) + (goto-char 17) + (delete-char 0) + (goto-char 7) + (delete-char 12) + (should + (equal + (test-overlay-regions) + '((1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 18) + (1 . 18) + (1 . 18) + (1 . 18) + (18 . 18) + (18 . 18) + (18 . 18)))))) + +(ert-deftest overlay-autogenerated-test-33 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 65 33 nil t nil) + (make-overlay 45 54 nil t t) + (make-overlay 17 38 nil t nil) + (make-overlay 58 46 nil nil t) + (make-overlay 21 36 nil t t) + (make-overlay 31 63 nil nil t) + (make-overlay 37 64 nil t t) + (make-overlay 42 19 nil nil nil) + (make-overlay 51 60 nil t nil) + (make-overlay 47 15 nil t t) + (make-overlay 57 47 nil nil nil) + (make-overlay 40 45 nil nil nil) + (make-overlay 44 47 nil t nil) + (make-overlay 42 35 nil t nil) + (make-overlay 1 65 nil nil t) + (make-overlay 29 63 nil t nil) + (goto-char 33) + (insert "...........") + (goto-char 56) + (insert ".........") + (goto-char 67) + (insert "....") + (goto-char 28) + (delete-char 35) + (goto-char 9) + (insert "......") + (goto-char 43) + (delete-char 17) + (goto-char 29) + (insert ".......") + (goto-char 20) + (insert "....") + (goto-char 53) + (insert ".......") + (goto-char 14) + (widen) + (narrow-to-region 38 57) + (goto-char 51) + (insert "") + (goto-char 57) + (insert ".......") + (goto-char 64) + (insert ".....") + (goto-char 59) + (delete-char 3) + (goto-char 45) + (delete-char 12) + (goto-char 43) + (insert "......") + (goto-char 48) + (insert "......") + (goto-char 52) + (insert "........") + (goto-char 57) + (delete-char 16) + (goto-char 43) + (delete-char 9) + (goto-char 40) + (insert "") + (goto-char 39) + (insert "..........") + (goto-char 50) + (widen) + (narrow-to-region 31 27) + (goto-char 27) + (insert "..........") + (goto-char 33) + (delete-char 0) + (goto-char 37) + (insert "..") + (goto-char 38) + (delete-char 4) + (goto-char 38) + (insert "..........") + (goto-char 45) + (insert ".....") + (goto-char 53) + (insert "...") + (goto-char 51) + (insert ".") + (goto-char 28) + (insert "...") + (should + (equal + (test-overlay-regions) + '((1 . 93) + (25 . 92) + (41 . 88) + (60 . 88)))))) + +(ert-deftest overlay-autogenerated-test-34 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 2 63 nil nil t) + (make-overlay 54 30 nil t nil) + (make-overlay 21 57 nil t nil) + (make-overlay 61 19 nil nil nil) + (make-overlay 55 8 nil nil t) + (make-overlay 14 51 nil nil nil) + (make-overlay 33 13 nil t t) + (make-overlay 36 25 nil t t) + (make-overlay 22 21 nil nil t) + (make-overlay 21 48 nil nil t) + (make-overlay 36 7 nil nil t) + (make-overlay 2 40 nil nil nil) + (make-overlay 21 27 nil nil t) + (make-overlay 26 2 nil nil nil) + (make-overlay 60 43 nil nil nil) + (make-overlay 12 50 nil t t) + (goto-char 44) + (delete-char 6) + (goto-char 5) + (insert "..") + (goto-char 17) + (insert "........") + (goto-char 48) + (insert "..") + (goto-char 27) + (delete-char 29) + (goto-char 10) + (delete-char 2) + (goto-char 35) + (insert ".............") + (goto-char 20) + (delete-char 0) + (goto-char 6) + (insert ".") + (goto-char 9) + (delete-char 6) + (goto-char 38) + (insert ".........") + (goto-char 5) + (insert ".........") + (goto-char 10) + (delete-char 20) + (goto-char 6) + (delete-char 6) + (goto-char 14) + (insert ".............") + (goto-char 31) + (delete-char 10) + (goto-char 20) + (widen) + (narrow-to-region 27 39) + (goto-char 34) + (delete-char 5) + (goto-char 32) + (delete-char 1) + (goto-char 27) + (insert "..") + (goto-char 28) + (insert "........") + (goto-char 39) + (insert "........") + (goto-char 38) + (delete-char 7) + (goto-char 44) + (delete-char 0) + (goto-char 30) + (insert "...............") + (goto-char 43) + (insert "............") + (goto-char 56) + (delete-char 1) + (goto-char 65) + (delete-char 3) + (goto-char 36) + (insert ".........") + (goto-char 74) + (insert ".....") + (goto-char 67) + (delete-char 5) + (goto-char 38) + (insert "..") + (should + (equal + (test-overlay-regions) + '((2 . 80) + (6 . 78)))))) + +(ert-deftest overlay-autogenerated-test-35 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 38 16 nil nil nil) + (make-overlay 19 22 nil t nil) + (make-overlay 16 43 nil nil t) + (make-overlay 27 5 nil nil nil) + (make-overlay 43 34 nil t nil) + (make-overlay 47 4 nil nil t) + (make-overlay 1 47 nil nil t) + (make-overlay 27 35 nil t nil) + (make-overlay 41 41 nil nil t) + (make-overlay 21 19 nil nil nil) + (make-overlay 16 38 nil nil t) + (make-overlay 33 39 nil t nil) + (make-overlay 34 51 nil nil t) + (make-overlay 45 36 nil t nil) + (make-overlay 42 18 nil t t) + (make-overlay 12 30 nil nil nil) + (goto-char 18) + (insert "") + (goto-char 58) + (delete-char 3) + (goto-char 58) + (delete-char 0) + (goto-char 1) + (insert ".......") + (goto-char 48) + (delete-char 17) + (goto-char 39) + (delete-char 6) + (goto-char 33) + (widen) + (narrow-to-region 45 46) + (goto-char 46) + (insert "") + (goto-char 46) + (delete-char 0) + (goto-char 46) + (insert ".....") + (goto-char 51) + (widen) + (narrow-to-region 17 26) + (goto-char 25) + (widen) + (narrow-to-region 50 41) + (goto-char 45) + (insert "..............") + (goto-char 59) + (insert "...........") + (goto-char 47) + (delete-char 9) + (goto-char 59) + (insert "") + (goto-char 46) + (insert "") + (goto-char 54) + (delete-char 5) + (goto-char 57) + (widen) + (narrow-to-region 57 31) + (goto-char 42) + (delete-char 2) + (goto-char 52) + (insert "....") + (goto-char 44) + (insert "..") + (goto-char 44) + (insert "...............") + (goto-char 72) + (delete-char 1) + (goto-char 66) + (delete-char 6) + (goto-char 64) + (delete-char 5) + (goto-char 49) + (delete-char 12) + (goto-char 32) + (insert "......") + (goto-char 44) + (delete-char 2) + (goto-char 39) + (delete-char 12) + (goto-char 42) + (insert "......") + (goto-char 36) + (widen) + (narrow-to-region 14 47) + (should + (equal + (test-overlay-regions) + '((1 . 39) + (11 . 39) + (12 . 39) + (19 . 39) + (23 . 39) + (23 . 39) + (23 . 39) + (25 . 39) + (26 . 28) + (26 . 29) + (39 . 39) + (39 . 39) + (39 . 39) + (39 . 39) + (39 . 39) + (39 . 39)))))) + +(ert-deftest overlay-autogenerated-test-36 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 1 38 nil t t) + (make-overlay 58 34 nil t nil) + (make-overlay 6 33 nil nil t) + (make-overlay 63 54 nil nil t) + (make-overlay 54 54 nil t t) + (make-overlay 21 61 nil nil nil) + (make-overlay 64 55 nil nil t) + (make-overlay 28 65 nil nil t) + (make-overlay 32 51 nil t nil) + (make-overlay 36 38 nil nil nil) + (make-overlay 35 21 nil nil nil) + (make-overlay 65 48 nil nil nil) + (make-overlay 32 27 nil nil t) + (make-overlay 27 55 nil t t) + (make-overlay 30 22 nil t nil) + (make-overlay 14 58 nil t nil) + (goto-char 40) + (delete-char 7) + (goto-char 42) + (insert "......") + (goto-char 11) + (widen) + (narrow-to-region 64 9) + (goto-char 21) + (delete-char 23) + (goto-char 24) + (insert "...") + (goto-char 13) + (insert "..........") + (goto-char 12) + (delete-char 5) + (goto-char 10) + (delete-char 0) + (goto-char 21) + (widen) + (narrow-to-region 9 5) + (goto-char 6) + (delete-char 0) + (goto-char 9) + (delete-char 0) + (goto-char 9) + (delete-char 0) + (goto-char 7) + (insert "............") + (goto-char 9) + (insert "...") + (goto-char 18) + (insert ".") + (goto-char 23) + (delete-char 1) + (goto-char 9) + (insert "....") + (goto-char 6) + (insert ".....") + (goto-char 23) + (widen) + (narrow-to-region 28 1) + (goto-char 6) + (insert "...........") + (goto-char 30) + (delete-char 8) + (goto-char 2) + (insert ".") + (goto-char 18) + (insert "......") + (goto-char 5) + (delete-char 9) + (goto-char 5) + (delete-char 20) + (goto-char 4) + (delete-char 3) + (goto-char 3) + (delete-char 2) + (goto-char 3) + (delete-char 0) + (goto-char 1) + (insert "......") + (goto-char 8) + (widen) + (narrow-to-region 39 2) + (goto-char 13) + (delete-char 12) + (goto-char 24) + (delete-char 0) + (should + (equal + (test-overlay-regions) + '((7 . 20) + (9 . 20) + (13 . 36) + (20 . 20) + (20 . 20) + (20 . 20) + (20 . 20) + (20 . 29) + (20 . 33) + (20 . 36) + (20 . 39) + (20 . 43) + (20 . 43)))))) + +(ert-deftest overlay-autogenerated-test-37 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 26 30 nil nil nil) + (make-overlay 55 50 nil nil t) + (make-overlay 43 54 nil nil t) + (make-overlay 53 48 nil nil nil) + (make-overlay 37 51 nil nil t) + (make-overlay 15 30 nil nil nil) + (make-overlay 2 24 nil t t) + (make-overlay 56 61 nil t nil) + (make-overlay 65 46 nil t nil) + (make-overlay 28 47 nil t nil) + (make-overlay 21 24 nil t t) + (make-overlay 17 13 nil t t) + (make-overlay 7 44 nil t nil) + (make-overlay 28 63 nil nil nil) + (make-overlay 22 16 nil t t) + (make-overlay 26 44 nil t t) + (goto-char 57) + (delete-char 6) + (goto-char 42) + (insert ".....") + (goto-char 63) + (insert ".............") + (goto-char 17) + (insert "") + (goto-char 57) + (insert "...........") + (goto-char 3) + (delete-char 47) + (goto-char 15) + (insert ".............") + (goto-char 28) + (insert "") + (goto-char 17) + (delete-char 31) + (goto-char 7) + (delete-char 16) + (goto-char 2) + (insert "...........") + (goto-char 2) + (insert "..") + (goto-char 18) + (widen) + (narrow-to-region 20 8) + (goto-char 13) + (widen) + (narrow-to-region 12 10) + (goto-char 10) + (delete-char 1) + (goto-char 11) + (delete-char 0) + (goto-char 10) + (insert "...") + (goto-char 11) + (delete-char 0) + (goto-char 13) + (insert "..") + (goto-char 16) + (delete-char 0) + (goto-char 10) + (delete-char 2) + (goto-char 11) + (insert ".....") + (goto-char 16) + (widen) + (narrow-to-region 6 13) + (goto-char 10) + (insert "..") + (goto-char 6) + (delete-char 6) + (goto-char 8) + (insert "...............") + (goto-char 21) + (delete-char 0) + (goto-char 21) + (widen) + (narrow-to-region 36 11) + (goto-char 12) + (insert "...............") + (goto-char 19) + (insert ".......") + (goto-char 56) + (delete-char 2) + (goto-char 42) + (delete-char 11) + (should + (equal + (test-overlay-regions) + '((44 . 45)))))) + +(ert-deftest overlay-autogenerated-test-38 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 29 13 nil t t) + (make-overlay 19 28 nil nil t) + (make-overlay 47 33 nil nil nil) + (make-overlay 8 44 nil t nil) + (make-overlay 48 4 nil t nil) + (make-overlay 8 20 nil t t) + (make-overlay 38 31 nil nil t) + (make-overlay 17 65 nil nil t) + (make-overlay 49 31 nil nil nil) + (make-overlay 39 19 nil nil t) + (make-overlay 40 49 nil t t) + (make-overlay 24 16 nil t t) + (make-overlay 4 41 nil t nil) + (make-overlay 61 42 nil t nil) + (make-overlay 46 11 nil nil nil) + (make-overlay 1 43 nil nil t) + (goto-char 62) + (delete-char 2) + (goto-char 25) + (widen) + (narrow-to-region 30 38) + (goto-char 37) + (delete-char 1) + (goto-char 37) + (insert "...........") + (goto-char 41) + (delete-char 3) + (goto-char 39) + (delete-char 5) + (goto-char 39) + (widen) + (narrow-to-region 31 9) + (goto-char 11) + (insert "..............") + (goto-char 9) + (widen) + (narrow-to-region 62 30) + (goto-char 32) + (widen) + (narrow-to-region 17 48) + (goto-char 39) + (delete-char 7) + (goto-char 24) + (delete-char 8) + (goto-char 19) + (insert "") + (goto-char 25) + (delete-char 5) + (goto-char 28) + (delete-char 0) + (goto-char 22) + (widen) + (narrow-to-region 52 35) + (goto-char 49) + (delete-char 0) + (goto-char 49) + (delete-char 3) + (goto-char 48) + (insert "...........") + (goto-char 37) + (delete-char 23) + (goto-char 36) + (delete-char 0) + (goto-char 35) + (insert "....") + (goto-char 35) + (insert "..") + (goto-char 39) + (delete-char 4) + (goto-char 39) + (delete-char 0) + (goto-char 36) + (delete-char 3) + (goto-char 36) + (delete-char 0) + (goto-char 36) + (delete-char 0) + (goto-char 36) + (delete-char 0) + (goto-char 36) + (insert ".....") + (goto-char 38) + (delete-char 1) + (goto-char 35) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((1 . 37) + (24 . 44) + (25 . 37)))))) + +(ert-deftest overlay-autogenerated-test-39 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 15 49 nil t t) + (make-overlay 27 20 nil t nil) + (make-overlay 55 50 nil t nil) + (make-overlay 17 5 nil t t) + (make-overlay 26 56 nil nil t) + (make-overlay 42 11 nil t t) + (make-overlay 24 35 nil nil t) + (make-overlay 47 45 nil t t) + (make-overlay 37 12 nil nil t) + (make-overlay 17 25 nil t nil) + (make-overlay 32 53 nil nil nil) + (make-overlay 20 34 nil nil t) + (make-overlay 56 58 nil nil t) + (make-overlay 42 31 nil nil t) + (make-overlay 22 55 nil t t) + (make-overlay 55 11 nil t nil) + (goto-char 16) + (insert ".............") + (goto-char 30) + (insert ".") + (goto-char 12) + (delete-char 56) + (goto-char 9) + (insert ".............") + (goto-char 6) + (insert "....") + (goto-char 19) + (delete-char 19) + (goto-char 19) + (insert "...............") + (goto-char 13) + (delete-char 21) + (goto-char 7) + (delete-char 0) + (goto-char 14) + (widen) + (narrow-to-region 5 6) + (goto-char 5) + (delete-char 0) + (goto-char 6) + (insert "......") + (goto-char 10) + (delete-char 0) + (goto-char 7) + (widen) + (narrow-to-region 2 6) + (goto-char 2) + (insert "..........") + (goto-char 2) + (delete-char 9) + (goto-char 7) + (insert "...") + (goto-char 9) + (insert "...") + (goto-char 10) + (insert "......") + (goto-char 4) + (delete-char 14) + (goto-char 4) + (insert ".") + (goto-char 5) + (insert "..............") + (goto-char 13) + (insert "......") + (goto-char 10) + (insert "......") + (goto-char 20) + (insert "............") + (goto-char 16) + (widen) + (narrow-to-region 3 32) + (goto-char 18) + (insert "..") + (goto-char 6) + (insert "......") + (goto-char 38) + (delete-char 0) + (goto-char 31) + (insert "............") + (goto-char 28) + (insert "") + (goto-char 9) + (delete-char 23) + (should + (equal + (test-overlay-regions) + 'nil)))) + +(ert-deftest overlay-autogenerated-test-40 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 52 3 nil t nil) + (make-overlay 35 41 nil t t) + (make-overlay 4 2 nil t nil) + (make-overlay 51 48 nil nil t) + (make-overlay 44 57 nil t t) + (make-overlay 13 32 nil nil nil) + (make-overlay 46 29 nil t nil) + (make-overlay 28 13 nil t nil) + (make-overlay 10 65 nil t t) + (make-overlay 41 48 nil nil t) + (make-overlay 36 44 nil nil t) + (make-overlay 29 61 nil t nil) + (make-overlay 25 24 nil nil t) + (make-overlay 22 45 nil nil t) + (make-overlay 37 55 nil nil t) + (make-overlay 36 39 nil nil nil) + (goto-char 16) + (delete-char 48) + (goto-char 17) + (delete-char 0) + (goto-char 7) + (insert "..............") + (goto-char 30) + (insert "........") + (goto-char 11) + (insert "..........") + (goto-char 5) + (delete-char 14) + (goto-char 19) + (insert ".") + (goto-char 27) + (insert "..") + (goto-char 35) + (delete-char 1) + (goto-char 29) + (delete-char 0) + (goto-char 33) + (delete-char 2) + (goto-char 33) + (insert "..") + (goto-char 28) + (insert ".........") + (goto-char 30) + (delete-char 4) + (goto-char 40) + (delete-char 1) + (goto-char 15) + (widen) + (narrow-to-region 40 8) + (goto-char 10) + (delete-char 13) + (goto-char 11) + (delete-char 5) + (goto-char 15) + (insert "........") + (goto-char 26) + (delete-char 4) + (goto-char 11) + (delete-char 1) + (goto-char 14) + (insert "............") + (goto-char 33) + (insert ".") + (goto-char 10) + (insert "...") + (goto-char 30) + (widen) + (narrow-to-region 28 9) + (goto-char 27) + (delete-char 0) + (goto-char 27) + (delete-char 1) + (goto-char 26) + (insert "..") + (goto-char 27) + (insert "..") + (goto-char 20) + (delete-char 5) + (goto-char 12) + (widen) + (narrow-to-region 40 30) + (goto-char 37) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((13 . 37) + (14 . 37) + (14 . 37) + (14 . 37) + (14 . 37) + (14 . 37) + (14 . 37) + (37 . 37) + (37 . 37)))))) + +(ert-deftest overlay-autogenerated-test-41 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 28 48 nil nil t) + (make-overlay 30 11 nil nil t) + (make-overlay 7 12 nil t nil) + (make-overlay 65 35 nil t nil) + (make-overlay 22 61 nil t nil) + (make-overlay 37 42 nil nil nil) + (make-overlay 33 38 nil nil t) + (make-overlay 48 45 nil t t) + (make-overlay 45 62 nil t nil) + (make-overlay 63 7 nil nil t) + (make-overlay 23 42 nil t nil) + (make-overlay 21 4 nil t nil) + (make-overlay 64 41 nil t nil) + (make-overlay 20 33 nil t t) + (make-overlay 41 26 nil t nil) + (make-overlay 43 31 nil t t) + (goto-char 55) + (delete-char 3) + (goto-char 12) + (insert "..") + (goto-char 62) + (insert "") + (goto-char 24) + (delete-char 2) + (goto-char 41) + (insert "............") + (goto-char 2) + (insert ".") + (goto-char 55) + (insert "........") + (goto-char 67) + (delete-char 6) + (goto-char 58) + (delete-char 10) + (goto-char 29) + (insert "") + (goto-char 6) + (widen) + (narrow-to-region 44 45) + (goto-char 44) + (delete-char 1) + (goto-char 44) + (widen) + (narrow-to-region 24 37) + (goto-char 30) + (delete-char 7) + (goto-char 27) + (insert "......") + (goto-char 35) + (delete-char 0) + (goto-char 32) + (insert "...............") + (goto-char 37) + (delete-char 9) + (goto-char 40) + (insert "..........") + (goto-char 35) + (insert "......") + (goto-char 25) + (delete-char 7) + (goto-char 40) + (delete-char 4) + (goto-char 25) + (delete-char 14) + (goto-char 28) + (insert "") + (goto-char 28) + (widen) + (narrow-to-region 17 43) + (goto-char 20) + (insert "..........") + (goto-char 22) + (delete-char 2) + (goto-char 48) + (insert "............") + (goto-char 47) + (insert ".........") + (goto-char 69) + (widen) + (narrow-to-region 52 25) + (goto-char 26) + (insert "......") + (goto-char 53) + (insert "..") + (should + (equal + (test-overlay-regions) + '((5 . 38) + (8 . 97) + (12 . 47) + (37 . 47) + (39 . 52) + (39 . 87) + (39 . 95) + (46 . 90) + (47 . 49) + (47 . 90) + (47 . 99) + (48 . 87)))))) + +(ert-deftest overlay-autogenerated-test-42 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 20 23 nil nil nil) + (make-overlay 45 51 nil t nil) + (make-overlay 34 58 nil t nil) + (make-overlay 27 11 nil nil nil) + (make-overlay 14 8 nil t t) + (make-overlay 64 43 nil t nil) + (make-overlay 61 56 nil nil t) + (make-overlay 28 14 nil t nil) + (make-overlay 21 46 nil t t) + (make-overlay 30 34 nil t t) + (make-overlay 47 40 nil nil nil) + (make-overlay 5 44 nil t t) + (make-overlay 11 45 nil nil nil) + (make-overlay 65 8 nil nil t) + (make-overlay 47 54 nil t t) + (make-overlay 37 57 nil t nil) + (goto-char 11) + (insert "....") + (goto-char 65) + (delete-char 0) + (goto-char 56) + (delete-char 4) + (goto-char 11) + (delete-char 2) + (goto-char 23) + (insert ".............") + (goto-char 2) + (insert "............") + (goto-char 84) + (delete-char 1) + (goto-char 10) + (insert "..............") + (goto-char 19) + (insert "............") + (goto-char 69) + (delete-char 6) + (goto-char 15) + (insert "........") + (goto-char 104) + (insert "") + (goto-char 94) + (delete-char 11) + (goto-char 66) + (insert ".....") + (goto-char 67) + (insert "") + (goto-char 53) + (delete-char 22) + (goto-char 42) + (insert ".") + (goto-char 38) + (delete-char 13) + (goto-char 27) + (insert "......") + (goto-char 16) + (insert "............") + (goto-char 71) + (widen) + (narrow-to-region 59 15) + (goto-char 46) + (insert "..") + (goto-char 20) + (widen) + (narrow-to-region 95 93) + (goto-char 94) + (insert ".............") + (goto-char 103) + (widen) + (narrow-to-region 97 7) + (goto-char 93) + (insert "....") + (goto-char 85) + (insert "...........") + (goto-char 69) + (delete-char 24) + (goto-char 87) + (insert ".............") + (goto-char 7) + (delete-char 28) + (goto-char 65) + (delete-char 8) + (goto-char 48) + (insert "......") + (should + (equal + (test-overlay-regions) + '((31 . 44) + (33 . 33) + (33 . 41) + (33 . 41) + (33 . 41) + (33 . 41) + (33 . 82) + (40 . 44) + (41 . 41) + (41 . 41) + (41 . 47) + (41 . 48) + (44 . 45) + (44 . 46) + (44 . 63) + (46 . 57)))))) + +(ert-deftest overlay-autogenerated-test-43 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 8 53 nil t nil) + (make-overlay 11 50 nil t nil) + (make-overlay 1 30 nil nil nil) + (make-overlay 54 15 nil t t) + (make-overlay 22 30 nil nil nil) + (make-overlay 1 33 nil nil nil) + (make-overlay 18 15 nil t nil) + (make-overlay 43 39 nil nil t) + (make-overlay 43 17 nil t nil) + (make-overlay 2 29 nil t nil) + (make-overlay 57 42 nil t nil) + (make-overlay 40 1 nil nil nil) + (make-overlay 8 64 nil nil nil) + (make-overlay 64 15 nil nil nil) + (make-overlay 9 11 nil nil t) + (make-overlay 40 21 nil t nil) + (goto-char 5) + (delete-char 37) + (goto-char 25) + (delete-char 2) + (goto-char 17) + (insert "...........") + (goto-char 19) + (widen) + (narrow-to-region 20 20) + (goto-char 20) + (delete-char 0) + (goto-char 20) + (insert "..........") + (goto-char 24) + (delete-char 5) + (goto-char 24) + (insert "...") + (goto-char 28) + (widen) + (narrow-to-region 20 36) + (goto-char 26) + (delete-char 2) + (goto-char 31) + (insert ".............") + (goto-char 22) + (insert ".....") + (goto-char 38) + (delete-char 0) + (goto-char 31) + (delete-char 4) + (goto-char 27) + (insert "...") + (goto-char 23) + (widen) + (narrow-to-region 37 20) + (goto-char 22) + (insert ".............") + (goto-char 33) + (insert "......") + (goto-char 43) + (insert "............") + (goto-char 59) + (insert ".......") + (goto-char 25) + (delete-char 26) + (goto-char 49) + (insert ".........") + (goto-char 50) + (insert ".......") + (goto-char 39) + (widen) + (narrow-to-region 54 86) + (goto-char 64) + (insert "...............") + (goto-char 83) + (insert "............") + (goto-char 70) + (insert "........") + (goto-char 58) + (insert "..............") + (goto-char 83) + (insert "............") + (goto-char 83) + (insert "..........") + (goto-char 69) + (delete-char 75) + (goto-char 75) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((5 . 75) + (5 . 75) + (5 . 80) + (5 . 80)))))) + +(ert-deftest overlay-autogenerated-test-44 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 8 48 nil nil t) + (make-overlay 52 38 nil nil nil) + (make-overlay 3 63 nil nil nil) + (make-overlay 44 15 nil nil t) + (make-overlay 27 44 nil nil t) + (make-overlay 43 9 nil nil t) + (make-overlay 11 27 nil t nil) + (make-overlay 36 41 nil nil t) + (make-overlay 23 25 nil t t) + (make-overlay 19 60 nil t t) + (make-overlay 11 55 nil t nil) + (make-overlay 59 2 nil t nil) + (make-overlay 32 64 nil t nil) + (make-overlay 15 8 nil nil nil) + (make-overlay 61 15 nil nil nil) + (make-overlay 64 30 nil t t) + (goto-char 42) + (delete-char 20) + (goto-char 44) + (delete-char 1) + (goto-char 43) + (insert "...........") + (goto-char 43) + (delete-char 1) + (goto-char 28) + (delete-char 8) + (goto-char 37) + (delete-char 9) + (goto-char 4) + (delete-char 30) + (goto-char 6) + (delete-char 0) + (goto-char 7) + (delete-char 0) + (goto-char 2) + (delete-char 2) + (goto-char 5) + (delete-char 0) + (goto-char 5) + (delete-char 0) + (goto-char 2) + (insert ".....") + (goto-char 10) + (insert "...........") + (goto-char 21) + (insert "...") + (goto-char 10) + (delete-char 13) + (goto-char 9) + (insert "..........") + (goto-char 16) + (delete-char 1) + (goto-char 16) + (delete-char 4) + (goto-char 16) + (delete-char 0) + (goto-char 14) + (delete-char 1) + (goto-char 3) + (widen) + (narrow-to-region 2 9) + (goto-char 2) + (insert "") + (goto-char 2) + (insert ".............") + (goto-char 17) + (insert "....") + (goto-char 12) + (insert "........") + (goto-char 8) + (widen) + (narrow-to-region 32 23) + (goto-char 29) + (insert ".....") + (goto-char 35) + (delete-char 2) + (goto-char 27) + (delete-char 7) + (goto-char 23) + (widen) + (narrow-to-region 4 14) + (goto-char 8) + (insert "...............") + (should + (equal + (test-overlay-regions) + '((2 . 43) + (2 . 43) + (2 . 43) + (2 . 43) + (2 . 43) + (2 . 44)))))) + +(ert-deftest overlay-autogenerated-test-45 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 15 48 nil nil nil) + (make-overlay 1 47 nil t nil) + (make-overlay 43 4 nil t t) + (make-overlay 9 45 nil t t) + (make-overlay 1 25 nil t t) + (make-overlay 5 46 nil t t) + (make-overlay 7 14 nil t nil) + (make-overlay 1 53 nil nil t) + (make-overlay 13 41 nil t nil) + (make-overlay 5 31 nil t t) + (make-overlay 26 10 nil nil nil) + (make-overlay 56 37 nil nil nil) + (make-overlay 23 15 nil t nil) + (make-overlay 62 30 nil t t) + (make-overlay 2 35 nil t t) + (make-overlay 46 41 nil nil nil) + (goto-char 65) + (delete-char 0) + (goto-char 55) + (insert "...........") + (goto-char 22) + (insert "") + (goto-char 73) + (delete-char 3) + (goto-char 43) + (widen) + (narrow-to-region 54 63) + (goto-char 56) + (insert "......") + (goto-char 61) + (delete-char 3) + (goto-char 65) + (insert "......") + (goto-char 66) + (insert ".....") + (goto-char 62) + (insert ".") + (goto-char 74) + (insert ".........") + (goto-char 76) + (delete-char 4) + (goto-char 56) + (widen) + (narrow-to-region 2 46) + (goto-char 43) + (insert "...........") + (goto-char 20) + (delete-char 4) + (goto-char 38) + (delete-char 7) + (goto-char 25) + (delete-char 21) + (goto-char 12) + (insert ".........") + (goto-char 19) + (widen) + (narrow-to-region 72 61) + (goto-char 63) + (insert "") + (goto-char 65) + (delete-char 4) + (goto-char 61) + (delete-char 5) + (goto-char 63) + (delete-char 0) + (goto-char 63) + (delete-char 0) + (goto-char 62) + (delete-char 0) + (goto-char 61) + (insert "............") + (goto-char 72) + (insert "..............") + (goto-char 62) + (delete-char 7) + (goto-char 71) + (delete-char 5) + (goto-char 75) + (widen) + (narrow-to-region 29 8) + (goto-char 17) + (delete-char 2) + (goto-char 27) + (insert "........") + (should + (equal + (test-overlay-regions) + '((1 . 36) + (1 . 41) + (1 . 47) + (2 . 40) + (4 . 40) + (5 . 40) + (5 . 40) + (7 . 21) + (9 . 40) + (10 . 37) + (20 . 40) + (22 . 27) + (22 . 42)))))) + +(ert-deftest overlay-autogenerated-test-46 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 2 43 nil nil t) + (make-overlay 44 40 nil nil t) + (make-overlay 49 14 nil nil t) + (make-overlay 6 55 nil nil nil) + (make-overlay 13 52 nil t t) + (make-overlay 40 54 nil t nil) + (make-overlay 51 41 nil nil t) + (make-overlay 7 28 nil nil t) + (make-overlay 10 47 nil nil t) + (make-overlay 63 21 nil t nil) + (make-overlay 4 55 nil nil nil) + (make-overlay 52 58 nil t nil) + (make-overlay 62 11 nil t t) + (make-overlay 22 49 nil t nil) + (make-overlay 23 65 nil nil nil) + (make-overlay 50 33 nil nil t) + (goto-char 22) + (insert "..............") + (goto-char 12) + (insert "....") + (goto-char 25) + (delete-char 16) + (goto-char 14) + (delete-char 53) + (goto-char 2) + (insert "............") + (goto-char 20) + (delete-char 5) + (goto-char 11) + (delete-char 7) + (goto-char 9) + (widen) + (narrow-to-region 11 7) + (goto-char 8) + (insert "...............") + (goto-char 12) + (delete-char 4) + (goto-char 21) + (insert "...") + (goto-char 20) + (delete-char 5) + (goto-char 7) + (delete-char 3) + (goto-char 16) + (delete-char 0) + (goto-char 12) + (delete-char 1) + (goto-char 15) + (delete-char 0) + (goto-char 7) + (insert "..............") + (goto-char 17) + (insert "...........") + (goto-char 15) + (insert "............") + (goto-char 20) + (delete-char 5) + (goto-char 7) + (insert "....") + (goto-char 37) + (delete-char 7) + (goto-char 8) + (insert "..........") + (goto-char 47) + (insert ".............") + (goto-char 65) + (insert ".......") + (goto-char 39) + (delete-char 26) + (goto-char 14) + (delete-char 2) + (goto-char 27) + (insert ".............") + (goto-char 17) + (widen) + (narrow-to-region 54 32) + (goto-char 40) + (widen) + (narrow-to-region 10 3) + (goto-char 7) + (insert "........") + (goto-char 13) + (insert "..............") + (should + (equal + (test-overlay-regions) + '((2 . 85)))))) + +(ert-deftest overlay-autogenerated-test-47 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 58 62 nil t nil) + (make-overlay 14 38 nil nil nil) + (make-overlay 63 44 nil t t) + (make-overlay 41 41 nil nil t) + (make-overlay 19 39 nil nil nil) + (make-overlay 10 49 nil t t) + (make-overlay 56 38 nil t t) + (make-overlay 23 38 nil nil t) + (make-overlay 1 64 nil nil t) + (make-overlay 21 3 nil t nil) + (make-overlay 1 1 nil nil t) + (make-overlay 27 61 nil nil nil) + (make-overlay 29 59 nil nil nil) + (make-overlay 37 30 nil t nil) + (make-overlay 47 21 nil nil t) + (make-overlay 34 26 nil t nil) + (goto-char 6) + (delete-char 44) + (goto-char 8) + (delete-char 0) + (goto-char 8) + (insert "....") + (goto-char 17) + (delete-char 2) + (goto-char 12) + (insert "...") + (goto-char 20) + (insert "") + (goto-char 2) + (delete-char 20) + (goto-char 1) + (insert ".........") + (goto-char 7) + (insert ".............") + (goto-char 27) + (delete-char 0) + (goto-char 15) + (insert "..........") + (goto-char 36) + (insert "..............") + (goto-char 26) + (insert "..............") + (goto-char 63) + (insert "...........") + (goto-char 9) + (insert "............") + (goto-char 71) + (delete-char 17) + (goto-char 36) + (insert "....") + (goto-char 45) + (delete-char 31) + (goto-char 28) + (delete-char 8) + (goto-char 10) + (delete-char 16) + (goto-char 14) + (delete-char 4) + (goto-char 16) + (delete-char 0) + (goto-char 15) + (insert "") + (goto-char 14) + (delete-char 1) + (goto-char 10) + (delete-char 2) + (goto-char 6) + (delete-char 0) + (goto-char 1) + (insert ".........") + (goto-char 23) + (insert "......") + (goto-char 25) + (insert "..........") + (goto-char 25) + (widen) + (narrow-to-region 10 30) + (goto-char 21) + (delete-char 1) + (goto-char 17) + (insert "..........") + (should + (equal + (test-overlay-regions) + '((1 . 48) + (1 . 48) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 32) + (32 . 48) + (32 . 48) + (32 . 48)))))) + +(ert-deftest overlay-autogenerated-test-48 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 1 11 nil nil nil) + (make-overlay 35 29 nil t t) + (make-overlay 24 46 nil nil t) + (make-overlay 15 43 nil nil t) + (make-overlay 51 49 nil t t) + (make-overlay 25 43 nil t nil) + (make-overlay 23 59 nil nil nil) + (make-overlay 10 4 nil t nil) + (make-overlay 40 45 nil nil nil) + (make-overlay 42 43 nil nil t) + (make-overlay 20 38 nil t nil) + (make-overlay 17 49 nil nil nil) + (make-overlay 9 25 nil nil t) + (make-overlay 13 19 nil nil nil) + (make-overlay 44 31 nil t nil) + (make-overlay 12 65 nil nil t) + (goto-char 59) + (widen) + (narrow-to-region 28 14) + (goto-char 26) + (insert "...") + (goto-char 30) + (delete-char 1) + (goto-char 23) + (insert "...") + (goto-char 27) + (widen) + (narrow-to-region 45 67) + (goto-char 50) + (insert "...............") + (goto-char 59) + (insert "..............") + (goto-char 55) + (insert ".............") + (goto-char 106) + (delete-char 0) + (goto-char 97) + (delete-char 10) + (goto-char 67) + (delete-char 16) + (goto-char 76) + (insert "..............") + (goto-char 71) + (insert ".............") + (goto-char 110) + (delete-char 0) + (goto-char 56) + (delete-char 38) + (goto-char 61) + (delete-char 10) + (goto-char 56) + (delete-char 5) + (goto-char 49) + (insert ".......") + (goto-char 62) + (insert "...") + (goto-char 54) + (insert "..........") + (goto-char 47) + (delete-char 10) + (goto-char 47) + (delete-char 20) + (goto-char 46) + (insert ".............") + (goto-char 56) + (insert "...........") + (goto-char 70) + (delete-char 1) + (goto-char 62) + (widen) + (narrow-to-region 50 64) + (goto-char 60) + (insert "..") + (goto-char 55) + (delete-char 6) + (goto-char 60) + (insert ".............") + (goto-char 61) + (delete-char 9) + (goto-char 64) + (delete-char 0) + (goto-char 53) + (widen) + (narrow-to-region 15 62) + (should + (equal + (test-overlay-regions) + '((9 . 28) + (12 . 73) + (13 . 19) + (15 . 70) + (17 . 70) + (20 . 43) + (23 . 70) + (27 . 70) + (28 . 70) + (34 . 40) + (36 . 70) + (45 . 70)))))) + +(ert-deftest overlay-autogenerated-test-49 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 24 10 nil nil t) + (make-overlay 53 23 nil t nil) + (make-overlay 53 9 nil nil t) + (make-overlay 65 64 nil t t) + (make-overlay 48 2 nil nil t) + (make-overlay 12 58 nil nil t) + (make-overlay 64 64 nil nil nil) + (make-overlay 26 13 nil t t) + (make-overlay 46 26 nil nil t) + (make-overlay 28 59 nil t t) + (make-overlay 33 52 nil nil nil) + (make-overlay 39 8 nil t t) + (make-overlay 9 59 nil t t) + (make-overlay 50 45 nil nil t) + (make-overlay 41 53 nil nil t) + (make-overlay 51 51 nil t nil) + (goto-char 61) + (insert "..............") + (goto-char 19) + (widen) + (narrow-to-region 10 65) + (goto-char 65) + (delete-char 0) + (goto-char 11) + (insert "...............") + (goto-char 77) + (delete-char 0) + (goto-char 51) + (insert "...") + (goto-char 75) + (insert ".....") + (goto-char 77) + (delete-char 11) + (goto-char 45) + (delete-char 0) + (goto-char 24) + (widen) + (narrow-to-region 33 52) + (goto-char 46) + (insert "..............") + (goto-char 46) + (insert "..........") + (goto-char 39) + (widen) + (narrow-to-region 46 77) + (goto-char 77) + (insert "..............") + (goto-char 54) + (insert ".......") + (goto-char 87) + (insert ".") + (goto-char 70) + (delete-char 16) + (goto-char 79) + (delete-char 0) + (goto-char 73) + (widen) + (narrow-to-region 74 100) + (goto-char 91) + (insert ".............") + (goto-char 80) + (delete-char 11) + (goto-char 82) + (insert "......") + (goto-char 108) + (delete-char 0) + (goto-char 104) + (insert ".....") + (goto-char 100) + (delete-char 1) + (goto-char 90) + (insert ".............") + (goto-char 99) + (insert ".............") + (goto-char 124) + (insert "..............") + (goto-char 114) + (insert "....") + (goto-char 134) + (delete-char 0) + (goto-char 89) + (delete-char 65) + (goto-char 75) + (delete-char 16) + (should + (equal + (test-overlay-regions) + '((2 . 75) + (8 . 75) + (9 . 76) + (9 . 82) + (27 . 82) + (38 . 76) + (41 . 75) + (43 . 82) + (70 . 75)))))) + +(ert-deftest overlay-autogenerated-test-50 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 29 53 nil t t) + (make-overlay 65 64 nil nil nil) + (make-overlay 3 31 nil nil t) + (make-overlay 45 59 nil t nil) + (make-overlay 60 37 nil t t) + (make-overlay 7 5 nil t t) + (make-overlay 37 24 nil nil nil) + (make-overlay 45 20 nil nil nil) + (make-overlay 33 42 nil nil t) + (make-overlay 47 57 nil t nil) + (make-overlay 14 49 nil t t) + (make-overlay 14 30 nil t nil) + (make-overlay 21 40 nil t t) + (make-overlay 5 45 nil t t) + (make-overlay 59 40 nil t t) + (make-overlay 37 52 nil nil nil) + (goto-char 48) + (insert "") + (goto-char 7) + (insert ".........") + (goto-char 31) + (insert "...........") + (goto-char 41) + (delete-char 7) + (goto-char 21) + (delete-char 11) + (goto-char 41) + (widen) + (narrow-to-region 51 53) + (goto-char 52) + (insert ".....") + (goto-char 55) + (widen) + (narrow-to-region 18 24) + (goto-char 23) + (widen) + (narrow-to-region 39 38) + (goto-char 38) + (insert ".............") + (goto-char 41) + (insert "......") + (goto-char 38) + (insert "..............") + (goto-char 52) + (insert "...............") + (goto-char 78) + (delete-char 5) + (goto-char 50) + (insert "..........") + (goto-char 50) + (delete-char 3) + (goto-char 85) + (widen) + (narrow-to-region 86 1) + (goto-char 5) + (insert "....") + (goto-char 69) + (insert "...........") + (goto-char 94) + (insert "......") + (goto-char 98) + (delete-char 7) + (goto-char 46) + (insert "...............") + (goto-char 79) + (insert "............") + (goto-char 89) + (insert "") + (goto-char 14) + (delete-char 63) + (goto-char 20) + (insert ".........") + (goto-char 34) + (insert "...") + (goto-char 53) + (delete-char 14) + (goto-char 6) + (widen) + (narrow-to-region 6 52) + (goto-char 42) + (insert "...........") + (goto-char 40) + (insert ".......") + (goto-char 46) + (widen) + (narrow-to-region 1 68) + (should + (equal + (test-overlay-regions) + '((3 . 14) + (9 . 14) + (9 . 91) + (14 . 14) + (14 . 83) + (14 . 86) + (14 . 88) + (14 . 91) + (14 . 95) + (14 . 104)))))) + +(ert-deftest overlay-autogenerated-test-51 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 14 5 nil t nil) + (make-overlay 62 34 nil nil t) + (make-overlay 7 62 nil nil t) + (make-overlay 23 12 nil t t) + (make-overlay 16 4 nil nil nil) + (make-overlay 24 15 nil nil nil) + (make-overlay 6 6 nil t t) + (make-overlay 25 64 nil t t) + (make-overlay 23 6 nil t t) + (make-overlay 55 64 nil nil nil) + (make-overlay 8 62 nil nil t) + (make-overlay 65 65 nil nil nil) + (make-overlay 57 51 nil t t) + (make-overlay 35 8 nil t nil) + (make-overlay 55 13 nil nil t) + (make-overlay 60 62 nil nil t) + (goto-char 12) + (insert "..") + (goto-char 66) + (insert "............") + (goto-char 32) + (insert "..") + (goto-char 27) + (insert ".........") + (goto-char 8) + (insert ".............") + (goto-char 79) + (insert ".") + (goto-char 47) + (insert "....") + (goto-char 49) + (insert "...") + (goto-char 81) + (insert "....") + (goto-char 112) + (delete-char 0) + (goto-char 97) + (insert ".....") + (goto-char 109) + (delete-char 5) + (goto-char 20) + (insert ".....") + (goto-char 59) + (delete-char 33) + (goto-char 87) + (insert ".............") + (goto-char 98) + (insert "....") + (goto-char 22) + (delete-char 36) + (goto-char 45) + (insert "..............") + (goto-char 42) + (delete-char 29) + (goto-char 51) + (widen) + (narrow-to-region 39 41) + (goto-char 39) + (delete-char 2) + (goto-char 39) + (insert ".............") + (goto-char 51) + (insert "......") + (goto-char 52) + (insert "...............") + (goto-char 56) + (widen) + (narrow-to-region 59 20) + (goto-char 56) + (insert "............") + (goto-char 57) + (insert ".") + (goto-char 37) + (delete-char 12) + (goto-char 39) + (delete-char 11) + (goto-char 38) + (delete-char 8) + (goto-char 36) + (widen) + (narrow-to-region 65 26) + (goto-char 40) + (widen) + (narrow-to-region 27 55) + (should + (equal + (test-overlay-regions) + '((7 . 55) + (8 . 55) + (22 . 29) + (23 . 55) + (23 . 56) + (24 . 31) + (29 . 56) + (37 . 55)))))) + +(ert-deftest overlay-autogenerated-test-52 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 58 32 nil nil nil) + (make-overlay 44 54 nil nil t) + (make-overlay 27 50 nil nil nil) + (make-overlay 55 35 nil nil t) + (make-overlay 40 46 nil nil t) + (make-overlay 56 63 nil t nil) + (make-overlay 29 48 nil nil nil) + (make-overlay 45 24 nil t nil) + (make-overlay 60 25 nil t nil) + (make-overlay 55 41 nil t nil) + (make-overlay 55 1 nil nil t) + (make-overlay 30 45 nil t t) + (make-overlay 26 19 nil nil t) + (make-overlay 61 5 nil nil nil) + (make-overlay 33 5 nil nil nil) + (make-overlay 42 18 nil t nil) + (goto-char 55) + (insert ".") + (goto-char 49) + (delete-char 12) + (goto-char 41) + (insert "..........") + (goto-char 27) + (insert ".....") + (goto-char 58) + (insert "...........") + (goto-char 24) + (delete-char 23) + (goto-char 47) + (delete-char 9) + (goto-char 4) + (insert "...") + (goto-char 10) + (delete-char 32) + (goto-char 4) + (insert "..............") + (goto-char 29) + (insert "....") + (goto-char 28) + (delete-char 2) + (goto-char 34) + (insert "...........") + (goto-char 9) + (insert "......") + (goto-char 5) + (insert "") + (goto-char 45) + (delete-char 1) + (goto-char 18) + (insert ".........") + (goto-char 36) + (delete-char 5) + (goto-char 15) + (delete-char 27) + (goto-char 15) + (delete-char 10) + (goto-char 16) + (delete-char 2) + (goto-char 16) + (widen) + (narrow-to-region 10 2) + (goto-char 9) + (delete-char 1) + (goto-char 3) + (delete-char 2) + (goto-char 2) + (widen) + (narrow-to-region 9 10) + (goto-char 9) + (insert "...........") + (goto-char 19) + (delete-char 0) + (goto-char 14) + (delete-char 3) + (goto-char 11) + (delete-char 2) + (goto-char 9) + (delete-char 6) + (goto-char 9) + (delete-char 0) + (goto-char 10) + (insert "....") + (should + (equal + (test-overlay-regions) + '((1 . 17)))))) + +(ert-deftest overlay-autogenerated-test-53 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 10 30 nil nil nil) + (make-overlay 11 57 nil t nil) + (make-overlay 59 56 nil nil t) + (make-overlay 20 37 nil nil t) + (make-overlay 41 29 nil nil nil) + (make-overlay 31 10 nil nil t) + (make-overlay 6 36 nil nil nil) + (make-overlay 12 54 nil nil nil) + (make-overlay 25 26 nil t t) + (make-overlay 21 19 nil nil t) + (make-overlay 1 21 nil nil t) + (make-overlay 48 51 nil nil nil) + (make-overlay 54 55 nil t nil) + (make-overlay 64 48 nil t t) + (make-overlay 56 25 nil nil t) + (make-overlay 12 60 nil t nil) + (goto-char 41) + (delete-char 1) + (goto-char 63) + (insert "") + (goto-char 14) + (delete-char 5) + (goto-char 11) + (insert "..............") + (goto-char 41) + (widen) + (narrow-to-region 12 1) + (goto-char 1) + (delete-char 3) + (goto-char 9) + (delete-char 0) + (goto-char 5) + (insert "..............") + (goto-char 1) + (insert "..........") + (goto-char 29) + (insert "...............") + (goto-char 4) + (insert "..") + (goto-char 31) + (delete-char 15) + (goto-char 31) + (insert "") + (goto-char 27) + (insert "......") + (goto-char 6) + (insert "...") + (goto-char 23) + (widen) + (narrow-to-region 23 47) + (goto-char 37) + (delete-char 2) + (goto-char 35) + (delete-char 5) + (goto-char 38) + (delete-char 2) + (goto-char 30) + (insert ".......") + (goto-char 45) + (widen) + (narrow-to-region 13 2) + (goto-char 9) + (delete-char 1) + (goto-char 3) + (insert ".....") + (goto-char 2) + (insert "...............") + (goto-char 16) + (delete-char 5) + (goto-char 20) + (insert ".....") + (goto-char 26) + (delete-char 0) + (goto-char 26) + (widen) + (narrow-to-region 76 98) + (goto-char 88) + (insert ".........") + (goto-char 92) + (insert ".") + (goto-char 108) + (delete-char 0) + (goto-char 103) + (delete-char 3) + (should + (equal + (test-overlay-regions) + '((1 . 79) + (37 . 103) + (61 . 88) + (61 . 99) + (74 . 121) + (75 . 118) + (75 . 124) + (77 . 79) + (78 . 103) + (83 . 84) + (83 . 120) + (87 . 106)))))) + +(ert-deftest overlay-autogenerated-test-54 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 58 36 nil t t) + (make-overlay 55 49 nil nil t) + (make-overlay 12 25 nil nil t) + (make-overlay 16 37 nil t t) + (make-overlay 42 25 nil t t) + (make-overlay 8 41 nil t t) + (make-overlay 13 27 nil nil t) + (make-overlay 52 22 nil t nil) + (make-overlay 36 17 nil t nil) + (make-overlay 1 52 nil t nil) + (make-overlay 55 5 nil nil t) + (make-overlay 50 50 nil t nil) + (make-overlay 32 15 nil t nil) + (make-overlay 39 26 nil t nil) + (make-overlay 26 4 nil nil nil) + (make-overlay 38 47 nil t t) + (goto-char 23) + (insert ".") + (goto-char 57) + (delete-char 6) + (goto-char 54) + (insert "..............") + (goto-char 46) + (insert "...............") + (goto-char 29) + (insert ".......") + (goto-char 58) + (delete-char 21) + (goto-char 45) + (delete-char 4) + (goto-char 50) + (delete-char 4) + (goto-char 20) + (insert ".........") + (goto-char 16) + (insert "......") + (goto-char 17) + (insert ".....") + (goto-char 63) + (insert "........") + (goto-char 83) + (insert "....") + (goto-char 73) + (delete-char 8) + (goto-char 69) + (insert "...........") + (goto-char 48) + (widen) + (narrow-to-region 19 31) + (goto-char 22) + (delete-char 3) + (goto-char 23) + (delete-char 5) + (goto-char 20) + (insert "............") + (goto-char 23) + (delete-char 11) + (goto-char 19) + (insert "..........") + (goto-char 23) + (insert "........") + (goto-char 38) + (delete-char 1) + (goto-char 33) + (delete-char 5) + (goto-char 27) + (insert "..........") + (goto-char 35) + (delete-char 8) + (goto-char 35) + (insert ".") + (goto-char 20) + (insert "......") + (goto-char 22) + (delete-char 22) + (goto-char 23) + (delete-char 0) + (goto-char 22) + (widen) + (narrow-to-region 1 41) + (goto-char 13) + (insert ".......") + (should + (equal + (test-overlay-regions) + '((1 . 83) + (4 . 46) + (5 . 97) + (8 . 83) + (12 . 45) + (13 . 47) + (22 . 59) + (30 . 82) + (30 . 83) + (41 . 83) + (45 . 83) + (46 . 83)))))) + +(ert-deftest overlay-autogenerated-test-55 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 58 20 nil nil nil) + (make-overlay 60 33 nil t nil) + (make-overlay 6 27 nil nil nil) + (make-overlay 53 31 nil nil t) + (make-overlay 30 55 nil t t) + (make-overlay 4 64 nil t t) + (make-overlay 51 31 nil nil t) + (make-overlay 4 65 nil t t) + (make-overlay 57 62 nil t t) + (make-overlay 28 7 nil nil t) + (make-overlay 61 48 nil t nil) + (make-overlay 23 54 nil nil t) + (make-overlay 47 49 nil nil nil) + (make-overlay 12 52 nil t nil) + (make-overlay 39 57 nil t t) + (make-overlay 28 61 nil nil t) + (goto-char 8) + (insert "..............") + (goto-char 63) + (delete-char 3) + (goto-char 67) + (delete-char 6) + (goto-char 3) + (widen) + (narrow-to-region 10 67) + (goto-char 43) + (insert ".............") + (goto-char 20) + (insert "...............") + (goto-char 18) + (insert "..") + (goto-char 37) + (delete-char 47) + (goto-char 34) + (insert "..............") + (goto-char 31) + (delete-char 2) + (goto-char 16) + (widen) + (narrow-to-region 29 36) + (goto-char 31) + (delete-char 2) + (goto-char 31) + (insert ".......") + (goto-char 40) + (delete-char 0) + (goto-char 32) + (widen) + (narrow-to-region 40 19) + (goto-char 40) + (insert "..") + (goto-char 37) + (delete-char 0) + (goto-char 40) + (delete-char 1) + (goto-char 34) + (delete-char 4) + (goto-char 33) + (insert "..............") + (goto-char 19) + (widen) + (narrow-to-region 78 70) + (goto-char 77) + (insert ".........") + (goto-char 80) + (delete-char 1) + (goto-char 73) + (delete-char 3) + (goto-char 70) + (insert ".........") + (goto-char 75) + (delete-char 10) + (goto-char 74) + (delete-char 3) + (goto-char 73) + (insert "...............") + (goto-char 90) + (insert "......") + (goto-char 94) + (insert "..............") + (goto-char 101) + (insert "........") + (goto-char 111) + (insert "........") + (should + (equal + (test-overlay-regions) + '((4 . 132) + (4 . 133) + (65 . 89) + (65 . 89) + (65 . 89) + (65 . 89) + (65 . 129) + (65 . 130) + (65 . 130) + (65 . 130) + (65 . 130) + (89 . 89) + (89 . 130)))))) + +(ert-deftest overlay-autogenerated-test-56 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 7 14 nil nil t) + (make-overlay 10 10 nil nil t) + (make-overlay 21 23 nil nil t) + (make-overlay 4 44 nil t nil) + (make-overlay 42 16 nil t t) + (make-overlay 1 57 nil t nil) + (make-overlay 15 27 nil nil nil) + (make-overlay 31 1 nil t nil) + (make-overlay 56 45 nil t t) + (make-overlay 46 19 nil t nil) + (make-overlay 15 6 nil nil nil) + (make-overlay 31 26 nil nil t) + (make-overlay 39 41 nil t t) + (make-overlay 52 48 nil nil t) + (make-overlay 44 2 nil t nil) + (make-overlay 60 7 nil nil t) + (goto-char 49) + (delete-char 11) + (goto-char 43) + (delete-char 9) + (goto-char 42) + (delete-char 2) + (goto-char 12) + (insert "...........") + (goto-char 36) + (insert ".........") + (goto-char 1) + (insert "......") + (goto-char 67) + (delete-char 0) + (goto-char 47) + (insert ".............") + (goto-char 57) + (insert "........") + (goto-char 22) + (widen) + (narrow-to-region 75 33) + (goto-char 41) + (delete-char 28) + (goto-char 43) + (delete-char 0) + (goto-char 33) + (delete-char 5) + (goto-char 38) + (insert "..") + (goto-char 42) + (delete-char 0) + (goto-char 38) + (delete-char 0) + (goto-char 38) + (insert "............") + (goto-char 51) + (insert ".......") + (goto-char 48) + (insert "..") + (goto-char 55) + (insert ".") + (goto-char 33) + (delete-char 8) + (goto-char 42) + (insert "..") + (goto-char 45) + (insert "..") + (goto-char 59) + (insert ".............") + (goto-char 53) + (insert ".......") + (goto-char 81) + (delete-char 0) + (goto-char 44) + (delete-char 36) + (goto-char 38) + (delete-char 8) + (goto-char 33) + (insert ".............") + (goto-char 41) + (insert "..............") + (goto-char 65) + (insert "...............") + (goto-char 61) + (insert "...") + (should + (equal + (test-overlay-regions) + '((7 . 86) + (7 . 97) + (8 . 97) + (10 . 97) + (13 . 97) + (32 . 68) + (33 . 60) + (60 . 97) + (60 . 97) + (68 . 86)))))) + +(ert-deftest overlay-autogenerated-test-57 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 52 31 nil t nil) + (make-overlay 39 17 nil t nil) + (make-overlay 19 20 nil t t) + (make-overlay 18 3 nil nil t) + (make-overlay 19 47 nil nil t) + (make-overlay 38 54 nil nil nil) + (make-overlay 30 51 nil nil t) + (make-overlay 29 60 nil t t) + (make-overlay 57 38 nil nil nil) + (make-overlay 13 41 nil t nil) + (make-overlay 9 44 nil t nil) + (make-overlay 30 55 nil t nil) + (make-overlay 33 10 nil nil nil) + (make-overlay 14 35 nil nil t) + (make-overlay 53 50 nil t nil) + (make-overlay 25 28 nil nil t) + (goto-char 40) + (insert "..") + (goto-char 64) + (insert "........") + (goto-char 47) + (insert "............") + (goto-char 65) + (delete-char 0) + (goto-char 86) + (delete-char 1) + (goto-char 59) + (delete-char 11) + (goto-char 64) + (delete-char 8) + (goto-char 53) + (delete-char 0) + (goto-char 28) + (delete-char 8) + (goto-char 6) + (delete-char 33) + (goto-char 14) + (delete-char 2) + (goto-char 2) + (delete-char 10) + (goto-char 3) + (insert "..") + (goto-char 5) + (insert ".........") + (goto-char 1) + (insert "........") + (goto-char 10) + (delete-char 4) + (goto-char 26) + (insert "........") + (goto-char 23) + (insert "....") + (goto-char 1) + (widen) + (narrow-to-region 15 23) + (goto-char 19) + (insert "...") + (goto-char 24) + (delete-char 0) + (goto-char 19) + (insert ".......") + (goto-char 18) + (insert "..") + (goto-char 33) + (insert "...") + (goto-char 32) + (insert "...............") + (goto-char 29) + (delete-char 10) + (goto-char 29) + (insert "..........") + (goto-char 50) + (insert "") + (goto-char 16) + (insert ".........") + (goto-char 52) + (widen) + (narrow-to-region 59 15) + (goto-char 35) + (delete-char 4) + (goto-char 18) + (insert "....") + (should + (equal + (test-overlay-regions) + '((10 . 57) + (10 . 57) + (10 . 57) + (10 . 60) + (10 . 60) + (10 . 61) + (10 . 68) + (57 . 57)))))) + +(ert-deftest overlay-autogenerated-test-58 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 8 16 nil t nil) + (make-overlay 57 27 nil nil nil) + (make-overlay 15 62 nil nil nil) + (make-overlay 32 33 nil nil t) + (make-overlay 47 27 nil nil t) + (make-overlay 41 4 nil nil t) + (make-overlay 57 61 nil t nil) + (make-overlay 18 43 nil nil t) + (make-overlay 64 51 nil t t) + (make-overlay 44 26 nil nil nil) + (make-overlay 9 13 nil nil t) + (make-overlay 41 65 nil nil t) + (make-overlay 23 13 nil t t) + (make-overlay 26 59 nil t t) + (make-overlay 65 65 nil t t) + (make-overlay 15 7 nil nil nil) + (goto-char 41) + (insert "........") + (goto-char 35) + (delete-char 14) + (goto-char 32) + (widen) + (narrow-to-region 23 46) + (goto-char 41) + (delete-char 5) + (goto-char 29) + (delete-char 10) + (goto-char 31) + (insert ".") + (goto-char 29) + (insert "........") + (goto-char 27) + (delete-char 7) + (goto-char 29) + (insert "") + (goto-char 24) + (insert "............") + (goto-char 43) + (delete-char 1) + (goto-char 31) + (delete-char 9) + (goto-char 34) + (widen) + (narrow-to-region 20 14) + (goto-char 20) + (delete-char 0) + (goto-char 17) + (insert "...........") + (goto-char 31) + (delete-char 0) + (goto-char 16) + (insert "...........") + (goto-char 17) + (delete-char 8) + (goto-char 23) + (delete-char 5) + (goto-char 20) + (insert "..........") + (goto-char 33) + (widen) + (narrow-to-region 16 29) + (goto-char 24) + (insert "...............") + (goto-char 44) + (delete-char 0) + (goto-char 30) + (insert "....") + (goto-char 27) + (widen) + (narrow-to-region 4 22) + (goto-char 10) + (insert "..............") + (goto-char 36) + (insert "..") + (goto-char 10) + (delete-char 21) + (goto-char 14) + (delete-char 1) + (goto-char 14) + (insert "...........") + (goto-char 12) + (insert "........") + (goto-char 32) + (insert "........") + (should + (equal + (test-overlay-regions) + '((4 . 92) + (7 . 10) + (8 . 10) + (9 . 10) + (10 . 82) + (10 . 104)))))) + +(ert-deftest overlay-autogenerated-test-59 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 46 30 nil t t) + (make-overlay 3 26 nil nil nil) + (make-overlay 36 28 nil t t) + (make-overlay 49 49 nil t t) + (make-overlay 27 61 nil t nil) + (make-overlay 14 16 nil nil nil) + (make-overlay 50 61 nil t nil) + (make-overlay 59 63 nil nil nil) + (make-overlay 36 34 nil t nil) + (make-overlay 35 29 nil nil nil) + (make-overlay 5 65 nil nil nil) + (make-overlay 20 61 nil nil t) + (make-overlay 10 42 nil nil nil) + (make-overlay 47 49 nil nil t) + (make-overlay 12 4 nil nil nil) + (make-overlay 32 24 nil t t) + (goto-char 11) + (insert ".") + (goto-char 32) + (delete-char 2) + (goto-char 61) + (insert ".........") + (goto-char 36) + (insert "........") + (goto-char 55) + (widen) + (narrow-to-region 8 55) + (goto-char 21) + (insert "....") + (goto-char 32) + (delete-char 15) + (goto-char 30) + (delete-char 5) + (goto-char 31) + (insert "......") + (goto-char 18) + (insert "..") + (goto-char 14) + (insert ".............") + (goto-char 34) + (insert "............") + (goto-char 51) + (widen) + (narrow-to-region 58 31) + (goto-char 50) + (delete-char 5) + (goto-char 53) + (insert ".........") + (goto-char 56) + (insert "...............") + (goto-char 45) + (delete-char 1) + (goto-char 67) + (insert "............") + (goto-char 84) + (insert "") + (goto-char 39) + (delete-char 27) + (goto-char 39) + (delete-char 21) + (goto-char 32) + (insert "............") + (goto-char 36) + (widen) + (narrow-to-region 7 37) + (goto-char 11) + (insert ".......") + (goto-char 21) + (delete-char 13) + (goto-char 15) + (insert "....") + (goto-char 9) + (insert ".............") + (goto-char 13) + (delete-char 21) + (goto-char 21) + (delete-char 6) + (goto-char 16) + (insert ".......") + (goto-char 22) + (insert "") + (goto-char 27) + (delete-char 0) + (should + (equal + (test-overlay-regions) + '((3 . 42) + (4 . 16) + (5 . 83) + (13 . 51) + (25 . 27)))))) + +(ert-deftest overlay-autogenerated-test-60 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 38 32 nil t nil) + (make-overlay 32 42 nil t nil) + (make-overlay 29 11 nil nil t) + (make-overlay 52 22 nil t t) + (make-overlay 39 59 nil t nil) + (make-overlay 41 30 nil t t) + (make-overlay 29 61 nil nil t) + (make-overlay 11 45 nil nil nil) + (make-overlay 46 17 nil nil t) + (make-overlay 35 51 nil t t) + (make-overlay 22 13 nil nil t) + (make-overlay 52 34 nil nil t) + (make-overlay 59 4 nil nil t) + (make-overlay 8 22 nil nil nil) + (make-overlay 4 49 nil nil nil) + (make-overlay 52 45 nil t t) + (goto-char 48) + (delete-char 16) + (goto-char 37) + (delete-char 8) + (goto-char 14) + (insert "...............") + (goto-char 40) + (delete-char 16) + (goto-char 19) + (insert ".........") + (goto-char 16) + (insert "......") + (goto-char 10) + (insert "........") + (goto-char 11) + (insert "...............") + (goto-char 22) + (insert ".") + (goto-char 62) + (delete-char 16) + (goto-char 14) + (delete-char 11) + (goto-char 47) + (insert "....") + (goto-char 33) + (insert ".............") + (goto-char 49) + (delete-char 13) + (goto-char 28) + (insert "..") + (goto-char 35) + (delete-char 13) + (goto-char 44) + (insert "....") + (goto-char 34) + (delete-char 14) + (goto-char 23) + (insert ".....") + (goto-char 25) + (delete-char 4) + (goto-char 33) + (insert ".....") + (goto-char 27) + (delete-char 3) + (goto-char 16) + (widen) + (narrow-to-region 36 37) + (goto-char 36) + (delete-char 1) + (goto-char 36) + (insert ".......") + (goto-char 37) + (widen) + (narrow-to-region 35 31) + (goto-char 34) + (delete-char 0) + (goto-char 31) + (delete-char 2) + (goto-char 31) + (widen) + (narrow-to-region 24 3) + (goto-char 22) + (delete-char 2) + (goto-char 22) + (insert ".............") + (goto-char 4) + (insert ".") + (should + (equal + (test-overlay-regions) + '((4 . 54) + (4 . 54) + (9 . 46)))))) + +(ert-deftest overlay-autogenerated-test-61 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 45 56 nil t nil) + (make-overlay 60 45 nil nil nil) + (make-overlay 26 8 nil t t) + (make-overlay 63 39 nil nil nil) + (make-overlay 18 11 nil t nil) + (make-overlay 22 64 nil nil t) + (make-overlay 8 41 nil nil t) + (make-overlay 6 51 nil t t) + (make-overlay 38 26 nil t t) + (make-overlay 7 46 nil t nil) + (make-overlay 2 42 nil nil t) + (make-overlay 44 64 nil nil nil) + (make-overlay 7 62 nil t nil) + (make-overlay 8 40 nil nil t) + (make-overlay 62 36 nil t t) + (make-overlay 61 27 nil nil nil) + (goto-char 21) + (delete-char 0) + (goto-char 8) + (insert "") + (goto-char 55) + (insert "......") + (goto-char 38) + (delete-char 25) + (goto-char 37) + (delete-char 4) + (goto-char 12) + (delete-char 4) + (goto-char 3) + (delete-char 26) + (goto-char 10) + (insert ".......") + (goto-char 18) + (delete-char 0) + (goto-char 16) + (insert ".............") + (goto-char 18) + (delete-char 3) + (goto-char 7) + (insert "...") + (goto-char 20) + (insert "........") + (goto-char 38) + (delete-char 0) + (goto-char 1) + (delete-char 36) + (goto-char 3) + (delete-char 1) + (goto-char 2) + (insert "......") + (goto-char 4) + (insert ".......") + (goto-char 2) + (insert "...........") + (goto-char 27) + (insert ".....") + (goto-char 15) + (insert "...............") + (goto-char 2) + (insert "......") + (goto-char 17) + (delete-char 8) + (goto-char 15) + (delete-char 7) + (goto-char 33) + (delete-char 5) + (goto-char 13) + (insert "...........") + (goto-char 34) + (insert "...............") + (goto-char 33) + (insert "") + (goto-char 51) + (insert "....") + (goto-char 14) + (delete-char 36) + (goto-char 16) + (delete-char 1) + (goto-char 14) + (delete-char 8) + (should + (equal + (test-overlay-regions) + '((1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 1) + (1 . 18) + (1 . 18)))))) + +(ert-deftest overlay-autogenerated-test-62 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 25 36 nil t nil) + (make-overlay 38 6 nil t nil) + (make-overlay 40 63 nil nil t) + (make-overlay 34 23 nil nil nil) + (make-overlay 48 46 nil nil nil) + (make-overlay 43 57 nil t t) + (make-overlay 6 53 nil t t) + (make-overlay 37 27 nil t t) + (make-overlay 8 39 nil t nil) + (make-overlay 62 6 nil nil nil) + (make-overlay 51 6 nil t t) + (make-overlay 58 11 nil nil t) + (make-overlay 19 25 nil t nil) + (make-overlay 13 8 nil nil nil) + (make-overlay 19 8 nil nil t) + (make-overlay 39 5 nil t t) + (goto-char 51) + (delete-char 5) + (goto-char 16) + (delete-char 9) + (goto-char 18) + (insert "") + (goto-char 47) + (delete-char 4) + (goto-char 24) + (insert ".........") + (goto-char 24) + (insert ".....") + (goto-char 18) + (insert "...........") + (goto-char 5) + (delete-char 6) + (goto-char 30) + (insert "...........") + (goto-char 8) + (insert ".............") + (goto-char 78) + (insert "............") + (goto-char 67) + (insert "") + (goto-char 58) + (insert "") + (goto-char 5) + (insert ".") + (goto-char 79) + (widen) + (narrow-to-region 51 55) + (goto-char 51) + (insert "....") + (goto-char 58) + (widen) + (narrow-to-region 36 37) + (goto-char 37) + (insert "....") + (goto-char 40) + (insert ".......") + (goto-char 47) + (delete-char 1) + (goto-char 43) + (delete-char 4) + (goto-char 37) + (insert "........") + (goto-char 49) + (insert "............") + (goto-char 42) + (widen) + (narrow-to-region 75 111) + (goto-char 104) + (widen) + (narrow-to-region 21 95) + (goto-char 22) + (widen) + (narrow-to-region 64 79) + (goto-char 64) + (delete-char 0) + (goto-char 68) + (insert "........") + (goto-char 82) + (insert "") + (goto-char 81) + (insert "........") + (goto-char 92) + (delete-char 2) + (goto-char 87) + (insert ".") + (should + (equal + (test-overlay-regions) + '((5 . 145) + (5 . 148) + (6 . 118) + (6 . 119) + (6 . 119) + (6 . 143) + (6 . 143) + (24 . 114) + (24 . 116) + (63 . 117)))))) + +(ert-deftest overlay-autogenerated-test-63 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 9 49 nil t nil) + (make-overlay 9 16 nil nil nil) + (make-overlay 64 2 nil t t) + (make-overlay 17 31 nil nil t) + (make-overlay 24 51 nil nil nil) + (make-overlay 27 56 nil t t) + (make-overlay 21 4 nil nil nil) + (make-overlay 24 29 nil t t) + (make-overlay 4 63 nil nil t) + (make-overlay 34 49 nil t nil) + (make-overlay 19 47 nil nil t) + (make-overlay 8 50 nil t nil) + (make-overlay 49 61 nil t nil) + (make-overlay 52 10 nil t t) + (make-overlay 64 30 nil t nil) + (make-overlay 5 13 nil t nil) + (goto-char 27) + (insert "........") + (goto-char 42) + (insert "......") + (goto-char 48) + (insert "....") + (goto-char 55) + (widen) + (narrow-to-region 10 5) + (goto-char 8) + (insert ".............") + (goto-char 19) + (insert "......") + (goto-char 19) + (delete-char 3) + (goto-char 8) + (delete-char 3) + (goto-char 9) + (insert ".......") + (goto-char 29) + (insert "...............") + (goto-char 38) + (insert ".......") + (goto-char 34) + (insert "......") + (goto-char 28) + (delete-char 20) + (goto-char 22) + (insert "............") + (goto-char 21) + (delete-char 23) + (goto-char 25) + (delete-char 2) + (goto-char 19) + (delete-char 2) + (goto-char 12) + (delete-char 6) + (goto-char 12) + (delete-char 0) + (goto-char 13) + (delete-char 0) + (goto-char 12) + (insert "........") + (goto-char 23) + (delete-char 2) + (goto-char 5) + (insert "...............") + (goto-char 28) + (delete-char 0) + (goto-char 16) + (insert "..........") + (goto-char 8) + (delete-char 17) + (goto-char 27) + (delete-char 0) + (goto-char 12) + (insert ".") + (goto-char 14) + (delete-char 12) + (goto-char 11) + (insert "..............") + (goto-char 34) + (insert "") + (goto-char 25) + (delete-char 8) + (should + (equal + (test-overlay-regions) + '((2 . 98) + (4 . 37) + (4 . 97) + (25 . 29) + (25 . 32) + (25 . 84)))))) + +(ert-deftest overlay-autogenerated-test-64 nil + (with-temp-buffer + (insert "................................................................") + (make-overlay 31 10 nil nil nil) + (make-overlay 17 58 nil nil t) + (make-overlay 20 21 nil t nil) + (make-overlay 3 47 nil t t) + (make-overlay 47 43 nil t t) + (make-overlay 54 8 nil nil t) + (make-overlay 51 26 nil t nil) + (make-overlay 60 14 nil t nil) + (make-overlay 38 6 nil nil t) + (make-overlay 41 9 nil nil nil) + (make-overlay 44 38 nil nil t) + (make-overlay 55 48 nil nil t) + (make-overlay 10 41 nil nil t) + (make-overlay 35 49 nil t nil) + (make-overlay 50 46 nil nil nil) + (make-overlay 28 28 nil t nil) + (goto-char 59) + (delete-char 3) + (goto-char 28) + (widen) + (narrow-to-region 13 7) + (goto-char 11) + (insert ".") + (goto-char 9) + (delete-char 3) + (goto-char 8) + (delete-char 0) + (goto-char 7) + (insert ".............") + (goto-char 9) + (insert "..........") + (goto-char 22) + (delete-char 1) + (goto-char 31) + (delete-char 2) + (goto-char 22) + (insert ".........") + (goto-char 33) + (delete-char 1) + (goto-char 29) + (widen) + (narrow-to-region 59 51) + (goto-char 52) + (insert ".........") + (goto-char 53) + (insert "........") + (goto-char 53) + (delete-char 4) + (goto-char 54) + (insert "........") + (goto-char 53) + (insert "....") + (goto-char 75) + (widen) + (goto-char 70) + (delete-char 2) + (goto-char 108) + (delete-char 1) + (goto-char 80) + (widen) + (goto-char 70) + (widen) + (narrow-to-region 49 63) + (goto-char 49) + (insert "...") + (goto-char 66) + (delete-char 0) + (goto-char 63) + (delete-char 3) + (goto-char 59) + (insert "..........") + (goto-char 56) + (delete-char 6) + (goto-char 60) + (insert ".........") + (goto-char 62) + (widen) + (goto-char 58) + (insert ".............") + (goto-char 105) + (widen) + (narrow-to-region 94 109) + (goto-char 103) + (insert "............") + (should + (equal + (test-overlay-regions) + '((3 . 134) + (6 . 125) + (38 . 141) + (39 . 118) + (39 . 128) + (39 . 128) + (40 . 146) + (43 . 145) + (101 . 138) + (103 . 103)))))) + +) ;; End of `when nil' for autogenerated insert/delete/narrow tests. + (ert-deftest buffer-multibyte-overlong-sequences () (dolist (uni '("\xE0\x80\x80" "\xF0\x80\x80\x80" @@ -1615,65 +8373,92 @@ with parameters from the *Messages* buffer modification." (remove-overlays) (should (= (length (overlays-in (point-min) (point-max))) 0)))) -(ert-deftest test-kill-buffer-auto-save-default () +(defun test-kill-buffer-auto-save (auto-save-answer body-func) + "Test helper for `kill-buffer-delete-auto-save' tests. + +Call BODY-FUNC with the current buffer set to a buffer visiting a +temporary file. Around the call, mock the \"Buffer modified; +kill anyway?\" and \"Delete auto-save file?\" prompts, answering +\"yes\" for the former and AUTO-SAVE-ANSWER for the latter. The +expectation should be the characters `?y' or `?n', or `nil' if no +prompt is expected. The test fails if the \"Delete auto-save +file?\" prompt does not either prompt is not issued as expected. +Finally, kill the buffer and its temporary file." (ert-with-temp-file file - (let (auto-save) - ;; Always answer yes. - (cl-letf (((symbol-function #'yes-or-no-p) (lambda (_) t))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - (kill-buffer (current-buffer)) - (should (file-exists-p auto-save))) - (when auto-save - (ignore-errors (delete-file auto-save)))))))) - -(ert-deftest test-kill-buffer-auto-save-delete () - (ert-with-temp-file file - (let (auto-save) - (should (file-exists-p file)) - (setq kill-buffer-delete-auto-save-files t) - ;; Always answer yes. - (cl-letf (((symbol-function #'yes-or-no-p) (lambda (_) t))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - ;; This should delete the auto-save file. - (kill-buffer (current-buffer)) - (should-not (file-exists-p auto-save))) - (ignore-errors (delete-file file)) - (when auto-save - (ignore-errors (delete-file auto-save))))) - ;; Answer no to deletion. - (cl-letf (((symbol-function #'yes-or-no-p) - (lambda (prompt) - (not (string-search "Delete auto-save file" prompt))))) - (unwind-protect - (progn - (find-file file) - (auto-save-mode t) - (insert "foo\n") - (should buffer-auto-save-file-name) - (setq auto-save buffer-auto-save-file-name) - (do-auto-save) - (should (file-exists-p auto-save)) - ;; This should not delete the auto-save file. - (kill-buffer (current-buffer)) - (should (file-exists-p auto-save))) - (when auto-save - (ignore-errors (delete-file auto-save)))))))) + (should (file-exists-p file)) + (save-excursion + (find-file file) + (should (equal file (buffer-file-name))) + (let ((buffer (current-buffer)) + (auto-save-prompt-happened nil)) + (cl-letf (((symbol-function #'read-multiple-choice) + (lambda (prompt choices &rest _) + (should (string-search "modified; kill anyway?" prompt)) + (let ((answer (assq ?y choices))) + (should answer) + answer))) + ((symbol-function #'yes-or-no-p) + (lambda (prompt) + (should (string-search "Delete auto-save file?" prompt)) + (setq auto-save-prompt-happened t) + (pcase-exhaustive auto-save-answer + (?y t) + (?n nil))))) + (funcall body-func) + (should (equal (null auto-save-prompt-happened) + (null auto-save-answer)))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (set-buffer-modified-p nil) + (kill-buffer))))))) + +(ert-deftest test-kill-buffer-auto-save-default () + (let ((kill-buffer-delete-auto-save-files nil)) + (test-kill-buffer-auto-save + nil + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save t) + (should (file-exists-p auto-save)) + (kill-buffer (current-buffer)) + (should (file-exists-p auto-save))))))) + +(ert-deftest test-kill-buffer-auto-save-delete-yes () + (let ((kill-buffer-delete-auto-save-files t)) + (test-kill-buffer-auto-save + ?y + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save t) + (should (file-exists-p auto-save)) + ;; This should delete the auto-save file. + (kill-buffer (current-buffer)) + (should-not (file-exists-p auto-save))))))) + +(ert-deftest test-kill-buffer-auto-save-delete-no () + (let ((kill-buffer-delete-auto-save-files t)) + (test-kill-buffer-auto-save + ?n + (lambda () + (let (auto-save) + (auto-save-mode t) + (insert "foo\n") + (should buffer-auto-save-file-name) + (setq auto-save buffer-auto-save-file-name) + (do-auto-save t) + (should (file-exists-p auto-save)) + ;; This should not delete the auto-save file. + (kill-buffer (current-buffer)) + (should (file-exists-p auto-save)) + (delete-file auto-save)))))) (ert-deftest test-buffer-modifications () (ert-with-temp-file file @@ -1683,7 +8468,7 @@ with parameters from the *Messages* buffer modification." (insert "foo") (should (buffer-modified-p)) (should-not (eq (buffer-modified-p) 'autosaved)) - (do-auto-save nil t) + (do-auto-save t t) (should (eq (buffer-modified-p) 'autosaved)) (with-silent-modifications (put-text-property 1 3 'face 'bold)) @@ -1707,7 +8492,7 @@ with parameters from the *Messages* buffer modification." (restore-buffer-modified-p nil) (should-not (buffer-modified-p)) (insert "bar") - (do-auto-save nil t) + (do-auto-save t t) (should (eq (buffer-modified-p) 'autosaved)) (insert "zot") (restore-buffer-modified-p 'autosaved) diff --git a/test/src/comp-resources/comp-test-funcs.el b/test/src/comp-resources/comp-test-funcs.el index 9092f040c80..03925d4d2e8 100644 --- a/test/src/comp-resources/comp-test-funcs.el +++ b/test/src/comp-resources/comp-test-funcs.el @@ -211,10 +211,10 @@ (comp-tests-err-arith-f) (arith-error (concat "arith-error " (error-message-string err) - " catched")) + " caught")) (error (concat "error " (error-message-string err) - " catched")))) + " caught")))) (defun comp-tests-condition-case-1-f () ;; Bpushhandler Bpophandler (condition-case @@ -222,10 +222,10 @@ (comp-tests-err-foo-f) (arith-error (concat "arith-error " (error-message-string err) - " catched")) + " caught")) (error (concat "error " (error-message-string err) - " catched")))) + " caught")))) (defun comp-tests-catch-f (f) (catch 'foo (funcall f))) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 1edbd1777c6..4e512098a3d 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -298,9 +298,9 @@ Check that the resulting binaries do not differ." (comp-deftest non-locals () "Test non locals." (should (string= (comp-tests-condition-case-0-f) - "arith-error Arithmetic error catched")) + "arith-error Arithmetic error caught")) (should (string= (comp-tests-condition-case-1-f) - "error Foo catched")) + "error Foo caught")) (should (= (comp-tests-catch-f (lambda () (throw 'foo 3))) 3)) @@ -823,7 +823,7 @@ Return a list of results." (should (= (comp-tests-tco-f 1 0 10) 55)))) (defun comp-tests-fw-prop-checker-1 (_) - "Check that inside `comp-tests-fw-prop-f' `concat' and `length' are folded." + "Check that inside `comp-tests-fw-prop-1-f' `concat' and `length' are folded." (should (cl-notany #'identity diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 1099fd04678..a9a45d54632 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -263,7 +263,7 @@ must evaluate to a regular expression string." (ert-deftest module--test-assertions--load-non-live-object-with-global-copy () "Check that -module-assertions verify that non-live objects aren't accessed. -This differs from `module--test-assertions-load-non-live-object' +This differs from `module--test-assertions--load-non-live-object' in that it stows away a global reference. The module assertions should nevertheless detect the invalid load." :tags (if (getenv "EMACS_EMBA_CI") '(:unstable)) diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index bb2f04e8ee1..0e12e4dbd8a 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el @@ -222,7 +222,7 @@ expressions works for identifiers starting with period." (ert-deftest eval-tests/funcall-with-delayed-message () ;; Check that `funcall-with-delayed-message' displays its message before - ;; its function terminates iff the timeout is short enough. + ;; its function terminates if the timeout is short enough. ;; This also serves as regression test for bug#55628 where a short ;; timeout was rounded up to the next whole second. diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 9a2bd5cef34..7568d941d03 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -22,6 +22,7 @@ ;;; Code: (require 'cl-lib) +(require 'ert) (ert-deftest fns-tests-identity () (let ((num 12345)) (should (eq (identity num) num))) @@ -29,9 +30,22 @@ (let ((lst '(11))) (should (eq (identity lst) lst)))) (ert-deftest fns-tests-random () - (should (integerp (random))) - (should (>= (random 10) 0)) - (should (< (random 10) 10))) + (unwind-protect + (progn + (should-error (random -1) :type 'args-out-of-range) + (should-error (random 0) :type 'args-out-of-range) + (should (integerp (random))) + (should (= (random 1) 0)) + (should (>= (random 10) 0)) + (should (< (random 10) 10)) + (should (equal (random "seed") (random "seed"))) + ;; The probability of four calls being the same is low. + ;; This makes sure that the value isn't constant. + (should (not (= (random t) (random t) (random t) (random t)))) + ;; Handle bignums. + (should (integerp (random (1+ most-positive-fixnum))))) + ;; Reset the PRNG seed after testing. + (random t))) (ert-deftest fns-tests-length () (should (= (length nil) 0)) @@ -152,6 +166,8 @@ (,(string-to-multibyte "abc") < "abd") (,(string-to-multibyte "abc") < ,(string-to-multibyte "abd")) (,(string-to-multibyte "\x80") = ,(string-to-multibyte "\x80")) + ("Liberté, Égalité, Fraternité" = "Liberté, Égalité, Fraternité") + ("Liberté, Égalité, Fraternité" < "Liberté, Égalité, Sororité") ;; Cases concerning the ordering of raw bytes: these are ;; troublesome because the current `string<' order is not very useful as @@ -841,6 +857,14 @@ (should-error (reverse (dot1 1)) :type 'wrong-type-argument) (should-error (reverse (dot2 1 2)) :type 'wrong-type-argument)) +(ert-deftest test-cycle-equal () + (should-error (equal (cyc1 1) (cyc1 1))) + (should-error (equal (cyc2 1 2) (cyc2 1 2)))) + +(ert-deftest test-cycle-nconc () + (should-error (nconc (cyc1 1) 'tail) :type 'circular-list) + (should-error (nconc (cyc2 1 2) 'tail) :type 'circular-list)) + (ert-deftest test-cycle-plist-get () (let ((c1 (cyc1 1)) (c2 (cyc2 1 2)) @@ -895,30 +919,47 @@ (should-error (plist-put d1 3 3) :type 'wrong-type-argument) (should-error (plist-put d2 3 3) :type 'wrong-type-argument))) -(ert-deftest test-cycle-equal () - (should-error (equal (cyc1 1) (cyc1 1))) - (should-error (equal (cyc2 1 2) (cyc2 1 2)))) - -(ert-deftest test-cycle-nconc () - (should-error (nconc (cyc1 1) 'tail) :type 'circular-list) - (should-error (nconc (cyc2 1 2) 'tail) :type 'circular-list)) - (ert-deftest plist-get/odd-number-of-elements () "Test that `plist-get' doesn't signal an error on degenerate plists." (should-not (plist-get '(:foo 1 :bar) :bar))) (ert-deftest plist-put/odd-number-of-elements () - "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." - (should (equal (should-error (plist-put '(:foo 1 :bar) :zot 2) - :type 'wrong-type-argument) + "Check for bug#27726." + (should (equal (should-error (plist-put (list :foo 1 :bar) :zot 2)) '(wrong-type-argument plistp (:foo 1 :bar))))) (ert-deftest plist-member/improper-list () - "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." - (should (equal (should-error (plist-member '(:foo 1 . :bar) :qux) - :type 'wrong-type-argument) + "Check for bug#27726." + (should (equal (should-error (plist-member '(:foo 1 . :bar) :qux)) '(wrong-type-argument plistp (:foo 1 . :bar))))) +(ert-deftest test-plist () + (let ((plist (list :a "b"))) + (setq plist (plist-put plist :b "c")) + (should (equal (plist-get plist :b) "c")) + (should (equal (plist-member plist :b) '(:b "c")))) + + (let ((plist (list "1" "2" "a" "b"))) + (setq plist (plist-put plist (string ?a) "c")) + (should (equal plist '("1" "2" "a" "b" "a" "c"))) + (should-not (plist-get plist (string ?a))) + (should-not (plist-member plist (string ?a)))) + + (let ((plist (list "1" "2" "a" "b"))) + (setq plist (plist-put plist (string ?a) "c" #'equal)) + (should (equal plist '("1" "2" "a" "c"))) + (should (equal (plist-get plist (string ?a) #'equal) "c")) + (should (equal (plist-member plist (string ?a) #'equal) '("a" "c")))) + + (let ((plist (list :a 1 :b 2 :c 3))) + (setq plist (plist-put plist ":a" 4 #'string>)) + (should (equal plist '(:a 1 :b 4 :c 3))) + (should (equal (plist-get plist ":b" #'string>) 3)) + (should (equal (plist-member plist ":c" #'string<) plist)) + (dolist (fn '(plist-get plist-member)) + (should-not (funcall fn plist ":a" #'string<)) + (should-not (funcall fn plist ":c" #'string>))))) + (ert-deftest test-string-distance () "Test `string-distance' behavior." ;; ASCII characters are always fine @@ -1334,23 +1375,6 @@ (should-error (append loop '(end)) :type 'circular-list))) -(ert-deftest test-plist () - (let ((plist '(:a "b"))) - (setq plist (plist-put plist :b "c")) - (should (equal (plist-get plist :b) "c")) - (should (equal (plist-member plist :b) '(:b "c")))) - - (let ((plist '("1" "2" "a" "b"))) - (setq plist (plist-put plist (copy-sequence "a") "c")) - (should-not (equal (plist-get plist (copy-sequence "a")) "c")) - (should-not (equal (plist-member plist (copy-sequence "a")) '("a" "c")))) - - (let ((plist '("1" "2" "a" "b"))) - (setq plist (plist-put plist (copy-sequence "a") "c" #'equal)) - (should (equal (plist-get plist (copy-sequence "a") #'equal) "c")) - (should (equal (plist-member plist (copy-sequence "a") #'equal) - '("a" "c"))))) - (ert-deftest fns--string-to-unibyte-multibyte () (dolist (str (list "" "a" "abc" "a\x00\x7fz" "a\xaa\xbbz" "\x80\xdd\xff" (apply #'unibyte-string (number-sequence 0 255)))) diff --git a/test/src/font-tests.el b/test/src/font-tests.el index 7e9669c6513..683d331d753 100644 --- a/test/src/font-tests.el +++ b/test/src/font-tests.el @@ -115,7 +115,7 @@ expected font properties from parsing NAME.") (defun test-font-parse () "Test font name parsing." (interactive) - (switch-to-buffer (generate-new-buffer "*Font Pase Test*")) + (switch-to-buffer (generate-new-buffer "*Font Parse Test*")) (setq show-trailing-whitespace nil) (let ((pass-face '((t :foreground "green"))) (fail-face '((t :foreground "red")))) diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el index 1829a7ea1f1..7f0f660d13e 100644 --- a/test/src/lcms-tests.el +++ b/test/src/lcms-tests.el @@ -28,7 +28,7 @@ ;; https://github.com/njsmith/colorspacious ;; Other references: -;; http://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf +;; https://www.babelcolor.com/index_htm_files/A%20review%20of%20RGB%20color%20spaces.pdf ;;; Code: diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index ff0d6be3f5d..b323f592dca 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el @@ -867,4 +867,9 @@ This evaluates the TESTS test cases from glibc." (should (equal (string-match "[[:lower:]]" "ẞ") 0)) (should (equal (string-match "[[:upper:]]" "ẞ") 0)))) +(ert-deftest regexp-atomic-failure () + "Bug#58726." + (should (equal (string-match "\\`\\(?:ab\\)*\\'" "a") nil)) + (should (equal (string-match "\\`a\\{2\\}*\\'" "a") nil))) + ;;; regex-emacs-tests.el ends here diff --git a/test/src/sqlite-tests.el b/test/src/sqlite-tests.el index 5af43923012..be4f60ab57f 100644 --- a/test/src/sqlite-tests.el +++ b/test/src/sqlite-tests.el @@ -241,4 +241,17 @@ (should (multibyte-string-p c1)) (should-not (multibyte-string-p c2))))))) +(ert-deftest sqlite-returning () + (skip-unless (sqlite-available-p)) + (let (db) + (progn + (setq db (sqlite-open)) + (sqlite-execute db "CREATE TABLE people1 (people_id INTEGER PRIMARY KEY, first TEXT, last TEXT)") + (should (null (sqlite-select db "select * from people1"))) + (should + (equal + (sqlite-execute db "INSERT INTO people1 (first, last) values (?, ?) RETURNING people_id, first" + '("Joe" "Doe")) + '((1 "Joe"))))))) + ;;; sqlite-tests.el ends here diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el index 75d67140a90..731fa893c1f 100644 --- a/test/src/thread-tests.el +++ b/test/src/thread-tests.el @@ -217,7 +217,7 @@ (while (not threads-mutex-key) (thread-yield)) (thread-signal thr 'quit nil) - ;; `quit' is not catched by `should-error'. We must indicate it. + ;; `quit' is not caught by `should-error'. We must indicate it. (condition-case nil (thread-join thr) (quit (signal 'error nil))))))) |