diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.in | 232 | ||||
-rw-r--r-- | test/README | 6 | ||||
-rw-r--r-- | test/automated/Makefile.in | 173 | ||||
-rw-r--r-- | test/automated/abbrev-tests.el | 98 | ||||
-rw-r--r-- | test/automated/coding-tests.el | 50 | ||||
-rw-r--r-- | test/automated/core-elisp-tests.el | 52 | ||||
-rw-r--r-- | test/automated/data-tests.el | 257 | ||||
-rw-r--r-- | test/automated/fns-tests.el | 193 | ||||
-rw-r--r-- | test/automated/help-fns.el | 70 | ||||
-rw-r--r-- | test/automated/lexbind-tests.el | 75 | ||||
-rw-r--r-- | test/automated/syntax-tests.el | 97 | ||||
-rw-r--r-- | test/automated/tramp-tests.el | 2383 | ||||
-rw-r--r-- | test/data/decompress/foo.gz (renamed from test/automated/data/decompress/foo.gz) | bin | 30 -> 30 bytes | |||
-rw-r--r-- | test/data/emacs-module/Makefile | 41 | ||||
-rw-r--r-- | test/data/emacs-module/mod-test.c | 268 | ||||
-rwxr-xr-x | test/data/epg/dummy-pinentry | 22 | ||||
-rw-r--r-- | test/data/epg/pubkey.asc (renamed from test/automated/data/epg/pubkey.asc) | 0 | ||||
-rw-r--r-- | test/data/epg/seckey.asc (renamed from test/automated/data/epg/seckey.asc) | 0 | ||||
-rw-r--r-- | test/data/files-bug18141.el.gz (renamed from test/automated/data/files-bug18141.el.gz) | bin | 77 -> 77 bytes | |||
-rw-r--r-- | test/data/image/blank-100x200.png | bin | 0 -> 423 bytes | |||
-rw-r--r-- | test/data/image/blank-200x100.png | bin | 0 -> 338 bytes | |||
-rw-r--r-- | test/data/net/cert.pem | 25 | ||||
-rw-r--r-- | test/data/net/key.pem | 28 | ||||
-rw-r--r-- | test/data/shr/div-div.html | 1 | ||||
-rw-r--r-- | test/data/shr/div-div.txt | 2 | ||||
-rw-r--r-- | test/data/shr/div-p.html | 1 | ||||
-rw-r--r-- | test/data/shr/div-p.txt | 3 | ||||
-rw-r--r-- | test/data/shr/li-div.html | 10 | ||||
-rw-r--r-- | test/data/shr/li-div.txt | 6 | ||||
-rw-r--r-- | test/data/shr/li-empty.html | 1 | ||||
-rw-r--r-- | test/data/shr/li-empty.txt | 3 | ||||
-rw-r--r-- | test/data/shr/nonbr.html | 1 | ||||
-rw-r--r-- | test/data/shr/nonbr.txt | 12 | ||||
-rw-r--r-- | test/data/shr/ul-empty.html | 4 | ||||
-rw-r--r-- | test/data/shr/ul-empty.txt | 3 | ||||
-rw-r--r-- | test/data/somelib.el | 7 | ||||
-rw-r--r-- | test/data/somelib2.el | 7 | ||||
-rw-r--r-- | test/data/xref/file1.txt (renamed from test/automated/data/xref/file1.txt) | 0 | ||||
-rw-r--r-- | test/data/xref/file2.txt (renamed from test/automated/data/xref/file2.txt) | 0 | ||||
-rw-r--r-- | test/file-organization.org | 59 | ||||
-rw-r--r-- | test/indent/css-mode.css | 45 | ||||
-rw-r--r-- | test/indent/scss-mode.scss | 76 | ||||
-rw-r--r-- | test/lisp/abbrev-tests.el | 254 | ||||
-rw-r--r-- | test/lisp/auth-source-pass-tests.el | 227 | ||||
-rw-r--r-- | test/lisp/auth-source-tests.el (renamed from test/automated/auth-source-tests.el) | 45 | ||||
-rw-r--r-- | test/lisp/autorevert-tests.el (renamed from test/automated/auto-revert-tests.el) | 191 | ||||
-rw-r--r-- | test/lisp/buff-menu-tests.el | 43 | ||||
-rw-r--r-- | test/lisp/calc/calc-tests.el (renamed from test/automated/calc-tests.el) | 45 | ||||
-rw-r--r-- | test/lisp/calendar/icalendar-tests.el (renamed from test/automated/icalendar-tests.el) | 63 | ||||
-rw-r--r-- | test/lisp/calendar/parse-time-tests.el | 65 | ||||
-rw-r--r-- | test/lisp/calendar/todo-mode-resources/todo-test-1.toda | 13 | ||||
-rw-r--r-- | test/lisp/calendar/todo-mode-resources/todo-test-1.todo | 12 | ||||
-rw-r--r-- | test/lisp/calendar/todo-mode-tests.el | 138 | ||||
-rw-r--r-- | test/lisp/char-fold-tests.el (renamed from test/automated/char-fold-tests.el) | 12 | ||||
-rw-r--r-- | test/lisp/comint-tests.el (renamed from test/automated/comint-testsuite.el) | 0 | ||||
-rw-r--r-- | test/lisp/dabbrev-tests.el (renamed from test/automated/dabbrev-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/descr-text-tests.el (renamed from test/automated/descr-text-test.el) | 0 | ||||
-rw-r--r-- | test/lisp/dired-tests.el | 88 | ||||
-rw-r--r-- | test/lisp/dired-x-tests.el | 53 | ||||
-rw-r--r-- | test/lisp/dom-tests.el | 201 | ||||
-rw-r--r-- | test/lisp/electric-tests.el (renamed from test/automated/electric-tests.el) | 1 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/benchmark-tests.el | 51 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el (renamed from test/automated/bytecomp-tests.el) | 134 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/checkdoc-tests.el | 53 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-extra-tests.el | 97 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-generic-tests.el (renamed from test/automated/cl-generic-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-lib-tests.el (renamed from test/automated/cl-lib-tests.el) | 55 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-print-tests.el | 58 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/cl-seq-tests.el | 307 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el (renamed from test/automated/eieio-test-methodinvoke.el) | 3 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el (renamed from test/automated/eieio-test-persist.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/eieio-tests/eieio-tests.el (renamed from test/automated/eieio-tests.el) | 8 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/ert-tests.el (renamed from test/automated/ert-tests.el) | 68 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/ert-x-tests.el (renamed from test/automated/ert-x-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/generator-tests.el (renamed from test/automated/generator-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/let-alist-tests.el (renamed from test/automated/let-alist.el) | 13 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/lisp-mode-tests.el | 190 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/lisp-tests.el | 593 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/map-tests.el (renamed from test/automated/map-tests.el) | 8 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/nadvice-tests.el (renamed from test/automated/advice-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/archive-contents (renamed from test/automated/data/package/archive-contents) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/key.pub (renamed from test/automated/data/package/key.pub) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/key.sec (renamed from test/automated/data/package/key.sec) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el (renamed from test/automated/data/package/macro-problem-package-1.0/macro-aux.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el (renamed from test/automated/data/package/macro-problem-package-1.0/macro-problem.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el (renamed from test/automated/data/package/macro-problem-package-2.0/macro-aux.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el (renamed from test/automated/data/package/macro-problem-package-2.0/macro-problem.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/multi-file-0.2.3.tar (renamed from test/automated/data/package/multi-file-0.2.3.tar) | bin | 20480 -> 20480 bytes | |||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/multi-file-readme.txt (renamed from test/automated/data/package/multi-file-readme.txt) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/newer-versions/archive-contents (renamed from test/automated/data/package/newer-versions/archive-contents) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/newer-versions/new-pkg-1.0.el (renamed from test/automated/data/package/newer-versions/new-pkg-1.0.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el (renamed from test/automated/data/package/newer-versions/simple-single-1.4.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/package-test-server.py (renamed from test/automated/data/package/package-test-server.py) | 12 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/archive-contents (renamed from test/automated/data/package/signed/archive-contents) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig (renamed from test/automated/data/package/signed/archive-contents.sig) | bin | 287 -> 287 bytes | |||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el (renamed from test/automated/data/package/signed/signed-bad-1.0.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el.sig (renamed from test/automated/data/package/signed/signed-bad-1.0.el.sig) | bin | 287 -> 287 bytes | |||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el (renamed from test/automated/data/package/signed/signed-good-1.0.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig (renamed from test/automated/data/package/signed/signed-good-1.0.el.sig) | bin | 287 -> 287 bytes | |||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el (renamed from test/automated/data/package/simple-depend-1.0.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/simple-single-1.3.el (renamed from test/automated/data/package/simple-single-1.3.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/simple-single-readme.txt (renamed from test/automated/data/package/simple-single-readme.txt) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el (renamed from test/automated/data/package/simple-two-depend-1.1.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/package-tests.el (renamed from test/automated/package-test.el) | 61 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/pcase-tests.el (renamed from test/automated/pcase-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/pp-tests.el | 35 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/regexp-opt-tests.el (renamed from test/automated/regexp-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/ring-tests.el | 206 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 37 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/seq-tests.el (renamed from test/automated/seq-tests.el) | 87 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/subr-x-tests.el (renamed from test/automated/subr-x-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/tabulated-list-test.el (renamed from test/automated/tabulated-list-test.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/testcover-resources/testcases.el | 493 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/testcover-tests.el | 186 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/thunk-tests.el (renamed from test/automated/thunk-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emacs-lisp/timer-tests.el (renamed from test/automated/timer-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/emulation/viper-tests.el (renamed from test/automated/viper-tests.el) | 6 | ||||
-rw-r--r-- | test/lisp/epg-tests.el (renamed from test/automated/epg-tests.el) | 62 | ||||
-rw-r--r-- | test/lisp/erc/erc-track-tests.el | 122 | ||||
-rw-r--r-- | test/lisp/eshell/eshell-tests.el (renamed from test/automated/eshell.el) | 4 | ||||
-rw-r--r-- | test/lisp/faces-tests.el (renamed from test/automated/faces-tests.el) | 9 | ||||
-rw-r--r-- | test/lisp/ffap-tests.el | 84 | ||||
-rw-r--r-- | test/lisp/filenotify-tests.el (renamed from test/automated/file-notify-tests.el) | 981 | ||||
-rw-r--r-- | test/lisp/files-tests.el (renamed from test/automated/files.el) | 149 | ||||
-rw-r--r-- | test/lisp/files-x-tests.el | 333 | ||||
-rw-r--r-- | test/lisp/gnus/gnus-tests.el (renamed from test/automated/gnus-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/gnus/message-tests.el (renamed from test/automated/message-mode-tests.el) | 43 | ||||
-rw-r--r-- | test/lisp/help-fns-tests.el | 121 | ||||
-rw-r--r-- | test/lisp/hi-lock-tests.el | 40 | ||||
-rw-r--r-- | test/lisp/htmlfontify-tests.el | 46 | ||||
-rw-r--r-- | test/lisp/ibuffer-tests.el | 816 | ||||
-rw-r--r-- | test/lisp/ido-tests.el | 47 | ||||
-rw-r--r-- | test/lisp/imenu-tests.el (renamed from test/automated/imenu-test.el) | 10 | ||||
-rw-r--r-- | test/lisp/info-xref-tests.el (renamed from test/automated/info-xref.el) | 0 | ||||
-rw-r--r-- | test/lisp/international/mule-util-tests.el (renamed from test/automated/mule-util.el) | 0 | ||||
-rw-r--r-- | test/lisp/international/ucs-normalize-tests.el | 277 | ||||
-rw-r--r-- | test/lisp/isearch-tests.el (renamed from test/automated/isearch-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/jit-lock-tests.el | 60 | ||||
-rw-r--r-- | test/lisp/json-tests.el (renamed from test/automated/json-tests.el) | 8 | ||||
-rw-r--r-- | test/lisp/kmacro-tests.el | 891 | ||||
-rw-r--r-- | test/lisp/mail/rmail-tests.el (renamed from test/automated/finalizer-tests.el) | 26 | ||||
-rw-r--r-- | test/lisp/man-tests.el (renamed from test/automated/man-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/md4-tests.el | 61 | ||||
-rw-r--r-- | test/lisp/minibuffer-tests.el (renamed from test/automated/completion-tests.el) | 2 | ||||
-rw-r--r-- | test/lisp/mouse-tests.el | 59 | ||||
-rw-r--r-- | test/lisp/net/dbus-tests.el (renamed from test/automated/dbus-tests.el) | 3 | ||||
-rw-r--r-- | test/lisp/net/network-stream-tests.el | 294 | ||||
-rw-r--r-- | test/lisp/net/newsticker-tests.el (renamed from test/automated/newsticker-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/net/puny-tests.el | 41 | ||||
-rw-r--r-- | test/lisp/net/sasl-scram-rfc-tests.el (renamed from test/automated/sasl-scram-rfc-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/net/shr-tests.el | 58 | ||||
-rw-r--r-- | test/lisp/net/tramp-tests.el | 3827 | ||||
-rw-r--r-- | test/lisp/obarray-tests.el (renamed from test/automated/obarray-tests.el) | 6 | ||||
-rw-r--r-- | test/lisp/progmodes/bat-mode-tests.el | 86 | ||||
-rw-r--r-- | test/lisp/progmodes/cc-mode-tests.el | 72 | ||||
-rw-r--r-- | test/lisp/progmodes/compile-tests.el (renamed from test/automated/compile-tests.el) | 78 | ||||
-rw-r--r-- | test/lisp/progmodes/elisp-mode-tests.el (renamed from test/automated/elisp-mode-tests.el) | 156 | ||||
-rw-r--r-- | test/lisp/progmodes/etags-tests.el | 91 | ||||
-rw-r--r-- | test/lisp/progmodes/f90-tests.el (renamed from test/automated/f90.el) | 4 | ||||
-rw-r--r-- | test/lisp/progmodes/flymake-resources/Makefile (renamed from test/automated/data/flymake/Makefile) | 0 | ||||
-rw-r--r-- | test/lisp/progmodes/flymake-resources/test.c (renamed from test/automated/data/flymake/test.c) | 0 | ||||
-rw-r--r-- | test/lisp/progmodes/flymake-resources/test.pl (renamed from test/automated/data/flymake/test.pl) | 0 | ||||
-rw-r--r-- | test/lisp/progmodes/flymake-tests.el (renamed from test/automated/flymake-tests.el) | 2 | ||||
-rw-r--r-- | test/lisp/progmodes/js-tests.el | 182 | ||||
-rw-r--r-- | test/lisp/progmodes/python-tests.el (renamed from test/automated/python-tests.el) | 174 | ||||
-rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el (renamed from test/automated/ruby-mode-tests.el) | 11 | ||||
-rw-r--r-- | test/lisp/progmodes/sql-tests.el | 47 | ||||
-rw-r--r-- | test/lisp/progmodes/subword-tests.el (renamed from test/automated/subword-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/progmodes/xref-tests.el (renamed from test/automated/xref-tests.el) | 2 | ||||
-rw-r--r-- | test/lisp/ps-print-tests.el (renamed from test/automated/replace-tests.el) | 29 | ||||
-rw-r--r-- | test/lisp/replace-tests.el (renamed from test/automated/occur-tests.el) | 39 | ||||
-rw-r--r-- | test/lisp/rot13-tests.el | 54 | ||||
-rw-r--r-- | test/lisp/shell-tests.el (renamed from test/automated/cl-seq-tests.el) | 31 | ||||
-rw-r--r-- | test/lisp/simple-tests.el (renamed from test/automated/simple-test.el) | 116 | ||||
-rw-r--r-- | test/lisp/sort-tests.el (renamed from test/automated/sort-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/subr-tests.el (renamed from test/automated/subr-tests.el) | 102 | ||||
-rw-r--r-- | test/lisp/textmodes/css-mode-tests.el | 282 | ||||
-rw-r--r-- | test/lisp/textmodes/dns-mode-tests.el | 58 | ||||
-rw-r--r-- | test/lisp/textmodes/mhtml-mode-tests.el | 58 | ||||
-rw-r--r-- | test/lisp/textmodes/reftex-tests.el (renamed from test/automated/reftex-tests.el) | 15 | ||||
-rw-r--r-- | test/lisp/textmodes/sgml-mode-tests.el (renamed from test/automated/sgml-mode-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/textmodes/tildify-tests.el (renamed from test/automated/tildify-tests.el) | 2 | ||||
-rw-r--r-- | test/lisp/thingatpt-tests.el (renamed from test/automated/thingatpt.el) | 36 | ||||
-rw-r--r-- | test/lisp/url/url-auth-tests.el | 296 | ||||
-rw-r--r-- | test/lisp/url/url-expand-tests.el (renamed from test/automated/url-expand-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/url/url-future-tests.el (renamed from test/automated/url-future-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/url/url-parse-tests.el (renamed from test/automated/url-parse-tests.el) | 5 | ||||
-rw-r--r-- | test/lisp/url/url-util-tests.el (renamed from test/automated/url-util-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/vc/add-log-tests.el (renamed from test/automated/add-log-tests.el) | 0 | ||||
-rw-r--r-- | test/lisp/vc/diff-mode-tests.el | 203 | ||||
-rw-r--r-- | test/lisp/vc/ediff-diff-tests.el | 55 | ||||
-rw-r--r-- | test/lisp/vc/ediff-ptch-tests.el | 109 | ||||
-rw-r--r-- | test/lisp/vc/vc-bzr-tests.el (renamed from test/automated/vc-bzr.el) | 8 | ||||
-rw-r--r-- | test/lisp/vc/vc-hg-tests.el (renamed from test/automated/vc-hg.el) | 4 | ||||
-rw-r--r-- | test/lisp/vc/vc-tests.el (renamed from test/automated/vc-tests.el) | 286 | ||||
-rw-r--r-- | test/lisp/whitespace-tests.el | 86 | ||||
-rw-r--r-- | test/lisp/xml-tests.el (renamed from test/automated/xml-parse-tests.el) | 30 | ||||
-rw-r--r-- | test/lisp/xt-mouse-tests.el (renamed from test/automated/xt-mouse-tests.el) | 0 | ||||
-rw-r--r-- | test/manual/BidiCharacterTest.txt (renamed from test/BidiCharacterTest.txt) | 55 | ||||
-rw-r--r-- | test/manual/biditest.el (renamed from test/biditest.el) | 2 | ||||
-rw-r--r-- | test/manual/cedet/cedet-utests.el (renamed from test/cedet/cedet-utests.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/ede-tests.el (renamed from test/cedet/ede-tests.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/semantic-ia-utest.el (renamed from test/cedet/semantic-ia-utest.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/semantic-tests.el (renamed from test/cedet/semantic-tests.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/semantic-utest-c.el (renamed from test/cedet/semantic-utest-c.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/semantic-utest.el (renamed from test/cedet/semantic-utest.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/srecode-tests.el (renamed from test/cedet/srecode-tests.el) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/test.c (renamed from test/cedet/tests/test.c) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/test.el (renamed from test/cedet/tests/test.el) | 2 | ||||
-rw-r--r-- | test/manual/cedet/tests/test.make (renamed from test/cedet/tests/test.make) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testdoublens.cpp (renamed from test/cedet/tests/testdoublens.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testdoublens.hpp (renamed from test/cedet/tests/testdoublens.hpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testfriends.cpp (renamed from test/cedet/tests/testfriends.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testjavacomp.java (renamed from test/cedet/tests/testjavacomp.java) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testnsp.cpp (renamed from test/cedet/tests/testnsp.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testpolymorph.cpp (renamed from test/cedet/tests/testpolymorph.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testspp.c (renamed from test/cedet/tests/testspp.c) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppcomplete.c (renamed from test/cedet/tests/testsppcomplete.c) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppreplace.c (renamed from test/cedet/tests/testsppreplace.c) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppreplaced.c (renamed from test/cedet/tests/testsppreplaced.c) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsubclass.cpp (renamed from test/cedet/tests/testsubclass.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsubclass.hh (renamed from test/cedet/tests/testsubclass.hh) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testtypedefs.cpp (renamed from test/cedet/tests/testtypedefs.cpp) | 0 | ||||
-rw-r--r-- | test/manual/cedet/tests/testvarnames.c (renamed from test/cedet/tests/testvarnames.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/CTAGS.good (renamed from test/etags/CTAGS.good) | 252 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_1 (renamed from test/etags/ETAGS.good_1) | 1773 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_2 (renamed from test/etags/ETAGS.good_2) | 1844 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_3 (renamed from test/etags/ETAGS.good_3) | 1866 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_4 (renamed from test/etags/ETAGS.good_4) | 1821 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_5 (renamed from test/etags/ETAGS.good_5) | 1985 | ||||
-rw-r--r-- | test/manual/etags/ETAGS.good_6 (renamed from test/etags/ETAGS.good_6) | 1985 | ||||
-rw-r--r-- | test/manual/etags/Makefile (renamed from test/etags/Makefile) | 4 | ||||
-rw-r--r-- | test/manual/etags/a-src/empty.zz (renamed from test/etags/a-src/empty.zz) | 0 | ||||
-rw-r--r-- | test/manual/etags/a-src/empty.zz.gz (renamed from test/etags/a-src/empty.zz.gz) | 0 | ||||
-rw-r--r-- | test/manual/etags/ada-src/2ataspri.adb (renamed from test/etags/ada-src/2ataspri.adb) | 0 | ||||
-rw-r--r-- | test/manual/etags/ada-src/2ataspri.ads (renamed from test/etags/ada-src/2ataspri.ads) | 0 | ||||
-rw-r--r-- | test/manual/etags/ada-src/etags-test-for.ada (renamed from test/etags/ada-src/etags-test-for.ada) | 0 | ||||
-rw-r--r-- | test/manual/etags/ada-src/waroquiers.ada (renamed from test/etags/ada-src/waroquiers.ada) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/a/b/b.c (renamed from test/etags/c-src/a/b/b.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/abbrev.c (renamed from test/etags/c-src/abbrev.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/c.c (renamed from test/etags/c-src/c.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/dostorture.c (renamed from test/etags/c-src/dostorture.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/emacs/src/gmalloc.c (renamed from test/etags/c-src/emacs/src/gmalloc.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/emacs/src/keyboard.c (renamed from test/etags/c-src/emacs/src/keyboard.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/emacs/src/lisp.h (renamed from test/etags/c-src/emacs/src/lisp.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/emacs/src/regex.h (renamed from test/etags/c-src/emacs/src/regex.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/etags.c (renamed from test/etags/c-src/etags.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/exit.c (renamed from test/etags/c-src/exit.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/exit.strange_suffix (renamed from test/etags/c-src/exit.strange_suffix) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/fail.c (renamed from test/etags/c-src/fail.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/getopt.h (renamed from test/etags/c-src/getopt.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/h.h (renamed from test/etags/c-src/h.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/machsyscalls.c (renamed from test/etags/c-src/machsyscalls.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/machsyscalls.h (renamed from test/etags/c-src/machsyscalls.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/sysdep.h (renamed from test/etags/c-src/sysdep.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/tab.c (renamed from test/etags/c-src/tab.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/c-src/torture.c (renamed from test/etags/c-src/torture.c) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/MDiagArray2.h (renamed from test/etags/cp-src/MDiagArray2.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/Range.h (renamed from test/etags/cp-src/Range.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/burton.cpp (renamed from test/etags/cp-src/burton.cpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/c.C (renamed from test/etags/cp-src/c.C) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/clheir.cpp.gz (renamed from test/etags/cp-src/clheir.cpp.gz) | bin | 408 -> 408 bytes | |||
-rw-r--r-- | test/manual/etags/cp-src/clheir.hpp (renamed from test/etags/cp-src/clheir.hpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/conway.cpp (renamed from test/etags/cp-src/conway.cpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/conway.hpp (renamed from test/etags/cp-src/conway.hpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/fail.C (renamed from test/etags/cp-src/fail.C) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/functions.cpp (renamed from test/etags/cp-src/functions.cpp) | 6 | ||||
-rw-r--r-- | test/manual/etags/cp-src/screen.cpp (renamed from test/etags/cp-src/screen.cpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/screen.hpp (renamed from test/etags/cp-src/screen.hpp) | 0 | ||||
-rw-r--r-- | test/manual/etags/cp-src/x.cc (renamed from test/etags/cp-src/x.cc) | 0 | ||||
-rw-r--r-- | test/manual/etags/el-src/TAGTEST.EL (renamed from test/etags/el-src/TAGTEST.EL) | 0 | ||||
-rw-r--r-- | test/manual/etags/el-src/emacs/lisp/progmodes/etags.el (renamed from test/etags/el-src/emacs/lisp/progmodes/etags.el) | 0 | ||||
-rw-r--r-- | test/manual/etags/erl-src/gs_dialog.erl (renamed from test/etags/erl-src/gs_dialog.erl) | 0 | ||||
-rw-r--r-- | test/manual/etags/f-src/entry.for (renamed from test/etags/f-src/entry.for) | 0 | ||||
-rw-r--r-- | test/manual/etags/f-src/entry.strange.gz (renamed from test/etags/f-src/entry.strange.gz) | bin | 3265 -> 3265 bytes | |||
-rw-r--r-- | test/manual/etags/f-src/entry.strange_suffix (renamed from test/etags/f-src/entry.strange_suffix) | 0 | ||||
-rw-r--r-- | test/manual/etags/forth-src/test-forth.fth (renamed from test/etags/forth-src/test-forth.fth) | 21 | ||||
-rw-r--r-- | test/manual/etags/go-src/test.go (renamed from test/etags/go-src/test.go) | 0 | ||||
-rw-r--r-- | test/manual/etags/go-src/test1.go (renamed from test/etags/go-src/test1.go) | 0 | ||||
-rw-r--r-- | test/manual/etags/html-src/algrthms.html (renamed from test/etags/html-src/algrthms.html) | 0 | ||||
-rw-r--r-- | test/manual/etags/html-src/index.shtml (renamed from test/etags/html-src/index.shtml) | 0 | ||||
-rw-r--r-- | test/manual/etags/html-src/software.html (renamed from test/etags/html-src/software.html) | 4 | ||||
-rw-r--r-- | test/manual/etags/html-src/softwarelibero.html (renamed from test/etags/html-src/softwarelibero.html) | 0 | ||||
-rw-r--r-- | test/manual/etags/lua-src/allegro.lua (renamed from test/etags/lua-src/allegro.lua) | 0 | ||||
-rw-r--r-- | test/manual/etags/lua-src/test.lua (renamed from test/etags/lua-src/test.lua) | 0 | ||||
-rw-r--r-- | test/manual/etags/make-src/Makefile (renamed from test/etags/make-src/Makefile) | 0 | ||||
-rw-r--r-- | test/manual/etags/objc-src/PackInsp.h (renamed from test/etags/objc-src/PackInsp.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/objc-src/PackInsp.m (renamed from test/etags/objc-src/PackInsp.m) | 0 | ||||
-rw-r--r-- | test/manual/etags/objc-src/Subprocess.h (renamed from test/etags/objc-src/Subprocess.h) | 0 | ||||
-rw-r--r-- | test/manual/etags/objc-src/Subprocess.m (renamed from test/etags/objc-src/Subprocess.m) | 0 | ||||
-rw-r--r-- | test/manual/etags/objcpp-src/SimpleCalc.H (renamed from test/etags/objcpp-src/SimpleCalc.H) | 0 | ||||
-rw-r--r-- | test/manual/etags/objcpp-src/SimpleCalc.M (renamed from test/etags/objcpp-src/SimpleCalc.M) | 0 | ||||
-rw-r--r-- | test/manual/etags/pas-src/common.pas (renamed from test/etags/pas-src/common.pas) | 0 | ||||
-rw-r--r-- | test/manual/etags/perl-src/htlmify-cystic (renamed from test/etags/perl-src/htlmify-cystic) | 0 | ||||
-rw-r--r-- | test/manual/etags/perl-src/kai-test.pl (renamed from test/etags/perl-src/kai-test.pl) | 0 | ||||
-rw-r--r-- | test/manual/etags/perl-src/yagrip.pl (renamed from test/etags/perl-src/yagrip.pl) | 0 | ||||
-rw-r--r-- | test/manual/etags/php-src/lce_functions.php (renamed from test/etags/php-src/lce_functions.php) | 0 | ||||
-rw-r--r-- | test/manual/etags/php-src/ptest.php (renamed from test/etags/php-src/ptest.php) | 0 | ||||
-rw-r--r-- | test/manual/etags/php-src/sendmail.php (renamed from test/etags/php-src/sendmail.php) | 0 | ||||
-rw-r--r-- | test/manual/etags/prol-src/natded.prolog (renamed from test/etags/prol-src/natded.prolog) | 0 | ||||
-rw-r--r-- | test/manual/etags/prol-src/ordsets.prolog (renamed from test/etags/prol-src/ordsets.prolog) | 0 | ||||
-rw-r--r-- | test/manual/etags/ps-src/rfc1245.ps (renamed from test/etags/ps-src/rfc1245.ps) | 0 | ||||
-rw-r--r-- | test/manual/etags/pyt-src/server.py (renamed from test/etags/pyt-src/server.py) | 0 | ||||
-rw-r--r-- | test/manual/etags/ruby-src/test.rb (renamed from test/etags/ruby-src/test.rb) | 0 | ||||
-rw-r--r-- | test/manual/etags/ruby-src/test1.ru (renamed from test/etags/ruby-src/test1.ru) | 0 | ||||
-rw-r--r-- | test/manual/etags/tex-src/gzip.texi (renamed from test/etags/tex-src/gzip.texi) | 0 | ||||
-rw-r--r-- | test/manual/etags/tex-src/nonewline.tex (renamed from test/etags/tex-src/nonewline.tex) | 0 | ||||
-rw-r--r-- | test/manual/etags/tex-src/testenv.tex (renamed from test/etags/tex-src/testenv.tex) | 0 | ||||
-rw-r--r-- | test/manual/etags/tex-src/texinfo.tex (renamed from test/etags/tex-src/texinfo.tex) | 0 | ||||
-rw-r--r-- | test/manual/etags/y-src/atest.y (renamed from test/etags/y-src/atest.y) | 0 | ||||
-rw-r--r-- | test/manual/etags/y-src/cccp.c (renamed from test/etags/y-src/cccp.c) | 76 | ||||
-rw-r--r-- | test/manual/etags/y-src/cccp.y (renamed from test/etags/y-src/cccp.y) | 0 | ||||
-rw-r--r-- | test/manual/etags/y-src/parse.c (renamed from test/etags/y-src/parse.c) | 88 | ||||
-rw-r--r-- | test/manual/etags/y-src/parse.y (renamed from test/etags/y-src/parse.y) | 0 | ||||
-rw-r--r-- | test/manual/image-size-tests.el | 92 | ||||
-rw-r--r-- | test/manual/indent/Makefile (renamed from test/indent/Makefile) | 2 | ||||
-rw-r--r-- | test/manual/indent/css-mode.css | 84 | ||||
-rw-r--r-- | test/manual/indent/html-multi-2.html | 35 | ||||
-rw-r--r-- | test/manual/indent/html-multi-3.html | 35 | ||||
-rw-r--r-- | test/manual/indent/html-multi-4.html | 15 | ||||
-rw-r--r-- | test/manual/indent/html-multi.html | 30 | ||||
-rw-r--r-- | test/manual/indent/js-chain.js | 29 | ||||
-rw-r--r-- | test/manual/indent/js-indent-init-dynamic.js (renamed from test/indent/js-indent-init-dynamic.js) | 0 | ||||
-rw-r--r-- | test/manual/indent/js-indent-init-t.js (renamed from test/indent/js-indent-init-t.js) | 0 | ||||
-rw-r--r-- | test/manual/indent/js-jsx.js (renamed from test/indent/js-jsx.js) | 0 | ||||
-rw-r--r-- | test/manual/indent/js.js (renamed from test/indent/js.js) | 20 | ||||
-rw-r--r-- | test/manual/indent/latex-mode.tex (renamed from test/indent/latex-mode.tex) | 0 | ||||
-rw-r--r-- | test/manual/indent/modula2.mod (renamed from test/indent/modula2.mod) | 0 | ||||
-rw-r--r-- | test/manual/indent/nxml.xml (renamed from test/indent/nxml.xml) | 0 | ||||
-rw-r--r-- | test/manual/indent/octave.m (renamed from test/indent/octave.m) | 0 | ||||
-rw-r--r-- | test/manual/indent/pascal.pas (renamed from test/indent/pascal.pas) | 0 | ||||
-rwxr-xr-x | test/manual/indent/perl.perl (renamed from test/indent/perl.perl) | 0 | ||||
-rw-r--r-- | test/manual/indent/prolog.prolog (renamed from test/indent/prolog.prolog) | 0 | ||||
-rw-r--r-- | test/manual/indent/ps-mode.ps (renamed from test/indent/ps-mode.ps) | 0 | ||||
-rw-r--r-- | test/manual/indent/ruby.rb (renamed from test/indent/ruby.rb) | 0 | ||||
-rw-r--r-- | test/manual/indent/scheme.scm (renamed from test/indent/scheme.scm) | 0 | ||||
-rw-r--r-- | test/manual/indent/scss-mode.scss | 108 | ||||
-rw-r--r-- | test/manual/indent/sgml-mode-attribute.html (renamed from test/indent/sgml-mode-attribute.html) | 0 | ||||
-rwxr-xr-x | test/manual/indent/shell.rc (renamed from test/indent/shell.rc) | 0 | ||||
-rwxr-xr-x | test/manual/indent/shell.sh (renamed from test/indent/shell.sh) | 0 | ||||
-rw-r--r-- | test/manual/redisplay-testsuite.el (renamed from test/redisplay-testsuite.el) | 42 | ||||
-rw-r--r-- | test/manual/rmailmm.el (renamed from test/rmailmm.el) | 0 | ||||
-rw-r--r-- | test/manual/scroll-tests.el | 167 | ||||
-rw-r--r-- | test/src/alloc-tests.el | 53 | ||||
-rw-r--r-- | test/src/buffer-tests.el (renamed from test/automated/buffer-tests.el) | 0 | ||||
-rw-r--r-- | test/src/callproc-tests.el | 39 | ||||
-rw-r--r-- | test/src/casefiddle-tests.el | 263 | ||||
-rw-r--r-- | test/src/charset-tests.el | 26 | ||||
-rw-r--r-- | test/src/chartab-tests.el | 51 | ||||
-rw-r--r-- | test/src/cmds-tests.el (renamed from test/automated/cmds-tests.el) | 0 | ||||
-rw-r--r-- | test/src/coding-tests.el (renamed from test/automated/decoder-tests.el) | 214 | ||||
-rw-r--r-- | test/src/data-tests.el | 482 | ||||
-rw-r--r-- | test/src/decompress-tests.el (renamed from test/automated/zlib-tests.el) | 6 | ||||
-rw-r--r-- | test/src/doc-tests.el | 92 | ||||
-rw-r--r-- | test/src/editfns-tests.el | 211 | ||||
-rw-r--r-- | test/src/emacs-module-tests.el | 177 | ||||
-rw-r--r-- | test/src/eval-tests.el | 62 | ||||
-rw-r--r-- | test/src/floatfns-tests.el | 37 | ||||
-rw-r--r-- | test/src/fns-tests.el | 544 | ||||
-rw-r--r-- | test/src/font-tests.el (renamed from test/automated/font-parse-tests.el) | 5 | ||||
-rw-r--r-- | test/src/inotify-tests.el (renamed from test/automated/inotify-test.el) | 9 | ||||
-rw-r--r-- | test/src/keymap-tests.el (renamed from test/automated/keymap-tests.el) | 7 | ||||
-rw-r--r-- | test/src/lread-tests.el | 167 | ||||
-rw-r--r-- | test/src/marker-tests.el | 60 | ||||
-rw-r--r-- | test/src/minibuf-tests.el | 403 | ||||
-rw-r--r-- | test/src/print-tests.el (renamed from test/automated/print-tests.el) | 0 | ||||
-rw-r--r-- | test/src/process-tests.el (renamed from test/automated/process-tests.el) | 1 | ||||
-rw-r--r-- | test/src/regex-resources/BOOST.tests | 829 | ||||
-rw-r--r-- | test/src/regex-resources/PCRE.tests | 2386 | ||||
-rw-r--r-- | test/src/regex-resources/PTESTS | 341 | ||||
-rw-r--r-- | test/src/regex-resources/TESTS | 167 | ||||
-rw-r--r-- | test/src/regex-tests.el | 680 | ||||
-rw-r--r-- | test/src/syntax-tests.el | 85 | ||||
-rw-r--r-- | test/src/textprop-tests.el (renamed from test/automated/textprop-tests.el) | 3 | ||||
-rw-r--r-- | test/src/thread-tests.el | 301 | ||||
-rw-r--r-- | test/src/undo-tests.el (renamed from test/automated/undo-tests.el) | 0 | ||||
-rw-r--r-- | test/src/xml-tests.el (renamed from test/automated/libxml-tests.el) | 0 |
377 files changed, 29170 insertions, 10786 deletions
diff --git a/test/Makefile.in b/test/Makefile.in new file mode 100644 index 00000000000..7b8c967128f --- /dev/null +++ b/test/Makefile.in @@ -0,0 +1,232 @@ +### @configure_input@ + +# Copyright (C) 2010-2017 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 <http://www.gnu.org/licenses/>. + +### Commentary: + +## Some targets: +## check: re-run all tests, writing to .log files. +## check-maybe: run all tests which are outdated with their .log file +## or the source files they are testing. +## filename.log: run tests from filename.el(c) if .log file needs updating +## filename: re-run tests from filename.el(c), with no logging + +### Code: + +SHELL = @SHELL@ + +srcdir = @srcdir@ +VPATH = $(srcdir) + +FIND_DELETE = @FIND_DELETE@ +MKDIR_P = @MKDIR_P@ + +SEPCHAR = @SEPCHAR@ + + +# 'make' verbosity. +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ + +AM_V_ELC = $(am__v_ELC_@AM_V@) +am__v_ELC_ = $(am__v_ELC_@AM_DEFAULT_V@) +am__v_ELC_0 = @echo " ELC " $@; +am__v_ELC_1 = + +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = + +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = + + +# We never change directory before running Emacs, so a relative file +# name is fine, and makes life easier. If we need to change +# directory, we can use emacs --chdir. +EMACS = ../src/emacs + +EMACS_EXTRAOPT= + +# Command line flags for Emacs. +# Apparently MSYS bash would convert "-L :" to "-L ;" anyway, +# but we might as well be explicit. +EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT) + +# Prevent any settings in the user environment causing problems. +unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS + +## To run tests under a debugger, set this to eg: "gdb --args". +GDB = + +# The locale to run tests under. Tests should work if this is set to +# any supported locale. Use the C locale by default, as it should be +# supported everywhere. +TEST_LOCALE = C + +# Whether to run tests from .el files in preference to .elc, we do +# this by default since it gives nicer stacktraces. +TEST_LOAD_EL ?= yes + +# The actual Emacs command run in the targets below. +# Prevent any setting of EMACSLOADPATH in user environment causing problems. +emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) \ + EMACS_TEST_DIRECTORY=$(abspath $(srcdir)) \ + $(GDB) "$(EMACS)" $(EMACSOPT) + +.PHONY: all check + +all: check + +SELECTOR_DEFAULT = (quote (not (tag :expensive-test))) +SELECTOR_EXPENSIVE = nil +ifdef SELECTOR +SELECTOR_ACTUAL=$(SELECTOR) +else ifndef MAKECMDGOALS +SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) +else ifeq ($(MAKECMDGOALS),all) +SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) +else ifeq ($(MAKECMDGOALS),check) +SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) +else ifeq ($(MAKECMDGOALS),check-maybe) +SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) +else +SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE) +endif + +## Byte-compile all test files to test for errors. +%.elc: %.el + $(AM_V_ELC)$(emacs) -f batch-byte-compile $< + +## Save logs, and show logs for failed tests. +WRITE_LOG = > $@ 2>&1 || { STAT=$$?; cat $@; exit $$STAT; } + +ifeq ($(TEST_LOAD_EL), yes) +testloadfile = $*.el +else +testloadfile = $* +endif + +## Ignore any test errors so we can continue to test other files. +%.log: %.elc + $(AM_V_at)${MKDIR_P} $(dir $@) + -$(AM_V_GEN)HOME=/nonexistent $(emacs) -l ert -l $(testloadfile) \ + --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} + +ifeq (@HAVE_MODULES@, yes) +maybe_exclude_module_tests := +else +maybe_exclude_module_tests := -name emacs-module-tests.el -prune -o +endif + +ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \ + -path "${srcdir}/data" -prune -o \ + -name "*resources" -prune -o \ + ${maybe_exclude_module_tests} \ + -name "*.el" ! -name ".*" -print) +## .log files may be in a different directory for out of source builds +LOGFILES := $(patsubst %.el,%.log, \ + $(patsubst $(srcdir)/%,%,$(ELFILES))) +TESTS := $(LOGFILES:.log=) + +## If we have to interrupt a hanging test, preserve the log so we can +## see what the problem was. +.PRECIOUS: %.log + +## Stop make deleting these as intermediate files. +.SECONDARY: ${ELFILES:.el=.elc} + +.PHONY: ${TESTS} + +define test_template + ## A test FOO-tests depends on the source file with the similar + ## name, unless FOO itself contains the string '-tests/'. + ## The similar name is FOO.c if FOO begins with 'src/', FOO.el + ## otherwise. Although this heuristic does not identify all the + ## dependencies, it is better than nothing. + ifeq (,$(patsubst %-tests,,$(1))$(findstring -tests/,$(1))) + $(1).log: $(patsubst %-tests,$(srcdir)/../%,$(1))$(if \ + $(patsubst src/%,,$(1)),.el,.c) + endif + + ## Short aliases that always re-run the tests, with no logging. + ## Define both with and without the directory name for ease of use. + .PHONY: $(1) $(notdir $(1)) + $(1): + @test ! -f $(1).log || mv $(1).log $(1).log~ + @$(MAKE) $(1).log WRITE_LOG= + $(notdir $(1)): $(1) +endef + +$(foreach test,${TESTS},$(eval $(call test_template,${test}))) + +ifeq (@HAVE_MODULES@, yes) +test_module_dir := $(srcdir)/data/emacs-module +test_module_name := mod-test@MODULES_SUFFIX@ +test_module := $(test_module_dir)/$(test_module_name) +$(srcdir)/src/emacs-module-tests.log: $(test_module) +$(test_module): $(srcdir)/../src/emacs-module.[ch] $(test_module_dir)/mod-test.c + $(MAKE) -C $(test_module_dir) $(test_module_name) SO=@MODULES_SUFFIX@ +endif + +## Check that there is no 'automated' subdirectory, which would +## indicate an incomplete merge from an older version of Emacs where +## the tests were arranged differently. +.PHONY: check-no-automated-subdir +check-no-automated-subdir: + test ! -d $(srcdir)/automated + +## Rerun all default tests. +check: mostlyclean check-no-automated-subdir + @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" + +## Rerun all default and expensive tests. +.PHONY: check-expensive +check-expensive: mostlyclean check-no-automated-subdir + @${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}" + +## Re-run all tests which are outdated. A test is outdated if its +## logfile is out-of-date with either the test file, or the source +## files that the tests depend on. See test_template. +.PHONY: check-maybe +check-maybe: check-no-automated-subdir + @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" + +## Run the tests. +.PHONY: check-doit +check-doit: ${LOGFILES} + @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ + +.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean + +mostlyclean: + -@for f in ${LOGFILES}; do test ! -f $$f || mv $$f $$f~; done + rm -f *.tmp + +clean: + find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE) + +bootstrap-clean: clean + find $(srcdir) -name '*.elc' $(FIND_DELETE) + +distclean: clean + rm -f Makefile + +maintainer-clean: distclean bootstrap-clean diff --git a/test/README b/test/README index cdb307649a3..fca20166821 100644 --- a/test/README +++ b/test/README @@ -4,12 +4,14 @@ See the end of the file for license conditions. This directory contains files intended to test various aspects of Emacs's functionality. Please help add tests! +See the file file-organization.org for the details of the directory +structure and file-naming conventions. + Emacs uses ERT, Emacs Lisp Regression Testing, for testing. See (info "(ert)") or https://www.gnu.org/software/emacs/manual/html_node/ert/ for more information on writing and running tests. -All ERT test files are supposed to run from subdirectory automated/. -The Makefile in that directory supports the following targets: +The Makefile in this directory supports the following targets: * make check Run all tests as defined in the directory. Expensive tests are diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in deleted file mode 100644 index d3c5633c5d2..00000000000 --- a/test/automated/Makefile.in +++ /dev/null @@ -1,173 +0,0 @@ -### @configure_input@ - -# Copyright (C) 2010-2017 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 <http://www.gnu.org/licenses/>. - -### Commentary: - -## Some targets: -## check: re-run all tests, writing to .log files. -## check-maybe: run all tests whose .log file needs updating -## filename.log: run tests from filename.el(c) if .log file needs updating -## filename: re-run tests from filename.el(c), with no logging - -### Code: - -SHELL = @SHELL@ - -srcdir = @srcdir@ -VPATH = $(srcdir) - -SEPCHAR = @SEPCHAR@ - -# We never change directory before running Emacs, so a relative file -# name is fine, and makes life easier. If we need to change -# directory, we can use emacs --chdir. -EMACS = ../../src/emacs - -EMACS_EXTRAOPT= - -# Command line flags for Emacs. -# Apparently MSYS bash would convert "-L :" to "-L ;" anyway, -# but we might as well be explicit. -EMACSOPT = -batch --no-site-file --no-site-lisp -L "$(SEPCHAR)$(srcdir)" $(EMACS_EXTRAOPT) - -# Prevent any settings in the user environment causing problems. -unexport EMACSDATA EMACSDOC EMACSPATH GREP_OPTIONS - -## To run tests under a debugger, set this to eg: "gdb --args". -GDB = - -# The locale to run tests under. Tests should work if this is set to -# any supported locale. Use the C locale by default, as it should be -# supported everywhere. -TEST_LOCALE = C - -# The actual Emacs command run in the targets below. -# Prevent any setting of EMACSLOADPATH in user environment causing problems. -emacs = EMACSLOADPATH= LC_ALL=$(TEST_LOCALE) EMACS_TEST_DIRECTORY=$(srcdir) \ - $(GDB) "$(EMACS)" $(EMACSOPT) - -.PHONY: all check - -all: check - -%.elc: %.el - @echo Compiling $< - @$(emacs) -f batch-byte-compile $< - -## Ignore any test errors so we can continue to test other files. -## But compilation errors are always fatal. -WRITE_LOG = > $@ 2>&1 || { stat=ERROR; cat $@; }; echo $$stat: $@ - -## I'd prefer to use -emacs -f ert-run-tests-batch-and-exit rather -## than || true, since the former makes problems more obvious. -## I'd also prefer to @-hide the grep part and not the -## ert-run-tests-batch-and-exit part. -## -## We need to use $loadfile because: -## i) -L :$srcdir -l basename does not work, because we have files whose -## basename duplicates a file in lisp/ (eg eshell.el). -## ii) Although -l basename will automatically load .el or .elc, -## -l ./basename treats basename as a literal file (it would be nice -## to change this; bug#17848 - if that gets done, this can be simplified). -## -## Beware: it approximates 'no-byte-compile', so watch out for false-positives! -SELECTOR_DEFAULT = (quote (not (tag :expensive-test))) -SELECTOR_EXPENSIVE = nil -ifdef SELECTOR -SELECTOR_ACTUAL=$(SELECTOR) -else ifndef MAKECMDGOALS -SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) -else ifeq ($(MAKECMDGOALS),all) -SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) -else ifeq ($(MAKECMDGOALS),check) -SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) -else ifeq ($(MAKECMDGOALS),check-maybe) -SELECTOR_ACTUAL=$(SELECTOR_DEFAULT) -else -SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE) -endif - - -%.log: ${srcdir}/%.el - @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \ - loadfile=$<; \ - else \ - loadfile=$<c; \ - ${MAKE} $$loadfile; \ - fi; \ - echo Testing $$loadfile; \ - stat=OK ; \ - $(emacs) -l ert -l $$loadfile \ - --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" ${WRITE_LOG} - -ELFILES = $(sort $(wildcard ${srcdir}/*.el)) -LOGFILES = $(patsubst %.el,%.log,$(notdir ${ELFILES})) -TESTS = ${LOGFILES:.log=} - -## If we have to interrupt a hanging test, preserve the log so we can -## see what the problem was. -.PRECIOUS: %.log - -.PHONY: ${TESTS} - -## The short aliases that always re-run the tests, with no logging. -define test_template -$(1): - @test ! -f $(1).log || mv $(1).log $(1).log~ - @${MAKE} $(1).log WRITE_LOG= -endef - -$(foreach test,${TESTS},$(eval $(call test_template,${test}))) - -## Rerun all default tests. -check: mostlyclean - @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" - -## Rerun all default and expensive tests. -.PHONY: check-expensive -check-expensive: mostlyclean - @${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}" - -## Only re-run default tests whose .log is older than the test. -.PHONY: check-maybe -check-maybe: - @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}" - -## Run the tests. -.PHONY: check-doit -check-doit: ${LOGFILES} - $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^ - -.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean - -mostlyclean: - -@for f in *.log; do test ! -f $$f || mv $$f $$f~; done - -clean: - -rm -f *.log *.log~ - -bootstrap-clean: clean - -rm -f ${srcdir}/*.elc - -distclean: clean - rm -f Makefile - -maintainer-clean: distclean bootstrap-clean - -# Makefile ends here. diff --git a/test/automated/abbrev-tests.el b/test/automated/abbrev-tests.el deleted file mode 100644 index 7adab32892e..00000000000 --- a/test/automated/abbrev-tests.el +++ /dev/null @@ -1,98 +0,0 @@ -;;; abbrev-tests.el --- Test suite for abbrevs. - -;; Copyright (C) 2015-2017 Free Software Foundation, Inc. - -;; Author: Eli Zaretskii <eliz@gnu.org> -;; Keywords: abbrevs - -;; 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 <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; `kill-all-abbrevs-test' will remove all user *and* system abbrevs -;; if called noninteractively with the init file loaded. - -;;; Code: - -(require 'ert) -(require 'abbrev) -(require 'seq) - -;; set up test abbrev table and abbrev entry -(defun setup-test-abbrev-table () - (defvar ert-test-abbrevs nil) - (define-abbrev-table 'ert-test-abbrevs '(("a-e-t" "abbrev-ert-test"))) - (abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value") - ert-test-abbrevs) - -(ert-deftest copy-abbrev-table-test () - (defvar foo-abbrev-table nil) ; Avoid compiler warning - (define-abbrev-table 'foo-abbrev-table - '()) - (should (abbrev-table-p foo-abbrev-table)) - ;; Bug 21828 - (let ((new-foo-abbrev-table - (condition-case nil - (copy-abbrev-table foo-abbrev-table) - (error nil)))) - (should (abbrev-table-p new-foo-abbrev-table))) - (should-not (string-equal (buffer-name) "*Backtrace*"))) - -(ert-deftest kill-all-abbrevs-test () - "Test undefining all defined abbrevs" - (unless noninteractive - (ert-skip "Cannot test kill-all-abbrevs in interactive mode")) - - (let ((num-tables 0)) - ;; ensure at least one abbrev exists - (should (abbrev-table-p (setup-test-abbrev-table))) - (setf num-tables (length abbrev-table-name-list)) - (kill-all-abbrevs) - - ;; no tables should have been removed/added - (should (= num-tables (length abbrev-table-name-list))) - ;; number of empty tables should be the same as number of tables - (should (= num-tables (length (seq-filter - (lambda (table) - (abbrev-table-empty-p (symbol-value table))) - abbrev-table-name-list)))))) - -(ert-deftest abbrev-table-name-test () - "Test returning name of abbrev-table" - (let ((ert-test-abbrevs (setup-test-abbrev-table)) - (no-such-table nil)) - (should (equal 'ert-test-abbrevs (abbrev-table-name ert-test-abbrevs))) - (should (equal nil (abbrev-table-name no-such-table))))) - -(ert-deftest clear-abbrev-table-test () - "Test clearing single abbrev table" - (let ((ert-test-abbrevs (setup-test-abbrev-table))) - (should (equal "a-e-t" (symbol-name - (abbrev-symbol "a-e-t" ert-test-abbrevs)))) - (should (equal "abbrev-ert-test" (symbol-value - (abbrev-symbol "a-e-t" ert-test-abbrevs)))) - - (clear-abbrev-table ert-test-abbrevs) - - (should (equal "nil" (symbol-name - (abbrev-symbol "a-e-t" ert-test-abbrevs)))) - (should (equal nil (symbol-value - (abbrev-symbol "a-e-t" ert-test-abbrevs)))) - (should (equal t (abbrev-table-empty-p ert-test-abbrevs))))) - -(provide 'abbrev-tests) - -;;; abbrev-tests.el ends here diff --git a/test/automated/coding-tests.el b/test/automated/coding-tests.el deleted file mode 100644 index c0ad8d555b3..00000000000 --- a/test/automated/coding-tests.el +++ /dev/null @@ -1,50 +0,0 @@ -;;; coding-tests.el --- tests for text encoding and decoding - -;; Copyright (C) 2015-2017 Free Software Foundation, Inc. - -;; Author: Eli Zaretskii <eliz@gnu.org> - -;; 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 <http://www.gnu.org/licenses/>. - -;;; Code: - -(require 'ert) - -;; Directory to hold test data files. -(defvar coding-tests-workdir - (expand-file-name "coding-tests" temporary-file-directory)) - -;; Remove all generated test files. -(defun coding-tests-remove-files () - (delete-directory coding-tests-workdir t)) - -(ert-deftest ert-test-coding-bogus-coding-systems () - (unwind-protect - (let (test-file) - (or (file-directory-p coding-tests-workdir) - (mkdir coding-tests-workdir t)) - (setq test-file (expand-file-name "nonexistent" coding-tests-workdir)) - (if (file-exists-p test-file) - (delete-file test-file)) - (should-error - (let ((coding-system-for-read 'bogus)) - (insert-file-contents test-file))) - ;; See bug #21602. - (setq test-file (expand-file-name "writing" coding-tests-workdir)) - (should-error - (let ((coding-system-for-write (intern "\"us-ascii\""))) - (write-region "some text" nil test-file)))) - (coding-tests-remove-files))) diff --git a/test/automated/core-elisp-tests.el b/test/automated/core-elisp-tests.el deleted file mode 100644 index 0851367f9bc..00000000000 --- a/test/automated/core-elisp-tests.el +++ /dev/null @@ -1,52 +0,0 @@ -;;; core-elisp-tests.el --- Testing some core Elisp rules - -;; Copyright (C) 2013-2017 Free Software Foundation, Inc. - -;; Author: Stefan Monnier <monnier@iro.umontreal.ca> -;; Keywords: - -;; This program 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. - -;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; - -;;; Code: - -(ert-deftest core-elisp-tests-1-defvar-in-let () - "Test some core Elisp rules." - (with-temp-buffer - ;; Check that when defvar is run within a let-binding, the toplevel default - ;; is properly initialized. - (should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x) - '(1 2))) - (should (equal (list (let ((c-e-x 1)) - (defcustom c-e-x 2 "doc" :group 'blah :type 'integer) c-e-x) - c-e-x) - '(1 2))))) - -(ert-deftest core-elisp-tests-2-window-configurations () - "Test properties of window-configurations." - (let ((wc (current-window-configuration))) - (with-current-buffer (window-buffer (frame-selected-window)) - (push-mark) - (activate-mark)) - (set-window-configuration wc) - (should (or (not mark-active) (mark))))) - -(ert-deftest core-elisp-tests-3-backquote () - (should (eq 3 (eval ``,,'(+ 1 2))))) - -(provide 'core-elisp-tests) -;;; core-elisp-tests.el ends here diff --git a/test/automated/data-tests.el b/test/automated/data-tests.el deleted file mode 100644 index 9abc9e7c68f..00000000000 --- a/test/automated/data-tests.el +++ /dev/null @@ -1,257 +0,0 @@ -;;; data-tests.el --- tests for src/data.c - -;; Copyright (C) 2013-2017 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 <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;;; Code: - -(require 'cl-lib) -(eval-when-compile (require 'cl)) - -(ert-deftest data-tests-= () - (should-error (=)) - (should (= 1)) - (should (= 2 2)) - (should (= 9 9 9 9 9 9 9 9 9)) - (should-not (apply #'= '(3 8 3))) - (should-error (= 9 9 'foo)) - ;; Short circuits before getting to bad arg - (should-not (= 9 8 'foo))) - -(ert-deftest data-tests-< () - (should-error (<)) - (should (< 1)) - (should (< 2 3)) - (should (< -6 -1 0 2 3 4 8 9 999)) - (should-not (apply #'< '(3 8 3))) - (should-error (< 9 10 'foo)) - ;; Short circuits before getting to bad arg - (should-not (< 9 8 'foo))) - -(ert-deftest data-tests-> () - (should-error (>)) - (should (> 1)) - (should (> 3 2)) - (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) - (should-not (apply #'> '(3 8 3))) - (should-error (> 9 8 'foo)) - ;; Short circuits before getting to bad arg - (should-not (> 8 9 'foo))) - -(ert-deftest data-tests-<= () - (should-error (<=)) - (should (<= 1)) - (should (<= 2 3)) - (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) - (should-not (apply #'<= '(3 8 3 3))) - (should-error (<= 9 10 'foo)) - ;; Short circuits before getting to bad arg - (should-not (<= 9 8 'foo))) - -(ert-deftest data-tests->= () - (should-error (>=)) - (should (>= 1)) - (should (>= 3 2)) - (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) - (should-not (apply #'>= '(3 8 3))) - (should-error (>= 9 8 'foo)) - ;; Short circuits before getting to bad arg - (should-not (>= 8 9 'foo))) - -;; Bool vector tests. Compactly represent bool vectors as hex -;; strings. - -(ert-deftest bool-vector-count-population-all-0-nil () - (cl-loop for sz in '(0 45 1 64 9 344) - do (let* ((bv (make-bool-vector sz nil))) - (should - (zerop - (bool-vector-count-population bv)))))) - -(ert-deftest bool-vector-count-population-all-1-t () - (cl-loop for sz in '(0 45 1 64 9 344) - do (let* ((bv (make-bool-vector sz t))) - (should - (eql - (bool-vector-count-population bv) - sz))))) - -(ert-deftest bool-vector-count-population-1-nil () - (let* ((bv (make-bool-vector 45 nil))) - (aset bv 40 t) - (aset bv 0 t) - (should - (eql - (bool-vector-count-population bv) - 2)))) - -(ert-deftest bool-vector-count-population-1-t () - (let* ((bv (make-bool-vector 45 t))) - (aset bv 40 nil) - (aset bv 0 nil) - (should - (eql - (bool-vector-count-population bv) - 43)))) - -(defun mock-bool-vector-count-consecutive (a b i) - (loop for i from i below (length a) - while (eq (aref a i) b) - sum 1)) - -(defun test-bool-vector-bv-from-hex-string (desc) - (let (bv nchars nibbles) - (dolist (c (string-to-list desc)) - (push (string-to-number - (char-to-string c) - 16) - nibbles)) - (setf bv (make-bool-vector (* 4 (length nibbles)) nil)) - (let ((i 0)) - (dolist (n (nreverse nibbles)) - (dotimes (_ 4) - (aset bv i (> (logand 1 n) 0)) - (incf i) - (setf n (lsh n -1))))) - bv)) - -(defun test-bool-vector-to-hex-string (bv) - (let (nibbles (v (cl-coerce bv 'list))) - (while v - (push (logior - (lsh (if (nth 0 v) 1 0) 0) - (lsh (if (nth 1 v) 1 0) 1) - (lsh (if (nth 2 v) 1 0) 2) - (lsh (if (nth 3 v) 1 0) 3)) - nibbles) - (setf v (nthcdr 4 v))) - (mapconcat (lambda (n) (format "%X" n)) - (nreverse nibbles) - ""))) - -(defun test-bool-vector-count-consecutive-tc (desc) - "Run a test case for bool-vector-count-consecutive. -DESC is a string describing the test. It is a sequence of -hexadecimal digits describing the bool vector. We exhaustively -test all counts at all possible positions in the vector by -comparing the subr with a much slower lisp implementation." - (let ((bv (test-bool-vector-bv-from-hex-string desc))) - (loop - for lf in '(nil t) - do (loop - for pos from 0 upto (length bv) - for cnt = (mock-bool-vector-count-consecutive bv lf pos) - for rcnt = (bool-vector-count-consecutive bv lf pos) - unless (eql cnt rcnt) - do (error "FAILED testcase %S %3S %3S %3S" - pos lf cnt rcnt))))) - -(defconst bool-vector-test-vectors -'("" - "0" - "F" - "0F" - "F0" - "00000000000000000000000000000FFFFF0000000" - "44a50234053fba3340000023444a50234053fba33400000234" - "12341234123456123412346001234123412345612341234600" - "44a50234053fba33400000234" - "1234123412345612341234600" - "44a50234053fba33400000234" - "1234123412345612341234600" - "44a502340" - "123412341" - "0000000000000000000000000" - "FFFFFFFFFFFFFFFF1")) - -(ert-deftest bool-vector-count-consecutive () - (mapc #'test-bool-vector-count-consecutive-tc - bool-vector-test-vectors)) - -(defun test-bool-vector-apply-mock-op (mock a b c) - "Compute (slowly) the correct result of a bool-vector set operation." - (let (changed nv) - (assert (eql (length b) (length c))) - (if a (setf nv a) - (setf a (make-bool-vector (length b) nil)) - (setf changed t)) - - (loop for i below (length b) - for mockr = (funcall mock - (if (aref b i) 1 0) - (if (aref c i) 1 0)) - for r = (not (= 0 mockr)) - do (progn - (unless (eq (aref a i) r) - (setf changed t)) - (setf (aref a i) r))) - (if changed a))) - -(defun test-bool-vector-binop (mock real) - "Test a binary set operation." - (loop for s1 in bool-vector-test-vectors - for bv1 = (test-bool-vector-bv-from-hex-string s1) - for vecs2 = (cl-remove-if-not - (lambda (x) (eql (length x) (length s1))) - bool-vector-test-vectors) - do (loop for s2 in vecs2 - for bv2 = (test-bool-vector-bv-from-hex-string s2) - for mock-result = (test-bool-vector-apply-mock-op - mock nil bv1 bv2) - for real-result = (funcall real bv1 bv2) - do (progn - (should (equal mock-result real-result)))))) - -(ert-deftest bool-vector-intersection-op () - (test-bool-vector-binop - #'logand - #'bool-vector-intersection)) - -(ert-deftest bool-vector-union-op () - (test-bool-vector-binop - #'logior - #'bool-vector-union)) - -(ert-deftest bool-vector-xor-op () - (test-bool-vector-binop - #'logxor - #'bool-vector-exclusive-or)) - -(ert-deftest bool-vector-set-difference-op () - (test-bool-vector-binop - (lambda (a b) (logand a (lognot b))) - #'bool-vector-set-difference)) - -(ert-deftest bool-vector-change-detection () - (let* ((vc1 (test-bool-vector-bv-from-hex-string "abcdef")) - (vc2 (test-bool-vector-bv-from-hex-string "012345")) - (vc3 (make-bool-vector (length vc1) nil)) - (c1 (bool-vector-union vc1 vc2 vc3)) - (c2 (bool-vector-union vc1 vc2 vc3))) - (should (equal c1 (test-bool-vector-apply-mock-op - #'logior - nil - vc1 vc2))) - (should (not c2)))) - -(ert-deftest bool-vector-not () - (let* ((v1 (test-bool-vector-bv-from-hex-string "FFFF3")) - (v2 (test-bool-vector-bv-from-hex-string "0000C")) - (v3 (bool-vector-not v1))) - (should (equal v2 v3)))) diff --git a/test/automated/fns-tests.el b/test/automated/fns-tests.el deleted file mode 100644 index 8a5b7fe98fc..00000000000 --- a/test/automated/fns-tests.el +++ /dev/null @@ -1,193 +0,0 @@ -;;; fns-tests.el --- tests for src/fns.c - -;; Copyright (C) 2014-2017 Free Software Foundation, Inc. - -;; This file is part of GNU Emacs. - -;; This program 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. -;; -;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. - -;;; Commentary: - -;;; Code: - -(require 'cl-lib) -(eval-when-compile (require 'cl)) - -(ert-deftest fns-tests-reverse () - (should-error (reverse)) - (should-error (reverse 1)) - (should-error (reverse (make-char-table 'foo))) - (should (equal [] (reverse []))) - (should (equal [0] (reverse [0]))) - (should (equal [1 2 3 4] (reverse (reverse [1 2 3 4])))) - (should (equal '(a b c d) (reverse (reverse '(a b c d))))) - (should (equal "xyzzy" (reverse (reverse "xyzzy")))) - (should (equal "こんにちは / コンニチハ" (reverse (reverse "こんにちは / コンニチハ"))))) - -(ert-deftest fns-tests-nreverse () - (should-error (nreverse)) - (should-error (nreverse 1)) - (should-error (nreverse (make-char-table 'foo))) - (should (equal (nreverse "xyzzy") "yzzyx")) - (let ((A [])) - (nreverse A) - (should (equal A []))) - (let ((A [0])) - (nreverse A) - (should (equal A [0]))) - (let ((A [1 2 3 4])) - (nreverse A) - (should (equal A [4 3 2 1]))) - (let ((A [1 2 3 4])) - (nreverse A) - (nreverse A) - (should (equal A [1 2 3 4]))) - (let* ((A [1 2 3 4]) - (B (nreverse (nreverse A)))) - (should (equal A B)))) - -(ert-deftest fns-tests-reverse-bool-vector () - (let ((A (make-bool-vector 10 nil))) - (dotimes (i 5) (aset A i t)) - (should (equal [nil nil nil nil nil t t t t t] (vconcat (reverse A)))) - (should (equal A (reverse (reverse A)))))) - -(ert-deftest fns-tests-nreverse-bool-vector () - (let ((A (make-bool-vector 10 nil))) - (dotimes (i 5) (aset A i t)) - (nreverse A) - (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) - (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) - -(ert-deftest fns-tests-compare-strings () - (should-error (compare-strings)) - (should-error (compare-strings "xyzzy" "xyzzy")) - (should (= (compare-strings "xyzzy" 0 10 "zyxxy" 0 5) -1)) - (should-error (compare-strings "xyzzy" 0 5 "zyxxy" -1 2)) - (should-error (compare-strings "xyzzy" 'foo nil "zyxxy" 0 1)) - (should-error (compare-strings "xyzzy" 0 'foo "zyxxy" 2 3)) - (should-error (compare-strings "xyzzy" 0 2 "zyxxy" 'foo 3)) - (should-error (compare-strings "xyzzy" nil 3 "zyxxy" 4 'foo)) - (should (eq (compare-strings "" nil nil "" nil nil) t)) - (should (eq (compare-strings "" 0 0 "" 0 0) t)) - (should (eq (compare-strings "test" nil nil "test" nil nil) t)) - (should (eq (compare-strings "test" nil nil "test" nil nil t) t)) - (should (eq (compare-strings "test" nil nil "test" nil nil nil) t)) - (should (eq (compare-strings "Test" nil nil "test" nil nil t) t)) - (should (= (compare-strings "Test" nil nil "test" nil nil) -1)) - (should (= (compare-strings "Test" nil nil "test" nil nil) -1)) - (should (= (compare-strings "test" nil nil "Test" nil nil) 1)) - (should (= (compare-strings "foobaz" nil nil "barbaz" nil nil) 1)) - (should (= (compare-strings "barbaz" nil nil "foobar" nil nil) -1)) - (should (= (compare-strings "foobaz" nil nil "farbaz" nil nil) 2)) - (should (= (compare-strings "farbaz" nil nil "foobar" nil nil) -2)) - (should (eq (compare-strings "abcxyz" 0 2 "abcprq" 0 2) t)) - (should (eq (compare-strings "abcxyz" 0 -3 "abcprq" 0 -3) t)) - (should (= (compare-strings "abcxyz" 0 6 "abcprq" 0 6) 4)) - (should (= (compare-strings "abcprq" 0 6 "abcxyz" 0 6) -4)) - (should (eq (compare-strings "xyzzy" -3 4 "azza" -3 3) t)) - (should (eq (compare-strings "こんにちはコンニチハ" nil nil "こんにちはコンニチハ" nil nil) t)) - (should (= (compare-strings "んにちはコンニチハこ" nil nil "こんにちはコンニチハ" nil nil) 1)) - (should (= (compare-strings "こんにちはコンニチハ" nil nil "んにちはコンニチハこ" nil nil) -1))) - -(defun fns-tests--collate-enabled-p () - "Check whether collation functions are enabled." - (and - ;; When there is no collation library, collation functions fall back - ;; to their lexicographic counterparts. We don't need to test then. - (not (ignore-errors (string-collate-equalp "" "" t))) - ;; We use a locale, which might not be installed. Check it. - (ignore-errors - (string-collate-equalp - "" "" (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) - -(ert-deftest fns-tests-collate-strings () - (skip-unless (fns-tests--collate-enabled-p)) - - (should (string-collate-equalp "xyzzy" "xyzzy")) - (should-not (string-collate-equalp "xyzzy" "XYZZY")) - - ;; In POSIX or C locales, collation order is lexicographic. - (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX")) - ;; In a language specific locale, collation order is different. - (should (string-collate-lessp - "xyzzy" "XYZZY" - (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))) - - ;; Ignore case. - (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) - - ;; Locale must be valid. - (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_DE.UTF-8"))) - -;; There must be a check for valid codepoints. (Check not implemented yet) -; (should-error -; (string-collate-equalp (string ?\x00110000) (string ?\x00110000))) -;; Invalid UTF-8 sequences shall be indicated. How to create such strings? - -(ert-deftest fns-tests-sort () - (should (equal (sort '(9 5 2 -1 5 3 8 7 4) (lambda (x y) (< x y))) - '(-1 2 3 4 5 5 7 8 9))) - (should (equal (sort '(9 5 2 -1 5 3 8 7 4) (lambda (x y) (> x y))) - '(9 8 7 5 5 4 3 2 -1))) - (should (equal (sort '[9 5 2 -1 5 3 8 7 4] (lambda (x y) (< x y))) - [-1 2 3 4 5 5 7 8 9])) - (should (equal (sort '[9 5 2 -1 5 3 8 7 4] (lambda (x y) (> x y))) - [9 8 7 5 5 4 3 2 -1])) - (should (equal - (sort - (vector - '(8 . "xxx") '(9 . "aaa") '(8 . "bbb") '(9 . "zzz") - '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) - (lambda (x y) (< (car x) (car y)))) - [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") - (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) - -(ert-deftest fns-tests-collate-sort () - ;; See https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02505.html. - :expected-result (if (eq system-type 'cygwin) :failed :passed) - (skip-unless (fns-tests--collate-enabled-p)) - - ;; Punctuation and whitespace characters are relevant for POSIX. - (should - (equal - (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") - (lambda (a b) (string-collate-lessp a b "POSIX"))) - '("1 1" "1 2" "1.1" "1.2" "11" "12"))) - ;; Punctuation and whitespace characters are not taken into account - ;; for collation in other locales. - (should - (equal - (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") - (lambda (a b) - (let ((w32-collate-ignore-punctuation t)) - (string-collate-lessp - a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) - '("11" "1 1" "1.1" "12" "1 2" "1.2"))) - - ;; Diacritics are different letters for POSIX, they sort lexicographical. - (should - (equal - (sort '("Ævar" "Agustín" "Adrian" "Eli") - (lambda (a b) (string-collate-lessp a b "POSIX"))) - '("Adrian" "Agustín" "Eli" "Ævar"))) - ;; Diacritics are sorted between similar letters for other locales. - (should - (equal - (sort '("Ævar" "Agustín" "Adrian" "Eli") - (lambda (a b) - (let ((w32-collate-ignore-punctuation t)) - (string-collate-lessp - a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) - '("Adrian" "Ævar" "Agustín" "Eli")))) diff --git a/test/automated/help-fns.el b/test/automated/help-fns.el deleted file mode 100644 index 2bcd71b83f6..00000000000 --- a/test/automated/help-fns.el +++ /dev/null @@ -1,70 +0,0 @@ -;;; help-fns.el --- tests for help-fns.el - -;; Copyright (C) 2014-2017 Free Software Foundation, Inc. - -;; Maintainer: emacs-devel@gnu.org - -;; 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 <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;;; Code: - -(require 'ert) - -(autoload 'help-fns-test--macro "help-fns" nil nil t) - -(ert-deftest help-fns-test-bug17410 () - "Test for http://debbugs.gnu.org/17410 ." - (describe-function 'help-fns-test--macro) - (with-current-buffer "*Help*" - (goto-char (point-min)) - (should (search-forward "autoloaded Lisp macro" (line-end-position))))) - -(defun abc\\\[universal-argument\]b\`c\'d\\e\"f (x) - "A function with a funny name. - -\(fn XYZZY)" - x) - -(defun defgh\\\[universal-argument\]b\`c\'d\\e\"f (x) - "Another function with a funny name." - x) - -(ert-deftest help-fns-test-funny-names () - "Test for help with functions with funny names." - (describe-function 'abc\\\[universal-argument\]b\`c\'d\\e\"f) - (with-current-buffer "*Help*" - (goto-char (point-min)) - (should (search-forward - "(abc\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f XYZZY)"))) - (describe-function 'defgh\\\[universal-argument\]b\`c\'d\\e\"f) - (with-current-buffer "*Help*" - (goto-char (point-min)) - (should (search-forward - "(defgh\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f X)")))) - -(ert-deftest help-fns-test-describe-symbol () - "Test the `describe-symbol' function." - ;; 'describe-symbol' would originally signal an error for - ;; 'font-lock-comment-face'. - (describe-symbol 'font-lock-comment-face) - (with-current-buffer "*Help*" - (should (> (point-max) 1)) - (goto-char (point-min)) - (should (looking-at "^font-lock-comment-face is ")))) - -;;; help-fns.el ends here diff --git a/test/automated/lexbind-tests.el b/test/automated/lexbind-tests.el deleted file mode 100644 index 483bd1a7cd4..00000000000 --- a/test/automated/lexbind-tests.el +++ /dev/null @@ -1,75 +0,0 @@ -;;; lexbind-tests.el --- Testing the lexbind byte-compiler - -;; Copyright (C) 2011-2017 Free Software Foundation, Inc. - -;; Author: Stefan Monnier <monnier@iro.umontreal.ca> -;; Keywords: - -;; This program 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. - -;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; - -;;; Code: - -(require 'ert) - -(defconst lexbind-tests - `( - (let ((f #'car)) - (let ((f (lambda (x) (cons (funcall f x) (cdr x))))) - (funcall f '(1 . 2)))) - ) - "List of expression for test. -Each element will be executed by interpreter and with -bytecompiled code, and their results compared.") - - - -(defun lexbind-check-1 (pat) - "Return non-nil if PAT is the same whether directly evalled or compiled." - (let ((warning-minimum-log-level :emergency) - (byte-compile-warnings nil) - (v0 (condition-case nil - (eval pat t) - (error nil))) - (v1 (condition-case nil - (funcall (let ((lexical-binding t)) - (byte-compile `(lambda nil ,pat)))) - (error nil)))) - (equal v0 v1))) - -(put 'lexbind-check-1 'ert-explainer 'lexbind-explain-1) - -(defun lexbind-explain-1 (pat) - (let ((v0 (condition-case nil - (eval pat t) - (error nil))) - (v1 (condition-case nil - (funcall (let ((lexical-binding t)) - (byte-compile (list 'lambda nil pat)))) - (error nil)))) - (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." - pat v0 v1))) - -(ert-deftest lexbind-tests () - "Test the Emacs byte compiler lexbind handling." - (dolist (pat lexbind-tests) - (should (lexbind-check-1 pat)))) - - - -(provide 'lexbind-tests) -;;; lexbind-tests.el ends here diff --git a/test/automated/syntax-tests.el b/test/automated/syntax-tests.el deleted file mode 100644 index 7afafdfa768..00000000000 --- a/test/automated/syntax-tests.el +++ /dev/null @@ -1,97 +0,0 @@ -;;; syntax-tests.el --- Testing syntax rules and basic movement -*- lexical-binding: t -*- - -;; Copyright (C) 2014-2017 Free Software Foundation, Inc. - -;; Author: Daniel Colascione <dancol@dancol.org> -;; Keywords: - -;; This program 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. - -;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. - -;;; Commentary: - -;; - -;;; Code: -(require 'ert) -(require 'cl-lib) - -(defun run-up-list-test (fn data start instructions) - (cl-labels ((posof (thing) - (and (symbolp thing) - (= (length (symbol-name thing)) 1) - (- (aref (symbol-name thing) 0) ?a -1)))) - (with-temp-buffer - (set-syntax-table (make-syntax-table)) - ;; Use a syntax table in which single quote is a string - ;; character so that we can embed the test data in a lisp string - ;; literal. - (modify-syntax-entry ?\' "\"") - (insert data) - (goto-char (posof start)) - (dolist (instruction instructions) - (cond ((posof instruction) - (funcall fn) - (should (eql (point) (posof instruction)))) - ((symbolp instruction) - (should-error (funcall fn) - :type instruction)) - (t (cl-assert nil nil "unknown ins"))))))) - -(defmacro define-up-list-test (name fn data start &rest expected) - `(ert-deftest ,name () - (run-up-list-test ,fn ,data ',start ',expected))) - -(define-up-list-test up-list-basic - (lambda () (up-list)) - (or "(1 1 (1 1) 1 (1 1) 1)") - ;; abcdefghijklmnopqrstuv - i k v scan-error) - -(define-up-list-test up-list-with-forward-sexp-function - (lambda () - (let ((forward-sexp-function - (lambda (&optional arg) - (let ((forward-sexp-function nil)) - (forward-sexp arg))))) - (up-list))) - (or "(1 1 (1 1) 1 (1 1) 1)") - ;; abcdefghijklmnopqrstuv - i k v scan-error) - -(define-up-list-test up-list-out-of-string - (lambda () (up-list 1 t)) - (or "1 (1 '2 2 (2 2 2' 1) 1") - ;; abcdefghijklmnopqrstuvwxy - o r u scan-error) - -(define-up-list-test up-list-cross-string - (lambda () (up-list 1 t)) - (or "(1 '2 ( 2' 1 '2 ) 2' 1)") - ;; abcdefghijklmnopqrstuvwxy - i r u x scan-error) - -(define-up-list-test up-list-no-cross-string - (lambda () (up-list 1 t t)) - (or "(1 '2 ( 2' 1 '2 ) 2' 1)") - ;; abcdefghijklmnopqrstuvwxy - i k x scan-error) - -(define-up-list-test backward-up-list-basic - (lambda () (backward-up-list)) - (or "(1 1 (1 1) 1 (1 1) 1)") - ;; abcdefghijklmnopqrstuv - i f a scan-error) - -(provide 'syntax-tests) -;;; syntax-tests.el ends here diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el deleted file mode 100644 index 83a780d9906..00000000000 --- a/test/automated/tramp-tests.el +++ /dev/null @@ -1,2383 +0,0 @@ -;;; tramp-tests.el --- Tests of remote file access - -;; Copyright (C) 2013-2017 Free Software Foundation, Inc. - -;; Author: Michael Albinus <michael.albinus@gmx.de> - -;; This program 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. -;; -;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. - -;;; Commentary: - -;; The tests require a recent ert.el from Emacs 24.4. - -;; Some of the tests require access to a remote host files. Since -;; this could be problematic, a mock-up connection method "mock" is -;; used. Emulating a remote connection, it simply calls "sh -i". -;; Tramp's file name handlers still run, so this test is sufficient -;; except for connection establishing. - -;; If you want to test a real Tramp connection, set -;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to -;; overwrite the default value. If you want to skip tests accessing a -;; remote host, set this environment variable to "/dev/null" or -;; whatever is appropriate on your system. - -;; A whole test run can be performed calling the command `tramp-test-all'. - -;;; Code: - -(require 'ert) -(require 'tramp) -(require 'vc) -(require 'vc-bzr) -(require 'vc-git) -(require 'vc-hg) - -(autoload 'dired-uncache "dired") -(declare-function tramp-find-executable "tramp-sh") -(declare-function tramp-get-remote-path "tramp-sh") -(declare-function tramp-get-remote-stat "tramp-sh") -(declare-function tramp-get-remote-perl "tramp-sh") -(defvar tramp-copy-size-limit) -(defvar tramp-persistency-file-name) -(defvar tramp-remote-process-environment) - -;; There is no default value on w32 systems, which could work out of the box. -(defconst tramp-test-temporary-file-directory - (cond - ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) - ((eq system-type 'windows-nt) null-device) - (t (add-to-list - 'tramp-methods - '("mock" - (tramp-login-program "sh") - (tramp-login-args (("-i"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-connection-timeout 10))) - (format "/mock::%s" temporary-file-directory))) - "Temporary directory for Tramp tests.") - -(setq password-cache-expiry nil - tramp-verbose 0 - tramp-copy-size-limit nil - tramp-message-show-message nil - tramp-persistency-file-name nil) - -;; This shall happen on hydra only. -(when (getenv "NIX_STORE") - (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) - -(defvar tramp--test-enabled-checked nil - "Cached result of `tramp--test-enabled'. -If the function did run, the value is a cons cell, the `cdr' -being the result.") - -(defun tramp--test-enabled () - "Whether remote file access is enabled." - (unless (consp tramp--test-enabled-checked) - (setq - tramp--test-enabled-checked - (cons - t (ignore-errors - (and - (file-remote-p tramp-test-temporary-file-directory) - (file-directory-p tramp-test-temporary-file-directory) - (file-writable-p tramp-test-temporary-file-directory)))))) - - (when (cdr tramp--test-enabled-checked) - ;; Cleanup connection. - (ignore-errors - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password))) - - ;; Return result. - (cdr tramp--test-enabled-checked)) - -(defun tramp--test-make-temp-name (&optional local) - "Create a temporary file name for test." - (expand-file-name - (make-temp-name "tramp-test") - (if local temporary-file-directory tramp-test-temporary-file-directory))) - -(defmacro tramp--instrument-test-case (verbose &rest body) - "Run BODY with `tramp-verbose' equal VERBOSE. -Print the the content of the Tramp debug buffer, if BODY does not -eval properly in `should', `should-not' or `should-error'. BODY -shall not contain a timeout." - (declare (indent 1) (debug (natnump body))) - `(let ((tramp-verbose ,verbose) - (tramp-message-show-message t) - (tramp-debug-on-error t) - (debug-ignored-errors - (cons "^make-symbolic-link not supported$" debug-ignored-errors))) - (unwind-protect - (progn ,@body) - (when (> tramp-verbose 3) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (with-current-buffer (tramp-get-connection-buffer v) - (message "%s" (buffer-string))) - (with-current-buffer (tramp-get-debug-buffer v) - (message "%s" (buffer-string)))))))) - -(ert-deftest tramp-test00-availability () - "Test availability of Tramp functions." - :expected-result (if (tramp--test-enabled) :passed :failed) - (message "Remote directory: `%s'" tramp-test-temporary-file-directory) - (should (ignore-errors - (and - (file-remote-p tramp-test-temporary-file-directory) - (file-directory-p tramp-test-temporary-file-directory) - (file-writable-p tramp-test-temporary-file-directory))))) - -(ert-deftest tramp-test01-file-name-syntax () - "Check remote file name syntax." - ;; Simple cases. - (should (tramp-tramp-file-p "/method::")) - (should (tramp-tramp-file-p "/host:")) - (should (tramp-tramp-file-p "/user@:")) - (should (tramp-tramp-file-p "/user@host:")) - (should (tramp-tramp-file-p "/method:host:")) - (should (tramp-tramp-file-p "/method:user@:")) - (should (tramp-tramp-file-p "/method:user@host:")) - (should (tramp-tramp-file-p "/method:user@email@host:")) - - ;; Using a port. - (should (tramp-tramp-file-p "/host#1234:")) - (should (tramp-tramp-file-p "/user@host#1234:")) - (should (tramp-tramp-file-p "/method:host#1234:")) - (should (tramp-tramp-file-p "/method:user@host#1234:")) - - ;; Using an IPv4 address. - (should (tramp-tramp-file-p "/1.2.3.4:")) - (should (tramp-tramp-file-p "/user@1.2.3.4:")) - (should (tramp-tramp-file-p "/method:1.2.3.4:")) - (should (tramp-tramp-file-p "/method:user@1.2.3.4:")) - - ;; Using an IPv6 address. - (should (tramp-tramp-file-p "/[]:")) - (should (tramp-tramp-file-p "/[::1]:")) - (should (tramp-tramp-file-p "/user@[::1]:")) - (should (tramp-tramp-file-p "/method:[::1]:")) - (should (tramp-tramp-file-p "/method:user@[::1]:")) - - ;; Local file name part. - (should (tramp-tramp-file-p "/host:/:")) - (should (tramp-tramp-file-p "/method:::")) - (should (tramp-tramp-file-p "/method::/path/to/file")) - (should (tramp-tramp-file-p "/method::file")) - - ;; Multihop. - (should (tramp-tramp-file-p "/method1:|method2::")) - (should (tramp-tramp-file-p "/method1:host1|host2:")) - (should (tramp-tramp-file-p "/method1:host1|method2:host2:")) - (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) - (should (tramp-tramp-file-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) - - ;; No strings. - (should-not (tramp-tramp-file-p nil)) - (should-not (tramp-tramp-file-p 'symbol)) - ;; "/:" suppresses file name handlers. - (should-not (tramp-tramp-file-p "/::")) - (should-not (tramp-tramp-file-p "/:@:")) - (should-not (tramp-tramp-file-p "/:[]:")) - ;; Multihops require a method. - (should-not (tramp-tramp-file-p "/host1|host2:")) - ;; Methods or hostnames shall be at least two characters on MS Windows. - (when (memq system-type '(cygwin windows-nt)) - (should-not (tramp-tramp-file-p "/c:/path/to/file")) - (should-not (tramp-tramp-file-p "/c::/path/to/file")))) - -(ert-deftest tramp-test02-file-name-dissect () - "Check remote file name components." - (let ((tramp-default-method "default-method") - (tramp-default-user "default-user") - (tramp-default-host "default-host")) - ;; Expand `tramp-default-user' and `tramp-default-host'. - (should (string-equal - (file-remote-p "/method::") - (format "/%s:%s@%s:" "method" "default-user" "default-host"))) - (should (string-equal (file-remote-p "/method::" 'method) "method")) - (should (string-equal (file-remote-p "/method::" 'user) "default-user")) - (should (string-equal (file-remote-p "/method::" 'host) "default-host")) - (should (string-equal (file-remote-p "/method::" 'localname) "")) - (should (string-equal (file-remote-p "/method::" 'hop) nil)) - - ;; Expand `tramp-default-method' and `tramp-default-user'. - (should (string-equal - (file-remote-p "/host:") - (format "/%s:%s@%s:" "default-method" "default-user" "host"))) - (should (string-equal (file-remote-p "/host:" 'method) "default-method")) - (should (string-equal (file-remote-p "/host:" 'user) "default-user")) - (should (string-equal (file-remote-p "/host:" 'host) "host")) - (should (string-equal (file-remote-p "/host:" 'localname) "")) - (should (string-equal (file-remote-p "/host:" 'hop) nil)) - - ;; Expand `tramp-default-method' and `tramp-default-host'. - (should (string-equal - (file-remote-p "/user@:") - (format "/%s:%s@%s:" "default-method""user" "default-host"))) - (should (string-equal (file-remote-p "/user@:" 'method) "default-method")) - (should (string-equal (file-remote-p "/user@:" 'user) "user")) - (should (string-equal (file-remote-p "/user@:" 'host) "default-host")) - (should (string-equal (file-remote-p "/user@:" 'localname) "")) - (should (string-equal (file-remote-p "/user@:" 'hop) nil)) - - ;; Expand `tramp-default-method'. - (should (string-equal - (file-remote-p "/user@host:") - (format "/%s:%s@%s:" "default-method" "user" "host"))) - (should (string-equal - (file-remote-p "/user@host:" 'method) "default-method")) - (should (string-equal (file-remote-p "/user@host:" 'user) "user")) - (should (string-equal (file-remote-p "/user@host:" 'host) "host")) - (should (string-equal (file-remote-p "/user@host:" 'localname) "")) - (should (string-equal (file-remote-p "/user@host:" 'hop) nil)) - - ;; Expand `tramp-default-user'. - (should (string-equal - (file-remote-p "/method:host:") - (format "/%s:%s@%s:" "method" "default-user" "host"))) - (should (string-equal (file-remote-p "/method:host:" 'method) "method")) - (should (string-equal (file-remote-p "/method:host:" 'user) "default-user")) - (should (string-equal (file-remote-p "/method:host:" 'host) "host")) - (should (string-equal (file-remote-p "/method:host:" 'localname) "")) - (should (string-equal (file-remote-p "/method:host:" 'hop) nil)) - - ;; Expand `tramp-default-host'. - (should (string-equal - (file-remote-p "/method:user@:") - (format "/%s:%s@%s:" "method" "user" "default-host"))) - (should (string-equal (file-remote-p "/method:user@:" 'method) "method")) - (should (string-equal (file-remote-p "/method:user@:" 'user) "user")) - (should (string-equal (file-remote-p "/method:user@:" 'host) - "default-host")) - (should (string-equal (file-remote-p "/method:user@:" 'localname) "")) - (should (string-equal (file-remote-p "/method:user@:" 'hop) nil)) - - ;; No expansion. - (should (string-equal - (file-remote-p "/method:user@host:") - (format "/%s:%s@%s:" "method" "user" "host"))) - (should (string-equal - (file-remote-p "/method:user@host:" 'method) "method")) - (should (string-equal (file-remote-p "/method:user@host:" 'user) "user")) - (should (string-equal (file-remote-p "/method:user@host:" 'host) "host")) - (should (string-equal (file-remote-p "/method:user@host:" 'localname) "")) - (should (string-equal (file-remote-p "/method:user@host:" 'hop) nil)) - - ;; No expansion. - (should (string-equal - (file-remote-p "/method:user@email@host:") - (format "/%s:%s@%s:" "method" "user@email" "host"))) - (should (string-equal - (file-remote-p "/method:user@email@host:" 'method) "method")) - (should (string-equal - (file-remote-p "/method:user@email@host:" 'user) "user@email")) - (should (string-equal - (file-remote-p "/method:user@email@host:" 'host) "host")) - (should (string-equal - (file-remote-p "/method:user@email@host:" 'localname) "")) - (should (string-equal - (file-remote-p "/method:user@email@host:" 'hop) nil)) - - ;; Expand `tramp-default-method' and `tramp-default-user'. - (should (string-equal - (file-remote-p "/host#1234:") - (format "/%s:%s@%s:" "default-method" "default-user" "host#1234"))) - (should (string-equal - (file-remote-p "/host#1234:" 'method) "default-method")) - (should (string-equal (file-remote-p "/host#1234:" 'user) "default-user")) - (should (string-equal (file-remote-p "/host#1234:" 'host) "host#1234")) - (should (string-equal (file-remote-p "/host#1234:" 'localname) "")) - (should (string-equal (file-remote-p "/host#1234:" 'hop) nil)) - - ;; Expand `tramp-default-method'. - (should (string-equal - (file-remote-p "/user@host#1234:") - (format "/%s:%s@%s:" "default-method" "user" "host#1234"))) - (should (string-equal - (file-remote-p "/user@host#1234:" 'method) "default-method")) - (should (string-equal (file-remote-p "/user@host#1234:" 'user) "user")) - (should (string-equal (file-remote-p "/user@host#1234:" 'host) "host#1234")) - (should (string-equal (file-remote-p "/user@host#1234:" 'localname) "")) - (should (string-equal (file-remote-p "/user@host#1234:" 'hop) nil)) - - ;; Expand `tramp-default-user'. - (should (string-equal - (file-remote-p "/method:host#1234:") - (format "/%s:%s@%s:" "method" "default-user" "host#1234"))) - (should (string-equal - (file-remote-p "/method:host#1234:" 'method) "method")) - (should (string-equal - (file-remote-p "/method:host#1234:" 'user) "default-user")) - (should (string-equal - (file-remote-p "/method:host#1234:" 'host) "host#1234")) - (should (string-equal (file-remote-p "/method:host#1234:" 'localname) "")) - (should (string-equal (file-remote-p "/method:host#1234:" 'hop) nil)) - - ;; No expansion. - (should (string-equal - (file-remote-p "/method:user@host#1234:") - (format "/%s:%s@%s:" "method" "user" "host#1234"))) - (should (string-equal - (file-remote-p "/method:user@host#1234:" 'method) "method")) - (should (string-equal - (file-remote-p "/method:user@host#1234:" 'user) "user")) - (should (string-equal - (file-remote-p "/method:user@host#1234:" 'host) "host#1234")) - (should (string-equal - (file-remote-p "/method:user@host#1234:" 'localname) "")) - (should (string-equal - (file-remote-p "/method:user@host#1234:" 'hop) nil)) - - ;; Expand `tramp-default-method' and `tramp-default-user'. - (should (string-equal - (file-remote-p "/1.2.3.4:") - (format "/%s:%s@%s:" "default-method" "default-user" "1.2.3.4"))) - (should (string-equal (file-remote-p "/1.2.3.4:" 'method) "default-method")) - (should (string-equal (file-remote-p "/1.2.3.4:" 'user) "default-user")) - (should (string-equal (file-remote-p "/1.2.3.4:" 'host) "1.2.3.4")) - (should (string-equal (file-remote-p "/1.2.3.4:" 'localname) "")) - (should (string-equal (file-remote-p "/1.2.3.4:" 'hop) nil)) - - ;; Expand `tramp-default-method'. - (should (string-equal - (file-remote-p "/user@1.2.3.4:") - (format "/%s:%s@%s:" "default-method" "user" "1.2.3.4"))) - (should (string-equal - (file-remote-p "/user@1.2.3.4:" 'method) "default-method")) - (should (string-equal (file-remote-p "/user@1.2.3.4:" 'user) "user")) - (should (string-equal (file-remote-p "/user@1.2.3.4:" 'host) "1.2.3.4")) - (should (string-equal (file-remote-p "/user@1.2.3.4:" 'localname) "")) - (should (string-equal (file-remote-p "/user@1.2.3.4:" 'hop) nil)) - - ;; Expand `tramp-default-user'. - (should (string-equal - (file-remote-p "/method:1.2.3.4:") - (format "/%s:%s@%s:" "method" "default-user" "1.2.3.4"))) - (should (string-equal (file-remote-p "/method:1.2.3.4:" 'method) "method")) - (should (string-equal - (file-remote-p "/method:1.2.3.4:" 'user) "default-user")) - (should (string-equal (file-remote-p "/method:1.2.3.4:" 'host) "1.2.3.4")) - (should (string-equal (file-remote-p "/method:1.2.3.4:" 'localname) "")) - (should (string-equal (file-remote-p "/method:1.2.3.4:" 'hop) nil)) - - ;; No expansion. - (should (string-equal - (file-remote-p "/method:user@1.2.3.4:") - (format "/%s:%s@%s:" "method" "user" "1.2.3.4"))) - (should (string-equal - (file-remote-p "/method:user@1.2.3.4:" 'method) "method")) - (should (string-equal (file-remote-p "/method:user@1.2.3.4:" 'user) "user")) - (should (string-equal - (file-remote-p "/method:user@1.2.3.4:" 'host) "1.2.3.4")) - (should (string-equal - (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) - (should (string-equal - (file-remote-p "/method:user@1.2.3.4:" 'hop) nil)) - - ;; Expand `tramp-default-method', `tramp-default-user' and - ;; `tramp-default-host'. - (should (string-equal - (file-remote-p "/[]:") - (format - "/%s:%s@%s:" "default-method" "default-user" "default-host"))) - (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) - (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) - (should (string-equal (file-remote-p "/[]:" 'host) "default-host")) - (should (string-equal (file-remote-p "/[]:" 'localname) "")) - (should (string-equal (file-remote-p "/[]:" 'hop) nil)) - - ;; Expand `tramp-default-method' and `tramp-default-user'. - (let ((tramp-default-host "::1")) - (should (string-equal - (file-remote-p "/[]:") - (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) - (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) - (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) - (should (string-equal (file-remote-p "/[]:" 'host) "::1")) - (should (string-equal (file-remote-p "/[]:" 'localname) "")) - (should (string-equal (file-remote-p "/[]:" 'hop) nil))) - - ;; Expand `tramp-default-method' and `tramp-default-user'. - (should (string-equal - (file-remote-p "/[::1]:") - (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) - (should (string-equal (file-remote-p "/[::1]:" 'method) "default-method")) - (should (string-equal (file-remote-p "/[::1]:" 'user) "default-user")) - (should (string-equal (file-remote-p "/[::1]:" 'host) "::1")) - (should (string-equal (file-remote-p "/[::1]:" 'localname) "")) - (should (string-equal (file-remote-p "/[::1]:" 'hop) nil)) - - ;; Expand `tramp-default-method'. - (should (string-equal - (file-remote-p "/user@[::1]:") - (format "/%s:%s@%s:" "default-method" "user" "[::1]"))) - (should (string-equal - (file-remote-p "/user@[::1]:" 'method) "default-method")) - (should (string-equal (file-remote-p "/user@[::1]:" 'user) "user")) - (should (string-equal (file-remote-p "/user@[::1]:" 'host) "::1")) - (should (string-equal (file-remote-p "/user@[::1]:" 'localname) "")) - (should (string-equal (file-remote-p "/user@[::1]:" 'hop) nil)) - - ;; Expand `tramp-default-user'. - (should (string-equal - (file-remote-p "/method:[::1]:") - (format "/%s:%s@%s:" "method" "default-user" "[::1]"))) - (should (string-equal (file-remote-p "/method:[::1]:" 'method) "method")) - (should (string-equal - (file-remote-p "/method:[::1]:" 'user) "default-user")) - (should (string-equal (file-remote-p "/method:[::1]:" 'host) "::1")) - (should (string-equal (file-remote-p "/method:[::1]:" 'localname) "")) - (should (string-equal (file-remote-p "/method:[::1]:" 'hop) nil)) - - ;; No expansion. - (should (string-equal - (file-remote-p "/method:user@[::1]:") - (format "/%s:%s@%s:" "method" "user" "[::1]"))) - (should (string-equal - (file-remote-p "/method:user@[::1]:" 'method) "method")) - (should (string-equal (file-remote-p "/method:user@[::1]:" 'user) "user")) - (should (string-equal (file-remote-p "/method:user@[::1]:" 'host) "::1")) - (should (string-equal - (file-remote-p "/method:user@[::1]:" 'localname) "")) - (should (string-equal (file-remote-p "/method:user@[::1]:" 'hop) nil)) - - ;; Local file name part. - (should (string-equal (file-remote-p "/host:/:" 'localname) "/:")) - (should (string-equal (file-remote-p "/method:::" 'localname) ":")) - (should (string-equal (file-remote-p "/method:: " 'localname) " ")) - (should (string-equal (file-remote-p "/method::file" 'localname) "file")) - (should (string-equal - (file-remote-p "/method::/path/to/file" 'localname) - "/path/to/file")) - - ;; Multihop. - (should - (string-equal - (file-remote-p "/method1:user1@host1|method2:user2@host2:/path/to/file") - (format "/%s:%s@%s|%s:%s@%s:" - "method1" "user1" "host1" "method2" "user2" "host2"))) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2:/path/to/file" 'method) - "method2")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2:/path/to/file" 'user) - "user2")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2:/path/to/file" 'host) - "host2")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2:/path/to/file" 'localname) - "/path/to/file")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2:/path/to/file" 'hop) - (format "%s:%s@%s|" - "method1" "user1" "host1"))) - - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file") - (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" - "method1" "user1" "host1" - "method2" "user2" "host2" - "method3" "user3" "host3"))) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file" - 'method) - "method3")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file" - 'user) - "user3")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file" - 'host) - "host3")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file" - 'localname) - "/path/to/file")) - (should - (string-equal - (file-remote-p - "/method1:user1@host1|method2:user2@host2|method3:user3@host3:/path/to/file" - 'hop) - (format "%s:%s@%s|%s:%s@%s|" - "method1" "user1" "host1" "method2" "user2" "host2"))))) - -(ert-deftest tramp-test03-file-name-defaults () - "Check default values for some methods." - ;; Default values in tramp-adb.el. - (should (string-equal (file-remote-p "/adb::" 'host) "")) - ;; Default values in tramp-ftp.el. - (should (string-equal (file-remote-p "/ftp.host:" 'method) "ftp")) - (dolist (u '("ftp" "anonymous")) - (should (string-equal (file-remote-p (format "/%s@:" u) 'method) "ftp"))) - ;; Default values in tramp-gvfs.el. - (when (and (load "tramp-gvfs" 'noerror 'nomessage) - (symbol-value 'tramp-gvfs-enabled)) - (should (string-equal (file-remote-p "/synce::" 'user) nil))) - ;; Default values in tramp-gw.el. - (dolist (m '("tunnel" "socks")) - (should - (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) - ;; Default values in tramp-sh.el. - (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) - (should (string-equal (file-remote-p (format "/root@%s:" h) 'method) "su"))) - (dolist (m '("su" "sudo" "ksu")) - (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))) - (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) - (should - (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) - ;; Default values in tramp-smb.el. - (should (string-equal (file-remote-p "/user%domain@host:" 'method) "smb")) - (should (string-equal (file-remote-p "/smb::" 'user) nil))) - -(ert-deftest tramp-test04-substitute-in-file-name () - "Check `substitute-in-file-name'." - (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo")) - (should - (string-equal - (substitute-in-file-name "/method:host:/path//foo") "/method:host:/foo")) - (should - (string-equal (substitute-in-file-name "/method:host:/path///foo") "/foo")) - (should - (string-equal - (substitute-in-file-name "/method:host:/path/~/foo") "/method:host:~/foo")) - (should - (string-equal (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) - (let (process-environment) - (should - (string-equal - (substitute-in-file-name "/method:host:/path/$FOO") - "/method:host:/path/$FOO")) - (setenv "FOO" "bla") - (should - (string-equal - (substitute-in-file-name "/method:host:/path/$FOO") - "/method:host:/path/bla")) - (should - (string-equal - (substitute-in-file-name "/method:host:/path/$$FOO") - "/method:host:/path/$FOO")))) - -(ert-deftest tramp-test05-expand-file-name () - "Check `expand-file-name'." - (should - (string-equal - (expand-file-name "/method:host:/path/./file") "/method:host:/path/file")) - (should - (string-equal - (expand-file-name "/method:host:/path/../file") "/method:host:/file"))) - -(ert-deftest tramp-test06-directory-file-name () - "Check `directory-file-name'. -This checks also `file-name-as-directory', `file-name-directory', -`file-name-nondirectory' and `unhandled-file-name-directory'." - (should - (string-equal - (directory-file-name "/method:host:/path/to/file") - "/method:host:/path/to/file")) - (should - (string-equal - (directory-file-name "/method:host:/path/to/file/") - "/method:host:/path/to/file")) - (should - (string-equal - (file-name-as-directory "/method:host:/path/to/file") - "/method:host:/path/to/file/")) - (should - (string-equal - (file-name-as-directory "/method:host:/path/to/file/") - "/method:host:/path/to/file/")) - (should - (string-equal - (file-name-directory "/method:host:/path/to/file") - "/method:host:/path/to/")) - (should - (string-equal - (file-name-directory "/method:host:/path/to/file/") - "/method:host:/path/to/file/")) - (should - (string-equal (file-name-nondirectory "/method:host:/path/to/file") "file")) - (should - (string-equal (file-name-nondirectory "/method:host:/path/to/file/") "")) - (should-not - (unhandled-file-name-directory "/method:host:/path/to/file"))) - -(ert-deftest tramp-test07-file-exists-p () - "Check `file-exist-p', `write-region' and `delete-file'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (should-not (file-exists-p tmp-name)) - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (delete-file tmp-name) - (should-not (file-exists-p tmp-name)))) - -(ert-deftest tramp-test08-file-local-copy () - "Check `file-local-copy'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name1 (tramp--test-make-temp-name)) - tmp-name2) - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (setq tmp-name2 (file-local-copy tmp-name1))) - (with-temp-buffer - (insert-file-contents tmp-name2) - (should (string-equal (buffer-string) "foo"))) - ;; Check also that a file transfer with compression works. - (let ((default-directory tramp-test-temporary-file-directory) - (tramp-copy-size-limit 4) - (tramp-inline-compress-start-size 2)) - (delete-file tmp-name2) - (should (setq tmp-name2 (file-local-copy tmp-name1))))) - - ;; Cleanup. - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2))))) - -(ert-deftest tramp-test09-insert-file-contents () - "Check `insert-file-contents'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (write-region "foo" nil tmp-name) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foo")) - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foofoo")) - ;; Insert partly. - (insert-file-contents tmp-name nil 1 3) - (should (string-equal (buffer-string) "oofoofoo")) - ;; Replace. - (insert-file-contents tmp-name nil nil nil 'replace) - (should (string-equal (buffer-string) "foo")))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(ert-deftest tramp-test10-write-region () - "Check `write-region'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (with-temp-buffer - (insert "foo") - (write-region nil nil tmp-name)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foo"))) - ;; Append. - (with-temp-buffer - (insert "bla") - (write-region nil nil tmp-name 'append)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foobla"))) - ;; Write string. - (write-region "foo" nil tmp-name) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "foo"))) - ;; Write partly. - (with-temp-buffer - (insert "123456789") - (write-region 3 5 tmp-name)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (string-equal (buffer-string) "34")))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(ert-deftest tramp-test11-copy-file () - "Check `copy-file'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (tramp--test-make-temp-name)) - (tmp-name4 (tramp--test-make-temp-name 'local)) - (tmp-name5 (tramp--test-make-temp-name 'local))) - - ;; Copy on remote side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (copy-file tmp-name1 tmp-name2) - (should (file-exists-p tmp-name2)) - (with-temp-buffer - (insert-file-contents tmp-name2) - (should (string-equal (buffer-string) "foo"))) - (should-error (copy-file tmp-name1 tmp-name2)) - (copy-file tmp-name1 tmp-name2 'ok) - (make-directory tmp-name3) - (copy-file tmp-name1 tmp-name3) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name2)) - (ignore-errors (delete-directory tmp-name3 'recursive))) - - ;; Copy from remote side to local side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (copy-file tmp-name1 tmp-name4) - (should (file-exists-p tmp-name4)) - (with-temp-buffer - (insert-file-contents tmp-name4) - (should (string-equal (buffer-string) "foo"))) - (should-error (copy-file tmp-name1 tmp-name4)) - (copy-file tmp-name1 tmp-name4 'ok) - (make-directory tmp-name5) - (copy-file tmp-name1 tmp-name5) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name4)) - (ignore-errors (delete-directory tmp-name5 'recursive))) - - ;; Copy from local side to remote side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name4 nil 'nomessage) - (copy-file tmp-name4 tmp-name1) - (should (file-exists-p tmp-name1)) - (with-temp-buffer - (insert-file-contents tmp-name1) - (should (string-equal (buffer-string) "foo"))) - (should-error (copy-file tmp-name4 tmp-name1)) - (copy-file tmp-name4 tmp-name1 'ok) - (make-directory tmp-name3) - (copy-file tmp-name4 tmp-name3) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name4)) - (ignore-errors (delete-directory tmp-name3 'recursive))))) - -(ert-deftest tramp-test12-rename-file () - "Check `rename-file'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (tramp--test-make-temp-name)) - (tmp-name4 (tramp--test-make-temp-name 'local)) - (tmp-name5 (tramp--test-make-temp-name 'local))) - - ;; Rename on remote side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (rename-file tmp-name1 tmp-name2) - (should-not (file-exists-p tmp-name1)) - (should (file-exists-p tmp-name2)) - (with-temp-buffer - (insert-file-contents tmp-name2) - (should (string-equal (buffer-string) "foo"))) - (write-region "foo" nil tmp-name1) - (should-error (rename-file tmp-name1 tmp-name2)) - (rename-file tmp-name1 tmp-name2 'ok) - (should-not (file-exists-p tmp-name1)) - (write-region "foo" nil tmp-name1) - (make-directory tmp-name3) - (rename-file tmp-name1 tmp-name3) - (should-not (file-exists-p tmp-name1)) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name2)) - (ignore-errors (delete-directory tmp-name3 'recursive))) - - ;; Rename from remote side to local side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (rename-file tmp-name1 tmp-name4) - (should-not (file-exists-p tmp-name1)) - (should (file-exists-p tmp-name4)) - (with-temp-buffer - (insert-file-contents tmp-name4) - (should (string-equal (buffer-string) "foo"))) - (write-region "foo" nil tmp-name1) - (should-error (rename-file tmp-name1 tmp-name4)) - (rename-file tmp-name1 tmp-name4 'ok) - (should-not (file-exists-p tmp-name1)) - (write-region "foo" nil tmp-name1) - (make-directory tmp-name5) - (rename-file tmp-name1 tmp-name5) - (should-not (file-exists-p tmp-name1)) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name4)) - (ignore-errors (delete-directory tmp-name5 'recursive))) - - ;; Rename from local side to remote side. - (unwind-protect - (progn - (write-region "foo" nil tmp-name4 nil 'nomessage) - (rename-file tmp-name4 tmp-name1) - (should-not (file-exists-p tmp-name4)) - (should (file-exists-p tmp-name1)) - (with-temp-buffer - (insert-file-contents tmp-name1) - (should (string-equal (buffer-string) "foo"))) - (write-region "foo" nil tmp-name4 nil 'nomessage) - (should-error (rename-file tmp-name4 tmp-name1)) - (rename-file tmp-name4 tmp-name1 'ok) - (should-not (file-exists-p tmp-name4)) - (write-region "foo" nil tmp-name4 nil 'nomessage) - (make-directory tmp-name3) - (rename-file tmp-name4 tmp-name3) - (should-not (file-exists-p tmp-name4)) - (should - (file-exists-p - (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name4)) - (ignore-errors (delete-directory tmp-name3 'recursive))))) - -(ert-deftest tramp-test13-make-directory () - "Check `make-directory'. -This tests also `file-directory-p' and `file-accessible-directory-p'." - (skip-unless (tramp--test-enabled)) - - (let* ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (expand-file-name "foo/bar" tmp-name1))) - (unwind-protect - (progn - (make-directory tmp-name1) - (should (file-directory-p tmp-name1)) - (should (file-accessible-directory-p tmp-name1)) - (should-error (make-directory tmp-name2) :type 'file-error) - (make-directory tmp-name2 'parents) - (should (file-directory-p tmp-name2)) - (should (file-accessible-directory-p tmp-name2))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive))))) - -(ert-deftest tramp-test14-delete-directory () - "Check `delete-directory'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - ;; Delete empty directory. - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (delete-directory tmp-name) - (should-not (file-directory-p tmp-name)) - ;; Delete non-empty directory. - (make-directory tmp-name) - (write-region "foo" nil (expand-file-name "bla" tmp-name)) - (should-error (delete-directory tmp-name) :type 'file-error) - (delete-directory tmp-name 'recursive) - (should-not (file-directory-p tmp-name)))) - -(ert-deftest tramp-test15-copy-directory () - "Check `copy-directory'." - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-smb-file-name-handler))) - - (let* ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (expand-file-name - (file-name-nondirectory tmp-name1) tmp-name2)) - (tmp-name4 (expand-file-name "foo" tmp-name1)) - (tmp-name5 (expand-file-name "foo" tmp-name2)) - (tmp-name6 (expand-file-name "foo" tmp-name3))) - (unwind-protect - (progn - ;; Copy empty directory. - (make-directory tmp-name1) - (write-region "foo" nil tmp-name4) - (should (file-directory-p tmp-name1)) - (should (file-exists-p tmp-name4)) - (copy-directory tmp-name1 tmp-name2) - (should (file-directory-p tmp-name2)) - (should (file-exists-p tmp-name5)) - ;; Target directory does exist already. - (copy-directory tmp-name1 tmp-name2) - (should (file-directory-p tmp-name3)) - (should (file-exists-p tmp-name6))) - - ;; Cleanup. - (ignore-errors - (delete-directory tmp-name1 'recursive) - (delete-directory tmp-name2 'recursive))))) - -(ert-deftest tramp-test16-directory-files () - "Check `directory-files'." - (skip-unless (tramp--test-enabled)) - - (let* ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (expand-file-name "bla" tmp-name1)) - (tmp-name3 (expand-file-name "foo" tmp-name1))) - (unwind-protect - (progn - (make-directory tmp-name1) - (write-region "foo" nil tmp-name2) - (write-region "bla" nil tmp-name3) - (should (file-directory-p tmp-name1)) - (should (file-exists-p tmp-name2)) - (should (file-exists-p tmp-name3)) - (should (equal (directory-files tmp-name1) '("." ".." "bla" "foo"))) - (should (equal (directory-files tmp-name1 'full) - `(,(concat tmp-name1 "/.") - ,(concat tmp-name1 "/..") - ,tmp-name2 ,tmp-name3))) - (should (equal (directory-files - tmp-name1 nil directory-files-no-dot-files-regexp) - '("bla" "foo"))) - (should (equal (directory-files - tmp-name1 'full directory-files-no-dot-files-regexp) - `(,tmp-name2 ,tmp-name3)))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive))))) - -(ert-deftest tramp-test17-insert-directory () - "Check `insert-directory'." - (skip-unless (tramp--test-enabled)) - - (let* ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (expand-file-name "foo" tmp-name1)) - ;; We test for the summary line. Keyword "total" could be localized. - (process-environment - (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment))) - (unwind-protect - (progn - (make-directory tmp-name1) - (write-region "foo" nil tmp-name2) - (should (file-directory-p tmp-name1)) - (should (file-exists-p tmp-name2)) - (with-temp-buffer - (insert-directory tmp-name1 nil) - (goto-char (point-min)) - (should (looking-at-p (regexp-quote tmp-name1)))) - (with-temp-buffer - (insert-directory tmp-name1 "-al") - (goto-char (point-min)) - (should (looking-at-p (format "^.+ %s$" (regexp-quote tmp-name1))))) - (with-temp-buffer - (insert-directory (file-name-as-directory tmp-name1) "-al") - (goto-char (point-min)) - (should - (looking-at-p (format "^.+ %s/$" (regexp-quote tmp-name1))))) - (with-temp-buffer - (insert-directory - (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p) - (goto-char (point-min)) - (should - (looking-at-p - (concat - ;; There might be a summary line. - "\\(total.+[[:digit:]]+\n\\)?" - ;; We don't know in which order ".", ".." and "foo" appear. - "\\(.+ \\(\\.?\\.\\|foo\\)\n\\)\\{3\\}"))))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive))))) - -(ert-deftest tramp-test18-file-attributes () - "Check `file-attributes'. -This tests also `file-readable-p' and `file-regular-p'." - (skip-unless (tramp--test-enabled)) - - ;; We must use `file-truename' for the temporary directory, because - ;; it could be located on a symlinked directory. This would let the - ;; test fail. - (let* ((tramp-test-temporary-file-directory - (file-truename tramp-test-temporary-file-directory)) - (tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - ;; File name with "//". - (tmp-name3 - (format - "%s%s" - (file-remote-p tmp-name1) - (replace-regexp-in-string - "/" "//" (file-remote-p tmp-name1 'localname)))) - attr) - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (file-exists-p tmp-name1)) - (setq attr (file-attributes tmp-name1)) - (should (consp attr)) - (should (file-exists-p tmp-name1)) - (should (file-readable-p tmp-name1)) - (should (file-regular-p tmp-name1)) - ;; We do not test inodes and device numbers. - (should (null (car attr))) - (should (numberp (nth 1 attr))) ;; Link. - (should (numberp (nth 2 attr))) ;; Uid. - (should (numberp (nth 3 attr))) ;; Gid. - ;; Last access time. - (should (stringp (current-time-string (nth 4 attr)))) - ;; Last modification time. - (should (stringp (current-time-string (nth 5 attr)))) - ;; Last status change time. - (should (stringp (current-time-string (nth 6 attr)))) - (should (numberp (nth 7 attr))) ;; Size. - (should (stringp (nth 8 attr))) ;; Modes. - - (setq attr (file-attributes tmp-name1 'string)) - (should (stringp (nth 2 attr))) ;; Uid. - (should (stringp (nth 3 attr))) ;; Gid. - - (condition-case err - (progn - (make-symbolic-link tmp-name1 tmp-name2) - (should (file-exists-p tmp-name2)) - (should (file-symlink-p tmp-name2)) - (setq attr (file-attributes tmp-name2)) - (should (string-equal - (car attr) - (file-remote-p (file-truename tmp-name1) 'localname))) - (delete-file tmp-name2)) - (file-error - (should (string-equal (error-message-string err) - "make-symbolic-link not supported")))) - - ;; Check, that "//" in symlinks are handled properly. - (with-temp-buffer - (let ((default-directory tramp-test-temporary-file-directory)) - (shell-command - (format - "ln -s %s %s" - (tramp-file-name-localname (tramp-dissect-file-name tmp-name3)) - (tramp-file-name-localname (tramp-dissect-file-name tmp-name2))) - t))) - (when (file-symlink-p tmp-name2) - (setq attr (file-attributes tmp-name2)) - (should - (string-equal - (car attr) - (tramp-file-name-localname (tramp-dissect-file-name tmp-name3)))) - (delete-file tmp-name2)) - - (delete-file tmp-name1) - (make-directory tmp-name1) - (should (file-exists-p tmp-name1)) - (should (file-readable-p tmp-name1)) - (should-not (file-regular-p tmp-name1)) - (setq attr (file-attributes tmp-name1)) - (should (eq (car attr) t))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1)) - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-file tmp-name2))))) - -(ert-deftest tramp-test19-directory-files-and-attributes () - "Check `directory-files-and-attributes'." - (skip-unless (tramp--test-enabled)) - - ;; `directory-files-and-attributes' contains also values for "../". - ;; Ensure that this doesn't change during tests, for - ;; example due to handling temporary files. - (let* ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (expand-file-name "bla" tmp-name1)) - attr) - (unwind-protect - (progn - (make-directory tmp-name1) - (should (file-directory-p tmp-name1)) - (make-directory tmp-name2) - (should (file-directory-p tmp-name2)) - (write-region "foo" nil (expand-file-name "foo" tmp-name2)) - (write-region "bar" nil (expand-file-name "bar" tmp-name2)) - (write-region "boz" nil (expand-file-name "boz" tmp-name2)) - (setq attr (directory-files-and-attributes tmp-name2)) - (should (consp attr)) - ;; Dumb remote shells without perl(1) or stat(1) are not - ;; able to return the date correctly. They say "don't know". - (dolist (elt attr) - (unless - (equal - (nth 5 - (file-attributes (expand-file-name (car elt) tmp-name2))) - '(0 0)) - (should - (equal (file-attributes (expand-file-name (car elt) tmp-name2)) - (cdr elt))))) - (setq attr (directory-files-and-attributes tmp-name2 'full)) - (dolist (elt attr) - (unless (equal (nth 5 (file-attributes (car elt))) '(0 0)) - (should - (equal (file-attributes (car elt)) (cdr elt))))) - (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) - (should (equal (mapcar 'car attr) '("bar" "boz")))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive))))) - -(ert-deftest tramp-test20-file-modes () - "Check `file-modes'. -This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (memq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-adb-file-name-handler - tramp-gvfs-file-name-handler - tramp-smb-file-name-handler)))) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (set-file-modes tmp-name #o777) - (should (= (file-modes tmp-name) #o777)) - (should (file-executable-p tmp-name)) - (should (file-writable-p tmp-name)) - (set-file-modes tmp-name #o444) - (should (= (file-modes tmp-name) #o444)) - (should-not (file-executable-p tmp-name)) - ;; A file is always writable for user "root". - (unless (zerop (nth 2 (file-attributes tmp-name))) - (should-not (file-writable-p tmp-name)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(ert-deftest tramp-test21-file-links () - "Check `file-symlink-p'. -This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." - (skip-unless (tramp--test-enabled)) - - ;; We must use `file-truename' for the temporary directory, because - ;; it could be located on a symlinked directory. This would let the - ;; test fail. - (let* ((tramp-test-temporary-file-directory - (file-truename tramp-test-temporary-file-directory)) - (tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (tramp--test-make-temp-name 'local))) - - ;; Check `make-symbolic-link'. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (file-exists-p tmp-name1)) - ;; Method "smb" supports `make-symbolic-link' only if the - ;; remote host has CIFS capabilities. tramp-adb.el and - ;; tramp-gvfs.el do not support symbolic links at all. - (condition-case err - (make-symbolic-link tmp-name1 tmp-name2) - (file-error - (skip-unless - (not (string-equal (error-message-string err) - "make-symbolic-link not supported"))))) - (should (file-symlink-p tmp-name2)) - (should-error (make-symbolic-link tmp-name1 tmp-name2)) - (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists) - (should (file-symlink-p tmp-name2)) - ;; `tmp-name3' is a local file name. - (should-error (make-symbolic-link tmp-name1 tmp-name3))) - - ;; Cleanup. - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2))) - - ;; Check `add-name-to-file'. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (file-exists-p tmp-name1)) - (add-name-to-file tmp-name1 tmp-name2) - (should-not (file-symlink-p tmp-name2)) - (should-error (add-name-to-file tmp-name1 tmp-name2)) - (add-name-to-file tmp-name1 tmp-name2 'ok-if-already-exists) - (should-not (file-symlink-p tmp-name2)) - ;; `tmp-name3' is a local file name. - (should-error (add-name-to-file tmp-name1 tmp-name3))) - - ;; Cleanup. - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2))) - - ;; Check `file-truename'. - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (file-exists-p tmp-name1)) - (make-symbolic-link tmp-name1 tmp-name2) - (should (file-symlink-p tmp-name2)) - (should-not (string-equal tmp-name2 (file-truename tmp-name2))) - (should - (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) - (should (file-equal-p tmp-name1 tmp-name2))) - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2))) - - ;; `file-truename' shall preserve trailing link of directories. - (unless (file-symlink-p tramp-test-temporary-file-directory) - (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory)) - (dir2 (file-name-as-directory dir1))) - (should (string-equal (file-truename dir1) (expand-file-name dir1))) - (should (string-equal (file-truename dir2) (expand-file-name dir2))))))) - -(ert-deftest tramp-test22-file-times () - "Check `set-file-times' and `file-newer-than-file-p'." - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (memq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - - (let ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name)) - (tmp-name3 (tramp--test-make-temp-name))) - (unwind-protect - (progn - (write-region "foo" nil tmp-name1) - (should (file-exists-p tmp-name1)) - (should (consp (nth 5 (file-attributes tmp-name1)))) - ;; '(0 0) means don't know, and will be replaced by - ;; `current-time'. Therefore, we use '(0 1). - ;; We skip the test, if the remote handler is not able to - ;; set the correct time. - (skip-unless (set-file-times tmp-name1 '(0 1))) - ;; Dumb remote shells without perl(1) or stat(1) are not - ;; able to return the date correctly. They say "don't know". - (unless (equal (nth 5 (file-attributes tmp-name1)) '(0 0)) - (should (equal (nth 5 (file-attributes tmp-name1)) '(0 1))) - (write-region "bla" nil tmp-name2) - (should (file-exists-p tmp-name2)) - (should (file-newer-than-file-p tmp-name2 tmp-name1)) - ;; `tmp-name3' does not exist. - (should (file-newer-than-file-p tmp-name2 tmp-name3)) - (should-not (file-newer-than-file-p tmp-name3 tmp-name1)))) - - ;; Cleanup. - (ignore-errors - (delete-file tmp-name1) - (delete-file tmp-name2))))) - -(ert-deftest tramp-test23-visited-file-modtime () - "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (with-temp-buffer - (insert-file-contents tmp-name) - (should (verify-visited-file-modtime)) - (set-visited-file-modtime '(0 1)) - (should (verify-visited-file-modtime)) - (should (equal (visited-file-modtime) '(0 1 0 0))))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(ert-deftest tramp-test24-file-name-completion () - "Check `file-name-completion' and `file-name-all-completions'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (write-region "foo" nil (expand-file-name "foo" tmp-name)) - (write-region "bar" nil (expand-file-name "bold" tmp-name)) - (make-directory (expand-file-name "boz" tmp-name)) - (should (equal (file-name-completion "fo" tmp-name) "foo")) - (should (equal (file-name-completion "b" tmp-name) "bo")) - (should - (equal (file-name-completion "b" tmp-name 'file-directory-p) "boz/")) - (should (equal (file-name-all-completions "fo" tmp-name) '("foo"))) - (should - (equal (sort (file-name-all-completions "b" tmp-name) 'string-lessp) - '("bold" "boz/")))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name 'recursive))))) - -(ert-deftest tramp-test25-load () - "Check `load'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name (tramp--test-make-temp-name))) - (unwind-protect - (progn - (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)) - (load tmp-name nil 'nomessage 'nosuffix) - (should (featurep 'tramp-test-load))) - - ;; Cleanup. - (ignore-errors - (and (featurep 'tramp-test-load) (unload-feature 'tramp-test-load)) - (delete-file tmp-name))))) - -(ert-deftest tramp-test26-process-file () - "Check `process-file'." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (memq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - - (let* ((tmp-name (tramp--test-make-temp-name)) - (fnnd (file-name-nondirectory tmp-name)) - (default-directory tramp-test-temporary-file-directory) - kill-buffer-query-functions) - (unwind-protect - (progn - ;; We cannot use "/bin/true" and "/bin/false"; those paths - ;; do not exist on hydra. - (should (zerop (process-file "true"))) - (should-not (zerop (process-file "false"))) - (should-not (zerop (process-file "binary-does-not-exist"))) - (with-temp-buffer - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (should (zerop (process-file "ls" nil t nil fnnd))) - ;; `ls' could produce colorized output. - (goto-char (point-min)) - (while (re-search-forward tramp-color-escape-sequence-regexp nil t) - (replace-match "" nil nil)) - (should (string-equal (format "%s\n" fnnd) (buffer-string))) - (should-not (get-buffer-window (current-buffer) t)) - - ;; Second run. The output must be appended. - (goto-char (point-max)) - (should (zerop (process-file "ls" nil t t fnnd))) - ;; `ls' could produce colorized output. - (goto-char (point-min)) - (while (re-search-forward tramp-color-escape-sequence-regexp nil t) - (replace-match "" nil nil)) - (should - (string-equal (format "%s\n%s\n" fnnd fnnd) (buffer-string))) - ;; A non-nil DISPLAY must not raise the buffer. - (should-not (get-buffer-window (current-buffer) t)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(ert-deftest tramp-test27-start-file-process () - "Check `start-file-process'." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (memq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-adb-file-name-handler - tramp-gvfs-file-name-handler - tramp-smb-file-name-handler)))) - - (let ((default-directory tramp-test-temporary-file-directory) - (tmp-name (tramp--test-make-temp-name)) - kill-buffer-query-functions proc) - (unwind-protect - (with-temp-buffer - (setq proc (start-file-process "test1" (current-buffer) "cat")) - (should (processp proc)) - (should (equal (process-status proc) 'run)) - (process-send-string proc "foo") - (process-send-eof proc) - ;; Read output. - (with-timeout (10 (ert-fail "`start-file-process' timed out")) - (while (< (- (point-max) (point-min)) (length "foo")) - (accept-process-output proc 1))) - (should (string-equal (buffer-string) "foo"))) - - ;; Cleanup. - (ignore-errors (delete-process proc))) - - (unwind-protect - (with-temp-buffer - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (setq proc - (start-file-process - "test2" (current-buffer) - "cat" (file-name-nondirectory tmp-name))) - (should (processp proc)) - ;; Read output. - (with-timeout (10 (ert-fail "`start-file-process' timed out")) - (while (< (- (point-max) (point-min)) (length "foo")) - (accept-process-output proc 1))) - (should (string-equal (buffer-string) "foo"))) - - ;; Cleanup. - (ignore-errors - (delete-process proc) - (delete-file tmp-name))) - - (unwind-protect - (with-temp-buffer - (setq proc (start-file-process "test3" (current-buffer) "cat")) - (should (processp proc)) - (should (equal (process-status proc) 'run)) - (set-process-filter - proc - (lambda (p s) (with-current-buffer (process-buffer p) (insert s)))) - (process-send-string proc "foo") - (process-send-eof proc) - ;; Read output. - (with-timeout (10 (ert-fail "`start-file-process' timed out")) - (while (< (- (point-max) (point-min)) (length "foo")) - (accept-process-output proc 1))) - (should (string-equal (buffer-string) "foo"))) - - ;; Cleanup. - (ignore-errors (delete-process proc))))) - -(ert-deftest tramp-test28-shell-command () - "Check `shell-command'." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (not - (memq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-adb-file-name-handler - tramp-gvfs-file-name-handler - tramp-smb-file-name-handler)))) - - (let ((tmp-name (tramp--test-make-temp-name)) - (default-directory tramp-test-temporary-file-directory) - kill-buffer-query-functions) - (unwind-protect - (with-temp-buffer - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (shell-command - (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) - ;; `ls' could produce colorized output. - (goto-char (point-min)) - (while (re-search-forward tramp-color-escape-sequence-regexp nil t) - (replace-match "" nil nil)) - (should - (string-equal - (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))) - - (unwind-protect - (with-temp-buffer - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (async-shell-command - (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) - (set-process-sentinel (get-buffer-process (current-buffer)) nil) - ;; Read output. - (with-timeout (10 (ert-fail "`async-shell-command' timed out")) - (while (< (- (point-max) (point-min)) - (1+ (length (file-name-nondirectory tmp-name)))) - (accept-process-output (get-buffer-process (current-buffer)) 1))) - ;; `ls' could produce colorized output. - (goto-char (point-min)) - (while (re-search-forward tramp-color-escape-sequence-regexp nil t) - (replace-match "" nil nil)) - ;; There might be a nasty "Process *Async Shell* finished" message. - (goto-char (point-min)) - (forward-line) - (narrow-to-region (point-min) (point)) - (should - (string-equal - (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))) - - (unwind-protect - (with-temp-buffer - (write-region "foo" nil tmp-name) - (should (file-exists-p tmp-name)) - (async-shell-command "read line; ls $line" (current-buffer)) - (set-process-sentinel (get-buffer-process (current-buffer)) nil) - (process-send-string - (get-buffer-process (current-buffer)) - (format "%s\n" (file-name-nondirectory tmp-name))) - ;; Read output. - (with-timeout (10 (ert-fail "`async-shell-command' timed out")) - (while (< (- (point-max) (point-min)) - (1+ (length (file-name-nondirectory tmp-name)))) - (accept-process-output (get-buffer-process (current-buffer)) 1))) - ;; `ls' could produce colorized output. - (goto-char (point-min)) - (while (re-search-forward tramp-color-escape-sequence-regexp nil t) - (replace-match "" nil nil)) - ;; There might be a nasty "Process *Async Shell* finished" message. - (goto-char (point-min)) - (forward-line) - (narrow-to-region (point-min) (point)) - (should - (string-equal - (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name))))) - -(defun tramp-test--shell-command-to-string-asynchronously (command) - "Like `shell-command-to-string', but for asynchronous processes." - (with-temp-buffer - (async-shell-command command (current-buffer)) - ;; Suppress nasty messages. - (set-process-sentinel (get-buffer-process (current-buffer)) nil) - (while (get-buffer-process (current-buffer)) - (accept-process-output (get-buffer-process (current-buffer)) 0.1)) - (accept-process-output) - (buffer-substring-no-properties (point-min) (point-max)))) - -;; This test is inspired by Bug#23952. -(ert-deftest tramp-test29-environment-variables () - "Check that remote processes set / unset environment variables properly." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - - (dolist (this-shell-command-to-string - '(;; Synchronously. - shell-command-to-string - ;; Asynchronously. - tramp-test--shell-command-to-string-asynchronously)) - - (let ((default-directory tramp-test-temporary-file-directory) - (shell-file-name "/bin/sh") - (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) - kill-buffer-query-functions) - - (unwind-protect - ;; Set a value. - (let ((process-environment - (cons (concat envvar "=foo") process-environment))) - ;; Default value. - (should - (string-match - "foo" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:?bla}" envvar)))))) - - (unwind-protect - ;; Set the empty value. - (let ((process-environment - (cons (concat envvar "=") process-environment))) - ;; Value is null. - (should - (string-match - "bla" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:?bla}" envvar)))) - ;; Variable is set. - (should - (string-match - (regexp-quote envvar) - (funcall this-shell-command-to-string "set"))))) - - ;; We force a reconnect, in order to have a clean environment. - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - 'keep-debug 'keep-password) - (unwind-protect - ;; Unset the variable. - (let ((tramp-remote-process-environment - (cons (concat envvar "=foo") - tramp-remote-process-environment))) - ;; Set the initial value, we want to unset below. - (should - (string-match - "foo" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:?bla}" envvar)))) - (let ((process-environment - (cons envvar process-environment))) - ;; Variable is unset. - (should - (string-match - "bla" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:?bla}" envvar)))) - ;; Variable is unset. - (should-not - (string-match - (regexp-quote envvar) - (funcall this-shell-command-to-string "set"))))))))) - -(ert-deftest tramp-test30-vc-registered () - "Check `vc-registered'." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - - (let* ((default-directory tramp-test-temporary-file-directory) - (tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (expand-file-name "foo" tmp-name1)) - (tramp-remote-process-environment tramp-remote-process-environment) - (vc-handled-backends - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (cond - ((tramp-find-executable v vc-git-program (tramp-get-remote-path v)) - '(Git)) - ((tramp-find-executable v vc-hg-program (tramp-get-remote-path v)) - '(Hg)) - ((tramp-find-executable v vc-bzr-program (tramp-get-remote-path v)) - (setq tramp-remote-process-environment - (cons (format "BZR_HOME=%s" - (file-remote-p tmp-name1 'localname)) - tramp-remote-process-environment)) - ;; We must force a reconnect, in order to activate $BZR_HOME. - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) - '(Bzr)) - (t nil))))) - (skip-unless vc-handled-backends) - (message "%s" vc-handled-backends) - - (unwind-protect - (progn - (make-directory tmp-name1) - (write-region "foo" nil tmp-name2) - (should (file-directory-p tmp-name1)) - (should (file-exists-p tmp-name2)) - (should-not (vc-registered tmp-name1)) - (should-not (vc-registered tmp-name2)) - - (let ((default-directory tmp-name1)) - ;; Create empty repository, and register the file. - ;; Sometimes, creation of repository fails (bzr!); we skip - ;; the test then. - (condition-case nil - (vc-create-repo (car vc-handled-backends)) - (error (skip-unless nil))) - ;; The structure of VC-FILESET is not documented. Let's - ;; hope it won't change. - (condition-case nil - (vc-register - (list (car vc-handled-backends) - (list (file-name-nondirectory tmp-name2)))) - ;; `vc-register' has changed its arguments in Emacs 25.1. - (error - (vc-register - nil (list (car vc-handled-backends) - (list (file-name-nondirectory tmp-name2)))))) - ;; vc-git uses an own process sentinel, Tramp's sentinel - ;; for flushing the cache isn't used. - (dired-uncache (concat (file-remote-p default-directory) "/")) - (should (vc-registered (file-name-nondirectory tmp-name2))))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive))))) - -(ert-deftest tramp-test31-make-auto-save-file-name () - "Check `make-auto-save-file-name'." - (skip-unless (tramp--test-enabled)) - - (let ((tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name))) - - (unwind-protect - (progn - ;; Use default `auto-save-file-name-transforms' mechanism. - (let (tramp-auto-save-directory) - (with-temp-buffer - (setq buffer-file-name tmp-name1) - (should - (string-equal - (make-auto-save-file-name) - ;; This is taken from original `make-auto-save-file-name'. - (expand-file-name - (format - "#%s#" - (subst-char-in-string - ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) - temporary-file-directory))))) - - ;; No mapping. - (let (tramp-auto-save-directory auto-save-file-name-transforms) - (with-temp-buffer - (setq buffer-file-name tmp-name1) - (should - (string-equal - (make-auto-save-file-name) - (expand-file-name - (format "#%s#" (file-name-nondirectory tmp-name1)) - tramp-test-temporary-file-directory))))) - - ;; Use default `tramp-auto-save-directory' mechanism. - (let ((tramp-auto-save-directory tmp-name2)) - (with-temp-buffer - (setq buffer-file-name tmp-name1) - (should - (string-equal - (make-auto-save-file-name) - ;; This is taken from Tramp. - (expand-file-name - (format - "#%s#" - (tramp-subst-strs-in-string - '(("_" . "|") - ("/" . "_a") - (":" . "_b") - ("|" . "__") - ("[" . "_l") - ("]" . "_r")) - tmp-name1)) - tmp-name2))) - (should (file-directory-p tmp-name2)))) - - ;; Relative file names shall work, too. - (let ((tramp-auto-save-directory ".")) - (with-temp-buffer - (setq buffer-file-name tmp-name1 - default-directory tmp-name2) - (should - (string-equal - (make-auto-save-file-name) - ;; This is taken from Tramp. - (expand-file-name - (format - "#%s#" - (tramp-subst-strs-in-string - '(("_" . "|") - ("/" . "_a") - (":" . "_b") - ("|" . "__") - ("[" . "_l") - ("]" . "_r")) - tmp-name1)) - tmp-name2))) - (should (file-directory-p tmp-name2))))) - - ;; Cleanup. - (ignore-errors (delete-file tmp-name1)) - (ignore-errors (delete-directory tmp-name2 'recursive))))) - -(defun tramp--test-adb-p () - "Check, whether the remote host runs Android. -This requires restrictions of file name syntax." - (tramp-adb-file-name-p tramp-test-temporary-file-directory)) - -(defun tramp--test-ftp-p () - "Check, whether an FTP-like method is used. -This does not support globbing characters in file names (yet)." - ;; Globbing characters are ??, ?* and ?\[. - (and (eq (tramp-find-foreign-file-name-handler - tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler) - (string-match - "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))) - -(defun tramp--test-gvfs-p () - "Check, whether the remote host runs a GVFS based method. -This requires restrictions of file name syntax." - (tramp-gvfs-file-name-p tramp-test-temporary-file-directory)) - -(defun tramp--test-smb-or-windows-nt-p () - "Check, whether the locale or remote host runs MS Windows. -This requires restrictions of file name syntax." - (or (eq system-type 'windows-nt) - (tramp-smb-file-name-p tramp-test-temporary-file-directory))) - -(defun tramp--test-hpux-p () - "Check, whether the remote host runs HP-UX. -Several special characters do not work properly there." - ;; We must refill the cache. `file-truename' does it. - (with-parsed-tramp-file-name - (file-truename tramp-test-temporary-file-directory) nil - (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) - -(defun tramp--test-check-files (&rest files) - "Run a simple but comprehensive test over every file in FILES." - ;; We must use `file-truename' for the temporary directory, because - ;; it could be located on a symlinked directory. This would let the - ;; test fail. - (let* ((tramp-test-temporary-file-directory - (file-truename tramp-test-temporary-file-directory)) - (tmp-name1 (tramp--test-make-temp-name)) - (tmp-name2 (tramp--test-make-temp-name 'local)) - (files (delq nil files))) - (unwind-protect - (progn - (make-directory tmp-name1) - (make-directory tmp-name2) - (dolist (elt files) - (let* ((file1 (expand-file-name elt tmp-name1)) - (file2 (expand-file-name elt tmp-name2)) - (file3 (expand-file-name (concat elt "foo") tmp-name1))) - (write-region elt nil file1) - (should (file-exists-p file1)) - - ;; Check file contents. - (with-temp-buffer - (insert-file-contents file1) - (should (string-equal (buffer-string) elt))) - - ;; Copy file both directions. - (copy-file file1 tmp-name2) - (should (file-exists-p file2)) - (delete-file file1) - (should-not (file-exists-p file1)) - (copy-file file2 tmp-name1) - (should (file-exists-p file1)) - - ;; Method "smb" supports `make-symbolic-link' only if the - ;; remote host has CIFS capabilities. tramp-adb.el and - ;; tramp-gvfs.el do not support symbolic links at all. - (condition-case err - (progn - (make-symbolic-link file1 file3) - (should (file-symlink-p file3)) - (should - (string-equal - (expand-file-name file1) (file-truename file3))) - (should - (string-equal - (car (file-attributes file3)) - (file-remote-p (file-truename file1) 'localname))) - ;; Check file contents. - (with-temp-buffer - (insert-file-contents file3) - (should (string-equal (buffer-string) elt))) - (delete-file file3)) - (file-error - (should (string-equal (error-message-string err) - "make-symbolic-link not supported")))))) - - ;; Check file names. - (should (equal (directory-files - tmp-name1 nil directory-files-no-dot-files-regexp) - (sort (copy-sequence files) 'string-lessp))) - (should (equal (directory-files - tmp-name2 nil directory-files-no-dot-files-regexp) - (sort (copy-sequence files) 'string-lessp))) - - ;; `substitute-in-file-name' could return different values. - ;; For `adb', there could be strange file permissions - ;; preventing overwriting a file. We don't care in this - ;; testcase. - (dolist (elt files) - (let ((file1 - (substitute-in-file-name (expand-file-name elt tmp-name1))) - (file2 - (substitute-in-file-name (expand-file-name elt tmp-name2)))) - (ignore-errors (write-region elt nil file1)) - (should (file-exists-p file1)) - (ignore-errors (write-region elt nil file2 nil 'nomessage)) - (should (file-exists-p file2)))) - - (should (equal (directory-files - tmp-name1 nil directory-files-no-dot-files-regexp) - (directory-files - tmp-name2 nil directory-files-no-dot-files-regexp))) - - ;; Check directory creation. We use a subdirectory "foo" - ;; in order to avoid conflicts with previous file name tests. - (dolist (elt files) - (let* ((elt1 (concat elt "foo")) - (file1 (expand-file-name (concat "foo/" elt) tmp-name1)) - (file2 (expand-file-name elt file1)) - (file3 (expand-file-name elt1 file1))) - (make-directory file1 'parents) - (should (file-directory-p file1)) - (write-region elt nil file2) - (should (file-exists-p file2)) - (should - (equal - (directory-files file1 nil directory-files-no-dot-files-regexp) - `(,elt))) - (should - (equal - (caar (directory-files-and-attributes - file1 nil directory-files-no-dot-files-regexp)) - elt)) - - ;; Check symlink in `directory-files-and-attributes'. - (condition-case err - (progn - (make-symbolic-link file2 file3) - (should (file-symlink-p file3)) - (should - (string-equal - (caar (directory-files-and-attributes - file1 nil (regexp-quote elt1))) - elt1)) - (should - (string-equal - (cadr (car (directory-files-and-attributes - file1 nil (regexp-quote elt1)))) - (file-remote-p (file-truename file2) 'localname))) - (delete-file file3) - (should-not (file-exists-p file3))) - (file-error - (should (string-equal (error-message-string err) - "make-symbolic-link not supported")))) - - (delete-file file2) - (should-not (file-exists-p file2)) - (delete-directory file1) - (should-not (file-exists-p file1))))) - - ;; Cleanup. - (ignore-errors (delete-directory tmp-name1 'recursive)) - (ignore-errors (delete-directory tmp-name2 'recursive))))) - -(defun tramp--test-special-characters () - "Perform the test in `tramp-test32-special-characters*'." - ;; Newlines, slashes and backslashes in file names are not - ;; supported. So we don't test. And we don't test the tab - ;; character on Windows or Cygwin, because the backslash is - ;; interpreted as a path separator, preventing "\t" from being - ;; expanded to <TAB>. - (tramp--test-check-files - (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) - "foo bar baz" - (if (or (tramp--test-adb-p) (eq system-type 'cygwin)) - " foo bar baz " - " foo\tbar baz\t")) - "$foo$bar$$baz$" - "-foo-bar-baz-" - "%foo%bar%baz%" - "&foo&bar&baz&" - (unless (or (tramp--test-ftp-p) - (tramp--test-gvfs-p) - (tramp--test-smb-or-windows-nt-p)) - "?foo?bar?baz?") - (unless (or (tramp--test-ftp-p) - (tramp--test-gvfs-p) - (tramp--test-smb-or-windows-nt-p)) - "*foo*bar*baz*") - (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) - "'foo'bar'baz'" - "'foo\"bar'baz\"") - "#foo~bar#baz~" - (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) - "!foo!bar!baz!" - "!foo|bar!baz|") - (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) - ";foo;bar;baz;" - ":foo;bar:baz;") - (unless (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) - "<foo>bar<baz>") - "(foo)bar(baz)" - (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]") - "{foo}bar{baz}")) - -;; These tests are inspired by Bug#17238. -(ert-deftest tramp-test32-special-characters () - "Check special characters in file names." - (skip-unless (tramp--test-enabled)) - - (tramp--test-special-characters)) - -(ert-deftest tramp-test32-special-characters-with-stat () - "Check special characters in file names. -Use the `stat' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (skip-unless (tramp-get-remote-stat v))) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "perl" nil)) - tramp-connection-properties))) - (tramp--test-special-characters))) - -(ert-deftest tramp-test32-special-characters-with-perl () - "Check special characters in file names. -Use the `perl' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (skip-unless (tramp-get-remote-perl v))) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "stat" nil) - ;; See `tramp-sh-handle-file-truename'. - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "readlink" nil)) - tramp-connection-properties))) - (tramp--test-special-characters))) - -(ert-deftest tramp-test32-special-characters-with-ls () - "Check special characters in file names. -Use the `ls' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "perl" nil) - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "stat" nil) - ;; See `tramp-sh-handle-file-truename'. - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "readlink" nil)) - tramp-connection-properties))) - (tramp--test-special-characters))) - -(defun tramp--test-utf8 () - "Perform the test in `tramp-test33-utf8*'." - (let* ((utf8 (if (and (eq system-type 'darwin) - (memq 'utf-8-hfs (coding-system-list))) - 'utf-8-hfs 'utf-8)) - (coding-system-for-read utf8) - (coding-system-for-write utf8) - (file-name-coding-system utf8)) - (tramp--test-check-files - (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") - (unless (tramp--test-hpux-p) - "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") - "银河系漫游指南系列" - "Автостопом по гала́ктике"))) - -(ert-deftest tramp-test33-utf8 () - "Check UTF8 encoding in file names and file contents." - (skip-unless (tramp--test-enabled)) - - (tramp--test-utf8)) - -(ert-deftest tramp-test33-utf8-with-stat () - "Check UTF8 encoding in file names and file contents. -Use the `stat' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (skip-unless (tramp-get-remote-stat v))) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "perl" nil)) - tramp-connection-properties))) - (tramp--test-utf8))) - -(ert-deftest tramp-test33-utf8-with-perl () - "Check UTF8 encoding in file names and file contents. -Use the `perl' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil - (skip-unless (tramp-get-remote-perl v))) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "stat" nil) - ;; See `tramp-sh-handle-file-truename'. - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "readlink" nil)) - tramp-connection-properties))) - (tramp--test-utf8))) - -(ert-deftest tramp-test33-utf8-with-ls () - "Check UTF8 encoding in file names and file contents. -Use the `ls' command." - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - - (let ((tramp-connection-properties - (append - `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "perl" nil) - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "stat" nil) - ;; See `tramp-sh-handle-file-truename'. - (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) - "readlink" nil)) - tramp-connection-properties))) - (tramp--test-utf8))) - -;; This test is inspired by Bug#16928. -(ert-deftest tramp-test34-asynchronous-requests () - "Check parallel asynchronous requests. -Such requests could arrive from timers, process filters and -process sentinels. They shall not disturb each other." - ;; Mark as failed until bug has been fixed. - :expected-result :failed - :tags '(:expensive-test) - (skip-unless (tramp--test-enabled)) - (skip-unless - (eq - (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - 'tramp-sh-file-name-handler)) - - ;; Keep instrumentation verbosity 0 until Tramp bug is fixed. This - ;; has the side effect, that this test fails instead to abort. Good - ;; for hydra. - (tramp--instrument-test-case 0 - (let* ((tmp-name (tramp--test-make-temp-name)) - (default-directory tmp-name) - (remote-file-name-inhibit-cache t) - timer buffers kill-buffer-query-functions) - - (unwind-protect - (progn - (make-directory tmp-name) - - ;; Setup a timer in order to raise an ordinary command again - ;; and again. `vc-registered' is well suited, because there - ;; are many checks. - (setq - timer - (run-at-time - 0 1 - (lambda () - (when buffers - (vc-registered - (buffer-name (nth (random (length buffers)) buffers))))))) - - ;; Create temporary buffers. The number of buffers - ;; corresponds to the number of processes; it could be - ;; increased in order to make pressure on Tramp. - (dotimes (i 5) - (add-to-list 'buffers (generate-new-buffer "*temp*"))) - - ;; Open asynchronous processes. Set process sentinel. - (dolist (buf buffers) - (async-shell-command "read line; touch $line; echo $line" buf) - (set-process-sentinel - (get-buffer-process buf) - (lambda (proc _state) - (delete-file (buffer-name (process-buffer proc)))))) - - ;; Send a string. Use a random order of the buffers. Mix - ;; with regular operation. - (let ((buffers (copy-sequence buffers)) - buf) - (while buffers - (setq buf (nth (random (length buffers)) buffers)) - (process-send-string - (get-buffer-process buf) (format "'%s'\n" buf)) - (file-attributes (buffer-name buf)) - (setq buffers (delq buf buffers)))) - - ;; Wait until the whole output has been read. - (with-timeout ((* 10 (length buffers)) - (ert-fail "`async-shell-command' timed out")) - (let ((buffers (copy-sequence buffers)) - buf) - (while buffers - (setq buf (nth (random (length buffers)) buffers)) - (if (ignore-errors - (memq (process-status (get-buffer-process buf)) - '(run open))) - (accept-process-output (get-buffer-process buf) 0.1) - (setq buffers (delq buf buffers)))))) - - ;; Check. - (dolist (buf buffers) - (with-current-buffer buf - (should - (string-equal (format "'%s'\n" buf) (buffer-string))))) - (should-not - (directory-files tmp-name nil directory-files-no-dot-files-regexp))) - - ;; Cleanup. - (ignore-errors (cancel-timer timer)) - (ignore-errors (delete-directory tmp-name 'recursive)) - (dolist (buf buffers) - (ignore-errors (kill-buffer buf))))))) - -(ert-deftest tramp-test35-recursive-load () - "Check that Tramp does not fail due to recursive load." - (skip-unless (tramp--test-enabled)) - - (dolist (code - (list - (format - "(expand-file-name %S)" - tramp-test-temporary-file-directory) - (format - "(let ((default-directory %S)) (expand-file-name %S))" - tramp-test-temporary-file-directory - temporary-file-directory))) - (should-not - (string-match - "Recursive load" - (shell-command-to-string - (format - "%s -batch -Q -L %s --eval %s" - (expand-file-name invocation-name invocation-directory) - (mapconcat 'shell-quote-argument load-path " -L ") - (shell-quote-argument code))))))) - -(ert-deftest tramp-test36-unload () - "Check that Tramp and its subpackages unload completely. -Since it unloads Tramp, it shall be the last test to run." - ;; Mark as failed until all symbols are unbound. - :expected-result (if (featurep 'tramp) :failed :passed) - :tags '(:expensive-test) - (when (featurep 'tramp) - (unload-feature 'tramp 'force) - ;; No Tramp feature must be left. - (should-not (featurep 'tramp)) - (should-not (all-completions "tramp" (delq 'tramp-tests features))) - ;; `file-name-handler-alist' must be clean. - (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist))) - ;; There shouldn't be left a bound symbol. We do not regard our - ;; test symbols, and the Tramp unload hooks. - (mapatoms - (lambda (x) - (and (or (boundp x) (functionp x)) - (string-match "^tramp" (symbol-name x)) - (not (string-match "^tramp--?test" (symbol-name x))) - (not (string-match "unload-hook$" (symbol-name x))) - (ert-fail (format "`%s' still bound" x))))) - ;; There shouldn't be left a hook function containing a Tramp - ;; function. We do not regard the Tramp unload hooks. - (mapatoms - (lambda (x) - (and (boundp x) - (string-match "-hooks?$" (symbol-name x)) - (not (string-match "unload-hook$" (symbol-name x))) - (consp (symbol-value x)) - (ignore-errors (all-completions "tramp" (symbol-value x))) - (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) - -;; TODO: - -;; * dired-compress-file -;; * dired-uncache -;; * file-acl -;; * file-ownership-preserved-p -;; * file-selinux-context -;; * find-backup-file-name -;; * set-file-acl -;; * set-file-selinux-context - -;; * Work on skipped tests. Make a comment, when it is impossible. -;; * Fix `tramp-test15-copy-directory' for `smb'. Using tar in a pipe -;; doesn't work well when an interactive password must be provided. -;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). -;; * Fix Bug#16928. Set expected error of `tramp-test34-asynchronous-requests'. -;; * Fix `tramp-test36-unload' (Not all symbols are unbound). Set -;; expected error. - -(defun tramp-test-all (&optional interactive) - "Run all tests for \\[tramp]." - (interactive "p") - (funcall - (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) - -(provide 'tramp-tests) -;;; tramp-tests.el ends here diff --git a/test/automated/data/decompress/foo.gz b/test/data/decompress/foo.gz Binary files differindex a68653fcbb9..a68653fcbb9 100644 --- a/test/automated/data/decompress/foo.gz +++ b/test/data/decompress/foo.gz diff --git a/test/data/emacs-module/Makefile b/test/data/emacs-module/Makefile new file mode 100644 index 00000000000..db5e1b68088 --- /dev/null +++ b/test/data/emacs-module/Makefile @@ -0,0 +1,41 @@ +# Test GNU Emacs modules. + +# Copyright 2015-2017 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 <http://www.gnu.org/licenses/>. + +ROOT = ../../.. + +CC = gcc +LD = gcc +LDFLAGS = + +# On MS-Windows, say "make SO=.dll" to build the module +SO = .so +# -fPIC is a no-op on Windows, but causes a compiler warning +ifeq ($(SO),.dll) +CFLAGS = -std=gnu99 -ggdb3 -Wall +else +CFLAGS = -std=gnu99 -ggdb3 -Wall -fPIC +endif + +all: mod-test$(SO) + +%$(SO): %.o + $(LD) -shared $(LDFLAGS) -o $@ $< + +%.o: %.c + $(CC) $(CFLAGS) -I$(ROOT)/src -c $< diff --git a/test/data/emacs-module/mod-test.c b/test/data/emacs-module/mod-test.c new file mode 100644 index 00000000000..309179d1501 --- /dev/null +++ b/test/data/emacs-module/mod-test.c @@ -0,0 +1,268 @@ +/* Test GNU Emacs modules. + +Copyright 2015-2017 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 <http://www.gnu.org/licenses/>. */ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <emacs-module.h> + +int plugin_is_GPL_compatible; + +/* Always return symbol 't'. */ +static emacs_value +Fmod_test_return_t (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + return env->intern (env, "t"); +} + +/* Expose simple sum function. */ +static intmax_t +sum (intmax_t a, intmax_t b) +{ + return a + b; +} + +static emacs_value +Fmod_test_sum (emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data) +{ + assert (nargs == 2); + + intmax_t a = env->extract_integer (env, args[0]); + intmax_t b = env->extract_integer (env, args[1]); + + intmax_t r = sum (a, b); + + return env->make_integer (env, r); +} + + +/* Signal '(error 56). */ +static emacs_value +Fmod_test_signal (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); + env->non_local_exit_signal (env, env->intern (env, "error"), + env->make_integer (env, 56)); + return env->intern (env, "nil"); +} + + +/* Throw '(tag 65). */ +static emacs_value +Fmod_test_throw (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + assert (env->non_local_exit_check (env) == emacs_funcall_exit_return); + env->non_local_exit_throw (env, env->intern (env, "tag"), + env->make_integer (env, 65)); + return env->intern (env, "nil"); +} + + +/* Call argument function, catch all non-local exists and return + either normal result or a list describing the non-local exit. */ +static emacs_value +Fmod_test_non_local_exit_funcall (emacs_env *env, ptrdiff_t nargs, + emacs_value args[], void *data) +{ + assert (nargs == 1); + emacs_value result = env->funcall (env, args[0], 0, NULL); + emacs_value non_local_exit_symbol, non_local_exit_data; + enum emacs_funcall_exit code + = env->non_local_exit_get (env, &non_local_exit_symbol, + &non_local_exit_data); + switch (code) + { + case emacs_funcall_exit_return: + return result; + case emacs_funcall_exit_signal: + { + env->non_local_exit_clear (env); + emacs_value Flist = env->intern (env, "list"); + emacs_value list_args[] = {env->intern (env, "signal"), + non_local_exit_symbol, non_local_exit_data}; + return env->funcall (env, Flist, 3, list_args); + } + case emacs_funcall_exit_throw: + { + env->non_local_exit_clear (env); + emacs_value Flist = env->intern (env, "list"); + emacs_value list_args[] = {env->intern (env, "throw"), + non_local_exit_symbol, non_local_exit_data}; + return env->funcall (env, Flist, 3, list_args); + } + } + + /* Never reached. */ + return env->intern (env, "nil");; +} + + +/* Return a global reference. */ +static emacs_value +Fmod_test_globref_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + /* Make a big string and make it global. */ + char str[26 * 100]; + for (int i = 0; i < sizeof str; i++) + str[i] = 'a' + (i % 26); + + /* We don't need to null-terminate str. */ + emacs_value lisp_str = env->make_string (env, str, sizeof str); + return env->make_global_ref (env, lisp_str); +} + + +/* Return a copy of the argument string where every 'a' is replaced + with 'b'. */ +static emacs_value +Fmod_test_string_a_to_b (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + emacs_value lisp_str = args[0]; + ptrdiff_t size = 0; + char * buf = NULL; + + env->copy_string_contents (env, lisp_str, buf, &size); + buf = malloc (size); + env->copy_string_contents (env, lisp_str, buf, &size); + + for (ptrdiff_t i = 0; i + 1 < size; i++) + if (buf[i] == 'a') + buf[i] = 'b'; + + return env->make_string (env, buf, size - 1); +} + + +/* Embedded pointers in lisp objects. */ + +/* C struct (pointer to) that will be embedded. */ +struct super_struct +{ + int amazing_int; + char large_unused_buffer[512]; +}; + +/* Return a new user-pointer to a super_struct, with amazing_int set + to the passed parameter. */ +static emacs_value +Fmod_test_userptr_make (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + struct super_struct *p = calloc (1, sizeof *p); + p->amazing_int = env->extract_integer (env, args[0]); + return env->make_user_ptr (env, free, p); +} + +/* Return the amazing_int of a passed 'user-pointer to a super_struct'. */ +static emacs_value +Fmod_test_userptr_get (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + struct super_struct *p = env->get_user_ptr (env, args[0]); + return env->make_integer (env, p->amazing_int); +} + + +/* Fill vector in args[0] with value in args[1]. */ +static emacs_value +Fmod_test_vector_fill (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + emacs_value vec = args[0]; + emacs_value val = args[1]; + ptrdiff_t size = env->vec_size (env, vec); + for (ptrdiff_t i = 0; i < size; i++) + env->vec_set (env, vec, i, val); + return env->intern (env, "t"); +} + + +/* Return whether all elements of vector in args[0] are 'eq' to value + in args[1]. */ +static emacs_value +Fmod_test_vector_eq (emacs_env *env, ptrdiff_t nargs, emacs_value args[], + void *data) +{ + emacs_value vec = args[0]; + emacs_value val = args[1]; + ptrdiff_t size = env->vec_size (env, vec); + for (ptrdiff_t i = 0; i < size; i++) + if (!env->eq (env, env->vec_get (env, vec, i), val)) + return env->intern (env, "nil"); + return env->intern (env, "t"); +} + + +/* Lisp utilities for easier readability (simple wrappers). */ + +/* Provide FEATURE to Emacs. */ +static void +provide (emacs_env *env, const char *feature) +{ + emacs_value Qfeat = env->intern (env, feature); + emacs_value Qprovide = env->intern (env, "provide"); + emacs_value args[] = { Qfeat }; + + env->funcall (env, Qprovide, 1, args); +} + +/* Bind NAME to FUN. */ +static void +bind_function (emacs_env *env, const char *name, emacs_value Sfun) +{ + emacs_value Qfset = env->intern (env, "fset"); + emacs_value Qsym = env->intern (env, name); + emacs_value args[] = { Qsym, Sfun }; + + env->funcall (env, Qfset, 2, args); +} + +/* Module init function. */ +int +emacs_module_init (struct emacs_runtime *ert) +{ + emacs_env *env = ert->get_environment (ert); + +#define DEFUN(lsym, csym, amin, amax, doc, data) \ + bind_function (env, lsym, \ + env->make_function (env, amin, amax, csym, doc, data)) + + DEFUN ("mod-test-return-t", Fmod_test_return_t, 1, 1, NULL, NULL); + DEFUN ("mod-test-sum", Fmod_test_sum, 2, 2, "Return A + B\n\n(fn a b)", NULL); + DEFUN ("mod-test-signal", Fmod_test_signal, 0, 0, NULL, NULL); + DEFUN ("mod-test-throw", Fmod_test_throw, 0, 0, NULL, NULL); + DEFUN ("mod-test-non-local-exit-funcall", Fmod_test_non_local_exit_funcall, + 1, 1, NULL, NULL); + DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL); + DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL); + DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL); + DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL); + DEFUN ("mod-test-vector-fill", Fmod_test_vector_fill, 2, 2, NULL, NULL); + DEFUN ("mod-test-vector-eq", Fmod_test_vector_eq, 2, 2, NULL, NULL); + +#undef DEFUN + + provide (env, "mod-test"); + return 0; +} diff --git a/test/data/epg/dummy-pinentry b/test/data/epg/dummy-pinentry new file mode 100755 index 00000000000..2228dfb0c6d --- /dev/null +++ b/test/data/epg/dummy-pinentry @@ -0,0 +1,22 @@ +#! /bin/bash +# Dummy pinentry +# +# Copyright 2008 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + +echo OK Your orders please + +while read cmd; do + case $cmd in + GETPIN) echo D test0123456789; echo OK;; + *) echo OK;; + esac +done diff --git a/test/automated/data/epg/pubkey.asc b/test/data/epg/pubkey.asc index c0bf28f6200..c0bf28f6200 100644 --- a/test/automated/data/epg/pubkey.asc +++ b/test/data/epg/pubkey.asc diff --git a/test/automated/data/epg/seckey.asc b/test/data/epg/seckey.asc index 4ac7ba4a502..4ac7ba4a502 100644 --- a/test/automated/data/epg/seckey.asc +++ b/test/data/epg/seckey.asc diff --git a/test/automated/data/files-bug18141.el.gz b/test/data/files-bug18141.el.gz Binary files differindex 53d463e85b5..53d463e85b5 100644 --- a/test/automated/data/files-bug18141.el.gz +++ b/test/data/files-bug18141.el.gz diff --git a/test/data/image/blank-100x200.png b/test/data/image/blank-100x200.png Binary files differnew file mode 100644 index 00000000000..ad26949e983 --- /dev/null +++ b/test/data/image/blank-100x200.png diff --git a/test/data/image/blank-200x100.png b/test/data/image/blank-200x100.png Binary files differnew file mode 100644 index 00000000000..d516ad51d31 --- /dev/null +++ b/test/data/image/blank-200x100.png diff --git a/test/data/net/cert.pem b/test/data/net/cert.pem new file mode 100644 index 00000000000..4df4e92e0bf --- /dev/null +++ b/test/data/net/cert.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIELTCCAxWgAwIBAgIJAI6LqlFyaPRkMA0GCSqGSIb3DQEBCwUAMIGsMQswCQYD +VQQGEwJBVTEYMBYGA1UECAwPTmV3IFNvdXRoIFdhbGVzMQ8wDQYDVQQHDAZTeWRu +ZXkxITAfBgNVBAoMGEVtYWNzIFRlc3QgU2VydmljZXNzIExMQzESMBAGA1UECwwJ +QXV0b21hdGVkMRcwFQYDVQQDDA50ZXN0LmVtYWNzLnpvdDEiMCAGCSqGSIb3DQEJ +ARYTZW1hY3MtZGV2ZWxAZnNmLm9yZzAeFw0xNjAyMDgwNDA0MzJaFw0xNjAzMDkw +NDA0MzJaMIGsMQswCQYDVQQGEwJBVTEYMBYGA1UECAwPTmV3IFNvdXRoIFdhbGVz +MQ8wDQYDVQQHDAZTeWRuZXkxITAfBgNVBAoMGEVtYWNzIFRlc3QgU2VydmljZXNz +IExMQzESMBAGA1UECwwJQXV0b21hdGVkMRcwFQYDVQQDDA50ZXN0LmVtYWNzLnpv +dDEiMCAGCSqGSIb3DQEJARYTZW1hY3MtZGV2ZWxAZnNmLm9yZzCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAM52lP7k1rBpctBX1irRVgDerxqlFSTkvg8L +WmRCfwm3XY8EZWqM/8Eex5soH7myRlWfUH/cKxbqScZqXotj0hlPxdRkM6gWgHS9 +Mml7wnz2LZGvD5PfMfs+yBHKAMrqortFXCKksHsYIJ66l9gJMm1G5XjWha6CaEr/ +k2bE5Ovw0fB2B4vH0OqhJzGyenJOspXZz1ttn3h3UC5fbDXS8fUM9k/FbgJKypWr +zB3P12GcMR939FsR5sqa8nNoCMw+WBzs4XuM5Ad+s/UtEaZvmtwvLwmdB7cgCEyM +x5gaM969SlpOmuy7dDTCCK3lBl6B5dgFKvVcChYwSW+xJz5tfL0CAwEAAaNQME4w +HQYDVR0OBBYEFG3YhH7ZzEdOGstkT67uUh1RylNjMB8GA1UdIwQYMBaAFG3YhH7Z +zEdOGstkT67uUh1RylNjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB +ADnJL2tBMnPepywA57yDfJz54FvrqRd+UAjSiB7/QySDpHnTM3b3sXWfwAkXPTjM +c+jRW2kfdnL6OQW2tpcpPZANGnwK8MJrtGcbHhtPXjgDRhVZp64hsB7ayS+l0Dm7 +2ZBbi2SF8FgZVcQy0WD01ir2raSODo124dMrq+3aHP77YLbiNEKj+wFoDbndQ1FQ +gtIJBE80FADoqc7LnBrpA20aVlfqhKZqe+leYDSZ+CE1iwlPdvD+RTUxVDs5EfpB +qVOHDlzEfVmcMnddKTV8pNYuo93AG4s0KdrGG9RwSvtLaOoHd2i6RmIs+Yiumbau +mXodMxxAEW/cM7Ita/2QVmk= +-----END CERTIFICATE----- diff --git a/test/data/net/key.pem b/test/data/net/key.pem new file mode 100644 index 00000000000..5db58f573ca --- /dev/null +++ b/test/data/net/key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDOdpT+5NawaXLQ +V9Yq0VYA3q8apRUk5L4PC1pkQn8Jt12PBGVqjP/BHsebKB+5skZVn1B/3CsW6knG +al6LY9IZT8XUZDOoFoB0vTJpe8J89i2Rrw+T3zH7PsgRygDK6qK7RVwipLB7GCCe +upfYCTJtRuV41oWugmhK/5NmxOTr8NHwdgeLx9DqoScxsnpyTrKV2c9bbZ94d1Au +X2w10vH1DPZPxW4CSsqVq8wdz9dhnDEfd/RbEebKmvJzaAjMPlgc7OF7jOQHfrP1 +LRGmb5rcLy8JnQe3IAhMjMeYGjPevUpaTprsu3Q0wgit5QZegeXYBSr1XAoWMElv +sSc+bXy9AgMBAAECggEAaqHkIiGeoE5V9jTncAXeHWTlmyVX3k4luy9p6A5P/nyt +3YevuXBJRzzWatQ2Tno8yUwXD3Ju7s7ie4/EdMmBYYFJ84AtDctRXPm6Z7B7qn6a +2ntH2F+WOOUb/9QMxMCae44/H8VfQLQdZN2KPxHA8Z+ENPzW3mKL6vBE+PcIJLK2 +kTXQdCEIuUb1v4kxKYfjyyHAQ9yHvocUvZdodGHrpmWOr/2QCrqCjwiKnXyvdJMi +JQ4a3dU+JG5Zwr2hScyeLgS4p+M3A2NY+oIACn2rCcsIKC6uvBK3wAbhssaY8z9c +5kap862oMBNmPCxPuQTIIO7ptla0EWHktpFxnu7GIQKBgQDvKyXt82zGHiOZ9acx +4fV7t3NF2MNd9fOn59NYWYRSs2gaEjit6BnsCgiKZOJJ2YFsggBiQMiWuEzwqIdW +bOH8W5AubTxnE2OjeIpH5r8AXI6I/pKdOedM86oeElbL0p53OZqSqBK6vA5SnE76 +fZwC505h/mqH2E6AdKpcyL7sJwKBgQDc/jc4MkVnqF7xcYoJrYEbnkhwqRxIM+0Y +HY2qXszWQPgjae3NK1rw/PEOATzWrHLvRS/utQ8yeLUAZIGsFY8+c1kjvkvl4ZK2 +OnsEOVLmEwjDqqnq3JFYCVSkXfLBGRD3wGldzkCQljOiGuJ/Co1rGHk7CfBmxX2p +kxdts5OKewKBgQDTRsSc7Zs7cMh2a0GlmTyoa6iTHSeIy4rQ2sQimgGApSfjUBFt +30l28G4XA4O7RT9FwZnhMeWA75JYTigwOsNvkNtPiAQB8mjksclGNxqnkRwA/RI7 +fjlMCzxOkFjIeWivXd2kjIDvIM1uQNKsCWZWUks12e/1zSmb5HPSvyuZpQKBgQDQ +qVgKP604ysmav9HOgXy+Tx2nAoYpxp2/f2gbzZcrVfz1szdN2fnsQWh6CMEhEYMU +WQeBJIRM65w72qp1iYXPOaqZDT0suWiFl4I/4sBbbO2BkssNb2Xs8iJxcCOeH8Td +qVfTssNTwf7OuQPTYGtXC6ysCh5ra13Tl4cvlbdhsQKBgFHXP+919wSncLS+2ySD +waBzG6GyVOgV+FE3DrM3Xp4S6fldWYAndKHQ1HjJVDY8SkC2Tk1D7QSQnmS+ZzYs +YqzcnkPCTHLb6wCErs4ZiW0gn9xJnfxyv6wPujsayL4TMsmsqkj/IAB61UjwaA/a +Z+rUw/WkcNPD59AD1J0eeSZu +-----END PRIVATE KEY----- diff --git a/test/data/shr/div-div.html b/test/data/shr/div-div.html new file mode 100644 index 00000000000..1c191ae44d8 --- /dev/null +++ b/test/data/shr/div-div.html @@ -0,0 +1 @@ +<div>foo</div><div>Bar</div> diff --git a/test/data/shr/div-div.txt b/test/data/shr/div-div.txt new file mode 100644 index 00000000000..62715e12513 --- /dev/null +++ b/test/data/shr/div-div.txt @@ -0,0 +1,2 @@ +foo +Bar diff --git a/test/data/shr/div-p.html b/test/data/shr/div-p.html new file mode 100644 index 00000000000..fcbdfc43293 --- /dev/null +++ b/test/data/shr/div-p.html @@ -0,0 +1 @@ +<div>foo</div><p>Bar</p> diff --git a/test/data/shr/div-p.txt b/test/data/shr/div-p.txt new file mode 100644 index 00000000000..859d731da89 --- /dev/null +++ b/test/data/shr/div-p.txt @@ -0,0 +1,3 @@ +foo + +Bar diff --git a/test/data/shr/li-div.html b/test/data/shr/li-div.html new file mode 100644 index 00000000000..eca3c511bd9 --- /dev/null +++ b/test/data/shr/li-div.html @@ -0,0 +1,10 @@ +<ul> + <li> + <div> + <p >This is the first paragraph of a list item.</div> + <p >This is the second paragraph of a list item.</li> + <li> + <div>This is the first paragraph of a list item.</div> + <div>This is the second paragraph of a list item.</div> + </li> +</ul> diff --git a/test/data/shr/li-div.txt b/test/data/shr/li-div.txt new file mode 100644 index 00000000000..9fc54f2bdc6 --- /dev/null +++ b/test/data/shr/li-div.txt @@ -0,0 +1,6 @@ +* This is the first paragraph of a list item. + + This is the second paragraph of a list item. + +* This is the first paragraph of a list item. + This is the second paragraph of a list item. diff --git a/test/data/shr/li-empty.html b/test/data/shr/li-empty.html new file mode 100644 index 00000000000..05cfee7bdd4 --- /dev/null +++ b/test/data/shr/li-empty.html @@ -0,0 +1 @@ +<ol><li></li><li></li><li></li></ol> diff --git a/test/data/shr/li-empty.txt b/test/data/shr/li-empty.txt new file mode 100644 index 00000000000..906fd8df8b3 --- /dev/null +++ b/test/data/shr/li-empty.txt @@ -0,0 +1,3 @@ +1%20 +2%20 +3%20 diff --git a/test/data/shr/nonbr.html b/test/data/shr/nonbr.html new file mode 100644 index 00000000000..56282cf4ca5 --- /dev/null +++ b/test/data/shr/nonbr.html @@ -0,0 +1 @@ +<div class="gmail_extra">(progn</div><div class="gmail_extra"> (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt))</div><div class="gmail_extra"><br></div><div class="gmail_extra"> (defun turn-on-cursor-intangible-mode ()</div><div class="gmail_extra"> "Turns on cursor-intangible-mode."</div><div class="gmail_extra"> (interactive)</div><div class="gmail_extra"> (cursor-intangible-mode 1))</div><div class="gmail_extra"> (define-globalized-minor-mode global-cursor-intangible-mode cursor-intangible-mode turn-on-cursor-intangible-mode)</div><div class="gmail_extra"><br></div><div class="gmail_extra"> (global-cursor-intangible-mode 1))</div><div class="gmail_extra"><br></div> diff --git a/test/data/shr/nonbr.txt b/test/data/shr/nonbr.txt new file mode 100644 index 00000000000..0c3cffa93f9 --- /dev/null +++ b/test/data/shr/nonbr.txt @@ -0,0 +1,12 @@ +(progn + (setq minibuffer-prompt-properties '(read-only t cursor-intangible t face +minibuffer-prompt)) + + (defun turn-on-cursor-intangible-mode () + "Turns on cursor-intangible-mode." + (interactive) + (cursor-intangible-mode 1)) + (define-globalized-minor-mode global-cursor-intangible-mode +cursor-intangible-mode turn-on-cursor-intangible-mode) + + (global-cursor-intangible-mode 1)) diff --git a/test/data/shr/ul-empty.html b/test/data/shr/ul-empty.html new file mode 100644 index 00000000000..e5a75ab9216 --- /dev/null +++ b/test/data/shr/ul-empty.html @@ -0,0 +1,4 @@ +<ul> +<li></li> +</ul> +Lala diff --git a/test/data/shr/ul-empty.txt b/test/data/shr/ul-empty.txt new file mode 100644 index 00000000000..8993555425b --- /dev/null +++ b/test/data/shr/ul-empty.txt @@ -0,0 +1,3 @@ +* + +Lala
\ No newline at end of file diff --git a/test/data/somelib.el b/test/data/somelib.el new file mode 100644 index 00000000000..7b8d4037396 --- /dev/null +++ b/test/data/somelib.el @@ -0,0 +1,7 @@ +;;; -*- lexical-binding: t; -*- + +;; blah + +(defun somefunc () t) + +(provide 'somelib) diff --git a/test/data/somelib2.el b/test/data/somelib2.el new file mode 100644 index 00000000000..05156145a22 --- /dev/null +++ b/test/data/somelib2.el @@ -0,0 +1,7 @@ +;;; -*- lexical-binding: t; -*- + +;; blah + +(defun somefunc2 () t) + +(provide 'somelib2) diff --git a/test/automated/data/xref/file1.txt b/test/data/xref/file1.txt index 5d7cc544443..5d7cc544443 100644 --- a/test/automated/data/xref/file1.txt +++ b/test/data/xref/file1.txt diff --git a/test/automated/data/xref/file2.txt b/test/data/xref/file2.txt index 9f075f26004..9f075f26004 100644 --- a/test/automated/data/xref/file2.txt +++ b/test/data/xref/file2.txt diff --git a/test/file-organization.org b/test/file-organization.org new file mode 100644 index 00000000000..4d76c0068e3 --- /dev/null +++ b/test/file-organization.org @@ -0,0 +1,59 @@ +#+TITLE: The Location of Emacs-Lisp Tests + + + +* The Main Emacs Repository + +The Emacs repository contains a very large number of Emacs-Lisp files, many of +which pre-date both formal package support for Emacs and automated unit +testing. + +All paths are relative to the Emacs root directory. + +** Source + +Lisp files are stored in the ~lisp~ directory or its sub-directories. +Sub-directories are in many cases themed after packages (~gnus~, ~org~, +~calc~), related functionality (~net~, ~emacs-lisp~, ~progmodes~) or status +(~obsolete~). + +C source is stored in the ~src~ directory, which is flat. + +** Test Files + +Automated tests should be stored in the ~test/lisp~ directory for +tests of functionality implemented in Lisp, and in the ~test/src~ +directory for functionality implemented in C. Tests should reflect +the directory structure of the source tree; so tests for files in the +~lisp/emacs-lisp~ source directory should reside in the +~test/lisp/emacs-lisp~ directory. + +Tests should normally reside in a file with ~-tests.el~ added to the +base-name of the tested source file; hence ~ert.el~ is tested in +~ert-tests.el~, and ~pcase.el~ is tested in ~pcase-tests.el~. As n +exception, tests for a single feature may be placed into multiple +files of any name which are themselves placed in a directory named +after the feature with ~-tests~ appended, such as +~/test/lisp/emacs-lisp/eieio-tests~ + +Similarly, features implemented in C should reside in ~/test/src~ and +be named after the C file with ~-tests.el~ added to the base-name of +the tested source file. Thus, tests for ~src/fileio.c~ should be in +~test/src/fileio-tests.el~. + +There are also some test materials that cannot be run automatically +(i.e. via ert). These should be placed in ~/test/manual~; they are +not run by the "make check" command and its derivatives. + +** Resource Files + +Resource files for tests (containing test data) should reside in a +directory named after the feature with a ~-resources~ suffix, and +located in the same directory as the feature. Hence, the lisp file +~lisp/progmodes/flymake.el~, with tests in +~test/lisp/progmodes/flymake-tests.el~, should have resources in a +directory called ~test/lisp/progmodes/flymake-resources~. + +No guidance is given for the organization of resource files inside the +~-resource~ directory; files can be organized at the author's +discretion. diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css deleted file mode 100644 index 3a00739bfc4..00000000000 --- a/test/indent/css-mode.css +++ /dev/null @@ -1,45 +0,0 @@ -/* asdfasdf */ - -.xxx -{ -} - -article[role="main"] { - width: 60%; -} - -a, b:hover, c { - color: black !important; -} - -a, b:hover { /* bug:20282 */ - c { - color: black; - } - color: black; -} - -a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */ - background-color: white; -} - -/* asdfasdf */ -@foo x2 { - bla:toto; -} -.x2 -{ - /* foo: bar; */ foo2: bar2; - bar1: url("http://toto/titi"); - bar2: url('http://toto/titi'); - bar3: url(http://toto/titi); -} - -div.x3 -{ -} - -article:hover -{ - color: black; -} diff --git a/test/indent/scss-mode.scss b/test/indent/scss-mode.scss deleted file mode 100644 index e1ec90a5299..00000000000 --- a/test/indent/scss-mode.scss +++ /dev/null @@ -1,76 +0,0 @@ -// Comment! - -nav { - ul { - margin: 0; /* More comment */ - padding: 0; - list-style: none; - } - - li { display: inline-block; } - - a { - display: block; - padding: 6px 12px; - text-decoration: none; - } -} -nav ul { - margin: 0; - padding: 0; - list-style: none; -} - -nav li { - display: inline-block; -} - -nav a var -{ - display: block; - padding: 6px 12px; - text-decoration: none; -} - -$name: foo; -$attr: border; -p.#{$name} var -{ - x#{$attr}-color: blue; -} -article[role="main"] { - $toto: 500 !global; - $var-with-default: 300 !default; - float: left !important; - width: 600px / 888px * 100%; - height: 100px / 888px * 100%; -} - -%placeholder { - color: #f0f0f0; -} - -button { - @extend %placeholder !optional; -} - -@import 'reset'; - -@mixin border-radius($radius) { - -webkit-border-radius: $radius; - -moz-border-radius: $radius; - -ms-border-radius: $radius; - border-radius: $radius; -} - -.box { @include border-radius(10px); } - -// bug:21230 -$list: ( - ('a', #000000, #fff) - ('b', #000000, #fff) - ('c', #000000, #fff) - ('d', #000000, #fff) - ('e', #000000, #fff) - ('f', #000000, #fff) -); diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el new file mode 100644 index 00000000000..1ffcd6ac0d0 --- /dev/null +++ b/test/lisp/abbrev-tests.el @@ -0,0 +1,254 @@ +;;; abbrev-tests.el --- Test suite for abbrevs -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2017 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii <eliz@gnu.org> +;; Keywords: abbrevs + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; `kill-all-abbrevs-test' will remove all user *and* system abbrevs +;; if called noninteractively with the init file loaded. + +;;; Code: + +(require 'ert) +(require 'abbrev) +(require 'seq) + +;; set up test abbrev table and abbrev entry +(defun setup-test-abbrev-table () + (defvar ert-test-abbrevs nil) + (define-abbrev-table 'ert-test-abbrevs '(("a-e-t" "abbrev-ert-test"))) + (abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value") + ert-test-abbrevs) + +(ert-deftest abbrev-table-p-test () + (should-not (abbrev-table-p 42)) + (should-not (abbrev-table-p "aoeu")) + (should-not (abbrev-table-p '())) + (should-not (abbrev-table-p [])) + ;; Missing :abbrev-table-modiff counter: + (should-not (abbrev-table-p (obarray-make))) + (should (abbrev-table-empty-p (make-abbrev-table)))) + +(ert-deftest abbrev-make-abbrev-table-test () + ;; Table without properties: + (let ((table (make-abbrev-table))) + (should (abbrev-table-p table)) + (should (= (length table) obarray-default-size))) + ;; Table with one property 'foo with value 'bar: + (let ((table (make-abbrev-table '(foo bar)))) + (should (abbrev-table-p table)) + (should (= (length table) obarray-default-size)) + (should (eq (abbrev-table-get table 'foo) 'bar)))) + +(ert-deftest abbrev-table-get-put-test () + (let ((table (make-abbrev-table))) + (should-not (abbrev-table-get table 'foo)) + (should (= (abbrev-table-put table 'foo 42) 42)) + (should (= (abbrev-table-get table 'foo) 42)) + (should (eq (abbrev-table-put table 'foo 'bar) 'bar)) + (should (eq (abbrev-table-get table 'foo) 'bar)))) + +(ert-deftest copy-abbrev-table-test () + (defvar foo-abbrev-table nil) ; Avoid compiler warning + (define-abbrev-table 'foo-abbrev-table + '()) + (should (abbrev-table-p foo-abbrev-table)) + ;; Bug 21828 + (let ((new-foo-abbrev-table + (condition-case nil + (copy-abbrev-table foo-abbrev-table) + (error nil)))) + (should (abbrev-table-p new-foo-abbrev-table))) + (should-not (string-equal (buffer-name) "*Backtrace*"))) + +(ert-deftest abbrev-table-empty-p-test () + (should-error (abbrev-table-empty-p 42)) + (should-error (abbrev-table-empty-p "aoeu")) + (should-error (abbrev-table-empty-p '())) + (should-error (abbrev-table-empty-p [])) + ;; Missing :abbrev-table-modiff counter: + (should-error (abbrev-table-empty-p (obarray-make))) + (let* ((table (obarray-make))) + (abbrev-table-put table :abbrev-table-modiff 42) + (should (abbrev-table-empty-p table)))) + +(ert-deftest kill-all-abbrevs-test () + "Test undefining all defined abbrevs" + (unless noninteractive + (ert-skip "Cannot test kill-all-abbrevs in interactive mode")) + + (let ((num-tables 0)) + ;; ensure at least one abbrev exists + (should (abbrev-table-p (setup-test-abbrev-table))) + (setf num-tables (length abbrev-table-name-list)) + (kill-all-abbrevs) + + ;; no tables should have been removed/added + (should (= num-tables (length abbrev-table-name-list))) + ;; number of empty tables should be the same as number of tables + (should (= num-tables (length (seq-filter + (lambda (table) + (abbrev-table-empty-p (symbol-value table))) + abbrev-table-name-list)))))) + +(ert-deftest abbrev-table-name-test () + "Test returning name of abbrev-table" + (let ((ert-test-abbrevs (setup-test-abbrev-table)) + (no-such-table nil)) + (should (equal 'ert-test-abbrevs (abbrev-table-name ert-test-abbrevs))) + (should (equal nil (abbrev-table-name no-such-table))))) + +(ert-deftest clear-abbrev-table-test () + "Test clearing single abbrev table" + (let ((ert-test-abbrevs (setup-test-abbrev-table))) + (should (equal "abbrev-ert-test" (abbrev-expansion "a-e-t" ert-test-abbrevs))) + (clear-abbrev-table ert-test-abbrevs) + (should (equal nil (abbrev-expansion "a-e-t" ert-test-abbrevs))) + (should (equal t (abbrev-table-empty-p ert-test-abbrevs))))) + +(ert-deftest list-abbrevs-test () + "Test generation of abbrev list buffer" + ;; Somewhat redundant as prepare-abbrev-list-buffer is also tested. + ;; all abbrevs + (let ((abbrev-buffer (prepare-abbrev-list-buffer))) + (should (equal "*Abbrevs*" (buffer-name abbrev-buffer))) + (kill-buffer abbrev-buffer)) + ;; mode-specific abbrevs + (let ((abbrev-buffer (prepare-abbrev-list-buffer t))) + (should (equal "*Abbrevs*" (buffer-name abbrev-buffer))) + (kill-buffer abbrev-buffer))) + +(ert-deftest prepare-abbrev-list-buffer-test () + "Test generation of abbrev list buffer" + ;; all abbrevs + (let ((ert-test-abbrevs (setup-test-abbrev-table))) + (with-current-buffer (prepare-abbrev-list-buffer) + ;; Check for a couple of abbrev-table names in buffer. + (should (and (progn + (goto-char (point-min)) + (search-forward (symbol-name (abbrev-table-name ert-test-abbrevs)))) + (progn + (goto-char (point-min)) + (search-forward "global-abbrev-table")))) + (should (equal 'edit-abbrevs-mode major-mode)) + (kill-buffer "*Abbrevs*"))) + + ;; mode-specific abbrevs (temp buffer uses fundamental-mode) + (with-temp-buffer + (prepare-abbrev-list-buffer t) + (with-current-buffer "*Abbrevs*" + (should (progn + (goto-char (point-min)) + (search-forward "fundamental-mode-abbrev-table"))) + (should-error (progn + (goto-char (point-min)) + (search-forward "global-abbrev-table"))) + (should-not (equal 'edit-abbrevs-mode major-mode)) + (kill-buffer "*Abbrevs*")))) + +(ert-deftest insert-abbrevs-test () + "Test inserting abbrev definitions into buffer" + (with-temp-buffer + (insert-abbrevs) + (should (progn + (goto-char (point-min)) + (search-forward "global-abbrev-table"))))) + +(ert-deftest edit-abbrevs-test () + "Test editing abbrevs from buffer" + (defvar ert-edit-abbrevs-test-table nil) + (let ((ert-test-abbrevs (setup-test-abbrev-table))) + (with-temp-buffer + ;; insert test table and new abbrev, redefine, check definition + (goto-char (point-min)) + (insert "(ert-edit-abbrevs-test-table)\n") + (insert "\n" "\"e-a-t\"\t" "0\t" "\"edit-abbrevs-test\"\n") + ;; check test table before redefine + (should (equal "abbrev-ert-test" + (abbrev-expansion "a-e-t" ert-test-abbrevs))) + (edit-abbrevs-redefine) + (should-not (abbrev-expansion "a-e-t" ert-test-abbrevs)) + (should (equal "edit-abbrevs-test" + (abbrev-expansion "e-a-t" ert-edit-abbrevs-test-table)))))) + +(ert-deftest define-abbrevs-test () + "Test defining abbrevs from buffer" + (defvar ert-bad-abbrev-table nil) + (defvar ert-good-abbrev-table nil) + (defvar ert-redefine-abbrev-table nil) + (with-temp-buffer + ;; insert bad abbrev data and attempt define + (goto-char (point-min)) + (insert "ert-bad-abbrev-table\n") + (insert "\n" "\"b-a-t\"\t" "0\t" "\n") + (should-not (define-abbrevs)) + (should (equal nil (abbrev-expansion "b-a-t" ert-bad-abbrev-table))) + (delete-region (point-min) (point-max)) + ;; try with valid abbrev data + (goto-char (point-min)) + (insert "(ert-good-abbrev-table)\n") + (insert "\n" "\"g-a-t\"\t" "0\t" "\"good-abbrev-table\"\n") + (define-abbrevs) + (should (equal "good-abbrev-table" + (abbrev-expansion "g-a-t" ert-good-abbrev-table))) + ;; redefine from buffer + (delete-region (point-min) (point-max)) + (insert "(ert-redefine-abbrev-table)\n") + (insert "\n" "\"r-a-t\"\t" "0\t" "\"redefine-abbrev-table\"\n") + ;; arg = kill-all-abbrevs + (define-abbrevs t) + (should (equal "redefine-abbrev-table" + (abbrev-expansion "r-a-t" ert-redefine-abbrev-table))) + (should (equal nil (abbrev-expansion "g-a-t" ert-good-abbrev-table))))) + +(ert-deftest read-write-abbrev-file-test () + "Test reading and writing abbrevs from file" + (let ((temp-test-file (make-temp-file "ert-abbrev-test")) + (ert-test-abbrevs (setup-test-abbrev-table))) + (write-abbrev-file temp-test-file) + (clear-abbrev-table ert-test-abbrevs) + (should (abbrev-table-empty-p ert-test-abbrevs)) + (read-abbrev-file temp-test-file) + (should (equal "abbrev-ert-test" (abbrev-expansion "a-e-t" ert-test-abbrevs))) + (delete-file temp-test-file))) + +(ert-deftest abbrev-edit-save-to-file-test () + "Test saving abbrev definitions in buffer to file" + (defvar ert-save-test-table nil) + (let ((temp-test-file (make-temp-file "ert-abbrev-test")) + (ert-test-abbrevs (setup-test-abbrev-table))) + (with-temp-buffer + (goto-char (point-min)) + (insert "(ert-save-test-table)\n") + (insert "\n" "\"s-a-t\"\t" "0\t" "\"save-abbrevs-test\"\n") + (should (equal "abbrev-ert-test" + (abbrev-expansion "a-e-t" ert-test-abbrevs))) + ;; clears abbrev tables + (abbrev-edit-save-to-file temp-test-file) + (should-not (abbrev-expansion "a-e-t" ert-test-abbrevs)) + (read-abbrev-file temp-test-file) + (should (equal "save-abbrevs-test" + (abbrev-expansion "s-a-t" ert-save-test-table))) + (delete-file temp-test-file)))) + +(provide 'abbrev-tests) + +;;; abbrev-tests.el ends here diff --git a/test/lisp/auth-source-pass-tests.el b/test/lisp/auth-source-pass-tests.el new file mode 100644 index 00000000000..689fed3f3f5 --- /dev/null +++ b/test/lisp/auth-source-pass-tests.el @@ -0,0 +1,227 @@ +;;; auth-source-pass-tests.el --- Tests for auth-source-pass.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2013, 2017 Free Software Foundation, Inc. + +;; Author: Damien Cassou <damien.cassou@gmail.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Tests for auth-source-pass.el + +;;; Code: + +(require 'ert) + +(require 'auth-source-pass) + +(eval-when-compile (require 'cl-lib)) + +(ert-deftest auth-source-pass-parse-simple () + (let ((content "pass\nkey1:val1\nkey2:val2\n")) + (should (equal (auth-source-pass--parse-data content) + '(("key1" . "val1") + ("key2" . "val2")))))) + +(ert-deftest auth-source-pass-parse-with-dash-line () + (let ((content "pass\n--\nkey1:val1\nkey2:val2\n")) + (should (equal (auth-source-pass--parse-data content) + '(("key1" . "val1") + ("key2" . "val2")))))) + +(ert-deftest auth-source-pass-parse-with-trailing-spaces () + (let ((content "pass\n--\nkey1 :val1 \nkey2: val2\n\n")) + (should (equal (auth-source-pass--parse-data content) + '(("key1" . "val1") + ("key2" . "val2")))))) + +(defvar auth-source-pass--debug-log nil + "Contains a list of all messages passed to `auth-source-do-debug`.") + +(defun auth-source-pass--should-have-message-containing (regexp) + "Assert that at least one `auth-source-do-debug` matched REGEXP." + (should (seq-find (lambda (message) + (string-match regexp message)) + auth-source-pass--debug-log))) + +(defun auth-source-pass--debug (&rest msg) + "Format MSG and add that to `auth-source-pass--debug-log`. +This function is intended to be set to `auth-source-debug`." + (add-to-list 'auth-source-pass--debug-log (apply #'format msg) t)) + +(defmacro auth-source-pass--with-store (store &rest body) + "Use STORE as password-store while executing BODY." + (declare (indent 1)) + `(cl-letf (((symbol-function 'auth-source-pass-parse-entry) (lambda (entry) (cdr (cl-find entry ,store :key #'car :test #'string=))) ) + ((symbol-function 'auth-source-pass-entries) (lambda () (mapcar #'car ,store))) + ((symbol-function 'auth-source-pass--entry-valid-p) (lambda (_entry) t))) + (let ((auth-source-debug #'auth-source-pass--debug) + (auth-source-pass--debug-log nil)) + ,@body))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name () + (auth-source-pass--with-store '(("foo")) + (should (equal (auth-source-pass--find-match "foo" nil) + "foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-part () + (auth-source-pass--with-store '(("foo")) + (should (equal (auth-source-pass--find-match "https://foo" nil) + "foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-ignoring-user () + (auth-source-pass--with-store '(("foo")) + (should (equal (auth-source-pass--find-match "https://SomeUser@foo" nil) + "foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-with-user () + (auth-source-pass--with-store '(("SomeUser@foo")) + (should (equal (auth-source-pass--find-match "https://SomeUser@foo" nil) + "SomeUser@foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-prefer-full () + (auth-source-pass--with-store '(("SomeUser@foo") ("foo")) + (should (equal (auth-source-pass--find-match "https://SomeUser@foo" nil) + "SomeUser@foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-prefer-full-reversed () + (auth-source-pass--with-store '(("foo") ("SomeUser@foo")) + (should (equal (auth-source-pass--find-match "https://SomeUser@foo" nil) + "SomeUser@foo")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-without-subdomain () + (auth-source-pass--with-store '(("bar.com")) + (should (equal (auth-source-pass--find-match "foo.bar.com" nil) + "bar.com")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-without-subdomain-with-user () + (auth-source-pass--with-store '(("someone@bar.com")) + (should (equal (auth-source-pass--find-match "foo.bar.com" "someone") + "someone@bar.com")))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-without-subdomain-with-bad-user () + (auth-source-pass--with-store '(("someoneelse@bar.com")) + (should (equal (auth-source-pass--find-match "foo.bar.com" "someone") + nil)))) + +(ert-deftest auth-source-pass-find-match-matching-at-entry-name-without-subdomain-prefer-full () + (auth-source-pass--with-store '(("bar.com") ("foo.bar.com")) + (should (equal (auth-source-pass--find-match "foo.bar.com" nil) + "foo.bar.com")))) + +(ert-deftest auth-source-pass-dont-match-at-folder-name () + (auth-source-pass--with-store '(("foo.bar.com/foo")) + (should (equal (auth-source-pass--find-match "foo.bar.com" nil) + nil)))) + +(ert-deftest auth-source-pass-search-with-user-first () + (auth-source-pass--with-store '(("foo") ("user@foo")) + (should (equal (auth-source-pass--find-match "foo" "user") + "user@foo")) + (auth-source-pass--should-have-message-containing "Found 1 match"))) + +(ert-deftest auth-source-pass-give-priority-to-desired-user () + (auth-source-pass--with-store '(("foo") ("subdir/foo" ("user" . "someone"))) + (should (equal (auth-source-pass--find-match "foo" "someone") + "subdir/foo")) + (auth-source-pass--should-have-message-containing "Found 2 matches") + (auth-source-pass--should-have-message-containing "matching user field"))) + +(ert-deftest auth-source-pass-give-priority-to-desired-user-reversed () + (auth-source-pass--with-store '(("foo" ("user" . "someone")) ("subdir/foo")) + (should (equal (auth-source-pass--find-match "foo" "someone") + "foo")) + (auth-source-pass--should-have-message-containing "Found 2 matches") + (auth-source-pass--should-have-message-containing "matching user field"))) + +(ert-deftest auth-source-pass-return-first-when-several-matches () + (auth-source-pass--with-store '(("foo") ("subdir/foo")) + (should (equal (auth-source-pass--find-match "foo" nil) + "foo")) + (auth-source-pass--should-have-message-containing "Found 2 matches") + (auth-source-pass--should-have-message-containing "the first one"))) + +(ert-deftest auth-source-pass-make-divansantana-happy () + (auth-source-pass--with-store '(("host.com")) + (should (equal (auth-source-pass--find-match "smtp.host.com" "myusername@host.co.za") + "host.com")))) + +(ert-deftest auth-source-pass-hostname () + (should (equal (auth-source-pass--hostname "https://foo.bar") "foo.bar")) + (should (equal (auth-source-pass--hostname "http://foo.bar") "foo.bar")) + (should (equal (auth-source-pass--hostname "https://SomeUser@foo.bar") "foo.bar"))) + +(ert-deftest auth-source-pass-hostname-with-user () + (should (equal (auth-source-pass--hostname-with-user "https://foo.bar") "foo.bar")) + (should (equal (auth-source-pass--hostname-with-user "http://foo.bar") "foo.bar")) + (should (equal (auth-source-pass--hostname-with-user "https://SomeUser@foo.bar") "SomeUser@foo.bar"))) + +(defmacro auth-source-pass--with-store-find-foo (store &rest body) + "Use STORE while executing BODY. \"foo\" is the matched entry." + (declare (indent 1)) + `(auth-source-pass--with-store ,store + (cl-letf (((symbol-function 'auth-source-pass-find-match) + (lambda (_host _user) + "foo"))) + ,@body))) + +(ert-deftest auth-source-pass-build-result-return-parameters () + (auth-source-pass--with-store-find-foo '(("foo")) + (let ((result (auth-source-pass--build-result "foo" 512 "user"))) + (should (equal (plist-get result :port) 512)) + (should (equal (plist-get result :user) "user"))))) + +(ert-deftest auth-source-pass-build-result-return-entry-values () + (auth-source-pass--with-store-find-foo '(("foo" ("port" . 512) ("user" . "anuser"))) + (let ((result (auth-source-pass--build-result "foo" nil nil))) + (should (equal (plist-get result :port) 512)) + (should (equal (plist-get result :user) "anuser"))))) + +(ert-deftest auth-source-pass-build-result-entry-takes-precedence () + (auth-source-pass--with-store-find-foo '(("foo" ("port" . 512) ("user" . "anuser"))) + (let ((result (auth-source-pass--build-result "foo" 1024 "anotheruser"))) + (should (equal (plist-get result :port) 512)) + (should (equal (plist-get result :user) "anuser"))))) + +(ert-deftest auth-source-pass-only-return-entries-that-can-be-open () + (cl-letf (((symbol-function 'auth-source-pass-entries) + (lambda () '("foo.site.com" "bar.site.com" + "mail/baz.site.com/scott"))) + ((symbol-function 'auth-source-pass--entry-valid-p) + ;; only foo.site.com and "mail/baz.site.com/scott" are valid + (lambda (entry) (member entry '("foo.site.com" + "mail/baz.site.com/scott"))))) + (should (equal (auth-source-pass--find-all-by-entry-name "foo.site.com" "someuser") + '("foo.site.com"))) + (should (equal (auth-source-pass--find-all-by-entry-name "bar.site.com" "someuser") + '())) + (should (equal (auth-source-pass--find-all-by-entry-name "baz.site.com" "scott") + '("mail/baz.site.com/scott"))))) + +(ert-deftest auth-source-pass-entry-is-not-valid-when-unreadable () + (cl-letf (((symbol-function 'auth-source-pass--read-entry) + (lambda (entry) + ;; only foo is a valid entry + (if (string-equal entry "foo") + "password" + nil)))) + (should (auth-source-pass--entry-valid-p "foo")) + (should-not (auth-source-pass--entry-valid-p "bar")))) + +(provide 'auth-source-pass-tests) + +;;; auth-source-pass-tests.el ends here diff --git a/test/automated/auth-source-tests.el b/test/lisp/auth-source-tests.el index e73f55e2bfa..2634777c7db 100644 --- a/test/automated/auth-source-tests.el +++ b/test/lisp/auth-source-tests.el @@ -32,6 +32,10 @@ (defvar secrets-enabled t "Enable the secrets backend to test its features.") +(defun auth-source-ensure-ignored-backend (source) + (auth-source-validate-backend source '((:source . "") + (:type . ignore)))) + (defun auth-source-validate-backend (source validation-alist) (let ((backend (auth-source-backend-parse source))) (should (auth-source-backend-p backend)) @@ -119,15 +123,6 @@ (:search-function . auth-source-secrets-search) (:create-function . auth-source-secrets-create))))) -(ert-deftest auth-source-backend-parse-secrets-nil-source () - (provide 'secrets) ; simulates the presence of the `secrets' package - (let ((secrets-enabled t)) - (auth-source-validate-backend '(:source (:secrets nil)) - '((:source . "session") - (:type . secrets) - (:search-function . auth-source-secrets-search) - (:create-function . auth-source-secrets-create))))) - (ert-deftest auth-source-backend-parse-secrets-alias () (provide 'secrets) ; simulates the presence of the `secrets' package (let ((secrets-enabled t)) @@ -162,17 +157,12 @@ (:search-function . auth-source-secrets-search) (:create-function . auth-source-secrets-create)))))) -;; TODO This test shows suspicious behavior of auth-source: the -;; "secrets" source is used even though nothing in the input indicates -;; that is what we want -(ert-deftest auth-source-backend-parse-secrets-no-source () +(ert-deftest auth-source-backend-parse-invalid-or-nil-source () (provide 'secrets) ; simulates the presence of the `secrets' package (let ((secrets-enabled t)) - (auth-source-validate-backend '(:source '(foo)) - '((:source . "session") - (:type . secrets) - (:search-function . auth-source-secrets-search) - (:create-function . auth-source-secrets-create))))) + (auth-source-ensure-ignored-backend nil) + (auth-source-ensure-ignored-backend '(:source '(foo))) + (auth-source-ensure-ignored-backend '(:source nil)))) (defun auth-source--test-netrc-parse-entry (entry host user port) "Parse a netrc entry from buffer." @@ -219,5 +209,24 @@ ("login" . "user1") ("machine" . "mymachine1")))))) +(ert-deftest auth-source-test-format-prompt () + (should (equal (auth-source-format-prompt "test %u %h %p" '((?u "user") (?h "host"))) + "test user host %p"))) + +(ert-deftest auth-source-test-remembrances-of-things-past () + (let ((password-cache t) + (password-data (make-vector 7 0))) + (auth-source-remember '(:host "wedd") '(4 5 6)) + (should (auth-source-remembered-p '(:host "wedd"))) + (should-not (auth-source-remembered-p '(:host "xedd"))) + (auth-source-remember '(:host "xedd") '(1 2 3)) + (should (auth-source-remembered-p '(:host "xedd"))) + (should-not (auth-source-remembered-p '(:host "zedd"))) + (should (auth-source-recall '(:host "xedd"))) + (should-not (auth-source-recall nil)) + (auth-source-forget+ :host t) + (should-not (auth-source-remembered-p '(:host "xedd"))) + (should-not (auth-source-remembered-p '(:host t))))) + (provide 'auth-source-tests) ;;; auth-source-tests.el ends here diff --git a/test/automated/auto-revert-tests.el b/test/lisp/autorevert-tests.el index c37830f8b20..c6f103321c6 100644 --- a/test/automated/auto-revert-tests.el +++ b/test/lisp/autorevert-tests.el @@ -24,24 +24,29 @@ ;;; Code: (require 'ert) +(require 'ert-x) (require 'autorevert) (setq auto-revert-notify-exclude-dir-regexp "nothing-to-be-excluded" auto-revert-stop-on-user-input nil) (defconst auto-revert--timeout 10 - "Time to wait until a message appears in the *Messages* buffer.") + "Time to wait for a message.") + +(defvar auto-revert--messages nil + "Used to collect messages issued during a section of a test.") (defun auto-revert--wait-for-revert (buffer) - "Wait until the *Messages* buffer reports reversion of BUFFER." + "Wait until a message reports reversion of BUFFER. +This expects `auto-revert--messages' to be bound by +`ert-with-message-capture' before calling." (with-timeout (auto-revert--timeout nil) - (with-current-buffer "*Messages*" - (while - (null (string-match - (format-message "Reverting buffer `%s'." (buffer-name buffer)) - (buffer-string))) - (if (with-current-buffer buffer auto-revert-use-notify) - (read-event nil nil 0.1) - (sleep-for 0.1)))))) + (while + (null (string-match + (format-message "Reverting buffer `%s'." (buffer-name buffer)) + auto-revert--messages)) + (if (with-current-buffer buffer auto-revert-use-notify) + (read-event nil nil 0.1) + (sleep-for 0.1))))) (ert-deftest auto-revert-test00-auto-revert-mode () "Check autorevert for a file." @@ -51,41 +56,38 @@ buf) (unwind-protect (progn - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (write-region "any text" nil tmpfile nil 'no-message) + (write-region "any text" nil tmpfile nil 'no-message) (setq buf (find-file-noselect tmpfile)) - (with-current-buffer buf - (should (string-equal (buffer-string) "any text")) - ;; `buffer-stale--default-function' checks for - ;; `verify-visited-file-modtime'. We must ensure that it - ;; returns nil. - (sleep-for 1) - (auto-revert-mode 1) - (should auto-revert-mode) + (with-current-buffer buf + (ert-with-message-capture auto-revert--messages + (should (string-equal (buffer-string) "any text")) + ;; `buffer-stale--default-function' checks for + ;; `verify-visited-file-modtime'. We must ensure that it + ;; returns nil. + (sleep-for 1) + (auto-revert-mode 1) + (should auto-revert-mode) - ;; Modify file. We wait for a second, in order to have - ;; another timestamp. - (sleep-for 1) - (write-region "another text" nil tmpfile nil 'no-message) + ;; Modify file. We wait for a second, in order to have + ;; another timestamp. + (sleep-for 1) + (write-region "another text" nil tmpfile nil 'no-message) - ;; Check, that the buffer has been reverted. - (auto-revert--wait-for-revert buf) + ;; Check, that the buffer has been reverted. + (auto-revert--wait-for-revert buf)) (should (string-match "another text" (buffer-string))) ;; When the buffer is modified, it shall not be reverted. - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (set-buffer-modified-p t) - (sleep-for 1) - (write-region "any text" nil tmpfile nil 'no-message) + (ert-with-message-capture auto-revert--messages + (set-buffer-modified-p t) + (sleep-for 1) + (write-region "any text" nil tmpfile nil 'no-message) - ;; Check, that the buffer hasn't been reverted. - (auto-revert--wait-for-revert buf) + ;; Check, that the buffer hasn't been reverted. + (auto-revert--wait-for-revert buf)) (should-not (string-match "any text" (buffer-string))))) ;; Exit. - (with-current-buffer "*Messages*" (widen)) (ignore-errors (with-current-buffer buf (set-buffer-modified-p nil)) (kill-buffer buf)) @@ -106,13 +108,11 @@ (make-temp-file (expand-file-name "auto-revert-test" tmpdir1))) buf1 buf2) (unwind-protect - (progn - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (write-region "any text" nil tmpfile1 nil 'no-message) - (setq buf1 (find-file-noselect tmpfile1)) - (write-region "any text" nil tmpfile2 nil 'no-message) - (setq buf2 (find-file-noselect tmpfile2)) + (ert-with-message-capture auto-revert--messages + (write-region "any text" nil tmpfile1 nil 'no-message) + (setq buf1 (find-file-noselect tmpfile1)) + (write-region "any text" nil tmpfile2 nil 'no-message) + (setq buf2 (find-file-noselect tmpfile2)) (dolist (buf (list buf1 buf2)) (with-current-buffer buf @@ -148,7 +148,6 @@ (should (string-match "another text" (buffer-string)))))) ;; Exit. - (with-current-buffer "*Messages*" (widen)) (ignore-errors (dolist (buf (list buf1 buf2)) (with-current-buffer buf (set-buffer-modified-p nil)) @@ -156,16 +155,77 @@ (ignore-errors (delete-directory tmpdir1 'recursive)) (ignore-errors (delete-directory tmpdir2 'recursive))))) -(ert-deftest auto-revert-test02-auto-revert-tail-mode () +;; This is inspired by Bug#23276. +(ert-deftest auto-revert-test02-auto-revert-deleted-file () + "Check autorevert for a deleted file." + :tags '(:expensive-test) + + (let ((tmpfile (make-temp-file "auto-revert-test")) + buf) + (unwind-protect + (progn + (write-region "any text" nil tmpfile nil 'no-message) + (setq buf (find-file-noselect tmpfile)) + (with-current-buffer buf + (should (string-equal (buffer-string) "any text")) + ;; `buffer-stale--default-function' checks for + ;; `verify-visited-file-modtime'. We must ensure that + ;; it returns nil. + (sleep-for 1) + (auto-revert-mode 1) + (should auto-revert-mode) + + ;; Remove file while reverting. We simulate this by + ;; modifying `before-revert-hook'. + (add-hook + 'before-revert-hook + (lambda () (delete-file buffer-file-name)) + nil t) + + (ert-with-message-capture auto-revert--messages + (sleep-for 1) + (write-region "another text" nil tmpfile nil 'no-message) + (auto-revert--wait-for-revert buf)) + ;; Check, that the buffer hasn't been reverted. File + ;; notification should be disabled, falling back to + ;; polling. + (should (string-match "any text" (buffer-string))) + ;; With w32notify, the 'stopped' events are not sent. + (or (eq file-notify--library 'w32notify) + (should-not auto-revert-use-notify)) + + ;; Once the file has been recreated, the buffer shall be + ;; reverted. + (kill-local-variable 'before-revert-hook) + (ert-with-message-capture auto-revert--messages + (sleep-for 1) + (write-region "another text" nil tmpfile nil 'no-message) + (auto-revert--wait-for-revert buf)) + ;; Check, that the buffer has been reverted. + (should (string-match "another text" (buffer-string))) + + ;; An empty file shall still be reverted. + (ert-with-message-capture auto-revert--messages + (sleep-for 1) + (write-region "" nil tmpfile nil 'no-message) + (auto-revert--wait-for-revert buf)) + ;; Check, that the buffer has been reverted. + (should (string-equal "" (buffer-string))))) + + ;; Exit. + (ignore-errors + (with-current-buffer buf (set-buffer-modified-p nil)) + (kill-buffer buf)) + (ignore-errors (delete-file tmpfile))))) + +(ert-deftest auto-revert-test03-auto-revert-tail-mode () "Check autorevert tail mode." ;; `auto-revert-buffers' runs every 5". And we must wait, until the ;; file has been reverted. (let ((tmpfile (make-temp-file "auto-revert-test")) buf) (unwind-protect - (progn - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) + (ert-with-message-capture auto-revert--messages (write-region "any text" nil tmpfile nil 'no-message) (setq buf (find-file-noselect tmpfile)) (with-current-buffer buf @@ -190,11 +250,10 @@ (string-match "modified text\nanother text" (buffer-string))))) ;; Exit. - (with-current-buffer "*Messages*" (widen)) (ignore-errors (kill-buffer buf)) (ignore-errors (delete-file tmpfile))))) -(ert-deftest auto-revert-test03-auto-revert-mode-dired () +(ert-deftest auto-revert-test04-auto-revert-mode-dired () "Check autorevert for dired." ;; `auto-revert-buffers' runs every 5". And we must wait, until the ;; file has been reverted. @@ -214,33 +273,29 @@ (should (string-match name (substring-no-properties (buffer-string)))) - ;; Delete file. We wait for a second, in order to have - ;; another timestamp. - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (sleep-for 1) - (delete-file tmpfile) - - ;; Check, that the buffer has been reverted. - (auto-revert--wait-for-revert buf) + (ert-with-message-capture auto-revert--messages + ;; Delete file. We wait for a second, in order to have + ;; another timestamp. + (sleep-for 1) + (delete-file tmpfile) + (auto-revert--wait-for-revert buf)) + ;; Check, that the buffer has been reverted. (should-not (string-match name (substring-no-properties (buffer-string)))) - ;; Make dired buffer modified. Check, that the buffer has - ;; been still reverted. - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (set-buffer-modified-p t) - (sleep-for 1) - (write-region "any text" nil tmpfile nil 'no-message) + (ert-with-message-capture auto-revert--messages + ;; Make dired buffer modified. Check, that the buffer has + ;; been still reverted. + (set-buffer-modified-p t) + (sleep-for 1) + (write-region "any text" nil tmpfile nil 'no-message) - ;; Check, that the buffer has been reverted. - (auto-revert--wait-for-revert buf) + (auto-revert--wait-for-revert buf)) + ;; Check, that the buffer has been reverted. (should (string-match name (substring-no-properties (buffer-string)))))) ;; Exit. - (with-current-buffer "*Messages*" (widen)) (ignore-errors (with-current-buffer buf (set-buffer-modified-p nil)) (kill-buffer buf)) diff --git a/test/lisp/buff-menu-tests.el b/test/lisp/buff-menu-tests.el new file mode 100644 index 00000000000..21ffb2ebf36 --- /dev/null +++ b/test/lisp/buff-menu-tests.el @@ -0,0 +1,43 @@ +;;; buff-menu-tests.el --- Test suite for buff-menu.el -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Tino Calancha <tino.calancha@gmail.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(ert-deftest buff-menu-24962 () + "Test for http://debbugs.gnu.org/24962 ." + (let* ((file (make-temp-file "foo")) + (buf (find-file file))) + (unwind-protect + (progn + (rename-buffer " foo") + (list-buffers) + (with-current-buffer "*Buffer List*" + (should (string= " foo" (buffer-name (Buffer-menu-buffer)))))) + (and (buffer-live-p buf) (kill-buffer buf)) + (and (file-exists-p file) (delete-file file))))) + +(provide 'buff-menu-tests) + +;;; buff-menu-tests.el ends here diff --git a/test/automated/calc-tests.el b/test/lisp/calc/calc-tests.el index 8f56d48d01d..e4b43357a01 100644 --- a/test/automated/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -86,6 +86,51 @@ An existing calc stack is reused, otherwise a new one is created." (math-read-expr "1m") "cm") '(* -100 (var cm var-cm))))) +(ert-deftest test-calc-23889 () + "Test for http://debbugs.gnu.org/23889 and 25652." + (skip-unless (>= math-bignum-digit-length 9)) + (dolist (mode '(deg rad)) + (let ((calc-angle-mode mode)) + ;; If user inputs angle units, then should ignore `calc-angle-mode'. + (should (string= "5253" + (substring + (number-to-string + (nth 1 + (math-simplify-units + '(calcFunc-cos (* 45 (var rad var-rad)))))) + 0 4))) + (should (string= "7071" + (substring + (number-to-string + (nth 1 + (math-simplify-units + '(calcFunc-cos (* 45 (var deg var-deg)))))) + 0 4))) + (should (string= "8939" + (substring + (number-to-string + (nth 1 + (math-simplify-units + '(+ (calcFunc-sin (* 90 (var rad var-rad))) + (calcFunc-cos (* 90 (var deg var-deg))))))) + 0 4))) + (should (string= "5519" + (substring + (number-to-string + (nth 1 + (math-simplify-units + '(+ (calcFunc-sin (* 90 (var deg var-deg))) + (calcFunc-cos (* 90 (var rad var-rad))))))) + 0 4))) + ;; If user doesn't input units, then must use `calc-angle-mode'. + (should (string= (if (eq calc-angle-mode 'deg) + "9998" + "5403") + (substring + (number-to-string + (nth 1 (calcFunc-cos 1))) + 0 4)))))) + (provide 'calc-tests) ;;; calc-tests.el ends here diff --git a/test/automated/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el index b813f33fa81..3e090029808 100644 --- a/test/automated/icalendar-tests.el +++ b/test/lisp/calendar/icalendar-tests.el @@ -58,23 +58,16 @@ (ert-deftest icalendar--create-uid () "Test for `icalendar--create-uid'." (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s") - t-ct (icalendar--uid-count 77) (entry-full "30.06.1964 07:01 blahblah") (hash (format "%d" (abs (sxhash entry-full)))) (contents "DTSTART:19640630T070100\nblahblah") - (username (or user-login-name "UNKNOWN_USER")) - ) - (fset 't-ct (symbol-function 'current-time)) - (unwind-protect - (progn - (fset 'current-time (lambda () '(1 2 3))) - (should (= 77 icalendar--uid-count)) - (should (string= (concat "xxx-123-77-" hash "-" username "-19640630") - (icalendar--create-uid entry-full contents))) - (should (= 78 icalendar--uid-count))) - ;; restore 'current-time - (fset 'current-time (symbol-function 't-ct))) + (username (or user-login-name "UNKNOWN_USER"))) + (cl-letf (((symbol-function 'current-time) (lambda () '(1 2 3)))) + (should (= 77 icalendar--uid-count)) + (should (string= (concat "xxx-123-77-" hash "-" username "-19640630") + (icalendar--create-uid entry-full contents))) + (should (= 78 icalendar--uid-count))) (setq contents "blahblah") (setq icalendar-uid-format "yyy%syyy") (should (string= (concat "yyyDTSTARTyyy") @@ -1264,6 +1257,50 @@ UID:8814e3f9-7482-408f-996c-3bfe486a1263 UID: 8814e3f9-7482-408f-996c-3bfe486a1263 ")) +(ert-deftest icalendar-import-bug-24199 () + ;;bug#24199 -- monthly rule with byday-clause + (icalendar-tests--test-import +" +SUMMARY:Summary +DESCRIPTION:Desc +LOCATION:Loc +DTSTART:20151202T124600 +DTEND:20151202T160000 +RRULE:FREQ=MONTHLY;BYDAY=1WE;INTERVAL=1 +EXDATE:20160106T114600Z +EXDATE:20160203T114600Z +EXDATE:20160302T114600Z +EXDATE:20160504T104600Z +EXDATE:20160601T104600Z +CLASS:DEFAULT +TRANSP:OPAQUE +BEGIN:VALARM +ACTION:DISPLAY +TRIGGER;VALUE=DURATION:-PT3H +END:VALARM +LAST-MODIFIED:20160805T191040Z +UID:9188710a-08a7-4061-bae3-d4cf4972599a +" +"&%%(and (not (diary-date 2016 1 6)) (not (diary-date 2016 2 3)) (not (diary-date 2016 3 2)) (not (diary-date 2016 5 4)) (not (diary-date 2016 6 1)) (diary-float t 3 1) (diary-block 2015 12 2 9999 1 1)) 12:46-16:00 Summary + Desc: Desc + Location: Loc + Class: DEFAULT + UID: 9188710a-08a7-4061-bae3-d4cf4972599a +" +"&%%(and (not (diary-date 6 1 2016)) (not (diary-date 3 2 2016)) (not (diary-date 2 3 2016)) (not (diary-date 4 5 2016)) (not (diary-date 1 6 2016)) (diary-float t 3 1) (diary-block 2 12 2015 1 1 9999)) 12:46-16:00 Summary + Desc: Desc + Location: Loc + Class: DEFAULT + UID: 9188710a-08a7-4061-bae3-d4cf4972599a +" +"&%%(and (not (diary-date 1 6 2016)) (not (diary-date 2 3 2016)) (not (diary-date 3 2 2016)) (not (diary-date 5 4 2016)) (not (diary-date 6 1 2016)) (diary-float t 3 1) (diary-block 12 2 2015 1 1 9999)) 12:46-16:00 Summary + Desc: Desc + Location: Loc + Class: DEFAULT + UID: 9188710a-08a7-4061-bae3-d4cf4972599a +" +)) + (ert-deftest icalendar-import-multiple-vcalendars () (icalendar-tests--test-import "DTSTART;VALUE=DATE:20110723 diff --git a/test/lisp/calendar/parse-time-tests.el b/test/lisp/calendar/parse-time-tests.el new file mode 100644 index 00000000000..26b4e9e44db --- /dev/null +++ b/test/lisp/calendar/parse-time-tests.el @@ -0,0 +1,65 @@ +;; parse-time-tests.el --- Test suite for parse-time.el + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Lars Ingebrigtsen <larsi@gnus.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'parse-time) + +(ert-deftest parse-time-tests () + (should (equal (parse-time-string "Mon, 22 Feb 2016 19:35:42 +0100") + '(42 35 19 22 2 2016 1 nil 3600))) + (should (equal (parse-time-string "22 Feb 2016 19:35:42 +0100") + '(42 35 19 22 2 2016 nil nil 3600))) + (should (equal (parse-time-string "22 Feb 2016 +0100") + '(nil nil nil 22 2 2016 nil nil 3600))) + (should (equal (parse-time-string "Mon, 22 Feb 16 19:35:42 +0100") + '(42 35 19 22 2 2016 1 nil 3600))) + (should (equal (parse-time-string "Mon, 22 February 2016 19:35:42 +0100") + '(42 35 19 22 2 2016 1 nil 3600))) + (should (equal (parse-time-string "Mon, 22 feb 2016 19:35:42 +0100") + '(42 35 19 22 2 2016 1 nil 3600))) + (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 +0100") + '(42 35 19 22 2 2016 1 nil 3600))) + (should (equal (parse-time-string "Monday, 22 february 2016 19:35:42 PDT") + '(42 35 19 22 2 2016 1 t -25200))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0200") + '(13818 33666))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-0230") + '(13818 35466))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-02:00") + '(13818 33666))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54-02") + '(13818 33666))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54+0230") + '(13818 17466))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54+02") + '(13818 19266))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54Z") + '(13818 26466))) + (should (equal (parse-iso8601-time-string "1998-09-12T12:21:54") + (encode-time 54 21 12 12 9 1998)))) + +(provide 'parse-time-tests) + +;;; parse-time-tests.el ends here diff --git a/test/lisp/calendar/todo-mode-resources/todo-test-1.toda b/test/lisp/calendar/todo-mode-resources/todo-test-1.toda new file mode 100644 index 00000000000..8ca4e1908da --- /dev/null +++ b/test/lisp/calendar/todo-mode-resources/todo-test-1.toda @@ -0,0 +1,13 @@ +(("testcat1" . [0 0 1 0]) ("testcat2" . [0 0 1 0]) ("testcat3" . [0 0 1 0])) +--==-- testcat1 + +==--== DONE +[DONE May 26, 2017] [May 26, 2017] testcat1 item1 +--==-- testcat2 + +==--== DONE +[DONE May 28, 2017] [May 28, 2017] testcat2 item1 +--==-- testcat3 + +==--== DONE +[DONE May 28, 2017] [May 28, 2017] testcat3 item1 diff --git a/test/lisp/calendar/todo-mode-resources/todo-test-1.todo b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo new file mode 100644 index 00000000000..8e845df6b69 --- /dev/null +++ b/test/lisp/calendar/todo-mode-resources/todo-test-1.todo @@ -0,0 +1,12 @@ +(("testcat1" . [2 0 0 1]) ("testcat2" . [1 0 0 1])) +--==-- testcat1 +[May 29, 2017] testcat1 item3 + has more than one line + to test item highlighting +[May 26, 2017] testcat1 item2 + +==--== DONE +--==-- testcat2 +[May 28, 2017] testcat2 item2 + +==--== DONE diff --git a/test/lisp/calendar/todo-mode-tests.el b/test/lisp/calendar/todo-mode-tests.el new file mode 100644 index 00000000000..08dfe541929 --- /dev/null +++ b/test/lisp/calendar/todo-mode-tests.el @@ -0,0 +1,138 @@ +;;; todo-mode-tests.el --- tests for todo-mode.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Stephen Berman <stephen.berman@gmx.net> +;; Keywords: calendar + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'todo-mode) + +(defvar todo-test-data-dir + (file-truename + (expand-file-name "todo-mode-resources/" + (file-name-directory (or load-file-name + buffer-file-name)))) + "Base directory of todo-mode.el test data files.") + +(defvar todo-test-file-1 (expand-file-name "todo-test-1.todo" + todo-test-data-dir) + "Todo mode test file.") + +(defvar todo-test-archive-1 (expand-file-name "todo-test-1.toda" + todo-test-data-dir) + "Todo Archive mode test file.") + +(defmacro with-todo-test (&rest body) + "Set up an isolated todo-mode test environment." + `(let* ((todo-test-home (make-temp-file "todo-test-home-" t)) + (process-environment (cons (format "HOME=%s" todo-test-home) + process-environment)) + (todo-directory todo-test-data-dir) + (todo-default-todo-file (todo-short-file-name + (car (funcall todo-files-function))))) + (unwind-protect + (progn ,@body) + (delete-directory todo-test-home t)))) + +;; (defun todo-test-show (num &optional archive) +;; "Display category NUM of test todo file. +;; With non-nil ARCHIVE argument, display test archive file category." +;; (let* ((file (if archive todo-test-archive-1 todo-test-file-1)) +;; (buf (find-file-noselect file))) +;; (set-buffer buf) +;; (if archive (todo-archive-mode) (todo-mode)) +;; (setq todo-category-number num) +;; (todo-category-select))) + +(defun todo-test-get-archive (num) + "Display category NUM of todo archive test file." + (let ((archive-buf (find-file-noselect todo-test-archive-1))) + (set-buffer archive-buf) + (todo-archive-mode) + (setq todo-category-number num) + (todo-category-select))) + +(defun todo-test-is-current-buffer (filename) + "Return non-nil if FILENAME's buffer is current." + (let ((bufname (buffer-file-name (current-buffer)))) + (and bufname (equal (file-truename bufname) filename)))) + +(ert-deftest todo-test-todo-quit01 () + "Test the behavior of todo-quit with archive and todo files. +Invoking todo-quit in todo-archive-mode should make the +corresponding todo-mode category current, if it exits, otherwise +the current todo-mode category. Quitting todo-mode without an +intermediate buffer switch should not make the archive buffer +current again." + (with-todo-test + (todo-test-get-archive 2) + (let ((cat-name (todo-current-category))) + (todo-quit) + (should (todo-test-is-current-buffer todo-test-file-1)) + (should (equal (todo-current-category) cat-name)) + (todo-test-get-archive 1) + (setq cat-name (todo-current-category)) + (todo-quit) + (should (todo-test-is-current-buffer todo-test-file-1)) + (should (equal todo-category-number 1)) + (todo-forward-category) ; Category 2 in todo file now current. + (todo-test-get-archive 3) ; No corresponding category in todo file. + (setq cat-name (todo-current-category)) + (todo-quit) + (should (todo-test-is-current-buffer todo-test-file-1)) + (should (equal todo-category-number 2)) + (todo-quit) + (should-not (todo-test-is-current-buffer todo-test-archive-1))))) + +(ert-deftest todo-test-todo-quit02 () ; bug#27121 + "Test the behavior of todo-quit with todo and non-todo buffers. +If the buffer made current by invoking todo-quit in a todo-mode +buffer is buried by quit-window, the todo-mode buffer should not +become current." + (with-todo-test + (todo-show) + (should (todo-test-is-current-buffer todo-test-file-1)) + (let ((dir (dired default-directory))) + (todo-show) + (todo-quit) + (should (equal (current-buffer) dir)) + (quit-window) + (should-not (todo-test-is-current-buffer todo-test-file-1))))) + +(ert-deftest todo-test-item-highlighting () ; bug#27133 + "Test whether `todo-toggle-item-highlighting' highlights whole item. +In particular, all lines of a multiline item should be highlighted." + (with-todo-test + (todo-show) + (todo-jump-to-category nil "testcat1") ; For test rerun. + (todo-toggle-item-highlighting) + (let ((end (1- (todo-item-end))) + (beg (todo-item-start))) + (should (eq (get-char-property beg 'face) 'hl-line)) + (should (eq (get-char-property end 'face) 'hl-line)) + (should (> (count-lines beg end) 1)) + (should (eq (next-single-char-property-change beg 'face) (1+ end)))) + (todo-toggle-item-highlighting))) ; Turn off highlighting (for test rerun). + +(provide 'todo-mode-tests) +;;; todo-mode-tests.el ends here diff --git a/test/automated/char-fold-tests.el b/test/lisp/char-fold-tests.el index d86c731b6e3..00bc3c83d05 100644 --- a/test/automated/char-fold-tests.el +++ b/test/lisp/char-fold-tests.el @@ -54,6 +54,14 @@ (concat w1 "\s\n\s\t\f\t\n\r\t" w2) (concat w1 (make-string 10 ?\s) w2))))) +(defun char-fold--ascii-upcase (string) + "Like `upcase' but acts on ASCII characters only." + (replace-regexp-in-string "[a-z]+" 'upcase string)) + +(defun char-fold--ascii-downcase (string) + "Like `downcase' but acts on ASCII characters only." + (replace-regexp-in-string "[a-z]+" 'downcase string)) + (defun char-fold--test-match-exactly (string &rest strings-to-match) (let ((re (concat "\\`" (char-fold-to-regexp string) "\\'"))) (dolist (it strings-to-match) @@ -61,8 +69,8 @@ ;; Case folding (let ((case-fold-search t)) (dolist (it strings-to-match) - (should (string-match (upcase re) (downcase it))) - (should (string-match (downcase re) (upcase it))))))) + (should (string-match (char-fold--ascii-upcase re) (downcase it))) + (should (string-match (char-fold--ascii-downcase re) (upcase it))))))) (ert-deftest char-fold--test-some-defaults () (dolist (it '(("ffl" . "ffl") ("ffi" . "ffi") diff --git a/test/automated/comint-testsuite.el b/test/lisp/comint-tests.el index 3205c9e4cd3..3205c9e4cd3 100644 --- a/test/automated/comint-testsuite.el +++ b/test/lisp/comint-tests.el diff --git a/test/automated/dabbrev-tests.el b/test/lisp/dabbrev-tests.el index 5baa31558e7..5baa31558e7 100644 --- a/test/automated/dabbrev-tests.el +++ b/test/lisp/dabbrev-tests.el diff --git a/test/automated/descr-text-test.el b/test/lisp/descr-text-tests.el index df0f8453161..df0f8453161 100644 --- a/test/automated/descr-text-test.el +++ b/test/lisp/descr-text-tests.el diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el new file mode 100644 index 00000000000..1b814baac58 --- /dev/null +++ b/test/lisp/dired-tests.el @@ -0,0 +1,88 @@ +;;; dired-tests.el --- Test suite. -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: +(require 'ert) +(require 'dired) +(require 'nadvice) + + +(ert-deftest dired-autoload () + "Tests to see whether dired-x has been autoloaded" + (should + (fboundp 'dired-jump)) + (should + (autoloadp + (symbol-function + 'dired-jump)))) + +(ert-deftest dired-test-bug22694 () + "Test for http://debbugs.gnu.org/22694 ." + (let* ((dir (expand-file-name "bug22694" default-directory)) + (file "test") + (full-name (expand-file-name file dir)) + (regexp "bar") + (dired-always-read-filesystem t)) + (if (file-exists-p dir) + (delete-directory dir 'recursive)) + (make-directory dir) + (with-temp-file full-name (insert "foo")) + (find-file-noselect full-name) + (dired dir) + (with-temp-file full-name (insert "bar")) + (dired-mark-files-containing-regexp regexp) + (unwind-protect + (should (equal (dired-get-marked-files nil nil nil 'distinguish-1-mark) + `(t ,full-name))) + ;; Clean up + (delete-directory dir 'recursive)))) + +(ert-deftest dired-test-bug25609 () + "Test for http://debbugs.gnu.org/25609 ." + (let* ((from (make-temp-file "foo" 'dir)) + (to (make-temp-file "bar" 'dir)) + (target (expand-file-name (file-name-nondirectory from) to)) + (nested (expand-file-name (file-name-nondirectory from) target)) + (dired-dwim-target t) + (dired-recursive-copies 'always)) ; Don't prompt me. + (advice-add 'dired-query ; Don't ask confirmation to overwrite a file. + :override + (lambda (_sym _prompt &rest _args) (setq dired-query t)) + '((name . "advice-dired-query"))) + (advice-add 'completing-read ; Just return init. + :override + (lambda (_prompt _coll &optional _pred _match init _hist _def _inherit _keymap) + init) + '((name . "advice-completing-read"))) + (dired to) + (dired-other-window temporary-file-directory) + (dired-goto-file from) + (dired-do-copy) + (dired-do-copy); Again. + (unwind-protect + (progn + (should (file-exists-p target)) + (should-not (file-exists-p nested))) + (delete-directory from 'recursive) + (delete-directory to 'recursive) + (advice-remove 'dired-query "advice-dired-query") + (advice-remove 'completing-read "advice-completing-read")))) + +(provide 'dired-tests) +;; dired-tests.el ends here diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el new file mode 100644 index 00000000000..e8352a4ecaf --- /dev/null +++ b/test/lisp/dired-x-tests.el @@ -0,0 +1,53 @@ +;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: +(require 'ert) +(require 'dired-x) + + +(ert-deftest dired-test-bug25942 () + "Test for http://debbugs.gnu.org/25942 ." + (let* ((dirs (list "Public" "Music")) + (files (list ".bashrc" "bar.c" "foo.c" "c" ".c")) + (all-but-c + (sort + (append (copy-sequence dirs) + (delete "c" (copy-sequence files))) + #'string<)) + (dir (make-temp-file "Bug25942" 'dir)) + (extension "c")) + (unwind-protect + (progn + (dolist (d dirs) + (make-directory (expand-file-name d dir))) + (dolist (f files) + (write-region nil nil (expand-file-name f dir))) + (dired dir) + (dired-mark-extension extension) + (should (equal '("bar.c" "foo.c") + (sort (dired-get-marked-files 'local) #'string<))) + (dired-unmark-all-marks) + (dired-mark-suffix extension) + (should (equal all-but-c + (sort (dired-get-marked-files 'local) #'string<)))) + (delete-directory dir 'recursive)))) + +(provide 'dired-x-tests) +;; dired-x-tests.el ends here diff --git a/test/lisp/dom-tests.el b/test/lisp/dom-tests.el new file mode 100644 index 00000000000..32d231a47e5 --- /dev/null +++ b/test/lisp/dom-tests.el @@ -0,0 +1,201 @@ +;;; dom-tests.el --- Tests for dom.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl <simenheg@gmail.com> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'dom) +(require 'ert) +(eval-when-compile (require 'subr-x)) + +(defun dom-tests--tree () + "Return a DOM tree for testing." + (dom-node "html" nil + (dom-node "head" nil + (dom-node "title" nil + "Test")) + (dom-node "body" nil + (dom-node "div" '((class . "foo") + (style . "color: red;")) + (dom-node "p" '((id . "bar")) + "foo")) + (dom-node "div" '((title . "2nd div")) + "bar")))) + +(ert-deftest dom-tests-tag () + (let ((dom (dom-tests--tree))) + (should (equal (dom-tag dom) "html")) + (should (equal (dom-tag (car (dom-children dom))) "head")))) + +(ert-deftest dom-tests-attributes () + (let ((dom (dom-tests--tree))) + (should-not (dom-attributes dom)) + (should (equal (dom-attributes (dom-by-class dom "foo")) + '((class . "foo") (style . "color: red;")))))) + +(ert-deftest dom-tests-children () + (let ((dom (dom-tests--tree))) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("head" "body"))) + (should (equal (dom-tag (dom-children (dom-children dom))) + "title")))) + +(ert-deftest dom-tests-non-text-children () + (let ((dom (dom-tests--tree))) + (should (equal (dom-children dom) (dom-non-text-children dom))) + (should-not (dom-non-text-children + (dom-children (dom-children dom)))))) + +(ert-deftest dom-tests-set-attributes () + (let ((dom (dom-tests--tree)) + (attributes '((xmlns "http://www.w3.org/1999/xhtml")))) + (should-not (dom-attributes dom)) + (dom-set-attributes dom attributes) + (should (equal (dom-attributes dom) attributes)))) + +(ert-deftest dom-tests-set-attribute () + (let ((dom (dom-tests--tree)) + (attr 'xmlns) + (value "http://www.w3.org/1999/xhtml")) + (should-not (dom-attributes dom)) + (dom-set-attribute dom attr value) + (should (equal (dom-attr dom attr) value)))) + +(ert-deftest dom-tests-attr () + (let ((dom (dom-tests--tree))) + (should-not (dom-attr dom 'id)) + (should (equal (dom-attr (dom-by-id dom "bar") 'id) "bar")))) + +(ert-deftest dom-tests-text () + (let ((dom (dom-tests--tree))) + (should (string-empty-p (dom-text dom))) + (should (equal (dom-text (dom-by-tag dom "title")) "Test")))) + +(ert-deftest dom-tests-texts () + (let ((dom (dom-tests--tree))) + (should (equal (dom-texts dom) "Test foo bar")) + (should (equal (dom-texts dom ", ") "Test, foo, bar")))) + +(ert-deftest dom-tests-child-by-tag () + (let ((dom (dom-tests--tree))) + (should (equal (dom-child-by-tag dom "head") + (car (dom-children dom)))) + (should-not (dom-child-by-tag dom "title")))) + +(ert-deftest dom-tests-by-tag () + (let ((dom (dom-tests--tree))) + (should (= (length (dom-by-tag dom "div")) 2)) + (should-not (dom-by-tag dom "article")))) + +(ert-deftest dom-tests-strings () + (let ((dom (dom-tests--tree))) + (should (equal (dom-strings dom) '("Test" "foo" "bar"))) + (should (equal (dom-strings (dom-children dom)) '("Test"))))) + +(ert-deftest dom-tests-by-class () + (let ((dom (dom-tests--tree))) + (should (equal (dom-tag (dom-by-class dom "foo")) "div")) + (should-not (dom-by-class dom "bar")))) + +(ert-deftest dom-tests-by-style () + (let ((dom (dom-tests--tree))) + (should (equal (dom-tag (dom-by-style dom "color")) "div")) + (should-not (dom-by-style dom "width")))) + +(ert-deftest dom-tests-by-id () + (let ((dom (dom-tests--tree))) + (should (equal (dom-tag (dom-by-id dom "bar")) "p")) + (should-not (dom-by-id dom "foo")))) + +(ert-deftest dom-tests-elements () + (let ((dom (dom-tests--tree))) + (should (equal (dom-elements dom 'class "foo") + (dom-by-class dom "foo"))) + (should (equal (dom-attr (dom-elements dom 'title "2nd") 'title) + "2nd div")))) + +(ert-deftest dom-tests-remove-node () + (let ((dom (dom-tests--tree))) + (should-not (dom-remove-node dom dom)) + (should (= (length (dom-children dom)) 2)) + (dom-remove-node dom (car (dom-children dom))) + (should (= (length (dom-children dom)) 1)) + (dom-remove-node dom (car (dom-children dom))) + (should-not (dom-children dom)))) + +(ert-deftest dom-tests-parent () + (let ((dom (dom-tests--tree))) + (should-not (dom-parent dom dom)) + (should (equal (dom-parent dom (car (dom-children dom))) dom)))) + +(ert-deftest dom-tests-previous-sibling () + (let ((dom (dom-tests--tree))) + (should-not (dom-previous-sibling dom dom)) + (let ((children (dom-children dom))) + (should (equal (dom-previous-sibling dom (cadr children)) + (car children)))))) + +(ert-deftest dom-tests-append-child () + (let ((dom (dom-tests--tree))) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("head" "body"))) + (dom-append-child dom (dom-node "feet")) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("head" "body" "feet"))))) + +(ert-deftest dom-tests-add-child-before () + "Test `dom-add-child-before'. +Tests the cases of adding a new first-child and mid-child. Also +checks that an attempt to add a new node before a non-existent +child results in an error." + (let ((dom (dom-tests--tree))) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("head" "body"))) + (dom-add-child-before dom (dom-node "neck") + (dom-child-by-tag dom "body")) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("head" "neck" "body"))) + (dom-add-child-before dom (dom-node "hat")) + (should (equal (mapcar #'dom-tag (dom-children dom)) + '("hat" "head" "neck" "body"))) + (should-error (dom-add-child-before dom (dom-node "neck") + (dom-by-id dom "bar"))))) + +(ert-deftest dom-tests-ensure-node () + (let ((node (dom-node "foo"))) + (should (equal (dom-ensure-node '("foo")) node)) + (should (equal (dom-ensure-node '(("foo"))) node)) + (should (equal (dom-ensure-node '("foo" nil)) node)) + (should (equal (dom-ensure-node '(("foo") nil)) node)))) + +(ert-deftest dom-tests-pp () + (let ((node (dom-node "foo" nil ""))) + (with-temp-buffer + (dom-pp node) + (should (equal (buffer-string) "(\"foo\" nil\n \"\")"))) + (with-temp-buffer + (dom-pp node t) + (should (equal (buffer-string) "(\"foo\" nil)"))))) + +(provide 'dom-tests) +;;; dom-tests.el ends here diff --git a/test/automated/electric-tests.el b/test/lisp/electric-tests.el index 96a12e44bf9..78a37650619 100644 --- a/test/automated/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -578,6 +578,7 @@ baz\"\"" (define-electric-pair-test autowrapping-7 "foo" "\"" :expected-string "``foo''" :expected-point 8 :modes '(tex-mode) + :test-in-comments nil :fixture-fn #'(lambda () (electric-pair-mode 1) (goto-char (point-max)) diff --git a/test/lisp/emacs-lisp/benchmark-tests.el b/test/lisp/emacs-lisp/benchmark-tests.el new file mode 100644 index 00000000000..14426aeec41 --- /dev/null +++ b/test/lisp/emacs-lisp/benchmark-tests.el @@ -0,0 +1,51 @@ +;;; benchmark-tests.el --- Test suite for benchmark. -*- lexical-binding: t -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'benchmark) +(require 'ert) + +(ert-deftest benchmark-tests () + (let (str t-long t-short) + (should (consp (benchmark-run nil (1+ 0)))) + (should (consp (benchmark-run 1 (1+ 0)))) + (should (stringp (benchmark nil (1+ 0)))) + (should (stringp (benchmark 1 (1+ 0)))) + (should (consp (benchmark-run-compiled nil (1+ 0)))) + (should (consp (benchmark-run-compiled 1 (1+ 0)))) + ;; First test is heavier, must need longer time. + (should (> (car (benchmark-run nil + (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) + (car (benchmark-run nil (1+ 0))))) + (should (> (car (benchmark-run nil + (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) + (car (benchmark-run nil (1+ 0))))) + (should (> (car (benchmark-run-compiled nil + (let ((n 100000)) (while (> n 1) (setq n (1- n)))))) + (car (benchmark-run-compiled nil (1+ 0))))) + (setq str (benchmark nil '(let ((n 100000)) (while (> n 1) (setq n (1- n)))))) + (string-match "Elapsed time: \\([0-9.]+\\)" str) + (setq t-long (string-to-number (match-string 1 str))) + (setq str (benchmark nil '(1+ 0))) + (string-match "Elapsed time: \\([0-9.]+\\)" str) + (setq t-short (string-to-number (match-string 1 str))) + (should (> t-long t-short)))) + +;;; benchmark-tests.el ends here. diff --git a/test/automated/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index f07138d3c55..d15bd8b6e65 100644 --- a/test/automated/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1,8 +1,9 @@ -;;; bytecomp-testsuite.el +;;; bytecomp-tests.el ;; Copyright (C) 2008-2017 Free Software Foundation, Inc. -;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com> +;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com> +;; Author: Stefan Monnier <monnier@iro.umontreal.ca> ;; Created: November 2008 ;; Keywords: internal ;; Human-Keywords: internal @@ -25,6 +26,7 @@ ;;; Commentary: (require 'ert) +(require 'cl-lib) ;;; Code: (defconst byte-opt-testsuite-arith-data @@ -241,7 +243,50 @@ (let ((a 3) (b 2) (c 1.0)) (/ 1 a b c)) (let ((a 3) (b 2) (c 1.0)) (/ a b c 0)) (let ((a 3) (b 2) (c 1.0)) (/ a b c 1)) - (let ((a 3) (b 2) (c 1.0)) (/ a b c -1))) + (let ((a 3) (b 2) (c 1.0)) (/ a b c -1)) + ;; Test switch bytecode + (let ((a 3)) (cond ((eq a 1) 'one) ((eq a 2) 'two) ((eq a 3) 'three) (t t))) + (let ((a 'three)) (cond ((eq a 'one) 1) ((eq a 2) 'two) ((eq a 'three) 3) + (t t))) + (let ((a 2)) (cond ((eq a 'one) 1) ((eq a 1) 'one) ((eq a 2) 'two) + (t nil))) + (let ((a 2.0)) (cond ((eql a 2) 'incorrect) ((eql a 2.00) 'correct))) + (let ((a "foobar")) (cond ((equal "notfoobar" a) 'incorrect) + ((equal 1 a) 'incorrect) + ((equal a "foobar") 'correct) + (t 'incorrect))) + (let ((a "foobar") (l t)) (pcase a + ("bar" 'incorrect) + ("foobar" (while l + a (setq l nil)) + 'correct))) + (let ((a 'foobar) (l t)) (cl-case a + ('foo 'incorrect) + ('bar 'incorrect) + ('foobar (while l + a (setq l nil)) + 'correct))) + (let ((a 'foobar) (l t)) (cond + ((eq a 'bar) 'incorrect) + ((eq a 'foo) 'incorrect) + ((eq a 'bar) 'incorrect) + (t (while l + a (setq l nil)) + 'correct))) + (let ((a 'foobar) (l t)) (cond + ((eq a 'bar) 'incorrect) + ((eq a 'foo) 'incorrect) + ((eq a 'foobar) + (while l + a (setq l nil)) + 'correct) + (t 'incorrect))) + (let ((a)) + (cond ((eq a 'foo) 'incorrect) + (t))) + (let ((a)) + (cond ((eq a 'foo) 'incorrect) + ('correct)))) "List of expression for test. Each element will be executed by interpreter and with bytecompiled code, and their results compared.") @@ -420,10 +465,89 @@ Subtests signal errors if something goes wrong." (defun def () (m)))) (should (equal (funcall 'def) 4))) +(defconst bytecomp-lexbind-tests + `( + (let ((f #'car)) + (let ((f (lambda (x) (cons (funcall f x) (cdr x))))) + (funcall f '(1 . 2)))) + ) + "List of expression for test. +Each element will be executed by interpreter and with +bytecompiled code, and their results compared.") + +(defun bytecomp-lexbind-check-1 (pat) + "Return non-nil if PAT is the same whether directly evalled or compiled." + (let ((warning-minimum-log-level :emergency) + (byte-compile-warnings nil) + (v0 (condition-case nil + (eval pat t) + (error nil))) + (v1 (condition-case nil + (funcall (let ((lexical-binding t)) + (byte-compile `(lambda nil ,pat)))) + (error nil)))) + (equal v0 v1))) + +(put 'bytecomp-lexbind-check-1 'ert-explainer 'bytecomp-lexbind-explain-1) + +(defun bytecomp-lexbind-explain-1 (pat) + (let ((v0 (condition-case nil + (eval pat t) + (error nil))) + (v1 (condition-case nil + (funcall (let ((lexical-binding t)) + (byte-compile (list 'lambda nil pat)))) + (error nil)))) + (format "Expression `%s' gives `%s' if directly evalled, `%s' if compiled." + pat v0 v1))) + +(ert-deftest bytecomp-lexbind-tests () + "Test the Emacs byte compiler lexbind handling." + (dolist (pat bytecomp-lexbind-tests) + (should (bytecomp-lexbind-check-1 pat)))) + +(defmacro bytecomp-tests--with-temp-file (file-name-var &rest body) + (declare (indent 1)) + (cl-check-type file-name-var symbol) + `(let ((,file-name-var (make-temp-file "emacs"))) + (unwind-protect + (progn ,@body) + (delete-file ,file-name-var)))) + +(ert-deftest bytecomp-tests--unescaped-char-literals () + "Check that byte compiling warns about unescaped character +literals (Bug#20852)." + (should (boundp 'lread--unescaped-character-literals)) + (bytecomp-tests--with-temp-file source + (write-region "(list ?) ?( ?; ?\" ?[ ?])" nil source) + (bytecomp-tests--with-temp-file destination + (let* ((byte-compile-dest-file-function (lambda (_) destination)) + (byte-compile-error-on-warn t) + (byte-compile-debug t) + (err (should-error (byte-compile-file source)))) + (should (equal (cdr err) + (list (concat "unescaped character literals " + "`?\"', `?(', `?)', `?;', `?[', `?]' " + "detected!")))))))) + +(ert-deftest bytecomp-tests--old-style-backquotes () + "Check that byte compiling warns about old-style backquotes." + (should (boundp 'lread--old-style-backquotes)) + (bytecomp-tests--with-temp-file source + (write-region "(` (a b))" nil source) + (bytecomp-tests--with-temp-file destination + (let* ((byte-compile-dest-file-function (lambda (_) destination)) + (byte-compile-error-on-warn t) + (byte-compile-debug t) + (err (should-error (byte-compile-file source)))) + (should (equal (cdr err) + (list "!! The file uses old-style backquotes !! +This functionality has been obsolete for more than 10 years already +and will be removed soon. See (elisp)Backquote in the manual."))))))) ;; Local Variables: ;; no-byte-compile: t ;; End: -(provide 'byte-opt-testsuite) - +(provide 'bytecomp-tests) +;; bytecomp-tests.el ends here. diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el new file mode 100644 index 00000000000..69985506f78 --- /dev/null +++ b/test/lisp/emacs-lisp/checkdoc-tests.el @@ -0,0 +1,53 @@ +;;; checkdoc-tests.el --- unit tests for checkdoc.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for lisp/emacs-lisp/checkdoc.el. + +;;; Code: + +(require 'checkdoc) + +(require 'elisp-mode) +(require 'ert) + +(ert-deftest checkdoc-tests--bug-24998 () + "Checks that Bug#24998 is fixed." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defun foo())") + (should-error (checkdoc-defun) :type 'user-error))) + +(ert-deftest checkdoc-tests--next-docstring () + "Checks that the one-argument form of `defvar' works. +See the comments in Bug#24998." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(defvar foo) +\(defvar foo bar \"baz\") +\(require 'foo)") + (goto-char (point-min)) + (should (checkdoc-next-docstring)) + (should (looking-at-p "\"baz\")")) + (should-not (checkdoc-next-docstring)))) + +;;; checkdoc-tests.el ends here diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el b/test/lisp/emacs-lisp/cl-extra-tests.el new file mode 100644 index 00000000000..5b2371e7b95 --- /dev/null +++ b/test/lisp/emacs-lisp/cl-extra-tests.el @@ -0,0 +1,97 @@ +;;; cl-extra-tests.el --- tests for emacs-lisp/cl-extra.el -*- lexical-binding:t -*- + +;; Copyright (C) 2013-2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Code: + +(require 'cl-lib) +(require 'ert) + +(ert-deftest cl-get () + (put 'cl-get-test 'x 1) + (put 'cl-get-test 'y nil) + (should (eq (cl-get 'cl-get-test 'x) 1)) + (should (eq (cl-get 'cl-get-test 'y :none) nil)) + (should (eq (cl-get 'cl-get-test 'z :none) :none))) + +(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)))) + +(ert-deftest cl-extra-test-mapc () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (_x) nil)) + (fn2 (lambda (_x _y) nil)) + (fn3 (lambda (_x _y _z) nil))) + (should (equal lst (cl-mapc fn1 lst))) + (should (equal lst (cl-mapc fn2 lst lst2))) + (should (equal lst (cl-mapc fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-mapl () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) (should (consp x)))) + (fn2 (lambda (x y) (should (and (consp x) (consp y))))) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z)))))) + (should (equal lst (cl-mapl fn1 lst))) + (should (equal lst (cl-mapl fn2 lst lst2))) + (should (equal lst (cl-mapl fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-mapcar () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) x)) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (_x _y z) z))) + (should (equal lst (cl-mapcar fn1 lst))) + (should (equal lst2 (cl-mapcar fn2 lst lst2))) + (should (equal lst3 (cl-mapcar fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-map () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) x)) + (fn2 (lambda (_x y) y)) + (fn3 (lambda (x _y _z) (string-to-char (format "%S" x))))) + (should (equal lst (cl-map 'list fn1 lst))) + (should (equal (vconcat lst2) (cl-map 'vector fn2 lst lst2))) + (should (equal (mapconcat (lambda (x) (format "%S" x)) lst "") + (cl-map 'string fn3 lst lst2 lst3))))) + +(ert-deftest cl-extra-test-maplist () + (let ((lst '(a b c)) + (lst2 '(d e f)) + (lst3 '(1 2 3)) + (fn1 (lambda (x) (should (consp x)) x)) + (fn2 (lambda (x y) (should (and (consp x) (consp y))) y)) + (fn3 (lambda (x y z) (should (and (consp x) (consp y) (consp z))) z))) + (should (equal (list lst (cdr lst) (cddr lst)) + (cl-maplist fn1 lst))) + (should (equal (list lst2 (cdr lst2) (cddr lst2)) + (cl-maplist fn2 lst lst2))) + (should (equal (list lst3 (cdr lst3) (cddr lst3)) + (cl-maplist fn3 lst lst2 lst3))))) + +;;; cl-extra-tests.el ends here diff --git a/test/automated/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el index 0768e31f7e6..0768e31f7e6 100644 --- a/test/automated/cl-generic-tests.el +++ b/test/lisp/emacs-lisp/cl-generic-tests.el diff --git a/test/automated/cl-lib-tests.el b/test/lisp/emacs-lisp/cl-lib-tests.el index 5edc3e72bf2..65bd97f3b2d 100644 --- a/test/automated/cl-lib-tests.el +++ b/test/lisp/emacs-lisp/cl-lib-tests.el @@ -493,4 +493,59 @@ (should (cl-typep '* 'cl-lib-test-type)) (should-not (cl-typep 1 'cl-lib-test-type))) +(ert-deftest cl-lib-symbol-macrolet () + ;; bug#26325 + (should (equal (cl-flet ((f (x) (+ x 5))) + (let ((x 5)) + (f (+ x 6)))) + ;; Go through `eval', otherwise the macro-expansion + ;; error prevents running the whole test suite :-( + (eval '(cl-symbol-macrolet ((f (+ x 6))) + (cl-flet ((f (x) (+ x 5))) + (let ((x 5)) + (f f)))) + t)))) + +(defmacro cl-lib-symbol-macrolet-4+5 () + ;; bug#26068 + (let* ((sname "x") + (s1 (make-symbol sname)) + (s2 (make-symbol sname))) + `(cl-symbol-macrolet ((,s1 4) + (,s2 5)) + (+ ,s1 ,s2)))) + +(ert-deftest cl-lib-symbol-macrolet-2 () + (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5)))) + +(ert-deftest cl-lib-defstruct-record () + (cl-defstruct foo x) + (let ((x (make-foo :x 42))) + (should (recordp x)) + (should (eq (type-of x) 'foo)) + (should (eql (foo-x x) 42)))) + +(ert-deftest old-struct () + (cl-defstruct foo x) + (let ((x [cl-struct-foo]) + (saved cl-old-struct-compat-mode)) + (cl-old-struct-compat-mode -1) + (should (eq (type-of x) 'vector)) + + (cl-old-struct-compat-mode 1) + (let ((cl-struct-foo (cl--struct-get-class 'foo))) + (setf (symbol-function 'cl-struct-foo) :quick-object-witness-check) + (should (eq (type-of x) 'foo)) + (should (eq (type-of [foo]) 'vector))) + + (cl-old-struct-compat-mode (if saved 1 -1)))) + +(ert-deftest cl-lib-old-struct () + (let ((saved cl-old-struct-compat-mode)) + (cl-old-struct-compat-mode -1) + (cl-struct-define 'foo "" 'cl-structure-object nil nil nil + 'cl-struct-foo-tags 'cl-struct-foo t) + (should cl-old-struct-compat-mode) + (cl-old-struct-compat-mode (if saved 1 -1)))) + ;;; cl-lib.el ends here diff --git a/test/lisp/emacs-lisp/cl-print-tests.el b/test/lisp/emacs-lisp/cl-print-tests.el new file mode 100644 index 00000000000..dfbe18d7844 --- /dev/null +++ b/test/lisp/emacs-lisp/cl-print-tests.el @@ -0,0 +1,58 @@ +;;; cl-print-tests.el --- Test suite for the cl-print facility. -*- lexical-binding:t -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(cl-defstruct cl-print--test a b) + +(ert-deftest cl-print-tests-1 () + "Test cl-print code." + (let ((x (make-cl-print--test :a 1 :b 2))) + (let ((print-circle nil)) + (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x))) + "((x . #s(cl-print--test :a 1 :b 2)) (y . #s(cl-print--test :a 1 :b 2)))"))) + (let ((print-circle t)) + (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x))) + "((x . #1=#s(cl-print--test :a 1 :b 2)) (y . #1#))"))) + (should (string-match "\\`#f(compiled-function (x) .*\n\n.*)\\'" + (cl-prin1-to-string (symbol-function #'caar)))))) + +(ert-deftest cl-print-tests-2 () + (let ((x (record 'foo 1 2 3))) + (should (equal + x + (car (read-from-string (with-output-to-string (prin1 x)))))) + (let ((print-circle t)) + (should (string-match + "\\`(#1=#s(foo 1 2 3) #1#)\\'" + (cl-prin1-to-string (list x x))))))) + +(ert-deftest cl-print-circle () + (let ((x '(#1=(a . #1#) #1#))) + (let ((print-circle nil)) + (should (string-match "\\`((a . #[0-9]) (a . #[0-9]))\\'" + (cl-prin1-to-string x)))) + (let ((print-circle t)) + (should (equal "(#1=(a . #1#) #1#)" (cl-prin1-to-string x)))))) + +;;; cl-print-tests.el ends here. diff --git a/test/lisp/emacs-lisp/cl-seq-tests.el b/test/lisp/emacs-lisp/cl-seq-tests.el new file mode 100644 index 00000000000..61e3d720331 --- /dev/null +++ b/test/lisp/emacs-lisp/cl-seq-tests.el @@ -0,0 +1,307 @@ +;;; cl-seq-tests.el --- Tests for cl-seq.el functionality -*- lexical-binding: t; -*- + +;; Copyright (C) 2015-2017 Free Software Foundation, Inc. + +;; Author: Nicolas Richard <youngfrog@members.fsf.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'cl-seq) + +(ert-deftest cl-union-test-00 () + "Test for http://debbugs.gnu.org/22729 ." + (let ((str1 "foo") + (str2 (make-string 3 ?o))) + ;; Emacs may make two string literals eql when reading. + (aset str2 0 ?f) + (should (not (eql str1 str2))) + (should (equal str1 str2)) + (should (equal (cl-union (list str1) (list str2)) + (list str2))) + (should (equal (cl-union (list str1) (list str2) :test 'eql) + (list str1 str2))))) + +(defvar cl-seq--test-list nil + "List used on `cl-seq' tests with side effects.") +(defvar cl-seq--test-list2 nil + "List used on `cl-seq' tests with side effects.") + +(defmacro cl-seq--with-side-effects (list list2 &rest body) + "Run a test with side effects on lists; after the test restore the lists. +LIST is the value of `cl-seq--test-list' before the test. +LIST2, if non-nil, is the value of `cl-seq--test-list2' before the test. +Body are forms defining the test." + (declare (indent 2) (debug t)) + (let ((orig (make-symbol "orig")) + (orig2 (make-symbol "orig2"))) + `(let ((,orig (copy-sequence ,list)) + (,orig2 (copy-sequence ,list2))) + (unwind-protect (progn ,@body) + (setq cl-seq--test-list ,orig) + (when ,list2 + (setq cl-seq--test-list2 ,orig2)))))) + +;; keywords supported: :start :end +(ert-deftest cl-seq-fill-test () + (let* ((cl-seq--test-list '(1 2 3 4 5 2 6)) + (orig (copy-sequence cl-seq--test-list)) + (tests '((should (equal '(b b b b b b b) (cl-fill _list 'b))) + (should (equal '(1 2 3 4 b b b) (cl-fill _list 'b :start 4))) + (should (equal '(b b b b 5 2 6) (cl-fill _list 'b :end 4))) + (should (equal '(1 2 b b 5 2 6) (cl-fill _list 'b :start 2 :end 4))) + (should (equal orig (cl-fill _list 'b :end 0)))))) + (dolist (test tests) + (let ((_list cl-seq--test-list)) + (cl-seq--with-side-effects orig nil + test))))) + +;; keywords supported: :start1 :end1 :start2 :end2 +(ert-deftest cl-seq-replace-test () + (let* ((cl-seq--test-list '(1 2 3 4 5 2 6)) + (cl-seq--test-list2 (make-list 6 'a)) + (orig (copy-sequence cl-seq--test-list)) + (orig2 (copy-sequence cl-seq--test-list2)) + (tests '((should (equal '(a a a a a a 6) (cl-replace _list _list2))) + (should (equal '(a a a a a a 6) (cl-replace _list _list2 :start1 0))) + (should (equal '(a a a a a a 6) (cl-replace _list _list2 :start2 0))) + (should (equal orig (cl-replace _list _list2 :start1 (length _list)))) + (should (equal orig (cl-replace _list _list2 :start2 (length _list2)))) + (should (equal orig (cl-replace _list _list2 :end1 0))) + (should (equal orig (cl-replace _list _list2 :end2 0))) + (should (equal '(1 2 3 4 a a a) (cl-replace _list _list2 :start1 4))) + (should (equal '(a a a a 5 2 6) (cl-replace _list _list2 :end1 4))) + (should (equal '(a a 3 4 5 2 6) (cl-replace _list _list2 :start2 4))) + (should (equal '(a a a a 5 2 6) (cl-replace _list _list2 :end2 4))) + (should (equal '(1 2 a a 5 2 6) (cl-replace _list _list2 :start1 2 :end1 4))) + (should (equal '(a a 3 4 5 2 6) (cl-replace _list _list2 :start2 2 :end2 4)))))) + (dolist (test tests) + (let ((_list cl-seq--test-list) + (_list2 cl-seq--test-list2)) + (cl-seq--with-side-effects orig orig2 + test))))) + +;; keywords supported: :test :test-not :key :count :start :end :from-end +(ert-deftest cl-seq-remove-test () + (let ((list '(1 2 3 4 5 2 6))) + (should (equal list (cl-remove 'foo list))) + (should (equal '(1 3 4 5 6) (cl-remove 2 list))) + (should (equal '(1 3 4 5 6) (cl-remove 2 list + :key #'identity + :test (lambda (a b) (eql a b))))) + (should (equal '(1 2 3 4 2) (cl-remove 4 list :test (lambda (a b) (> b a))))) + (should (equal '(5 6) (cl-remove 4 list :test-not (lambda (a b) (> b a))))) + (should (equal '(1 3 5) (cl-remove 'foo list :if #'cl-evenp))) + (should (equal '(2 4 2 6) (cl-remove 'foo list :if-not #'cl-evenp))) + (should (equal '(1 2 3 4 5) (cl-remove 'foo list :if #'cl-evenp :start 4))) + (should (equal '(1 2 3 4 5 6) (cl-remove 2 list :start 5 :end 6))) + (should (equal '(1 3 4 5 2 6) (cl-remove 2 list :count 1))) + (should (equal '(1 3 4 5 2 6) (cl-remove 2 list :from-end nil :count 1))) + (should (equal '(1 2 3 4 5 6) (cl-remove 2 list :from-end t :count 1))))) + +;; keywords supported: :test :test-not :key :count :start :end :from-end +(ert-deftest cl-seq-delete-test () + (let* ((cl-seq--test-list '(1 2 3 4 5 2 6)) + (orig (copy-sequence cl-seq--test-list)) + (tests '((should (equal orig (cl-delete 'foo _list))) + (should (equal '(1 3 4 5 6) (cl-delete 2 _list))) + (should (equal '(1 3 4 5 6) (cl-delete 2 _list + :key #'identity + :test (lambda (a b) (eql a b))))) + (should (equal '(1 2 3 4 2) (cl-delete 4 _list :test (lambda (a b) (> b a))))) + (should (equal '(5 6) (cl-delete 4 _list :test-not (lambda (a b) (> b a))))) + (should (equal '(1 3 5) (cl-delete 'foo _list :if #'cl-evenp))) + (should (equal '(2 4 2 6) (cl-delete 'foo _list :if-not #'cl-evenp))) + (should (equal '(1 2 3 4 5) (cl-delete 'foo _list :if #'cl-evenp :start 4))) + (should (equal '(1 2 3 4 5 6) (cl-delete 2 _list :start 5 :end 6))) + (should (equal '(1 3 4 5 2 6) (cl-delete 2 _list :count 1))) + (should (equal '(1 3 4 5 2 6) (cl-delete 2 _list :from-end nil :count 1))) + (should (equal '(1 2 3 4 5 6) (cl-delete 2 _list :from-end t :count 1)))))) + (dolist (test tests) + (let ((_list cl-seq--test-list)) + (cl-seq--with-side-effects orig nil + test))))) + +;; keywords supported: :test :test-not :key :start :end :from-end +(ert-deftest cl-seq-remove-duplicates-test () + (let ((list '(1 2 3 4 5 2 6))) + (should (equal '(1 3 4 5 2 6) (cl-remove-duplicates list))) + (should (equal '(1 2 3 4 5 6) (cl-remove-duplicates list :from-end t))) + (should (equal list (cl-remove-duplicates list :start 2))) + (should (equal list (cl-remove-duplicates list :start 2 :from-end t))) + (should (equal list (cl-remove-duplicates list :end 4))) + (should (equal '(6) (cl-remove-duplicates list :test (lambda (a b) (< a b))))) + (should (equal '(1 2 6) (cl-remove-duplicates list :test (lambda (a b) (>= a b))))) + (should (equal (cl-remove-duplicates list :test (lambda (a b) (>= a b))) + (cl-remove-duplicates list :test-not (lambda (a b) (< a b))))) + (should (equal (cl-remove-duplicates list) + (cl-remove-duplicates list :key #'number-to-string :test #'string=))) + (should (equal list + (cl-remove-duplicates list :key #'number-to-string :test #'eq))))) + +;; keywords supported: :test :test-not :key :count :start :end :from-end +(ert-deftest cl-seq-substitute-test () + (let ((list '(1 2 3 4 5 2 6))) + (should (equal '(1 b 3 4 5 b 6) (cl-substitute 'b 2 list))) + (should (equal list (cl-substitute 'b 2 list :start (length list)))) + (should (equal list (cl-substitute 'b 2 list :end 0))) + (should (equal '(1 2 3 4 5 b 6) (cl-substitute 'b 2 list :start 2))) + (should (equal '(1 b 3 4 5 2 6) (cl-substitute 'b 2 list :end 2))) + (should (equal list (cl-substitute 'b 2 list :start 2 :end 4))) + (should (equal '(1 b 3 4 5 2 6) (cl-substitute 'b 2 list :count 1))) + (should (equal '(1 2 3 4 5 b 6) (cl-substitute 'b 2 list :count 1 :from-end t))) + (should (equal list (cl-substitute 'b 2 list :count -1))) + (should (equal '(1 b 3 4 5 b 6) (cl-substitute 'b "2" list :key #'number-to-string + :test #'string=))) + (should (equal (cl-substitute 'b 2 list) + (cl-substitute 'b 2 list :test #'eq))) + (should (equal '(1 2 b b b 2 b) (cl-substitute 'b 2 list :test (lambda (a b) (< a b))))) + (should (equal '(b b 3 4 5 b 6) (cl-substitute 'b 2 list :test (lambda (a b) (>= a b))))) + (should (equal list (cl-substitute 'b 99 list :test (lambda (a b) (< a b))))) + (should (equal (cl-substitute 'b 2 list :test (lambda (a b) (>= a b))) + (cl-substitute 'b 2 list :test-not (lambda (a b) (< a b))))) + (should (equal '(1 2 b b b 2 b) (cl-substitute 'b nil list :if (lambda (x) (> (cl-position x list) 1))))) + (should (equal '(1 b b b b b b) (cl-substitute 'b nil list :if (lambda (x) (> (cl-position x list :from-end t) 1))))) + + (should (equal '(b b 3 4 5 b 6) (cl-substitute 'b nil list + :if-not (lambda (x) (> (cl-position x list) 1))))) + (should (equal '(b 2 3 4 5 2 6) (cl-substitute 'b nil list + :if-not (lambda (x) (> (cl-position x list :from-end t) 1))))))) + + +;; keywords supported: :test :test-not :key :count :start :end :from-end +(ert-deftest cl-seq-nsubstitute-test () + (let ((cl-seq--test-list '(1 2 3 4 5 2 6)) + (orig (copy-sequence cl-seq--test-list)) + (tests '((should (equal '(1 b 3 4 5 b 6) (cl-nsubstitute 'b 2 _list))) + (should (equal _list (cl-substitute 'b 2 _list :start (length _list)))) + (should (equal _list (cl-substitute 'b 2 _list :end 0))) + (should (equal '(1 2 3 4 5 b 6) (cl-substitute 'b 2 _list :start 2))) + (should (equal '(1 b 3 4 5 2 6) (cl-substitute 'b 2 _list :end 2))) + (should (equal _list (cl-substitute 'b 2 _list :start 2 :end 4))) + (should (equal '(1 b 3 4 5 2 6) (cl-nsubstitute 'b 2 _list :count 1))) + (should (equal '(1 2 3 4 5 b 6) (cl-nsubstitute 'b 2 _list :count 1 :from-end t))) + (should (equal _list (cl-nsubstitute 'b 2 _list :count -1))) + (should (equal '(1 b 3 4 5 b 6) (cl-nsubstitute 'b "2" _list :key #'number-to-string + :test #'string=))) + (should (equal (cl-nsubstitute 'b 2 _list) + (cl-nsubstitute 'b 2 _list :test #'eq))) + (should (equal '(1 2 b b b 2 b) (cl-nsubstitute 'b 2 _list :test (lambda (a b) (< a b))))) + (should (equal '(b b 3 4 5 b 6) (cl-nsubstitute 'b 2 _list :test (lambda (a b) (>= a b))))) + (should (equal _list (cl-nsubstitute 'b 99 _list :test (lambda (a b) (< a b))))) + (should (equal (cl-nsubstitute 'b 2 _list :test (lambda (a b) (>= a b))) + (cl-nsubstitute 'b 2 _list :test-not (lambda (a b) (< a b))))) + (should (equal '(1 2 b b b 2 b) + (cl-nsubstitute 'b nil _list :if (lambda (x) (> (cl-position x _list) 1))))) + (should (equal '(1 b b b b b b) + (cl-nsubstitute 'b nil _list :if (lambda (x) (> (cl-position x _list :from-end t) 1))))) + (should (equal '(b b 3 4 5 b 6) + (cl-nsubstitute 'b nil _list + :if-not (lambda (x) (> (cl-position x _list) 1))))) + (should (equal '(b 2 3 4 5 2 6) + (cl-nsubstitute 'b nil _list + :if-not (lambda (x) (> (cl-position x _list :from-end t) 1)))))))) + (dolist (test tests) + (let ((_list cl-seq--test-list)) + (cl-seq--with-side-effects orig nil + test))))) + +;; keywords supported: :test :test-not :key :start :end :from-end +(ert-deftest cl-seq-position-test () + (let ((list '(1 2 3 4 5 2 6))) + (should-not (cl-position 'foo list)) + (should (= 1 (cl-position 2 list))) + (should (= 5 (cl-position 2 list :start 5 :end 6))) + (should (= 1 (cl-position 2 list :from-end nil))) + (should (= 5 (cl-position 2 list :from-end t))) + (should (cl-position 2 list :key #'identity + :test (lambda (a b) (eql a b)))) + (should (= 1 (cl-position "2" list :key #'number-to-string :test #'string=))) + (should (= 5 (cl-position "2" list :key #'number-to-string :test #'string= :from-end t))) + (should-not (cl-position "2" list :key #'number-to-string)) + (should (cl-position 5 list :key (lambda (x) (1+ (* 1.0 x x))) :test #'=)) + (should-not (cl-position 5 list :key (lambda (x) (1+ (* 1.0 x x))))) + (should (= 1 (cl-position 5 list :key (lambda (x) (1+ (* x x)))))) + (should (= 5 (cl-position 5 list :key (lambda (x) (1+ (* x x))) :from-end t))))) + +;; keywords supported: :test :test-not :key :start :end +(ert-deftest cl-seq-count-test () + (let ((list '(1 2 3 4 5 2 6))) + (should (= 2 (cl-count 2 list))) + (should (= 1 (cl-count 2 list :start 2))) + (should (= 1 (cl-count 2 list :end 4))) + (should (= 0 (cl-count -5 list))) + (should (= 0 (cl-count 2 list :start 2 :end 4))) + (should (= 4 (cl-count 'foo list :key (lambda (x) (and (cl-evenp x) 'foo))))) + (should (= 4 (cl-count 'foo list :test (lambda (_a b) (cl-evenp b))))) + (should (equal (cl-count 'foo list :test (lambda (_a b) (cl-oddp b))) + (cl-count 'foo list :test-not (lambda (_a b) (cl-evenp b))))))) + +;; keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end +(ert-deftest cl-seq-mismatch-test () + (let ((list '(1 2 3 4 5 2 6)) + (list2 '(1 999 2 3 4 5 2 6))) + (should-not (cl-mismatch list list)) + (should-not (cl-mismatch list (remove 999 list2))) + (should (= 0 (cl-mismatch list list :key #'number-to-string))) + (should-not (cl-mismatch list list :key #'number-to-string :test #'string=)) + (should (= 1 (cl-mismatch list list2))) + (should (= 0 (cl-mismatch list list2 :from-end t))) + (should (= 3 (cl-mismatch '(1 2 3) list))) + (should-not (cl-mismatch list list2 :end1 1 :end2 1)) + (should-not (cl-mismatch list list2 :start1 1 :start2 2)) + (should (= 1 (cl-mismatch list list2 :start1 1 :end1 2 :start2 4 :end2 4))) + (should (= -1 (cl-mismatch list list2 :key #'number-to-string + :test (lambda (a b) + (and (stringp a) (stringp b))) :from-end t))) + (should (= 7 (cl-mismatch list list2 :key #'number-to-string + :test (lambda (a b) + (and (stringp a) (stringp b)))))))) + +;; keywords supported: :test :test-not :key :start1 :end1 :start2 :end2 :from-end +(ert-deftest cl-seq-search-test () + (let ((list '(1 2 3 4 5 2 6)) + (list2 '(1 999 2 3 4 5 2 6))) + (should-not (cl-search list list2)) + (should (= 2 (cl-search list list2 :start1 1 :start2 2))) + (should (= 4 (cl-search list list2 :start1 3))) + (should (= 6 (cl-search list list2 :start1 5))) + (should (= 0 (cl-search list list2 :end1 1))) + (should (= 0 (cl-search nil list2))) + (should (= 2 (cl-search list list2 :start1 1 :end1 2 :end2 3))) + (should (= 0 (cl-search list list2 :test (lambda (a b) (and (numberp a) (numberp b)))))) + (should (= 0 (cl-search list list2 :key (lambda (x) (and (numberp x) 'foo)) + :test (lambda (a b) (and (eq a 'foo) (eq b 'foo)))))) + (should (= 1 (cl-search (nthcdr 2 list) (nthcdr 2 list2)))) + (should (= 3 (cl-search (nthcdr 2 list) list2))))) + +(ert-deftest cl-seq-test-bug24264 () + "Test for http://debbugs.gnu.org/24264 ." + (let ((list (append (make-list 8000005 1) '(8))) + (list2 (make-list 8000005 2))) + (should (cl-position 8 list)) + (should-not (equal '(8) (last (cl-remove 8 list)))) + (should (equal '(2 8) (last (cl-substitute 2 1 list) 2))) + (should (equal '(2 8) (last (cl-replace list list2) 2))) + (should (equal '(1 1) (last (cl-fill list 1) 2))))) + + +(provide 'cl-seq-tests) +;;; cl-seq-tests.el ends here diff --git a/test/automated/eieio-test-methodinvoke.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el index 09edea461d1..241ca65122d 100644 --- a/test/automated/eieio-test-methodinvoke.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el @@ -190,6 +190,9 @@ ) (ert-deftest eieio-test-method-order-list-6 () + ;; FIXME repeated intermittent failures on hydra (bug#24503) + ;; ((:STATIC C) (:STATIC C-base1) (:STATIC C-base2)) != ((:STATIC C))") + (skip-unless (not (getenv "NIX_STORE"))) (let ((eieio-test-method-order-list nil) (ans '( (:STATIC C) diff --git a/test/automated/eieio-test-persist.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el index da4cc5f51f3..da4cc5f51f3 100644 --- a/test/automated/eieio-test-persist.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el diff --git a/test/automated/eieio-tests.el b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el index 994e987b703..c34560ab585 100644 --- a/test/automated/eieio-tests.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el @@ -893,8 +893,16 @@ Subclasses to override slot attributes.") (list newname 2)) (ert-deftest eieio-test-37-obsolete-name-in-constructor () + ;; FIXME repeated intermittent failures on hydra (bug#24503) + (skip-unless (not (getenv "NIX_STORE"))) (should (equal (eieio--testing "toto") '("toto" 2)))) +(ert-deftest eieio-autoload () + "Tests to see whether reftex-auc has been autoloaded" + (should + (fboundp 'eieio--defalias))) + + (provide 'eieio-tests) ;;; eieio-tests.el ends here diff --git a/test/automated/ert-tests.el b/test/lisp/emacs-lisp/ert-tests.el index ff1f32b4fdb..fc5790c3659 100644 --- a/test/automated/ert-tests.el +++ b/test/lisp/emacs-lisp/ert-tests.el @@ -344,53 +344,35 @@ This macro is used to test if macroexpansion in `should' works." ((error) (should (equal actual-condition expected-condition))))))) +(defun ert-test--which-file () + "Dummy function to help test `symbol-file' for tests.") + (ert-deftest ert-test-deftest () - ;; FIXME: These tests don't look very good. What is their intent, i.e. what - ;; are they really testing? The precise generated code shouldn't matter, so - ;; we should either test the behavior of the code, or else try to express the - ;; kind of efficiency guarantees we're looking for. - (should (equal (macroexpand '(ert-deftest abc () "foo" :tags '(bar))) - '(progn - (ert-set-test 'abc - (progn - "Constructor for objects of type `ert-test'." - (vector 'cl-struct-ert-test 'abc "foo" - #'(lambda nil) - nil ':passed - '(bar)))) - (setq current-load-list - (cons - '(ert-deftest . abc) - current-load-list)) - 'abc))) - (should (equal (macroexpand '(ert-deftest def () - :expected-result ':passed)) - '(progn - (ert-set-test 'def - (progn - "Constructor for objects of type `ert-test'." - (vector 'cl-struct-ert-test 'def nil - #'(lambda nil) - nil ':passed 'nil))) - (setq current-load-list - (cons - '(ert-deftest . def) - current-load-list)) - 'def))) + (ert-deftest ert-test-abc () "foo" :tags '(bar)) + (let ((abc (ert-get-test 'ert-test-abc))) + (should (equal (ert-test-tags abc) '(bar))) + (should (equal (ert-test-documentation abc) "foo"))) + (should (equal (symbol-file 'ert-test-deftest 'ert-deftest) + (symbol-file 'ert-test--which-file 'defun))) + + (ert-deftest ert-test-def () :expected-result ':passed) + (let ((def (ert-get-test 'ert-test-def))) + (should (equal (ert-test-expected-result-type def) :passed))) ;; :documentation keyword is forbidden (should-error (macroexpand '(ert-deftest ghi () :documentation "foo")))) (ert-deftest ert-test-record-backtrace () - (let ((test (make-ert-test :body (lambda () (ert-fail "foo"))))) - (let ((result (ert-run-test test))) - (should (ert-test-failed-p result)) - (with-temp-buffer - (ert--print-backtrace (ert-test-failed-backtrace result)) - (goto-char (point-min)) - (end-of-line) - (let ((first-line (buffer-substring-no-properties (point-min) (point)))) - (should (equal first-line " (closure (ert--test-body-was-run t) nil (ert-fail \"foo\"))()"))))))) + (let* ((test-body (lambda () (ert-fail "foo"))) + (test (make-ert-test :body test-body)) + (result (ert-run-test test))) + (should (ert-test-failed-p result)) + (with-temp-buffer + (ert--print-backtrace (ert-test-failed-backtrace result)) + (goto-char (point-min)) + (end-of-line) + (let ((first-line (buffer-substring-no-properties (point-min) (point)))) + (should (equal first-line (format " %S()" test-body))))))) (ert-deftest ert-test-messages () :tags '(:causes-redisplay) @@ -837,7 +819,3 @@ This macro is used to test if macroexpansion in `should' works." (provide 'ert-tests) ;;; ert-tests.el ends here - -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/test/automated/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el index 4615d08e303..4615d08e303 100644 --- a/test/automated/ert-x-tests.el +++ b/test/lisp/emacs-lisp/ert-x-tests.el diff --git a/test/automated/generator-tests.el b/test/lisp/emacs-lisp/generator-tests.el index 1a567ac70fc..1a567ac70fc 100644 --- a/test/automated/generator-tests.el +++ b/test/lisp/emacs-lisp/generator-tests.el diff --git a/test/automated/let-alist.el b/test/lisp/emacs-lisp/let-alist-tests.el index 342ef72b785..d04645709e4 100644 --- a/test/automated/let-alist.el +++ b/test/lisp/emacs-lisp/let-alist-tests.el @@ -31,7 +31,7 @@ (.test-two (cdr (assq 'test-two symbol)))) (list .test-one .test-two .test-two .test-two))) - (cl-letf (((symbol-function #'make-symbol) (lambda (x) 'symbol))) + (cl-letf (((symbol-function #'make-symbol) (lambda (_x) 'symbol))) (macroexpand '(let-alist data (list .test-one .test-two .test-two .test-two)))))) @@ -51,8 +51,7 @@ (ert-deftest let-alist-cons () (should (equal - (let ((.external "ext") - (.external.too "et")) + (let ((.external "ext")) (let-alist '((test-two . 0) (test-three . 1) (sublist . ((foo . 2) @@ -88,4 +87,12 @@ '(cdr (assq 'baz (cdr (assq 'bar (cdr (assq 'foo var)))))))) (should (equal (let-alist--access-sexp '..foo.bar.baz 'var) '.foo.bar.baz))) +(ert-deftest let-alist--deep-dot-search--nested () + "Check that nested `let-alist' forms don't generate spurious bindings. +See Bug#24641." + (should (equal (let-alist--deep-dot-search '(foo .bar (baz .qux))) + '((.bar . bar) (.qux . qux)))) + (should (equal (let-alist--deep-dot-search '(foo .bar (let-alist .qux .baz))) + '((.bar . bar) (.qux . qux))))) ; no .baz + ;;; let-alist.el ends here diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el new file mode 100644 index 00000000000..f2fe7a6cf41 --- /dev/null +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -0,0 +1,190 @@ +;;; lisp-mode-tests.el --- Test Lisp editing commands -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'cl-lib) +(require 'lisp-mode) + +(defconst lisp-mode-tests--correctly-indented-sexp "\ +\(a + (prog1 + (prog1 + 1 + 2) + 2) + (fun arg1 + + arg2) + (1 + \"string +noindent\" (\"string2 +noindent\" 3 +4) + 2) ; comment + ;; comment + b)") + +(ert-deftest indent-sexp () + "Test basics of \\[indent-sexp]." + (with-temp-buffer + (insert lisp-mode-tests--correctly-indented-sexp) + (goto-char (point-min)) + (let ((indent-tabs-mode nil) + (correct lisp-mode-tests--correctly-indented-sexp)) + (dolist (mode '(fundamental-mode emacs-lisp-mode)) + (funcall mode) + (indent-sexp) + ;; Don't mess up correctly indented code. + (should (string= (buffer-string) correct)) + ;; Correctly add indentation. + (save-excursion + (while (not (eobp)) + (delete-horizontal-space) + (forward-line))) + (indent-sexp) + (should (equal (buffer-string) correct)) + ;; Correctly remove indentation. + (save-excursion + (let ((n 0)) + (while (not (eobp)) + (unless (looking-at "noindent\\|^[[:blank:]]*$") + (insert (make-string n ?\s))) + (cl-incf n) + (forward-line)))) + (indent-sexp) + (should (equal (buffer-string) correct)))))) + +(ert-deftest indent-subsexp () + "Make sure calling `indent-sexp' inside a sexp works." + (with-temp-buffer + (insert "\ +\(d1 xx + (d2 yy + zz) + 11)") + (let ((correct (buffer-string))) + (search-backward "d2") + (up-list -1) + (indent-sexp) + (should (equal (buffer-string) correct)) + (backward-sexp) + (end-of-line) + (indent-sexp) + (should (equal (buffer-string) correct))))) + +(ert-deftest indent-sexp-in-string () + "Make sure calling `indent-sexp' inside a string works." + ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21343. + (with-temp-buffer + (emacs-lisp-mode) + (insert "\";\"") + (let ((correct (buffer-string))) + (search-backward ";") + (indent-sexp) + (should (equal (buffer-string) correct))))) + +(ert-deftest indent-sexp-stop () + "Make sure `indent-sexp' stops at the end of the sexp." + ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26878. + (with-temp-buffer + (emacs-lisp-mode) + (insert "(a ()\n)") + (let ((original (buffer-string))) + (search-backward "a ") + (goto-char (match-end 0)) + (indent-sexp) + ;; The final paren should not be indented, because the sexp + ;; we're indenting ends on the previous line. + (should (equal (buffer-string) original))))) + +(ert-deftest lisp-indent-region () + "Test basics of `lisp-indent-region'." + (with-temp-buffer + (insert lisp-mode-tests--correctly-indented-sexp) + (goto-char (point-min)) + (let ((indent-tabs-mode nil) + (correct lisp-mode-tests--correctly-indented-sexp)) + (emacs-lisp-mode) + (indent-region (point-min) (point-max)) + ;; Don't mess up correctly indented code. + (should (string= (buffer-string) correct)) + ;; Correctly add indentation. + (save-excursion + (while (not (eobp)) + (delete-horizontal-space) + (forward-line))) + (indent-region (point-min) (point-max)) + (should (equal (buffer-string) correct)) + ;; Correctly remove indentation. + (save-excursion + (let ((n 0)) + (while (not (eobp)) + (unless (looking-at "noindent\\|^[[:blank:]]*$") + (insert (make-string n ?\s))) + (cl-incf n) + (forward-line)))) + (indent-region (point-min) (point-max)) + (should (equal (buffer-string) correct))))) + + +(ert-deftest lisp-indent-region-defun-with-docstring () + "Test Bug#26619." + (with-temp-buffer + (insert "\ +\(defun test () + \"This is a test. +Test indentation in emacs-lisp-mode\" + (message \"Hi!\"))") + (let ((indent-tabs-mode nil) + (correct (buffer-string))) + (emacs-lisp-mode) + (indent-region (point-min) (point-max)) + (should (equal (buffer-string) correct))))) + +(ert-deftest lisp-indent-region-open-paren () + (with-temp-buffer + (insert "\ +\(with-eval-after-load 'foo + (setq bar `( + baz)))") + (let ((indent-tabs-mode nil) + (correct (buffer-string))) + (emacs-lisp-mode) + (indent-region (point-min) (point-max)) + (should (equal (buffer-string) correct))))) + +(ert-deftest lisp-indent-region-in-sexp () + (with-temp-buffer + (insert "\ +\(when t + (when t + (list 1 2 3) + 'etc) + (quote etc) + (quote etc))") + (let ((indent-tabs-mode nil) + (correct (buffer-string))) + (emacs-lisp-mode) + (search-backward "1") + (indent-region (point) (point-max)) + (should (equal (buffer-string) correct))))) + + +(provide 'lisp-mode-tests) +;;; lisp-mode-tests.el ends here diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el new file mode 100644 index 00000000000..ddbf378683b --- /dev/null +++ b/test/lisp/emacs-lisp/lisp-tests.el @@ -0,0 +1,593 @@ +;;; lisp-tests.el --- Test Lisp editing commands -*- lexical-binding: t; -*- + +;; Copyright (C) 2013-2017 Free Software Foundation, Inc. + +;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com> +;; Author: Stefan Monnier <monnier@iro.umontreal.ca> +;; Author: Daniel Colascione <dancol@dancol.org> +;; Author: Marcin Borkowski <mbork@mbork.pl> +;; Keywords: internal + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Testing of `forward-sexp' and related functions. + +;;; Code: + +(require 'ert) +(require 'python) +(require 'cl-lib) + +(ert-deftest lisp-forward-sexp-1-empty-parens () + "Test basics of \\[forward-sexp]." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null + (forward-sexp 1))))) + +(ert-deftest lisp-forward-sexp-1-error-mismatch () + "Test basics of \\[forward-sexp]." + (with-temp-buffer + (insert "(") + (goto-char (point-min)) + (should-error + (forward-sexp 1)))) + +(ert-deftest lisp-backward-sexp-1-empty-parens () + "Test basics of \\[backward-sexp]." + (with-temp-buffer + (insert "()") + (should (null + (forward-sexp -1))))) + +(ert-deftest lisp-backward-sexp-1-error-mismatch () + "Test mismatched parens with \\[backward-sexp]." + (with-temp-buffer + (insert "(") + (should-error + (forward-sexp -1)))) + +(ert-deftest lisp-forward-sexp-1-eobp () + "Test \\[forward-sexp] at `eobp'." + (with-temp-buffer + (insert "()") + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp 1))))) + +(ert-deftest lisp-backward-sexp-1-eobp () + "Test \\[backward-sexp] at `bobp'." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp -1))))) + +(ert-deftest lisp-forward-sexp-2-eobp () + "Test \\[forward-sexp] beyond `eobp'." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp 2))) + (should (eobp)))) + +(ert-deftest lisp-backward-sexp-2-bobp () + "Test \\[backward-sexp] beyond `bobp'." + (with-temp-buffer + (insert "()") + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp -2))) + (should (bobp)))) + +(ert-deftest lisp-forward-sexp-2-eobp-and-subsequent () + "Test \\[forward-sexp] beyond `eobp' and again." + (with-temp-buffer + (insert "()") + (goto-char (point-min)) + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp 2))) + (should (eobp)) + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp 1))))) + +(ert-deftest lisp-backward-sexp-2-bobp-and-subsequent () + "Test \\[backward-sexp] ahead of `bobp' and again." + (with-temp-buffer + (insert "()") + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp -2))) + (should (bobp)) + (should (null ;; (should-error ;; No, per #13994 + (forward-sexp -1))))) + +(ert-deftest lisp-delete-pair-parens () + "Test \\[delete-pair] with parens." + (with-temp-buffer + (insert "(foo)") + (goto-char (point-min)) + (delete-pair) + (should (string-equal "foo" (buffer-string))))) + +(ert-deftest lisp-delete-pair-quotation-marks () + "Test \\[delete-pair] with quotation marks." + (with-temp-buffer + (insert "\"foo\"") + (goto-char (point-min)) + (delete-pair) + (should (string-equal "foo" (buffer-string))))) + +(ert-deftest lisp-delete-pair-quotes-in-text-mode () + "Test \\[delete-pair] against string in Text Mode for #15014." + (with-temp-buffer + (text-mode) + (insert "\"foo\"") + (goto-char (point-min)) + (delete-pair) + (should (string-equal "fo\"" (buffer-string))))) + +(ert-deftest lisp-delete-pair-quotes-text-mode-syntax-table () + "Test \\[delete-pair] with modified Text Mode syntax for #15014." + (with-temp-buffer + (text-mode) + (let ((st (copy-syntax-table text-mode-syntax-table))) + (with-syntax-table st + ;; (modify-syntax-entry ?\" "." text-mode-syntax-table) + (modify-syntax-entry ?\" "$" st) + (insert "\"foo\"") + (goto-char (point-min)) + (delete-pair) + (should (string-equal "foo" (buffer-string))))))) + +(ert-deftest lisp-forward-sexp-elisp-inside-symbol () + "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492." + (with-temp-buffer + (emacs-lisp-mode) + (insert "hide-ifdef-env ") + (insert (concat (number-sequence 32 126))) + (goto-char (point-min)) + (re-search-forward "hide" nil t) ;; (forward-char 4) + (should (looking-at "-")) + (forward-sexp) + (should (looking-at " ")))) + +(ert-deftest lisp-forward-sexp-elisp-quoted-symbol () + "Test \\[forward-sexp] on symbol in Emacs Lisp Mode for #20492." + (with-temp-buffer + (emacs-lisp-mode) + (insert "`hide-ifdef-env'.") + (goto-char (point-min)) + (re-search-forward "hide" nil t) ;; (forward-char 5) + (should (= ?- (char-after))) + (forward-sexp) + (should (= ?. (char-before))))) + +(ert-deftest lisp-forward-sexp-python-triple-quoted-string () + "Test \\[forward-sexp] on Python doc strings for #11321." + (with-temp-buffer + (insert "\"\"\"Triple-quoted string\"\"\"") + (goto-char (point-min)) + (let ((python-indent-guess-indent-offset nil)) + (python-mode)) + (forward-sexp) + (should (eobp)))) + +(ert-deftest lisp-forward-sexp-python-triple-quotes-string () + "Test \\[forward-sexp] on Python doc strings for #11321." + (with-temp-buffer + (insert "'''Triple-quoted string'''") + (goto-char (point-min)) + (let ((python-indent-guess-indent-offset nil)) + (python-mode)) + (forward-sexp) + (should (eobp)))) + +(ert-deftest lisp-forward-sexp-emacs-lisp-semi-char-error () + "Test \\[forward-sexp] on expression with unquoted semicolon per #4030." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(insert ?;)") + (goto-char (point-min)) + (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error. + +(ert-deftest lisp-forward-sexp-emacs-lisp-quote-char () + "Test \\[forward-sexp] on expression with unquoted quote per #4030." + (with-temp-buffer + (emacs-lisp-mode) + (insert "(insert ?\")") + (goto-char (point-min)) + (should-error (forward-sexp)))) ;; FIXME: Shouldn't be an error. + +;; Test some core Elisp rules. +(ert-deftest core-elisp-tests-1-defvar-in-let () + "Test some core Elisp rules." + (with-temp-buffer + ;; Check that when defvar is run within a let-binding, the toplevel default + ;; is properly initialized. + (should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x) + '(1 2))) + (should (equal (list (let ((c-e-x 1)) + (defcustom c-e-x 2 "doc" :group 'blah :type 'integer) c-e-x) + c-e-x) + '(1 2))))) + +(ert-deftest core-elisp-tests-2-window-configurations () + "Test properties of window-configurations." + (let ((wc (current-window-configuration))) + (with-current-buffer (window-buffer (frame-selected-window)) + (push-mark) + (activate-mark)) + (set-window-configuration wc) + (should (or (not mark-active) (mark))))) + +(ert-deftest core-elisp-tests-3-backquote () + (should (eq 3 (eval ``,,'(+ 1 2))))) + +;; Test up-list and backward-up-list. +(defun lisp-run-up-list-test (fn data start instructions) + (cl-labels ((posof (thing) + (and (symbolp thing) + (= (length (symbol-name thing)) 1) + (- (aref (symbol-name thing) 0) ?a -1)))) + (with-temp-buffer + (set-syntax-table (make-syntax-table)) + ;; Use a syntax table in which single quote is a string + ;; character so that we can embed the test data in a lisp string + ;; literal. + (modify-syntax-entry ?\' "\"") + (insert data) + (goto-char (posof start)) + (dolist (instruction instructions) + (cond ((posof instruction) + (funcall fn) + (should (eql (point) (posof instruction)))) + ((symbolp instruction) + (should-error (funcall fn) + :type instruction)) + (t (cl-assert nil nil "unknown ins"))))))) + +(defmacro define-lisp-up-list-test (name fn data start &rest expected) + `(ert-deftest ,name () + (lisp-run-up-list-test ,fn ,data ',start ',expected))) + +(define-lisp-up-list-test up-list-basic + (lambda () (up-list)) + (or "(1 1 (1 1) 1 (1 1) 1)") + ;; abcdefghijklmnopqrstuv + i k v scan-error) + +(define-lisp-up-list-test up-list-with-forward-sexp-function + (lambda () + (let ((forward-sexp-function + (lambda (&optional arg) + (let ((forward-sexp-function nil)) + (forward-sexp arg))))) + (up-list))) + (or "(1 1 (1 1) 1 (1 1) 1)") + ;; abcdefghijklmnopqrstuv + i k v scan-error) + +(define-lisp-up-list-test up-list-out-of-string + (lambda () (up-list 1 t)) + (or "1 (1 '2 2 (2 2 2' 1) 1") + ;; abcdefghijklmnopqrstuvwxy + o r u scan-error) + +(define-lisp-up-list-test up-list-cross-string + (lambda () (up-list 1 t)) + (or "(1 '2 ( 2' 1 '2 ) 2' 1)") + ;; abcdefghijklmnopqrstuvwxy + i r u x scan-error) + +(define-lisp-up-list-test up-list-no-cross-string + (lambda () (up-list 1 t t)) + (or "(1 '2 ( 2' 1 '2 ) 2' 1)") + ;; abcdefghijklmnopqrstuvwxy + i k x scan-error) + +(define-lisp-up-list-test backward-up-list-basic + (lambda () (backward-up-list)) + (or "(1 1 (1 1) 1 (1 1) 1)") + ;; abcdefghijklmnopqrstuv + i f a scan-error) + +;;; Helpers + +(eval-and-compile + (defvar elisp-test-point-position-regex "=!\\([a-zA-Z0-9-]+\\)=" + "A regexp matching placeholders for point position for +`elisp-tests-with-temp-buffer'.")) + +;; Copied and heavily modified from `python-tests-with-temp-buffer' +(defmacro elisp-tests-with-temp-buffer (contents &rest body) + "Create an `emacs-lisp-mode' enabled temp buffer with CONTENTS. +BODY is the code to be executed within the temp buffer. Point is +always located at the beginning of buffer. CONTENTS is an +expression that must evaluate to a string at compile time. Words +of the form =!NAME= in CONTENTS are removed, and a for each one a +variable called NAME is bound to the position of the word's +start." + (declare (indent 1) (debug (def-form body))) + (let* ((var-pos nil) + (text (with-temp-buffer + (insert (eval contents)) + (goto-char (point-min)) + (while (re-search-forward elisp-test-point-position-regex nil t) + (push (list (intern (match-string-no-properties 1)) + (match-beginning 0)) + var-pos) + (delete-region (match-beginning 0) + (match-end 0))) + (buffer-string)))) + `(with-temp-buffer + (emacs-lisp-mode) + (insert ,text) + (goto-char (point-min)) + (let ,var-pos + ;; Let the =!POSITION= variables be ignorable. + ,@(mapcar (lambda (v-p) `(ignore ,(car v-p))) var-pos) + ,@body)))) + +;;; mark-defun + +(eval-and-compile + (defvar mark-defun-test-buffer + ";; Comment header +=!before-1= +\(defun func-1 (arg) + =!inside-1=\"docstring\" + body) +=!after-1==!before-2= +;; Comment before a defun +\(d=!inside-2=efun func-2 (arg) + \"docstring\" + body) +=!after-2==!before-3= +\(defun func-3 (arg) + \"docstring\"=!inside-3= + body) +=!after-3==!before-4=(defun func-4 (arg) + \"docstring\"=!inside-4= + body) +=!after-4= +;; end +" + "Test buffer for `mark-defun'.")) + +(ert-deftest mark-defun-no-arg-region-inactive () + "Test `mark-defun' with no prefix argument and inactive +region." + (setq last-command nil) + (elisp-tests-with-temp-buffer + mark-defun-test-buffer + ;; mark-defun inside a defun, with comments and an empty line + ;; before + (goto-char inside-1) + (mark-defun) + (should (= (point) before-1)) + (should (= (mark) after-1)) + ;; mark-defun inside a defun with comments before + (deactivate-mark) + (goto-char inside-2) + (mark-defun) + (should (= (point) before-2)) + (should (= (mark) after-2)) + ;; mark-defun inside a defun with empty line before + (deactivate-mark) + (goto-char inside-3) + (mark-defun) + (should (= (point) before-3)) + (should (= (mark) after-3)) + ;; mark-defun inside a defun with another one right before + (deactivate-mark) + (goto-char inside-4) + (mark-defun) + (should (= (point) before-4)) + (should (= (mark) after-4)) + ;; mark-defun between a comment and a defun + (deactivate-mark) + (goto-char before-1) + (mark-defun) + (should (= (point) before-1)) + (should (= (mark) after-1)) + ;; mark-defun between defuns + (deactivate-mark) + (goto-char before-3) + (mark-defun) + (should (= (point) before-3)) + (should (= (mark) after-3)) + ;; mark-defun in comment right before the defun + (deactivate-mark) + (goto-char before-2) + (mark-defun) + (should (= (point) before-2)) + (should (= (mark) after-2)))) + +(ert-deftest mark-defun-no-arg-region-active () + "Test `mark-defun' with no prefix argument and active +region." + (transient-mark-mode 1) + (setq last-command nil) + (elisp-tests-with-temp-buffer + mark-defun-test-buffer + ;; mark-defun when a defun is marked + (goto-char before-1) + (set-mark after-1) + (mark-defun) + (should (= (point) before-1)) + (should (= (mark) after-2)) + ;; mark-defun when two defuns are marked + (deactivate-mark) + (goto-char before-1) + (set-mark after-2) + (mark-defun) + (should (= (point) before-1)) + (should (= (mark) after-3)))) + +(ert-deftest mark-defun-arg-region-active () + "Test `mark-defun' with a prefix arg and active region." + (transient-mark-mode 1) + (setq last-command nil) + (elisp-tests-with-temp-buffer + mark-defun-test-buffer + ;; mark-defun with positive arg when a defun is marked + (goto-char before-1) + (set-mark after-1) + (mark-defun 2) + (should (= (point) before-1)) + (should (= (mark) after-3)) + ;; mark-defun with arg=-1 when a defun is marked + (goto-char before-2) + (set-mark after-2) + (mark-defun -1) + (should (= (point) before-1)) + (should (= (mark) after-2)) + ;; mark-defun with arg=-2 when a defun is marked + (goto-char before-3) + (set-mark after-3) + (mark-defun -2) + (should (= (point) before-1)) + (should (= (mark) after-3)))) + +(ert-deftest mark-defun-pos-arg-region-inactive () + "Test `mark-defun' with positive argument and inactive + region." + (setq last-command nil) + (elisp-tests-with-temp-buffer + mark-defun-test-buffer + ;; mark-defun with positive arg inside a defun + (goto-char inside-1) + (mark-defun 2) + (should (= (point) before-1)) + (should (= (mark) after-2)) + ;; mark-defun with positive arg between defuns + (deactivate-mark) + (goto-char before-3) + (mark-defun 2) + (should (= (point) before-3)) + (should (= (mark) after-4)) + ;; mark-defun with positive arg in a comment + (deactivate-mark) + (goto-char before-2) + (mark-defun 2) + (should (= (point) before-2)) + (should (= (mark) after-3)))) + +(ert-deftest mark-defun-neg-arg-region-inactive () + "Test `mark-defun' with negative argument and inactive + region." + (setq last-command nil) + (elisp-tests-with-temp-buffer + mark-defun-test-buffer + ;; mark-defun with arg=-1 inside a defun + (goto-char inside-1) + (mark-defun -1) + (should (= (point) before-1)) + (should (= (mark) after-1)) + ;; mark-defun with arg=-1 between defuns + (deactivate-mark) + (goto-char after-2) + (mark-defun -1) + (should (= (point) before-2)) + (should (= (mark) after-2)) + ;; mark-defun with arg=-1 in a comment + ;; (this is probably not an optimal behavior...) + (deactivate-mark) + (goto-char before-2) + (mark-defun -1) + (should (= (point) before-1)) + (should (= (mark) after-1)) + ;; mark-defun with arg=-2 inside a defun + (deactivate-mark) + (goto-char inside-4) + (mark-defun -2) + (should (= (point) before-3)) + (should (= (mark) after-4)) + ;; mark-defun with arg=-2 between defuns + (deactivate-mark) + (goto-char before-3) + (mark-defun -2) + (should (= (point) before-1)) + (should (= (mark) after-2))) + (elisp-tests-with-temp-buffer ; test case submitted by Drew Adams + "(defun a () + nil) +=!before-b=(defun b () +=!in-b= nil) +=!after-b=;;;; +\(defun c () + nil) +" + (setq last-command nil) + (goto-char in-b) + (mark-defun -1) + (should (= (point) before-b)) + (should (= (mark) after-b)))) + +(ert-deftest mark-defun-bob () + "Test `mark-defun' at the beginning of buffer." + ;; Bob, comment, newline, defun + (setq last-command nil) + (elisp-tests-with-temp-buffer + ";; Comment at the bob +=!before= +\(defun func (arg)=!inside= + \"docstring\" + body) +=!after=" + (goto-char inside) + (mark-defun) + (should (= (point) before)) + (should (= (mark) after))) + ;; Bob, newline, comment, defun + (elisp-tests-with-temp-buffer + "=!before= +;; Comment before the defun +\(defun func (arg)=!inside= + \"docstring\" + body) +=!after=" + (goto-char inside) + (mark-defun) + (should (= (point) before)) + (should (= (mark) after))) + ;; Bob, comment, defun + (elisp-tests-with-temp-buffer + "=!before=;; Comment at the bob before the defun +\(defun func (arg)=!inside= + \"docstring\" + body) +=!after=" + (goto-char inside) + (mark-defun) + (should (= (point) before)) + (should (= (mark) after))) + ;; Bob, newline, comment, newline, defun + (elisp-tests-with-temp-buffer + " +;; Comment before the defun +=!before= +\(defun func (arg)=!inside= + \"docstring\" + body) +=!after=" + (goto-char inside) + (mark-defun) + (should (= (point) before)) + (should (= (mark) after)))) + +(provide 'lisp-tests) +;;; lisp-tests.el ends here diff --git a/test/automated/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index 1c3e12060da..07e85cc5391 100644 --- a/test/automated/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el @@ -192,6 +192,14 @@ Evaluate BODY for each created map. (2 . b) (3 . c)))))) +(ert-deftest test-map-do () + (with-maps-do map + (let ((result nil)) + (map-do (lambda (k v) + (add-to-list 'result (list (int-to-string k) v))) + map) + (should (equal result '(("2" 5) ("1" 4) ("0" 3))))))) + (ert-deftest test-map-keys-apply () (with-maps-do map (should (equal (map-keys-apply (lambda (k) (int-to-string k)) diff --git a/test/automated/advice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el index b228da6cdb8..b228da6cdb8 100644 --- a/test/automated/advice-tests.el +++ b/test/lisp/emacs-lisp/nadvice-tests.el diff --git a/test/automated/data/package/archive-contents b/test/lisp/emacs-lisp/package-resources/archive-contents index e2f92304f86..e2f92304f86 100644 --- a/test/automated/data/package/archive-contents +++ b/test/lisp/emacs-lisp/package-resources/archive-contents diff --git a/test/automated/data/package/key.pub b/test/lisp/emacs-lisp/package-resources/key.pub index a326d34e54f..a326d34e54f 100644 --- a/test/automated/data/package/key.pub +++ b/test/lisp/emacs-lisp/package-resources/key.pub diff --git a/test/automated/data/package/key.sec b/test/lisp/emacs-lisp/package-resources/key.sec index d21e6ae9a45..d21e6ae9a45 100644 --- a/test/automated/data/package/key.sec +++ b/test/lisp/emacs-lisp/package-resources/key.sec diff --git a/test/automated/data/package/macro-problem-package-1.0/macro-aux.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el index f43232224af..f43232224af 100644 --- a/test/automated/data/package/macro-problem-package-1.0/macro-aux.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-aux.el diff --git a/test/automated/data/package/macro-problem-package-1.0/macro-problem.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el index 0533b1bd9c4..0533b1bd9c4 100644 --- a/test/automated/data/package/macro-problem-package-1.0/macro-problem.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-1.0/macro-problem.el diff --git a/test/automated/data/package/macro-problem-package-2.0/macro-aux.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el index 6a55a40e3b4..6a55a40e3b4 100644 --- a/test/automated/data/package/macro-problem-package-2.0/macro-aux.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-aux.el diff --git a/test/automated/data/package/macro-problem-package-2.0/macro-problem.el b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el index cad4ed93f19..cad4ed93f19 100644 --- a/test/automated/data/package/macro-problem-package-2.0/macro-problem.el +++ b/test/lisp/emacs-lisp/package-resources/macro-problem-package-2.0/macro-problem.el diff --git a/test/automated/data/package/multi-file-0.2.3.tar b/test/lisp/emacs-lisp/package-resources/multi-file-0.2.3.tar Binary files differindex 2f1c5e93df1..2f1c5e93df1 100644 --- a/test/automated/data/package/multi-file-0.2.3.tar +++ b/test/lisp/emacs-lisp/package-resources/multi-file-0.2.3.tar diff --git a/test/automated/data/package/multi-file-readme.txt b/test/lisp/emacs-lisp/package-resources/multi-file-readme.txt index affd2e96fb0..affd2e96fb0 100644 --- a/test/automated/data/package/multi-file-readme.txt +++ b/test/lisp/emacs-lisp/package-resources/multi-file-readme.txt diff --git a/test/automated/data/package/newer-versions/archive-contents b/test/lisp/emacs-lisp/package-resources/newer-versions/archive-contents index add5f2909d0..add5f2909d0 100644 --- a/test/automated/data/package/newer-versions/archive-contents +++ b/test/lisp/emacs-lisp/package-resources/newer-versions/archive-contents diff --git a/test/automated/data/package/newer-versions/new-pkg-1.0.el b/test/lisp/emacs-lisp/package-resources/newer-versions/new-pkg-1.0.el index 7251622fa59..7251622fa59 100644 --- a/test/automated/data/package/newer-versions/new-pkg-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/newer-versions/new-pkg-1.0.el diff --git a/test/automated/data/package/newer-versions/simple-single-1.4.el b/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el index 7b1c00c06db..7b1c00c06db 100644 --- a/test/automated/data/package/newer-versions/simple-single-1.4.el +++ b/test/lisp/emacs-lisp/package-resources/newer-versions/simple-single-1.4.el diff --git a/test/automated/data/package/package-test-server.py b/test/lisp/emacs-lisp/package-resources/package-test-server.py index 35ca820f31f..128b4249ec3 100644 --- a/test/automated/data/package/package-test-server.py +++ b/test/lisp/emacs-lisp/package-resources/package-test-server.py @@ -10,12 +10,16 @@ Protocol = "HTTP/1.0" if sys.argv[1:]: port = int(sys.argv[1]) else: - port = 8000 - server_address = ('127.0.0.1', port) + port = 0 +server_address = ('127.0.0.1', port) HandlerClass.protocol_version = Protocol httpd = ServerClass(server_address, HandlerClass) -sa = httpd.socket.getsockname() -print "Serving HTTP on", sa[0], "port", sa[1], "..." +ip, port = httpd.socket.getsockname()[0:2] +print ("Server started, http://%s:%s/" % (ip, port)) +# Flush in case we're in full buffering mode (instead of line +# buffering), this might happen if python is a cygwin program and we +# run it from a native w32 program. +sys.stdout.flush() httpd.serve_forever() diff --git a/test/automated/data/package/signed/archive-contents b/test/lisp/emacs-lisp/package-resources/signed/archive-contents index 2a773ecba6a..2a773ecba6a 100644 --- a/test/automated/data/package/signed/archive-contents +++ b/test/lisp/emacs-lisp/package-resources/signed/archive-contents diff --git a/test/automated/data/package/signed/archive-contents.sig b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig Binary files differindex 658edd3f60e..658edd3f60e 100644 --- a/test/automated/data/package/signed/archive-contents.sig +++ b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig diff --git a/test/automated/data/package/signed/signed-bad-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el index 3734823876e..3734823876e 100644 --- a/test/automated/data/package/signed/signed-bad-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el diff --git a/test/automated/data/package/signed/signed-bad-1.0.el.sig b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el.sig Binary files differindex 747918794ca..747918794ca 100644 --- a/test/automated/data/package/signed/signed-bad-1.0.el.sig +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el.sig diff --git a/test/automated/data/package/signed/signed-good-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el index 22718df2763..22718df2763 100644 --- a/test/automated/data/package/signed/signed-good-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el diff --git a/test/automated/data/package/signed/signed-good-1.0.el.sig b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig Binary files differindex 747918794ca..747918794ca 100644 --- a/test/automated/data/package/signed/signed-good-1.0.el.sig +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig diff --git a/test/automated/data/package/simple-depend-1.0.el b/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el index b58b658d024..b58b658d024 100644 --- a/test/automated/data/package/simple-depend-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/simple-depend-1.0.el diff --git a/test/automated/data/package/simple-single-1.3.el b/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el index 6756a28080b..6756a28080b 100644 --- a/test/automated/data/package/simple-single-1.3.el +++ b/test/lisp/emacs-lisp/package-resources/simple-single-1.3.el diff --git a/test/automated/data/package/simple-single-readme.txt b/test/lisp/emacs-lisp/package-resources/simple-single-readme.txt index 25d3034032b..25d3034032b 100644 --- a/test/automated/data/package/simple-single-readme.txt +++ b/test/lisp/emacs-lisp/package-resources/simple-single-readme.txt diff --git a/test/automated/data/package/simple-two-depend-1.1.el b/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el index 9cfe5c0d4e2..9cfe5c0d4e2 100644 --- a/test/automated/data/package/simple-two-depend-1.1.el +++ b/test/lisp/emacs-lisp/package-resources/simple-two-depend-1.1.el diff --git a/test/automated/package-test.el b/test/lisp/emacs-lisp/package-tests.el index 637a94bb330..62fdc751fb5 100644 --- a/test/automated/package-test.el +++ b/test/lisp/emacs-lisp/package-tests.el @@ -97,7 +97,7 @@ (multi-file (0 1)))) "`package-desc' used for testing dependencies.") -(defvar package-test-data-dir (expand-file-name "data/package" package-test-file-dir) +(defvar package-test-data-dir (expand-file-name "package-resources" package-test-file-dir) "Base directory of package test files.") (defvar package-test-fake-contents-file @@ -117,6 +117,7 @@ (process-environment (cons (format "HOME=%s" package-test-user-dir) process-environment)) (package-user-dir package-test-user-dir) + (package-gnupghome-dir (expand-file-name "gnupg" package-user-dir)) (package-archives `(("gnu" . ,(or ,location package-test-data-dir)))) (default-directory package-test-file-dir) abbreviated-home-dir @@ -190,18 +191,18 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-test-desc-from-buffer () "Parse an elisp buffer to get a `package-desc' object." - (with-package-test (:basedir "data/package" :file "simple-single-1.3.el") + (with-package-test (:basedir "package-resources" :file "simple-single-1.3.el") (should (equal (package-buffer-info) simple-single-desc))) - (with-package-test (:basedir "data/package" :file "simple-depend-1.0.el") + (with-package-test (:basedir "package-resources" :file "simple-depend-1.0.el") (should (equal (package-buffer-info) simple-depend-desc))) - (with-package-test (:basedir "data/package" + (with-package-test (:basedir "package-resources" :file "multi-file-0.2.3.tar") (tar-mode) (should (equal (package-tar-file-info) multi-file-desc)))) (ert-deftest package-test-install-single () "Install a single file without using an archive." - (with-package-test (:basedir "data/package" :file "simple-single-1.3.el") + (with-package-test (:basedir "package-resources" :file "simple-single-1.3.el") (should (package-install-from-buffer)) (package-initialize) (should (package-installed-p 'simple-single)) @@ -244,7 +245,7 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-test-macro-compilation () "Install a package which includes a dependency." - (with-package-test (:basedir "data/package") + (with-package-test (:basedir "package-resources") (package-install-file (expand-file-name "macro-problem-package-1.0/")) (require 'macro-problem) ;; `macro-problem-func' uses a macro from `macro-aux'. @@ -283,7 +284,7 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-test-install-prioritized () "Install a lower version from a higher-prioritized archive." (with-package-test () - (let* ((newer-version (expand-file-name "data/package/newer-versions" + (let* ((newer-version (expand-file-name "package-resources/newer-versions" package-test-file-dir)) (package-archives `(("older" . ,package-test-data-dir) ("newer" . ,newer-version))) @@ -299,7 +300,7 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-test-install-multifile () "Check properties of the installed multi-file package." - (with-package-test (:basedir "data/package" :install '(multi-file)) + (with-package-test (:basedir "package-resources" :install '(multi-file)) (let ((autoload-file (expand-file-name "multi-file-autoloads.el" (expand-file-name @@ -350,7 +351,7 @@ Must called from within a `tar-mode' buffer." (package-menu-execute) (should (package-installed-p 'simple-single)) (let ((package-test-data-dir - (expand-file-name "data/package/newer-versions" package-test-file-dir))) + (expand-file-name "package-resources/newer-versions" package-test-file-dir))) (setq package-archives `(("gnu" . ,package-test-data-dir))) (package-menu-refresh) @@ -370,18 +371,25 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-test-update-archives-async () "Test updating package archives asynchronously." (skip-unless (executable-find "python2")) - ;; For some reason this test doesn't work reliably on hydra.nixos.org. - (skip-unless (not (getenv "NIX_STORE"))) - (with-package-test (:basedir - package-test-data-dir - :location "http://0.0.0.0:8000/") - (let* ((package-menu-async t) - (process (start-process - "package-server" "package-server-buffer" - (executable-find "python2") - (expand-file-name "package-test-server.py")))) - (unwind-protect - (progn + (let* ((package-menu-async t) + (default-directory package-test-data-dir) + (process (start-process + "package-server" "package-server-buffer" + (executable-find "python2") + "package-test-server.py")) + (addr nil)) + (unwind-protect + (progn + (with-current-buffer "package-server-buffer" + (should + (with-timeout (10 nil) + (while (not addr) + (accept-process-output nil 1) + (goto-char (point-min)) + (when (re-search-forward "Server started, \\(.*\\)\n" nil t) + (setq addr (match-string 1)))) + addr))) + (with-package-test (:basedir package-test-data-dir :location addr) (list-packages) (should package--downloads-in-progress) (should mode-line-process) @@ -395,8 +403,8 @@ Must called from within a `tar-mode' buffer." (skip-unless (process-live-p process)) (goto-char (point-min)) (should - (search-forward-regexp "^ +simple-single" nil t))) - (if (process-live-p process) (kill-process process)))))) + (search-forward-regexp "^ +simple-single" nil t)))) + (if (process-live-p process) (kill-process process))))) (ert-deftest package-test-describe-package () "Test displaying help for a package." @@ -470,7 +478,7 @@ Must called from within a `tar-mode' buffer." (delete-directory homedir t))))) (let* ((keyring (expand-file-name "key.pub" package-test-data-dir)) (package-test-data-dir - (expand-file-name "data/package/signed" package-test-file-dir))) + (expand-file-name "package-resources/signed" package-test-file-dir))) (with-package-test () (package-initialize) (package-import-keyring keyring) @@ -529,7 +537,7 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-x-test-upload-buffer () "Test creating an \"archive-contents\" file" - (with-package-test (:basedir "data/package" + (with-package-test (:basedir "package-resources" :file "simple-single-1.3.el" :upload-base t) (package-upload-buffer) @@ -553,7 +561,7 @@ Must called from within a `tar-mode' buffer." (ert-deftest package-x-test-upload-new-version () "Test uploading a new version of a package" - (with-package-test (:basedir "data/package" + (with-package-test (:basedir "package-resources" :file "simple-single-1.3.el" :upload-base t) (package-upload-buffer) @@ -620,6 +628,7 @@ Must called from within a `tar-mode' buffer." simple-depend-desc-2))) (should (equal (package--sort-by-dependence delete-list) + (list simple-depend-desc-2 simple-depend-desc-1 new-pkg-desc multi-file-desc simple-depend-desc simple-single-desc))) (should diff --git a/test/automated/pcase-tests.el b/test/lisp/emacs-lisp/pcase-tests.el index ef0b2f6b246..ef0b2f6b246 100644 --- a/test/automated/pcase-tests.el +++ b/test/lisp/emacs-lisp/pcase-tests.el diff --git a/test/lisp/emacs-lisp/pp-tests.el b/test/lisp/emacs-lisp/pp-tests.el new file mode 100644 index 00000000000..b9ed79c7749 --- /dev/null +++ b/test/lisp/emacs-lisp/pp-tests.el @@ -0,0 +1,35 @@ +;;; pp-tests.el --- Test suite for pretty printer. -*- lexical-binding: t -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'pp) + +(ert-deftest pp-print-quote () + (should (string= (pp-to-string 'quote) "quote")) + (should (string= (pp-to-string ''quote) "'quote")) + (should (string= (pp-to-string '('a 'b)) "('a 'b)\n")) + (should (string= (pp-to-string '(''quote 'quote)) "(''quote 'quote)\n")) + (should (string= (pp-to-string '(quote)) "(quote)\n")) + (should (string= (pp-to-string '(quote . quote)) "(quote . quote)\n")) + (should (string= (pp-to-string '(quote a b)) "(quote a b)\n")) + (should (string= (pp-to-string '(quotefoo)) "(quotefoo)\n")) + (should (string= (pp-to-string '(a b)) "(a b)\n"))) + +;;; pp-tests.el ends here. diff --git a/test/automated/regexp-tests.el b/test/lisp/emacs-lisp/regexp-opt-tests.el index 92626317052..92626317052 100644 --- a/test/automated/regexp-tests.el +++ b/test/lisp/emacs-lisp/regexp-opt-tests.el diff --git a/test/lisp/emacs-lisp/ring-tests.el b/test/lisp/emacs-lisp/ring-tests.el new file mode 100644 index 00000000000..c869f9dc875 --- /dev/null +++ b/test/lisp/emacs-lisp/ring-tests.el @@ -0,0 +1,206 @@ +;;; ring-tests.el --- Tests for ring.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl <simenheg@gmail.com> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'ring) + +(ert-deftest ring-tests-make-ring-ring-p () + (should (ring-p (make-ring 5)))) + +(ert-deftest ring-tests-insert-at-beginning () + (let ((ring (make-ring 5))) + (ring-insert-at-beginning ring 'foo) + (ring-insert-at-beginning ring 'bar) + (should (equal (ring-elements ring) '(foo bar))))) + +(ert-deftest ring-tests-plus1 () + (should (= (ring-plus1 0 5) 1)) + (should (= (ring-plus1 4 5) 0))) + +(ert-deftest ring-tests-minus1 () + (should (= (ring-minus1 0 5) 4)) + (should (= (ring-minus1 4 5) 3))) + +(ert-deftest ring-tests-length () + (let ((ring (make-ring 2))) + (should (= (ring-length ring) 0)) + (ring-insert ring 'a) + (should (= (ring-length ring) 1)) + (ring-insert ring 'b) + (should (= (ring-length ring) 2)) + (ring-insert ring 'c) + (should (= (ring-length ring) 2)))) + +(ert-deftest ring-tests-index () + (should (= (ring-index 0 0 3 3) 2)) + (should (= (ring-index 0 0 3 5) 2)) + (should (= (ring-index 0 2 3 3) 1)) + (should (= (ring-index 1 2 3 3) 0)) + (should (= (ring-index 2 2 3 3) 2))) + +(ert-deftest ring-tests-empty-p () + (let ((ring (make-ring 5))) + (should (ring-empty-p ring)) + (ring-insert ring 1) + (should-not (ring-empty-p ring)) + (ring-remove ring) + (should (ring-empty-p ring)))) + +(ert-deftest ring-tests-size () + (let ((ring (make-ring 2))) + (should (= (ring-size ring) 2)) + (ring-insert ring "a") + (ring-insert ring "b") + (ring-insert ring "c") + (should (= (ring-size ring) 2)) + (ring-extend ring 3) + (should (= (ring-size ring) 5)))) + +(ert-deftest ring-tests-copy () + (let ((ring1 (make-ring 3))) + (ring-insert ring1 1) + (ring-insert ring1 2) + (let ((ring2 (ring-copy ring1))) + (should-not (eq ring1 ring2)) + (should (= (ring-size ring1) (ring-size ring2))) + (should (equal (ring-elements ring1) (ring-elements ring2)))))) + +(ert-deftest ring-tests-insert () + (let ((ring (make-ring 2))) + (ring-insert ring :a) + (should (equal (ring-elements ring) '(:a))) + (ring-insert ring :b) + (should (equal (ring-elements ring) '(:b :a))) + (ring-insert ring :c) + (should (equal (ring-elements ring) '(:c :b))))) + +(ert-deftest ring-tests-remove () + (let ((ring (make-ring 2))) + (should-error (ring-remove ring)) + (ring-insert ring 'foo) + (ring-insert ring 'bar) + (should (eq (ring-remove ring) 'foo)) + (should (equal (ring-elements ring) '(bar))) + (ring-insert ring 'baz) + (should (eq (ring-remove ring 0) 'baz)) + (should (equal (ring-elements ring) '(bar))))) + +(ert-deftest ring-tests-ref () + (let ((ring (make-ring 2))) + (should-error (ring-ref ring 0)) + (ring-insert ring :a) + (should (eq (ring-ref ring 0) :a)) + (ring-insert ring :b) + (should (eq (ring-ref ring 0) :b)) + (should (eq (ring-ref ring 1) :a)) + (should (eq (ring-ref ring 2) :b)))) + +(ert-deftest ring-tests-elements () + (let ((ring (make-ring 5))) + (ring-insert ring 3) + (ring-insert ring 2) + (ring-insert ring 1) + (should (equal (ring-elements ring) '(1 2 3))))) + +(ert-deftest ring-tests-member () + (let ((ring (make-ring 3))) + (ring-insert ring "foo") + (ring-insert ring "bar") + (should (= (ring-member ring "foo") 1)) + (should (= (ring-member ring "bar") 0)) + (should-not (ring-member ring "baz")))) + +(ert-deftest ring-tests-next () + (let ((ring (make-ring 3))) + (ring-insert ring 'a) + (ring-insert ring 'b) + (should (eq (ring-next ring 'b) 'a)) + (should (eq (ring-next ring 'a) 'b)) + (should-error (ring-next ring 'c)))) + +(ert-deftest ring-tests-previous () + (let ((ring (make-ring 3))) + (ring-insert ring 'a) + (ring-insert ring 'b) + (should (eq (ring-previous ring 'b) 'a)) + (should (eq (ring-previous ring 'a) 'b)) + (should-error (ring-previous ring 'c)))) + +(ert-deftest ring-tests-extend () + (let ((ring (make-ring 2))) + (ring-insert ring 1) + (ring-insert ring 2) + (should (= (ring-size ring) 2)) + (should (= (ring-length ring) 2)) + (ring-extend ring 3) + (ring-insert ring 3) + (should (= (ring-size ring) 5)) + (should (equal (ring-elements ring) '(3 2 1))))) + +(ert-deftest ring-tests-insert () + (let ((ring (make-ring 2))) + (ring-insert+extend ring :a) + (ring-insert+extend ring :b) + (should (equal (ring-elements ring) '(:b :a))) + (ring-insert+extend ring :c) + (should (equal (ring-elements ring) '(:c :b))) + (ring-insert+extend ring :d t) + (should (equal (ring-elements ring) '(:d :c :b))))) + +(ert-deftest ring-tests-remove+insert+extend () + (let ((ring (make-ring 3))) + (ring-insert ring 1) + (ring-insert ring 1) + (ring-insert ring 2) + (ring-remove+insert+extend ring 1) + (should (equal (ring-elements ring) '(1 2))) + (ring-remove+insert+extend ring 0) + (should (equal (ring-elements ring) '(0 1 2))) + (ring-remove+insert+extend ring 3) + (should (equal (ring-elements ring) '(3 0 1))) + (ring-remove+insert+extend ring 4 t) + (should (equal (ring-elements ring) '(4 3 0 1))) + (ring-remove+insert+extend ring 1 t) + (should (equal (ring-elements ring) '(1 4 3 0))))) + +(ert-deftest ring-tests-convert-sequence-to-ring () + (let ((ring (ring-convert-sequence-to-ring '(a b c)))) + (should (equal (ring-elements ring) '(a b c)))) + (let ((ring (ring-convert-sequence-to-ring [1 2 3]))) + (should (equal (ring-elements ring) '(1 2 3)))) + (let ((ring (ring-convert-sequence-to-ring "abc"))) + (should (equal (ring-elements ring) '(?a ?b ?c)))) + (let ((ring (make-ring 2))) + (ring-insert ring :a) + (ring-insert ring :b) + (should + (equal (ring-elements (ring-convert-sequence-to-ring ring)) + (ring-elements ring))))) + +(provide 'ring-tests) +;;; ring-tests.el ends here diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el new file mode 100644 index 00000000000..8b7945c9d27 --- /dev/null +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -0,0 +1,37 @@ +;;; rx-tests.el --- test for rx.el functions -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +(require 'ert) +(require 'rx) + +;;; Code: + +(ert-deftest rx-char-any () + "Test character alternatives with `\]' and `-' (Bug#25123)." + (should (string-match + (rx string-start (1+ (char (?\] . ?\{) (?< . ?\]) (?- . ?:))) + string-end) + (apply #'string (nconc (number-sequence ?\] ?\{) + (number-sequence ?< ?\]) + (number-sequence ?- ?:)))))) + +(provide 'rx-tests) +;; rx-tests.el ends here. diff --git a/test/automated/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el index 05d951bdb8a..495cf1e543c 100644 --- a/test/automated/seq-tests.el +++ b/test/lisp/emacs-lisp/seq-tests.el @@ -97,6 +97,31 @@ Evaluate BODY for each created sequence. (with-test-sequences (seq '()) (should (seq-empty-p (seq-take-while #'test-sequences-oddp seq))))) +(ert-deftest test-seq-map-indexed () + (should (equal (seq-map-indexed (lambda (elt i) + (list elt i)) + nil) + nil)) + (should (equal (seq-map-indexed (lambda (elt i) + (list elt i)) + '(a b c d)) + '((a 0) (b 1) (c 2) (d 3))))) + +(ert-deftest test-seq-do-indexed () + (let ((result nil)) + (seq-do-indexed (lambda (elt i) + (add-to-list 'result (list elt i))) + nil) + (should (equal result nil))) + (with-test-sequences (seq '(4 5 6)) + (let ((result nil)) + (seq-do-indexed (lambda (elt i) + (add-to-list 'result (list elt i))) + seq) + (should (equal (seq-elt result 0) '(6 2))) + (should (equal (seq-elt result 1) '(5 1))) + (should (equal (seq-elt result 2) '(4 0)))))) + (ert-deftest test-seq-filter () (with-test-sequences (seq '(6 7 8 9 10)) (should (equal (seq-filter #'test-sequences-evenp seq) '(6 8 10))) @@ -156,6 +181,10 @@ Evaluate BODY for each created sequence. (should-not (seq-contains seq 3)) (should-not (seq-contains seq nil)))) +(ert-deftest test-seq-contains-should-return-the-elt () + (with-test-sequences (seq '(3 4 5 6)) + (should (= 5 (seq-contains seq 5))))) + (ert-deftest test-seq-every-p () (with-test-sequences (seq '(43 54 22 1)) (should (seq-every-p (lambda (elt) t) seq)) @@ -168,6 +197,31 @@ Evaluate BODY for each created sequence. (should (seq-every-p #'identity seq)) (should (seq-every-p #'test-sequences-evenp seq)))) +(ert-deftest test-seq-set-equal-p () + (with-test-sequences (seq1 '(1 2 3)) + (should (seq-set-equal-p seq1 seq1)) + (should (seq-set-equal-p seq1 seq1 #'eq)) + + (with-test-sequences (seq2 '(3 2 1)) + (should (seq-set-equal-p seq1 seq2)) + (should (seq-set-equal-p seq2 seq1)) + (should (seq-set-equal-p seq1 seq2 #'eq)) + (should (seq-set-equal-p seq2 seq1 #'eq))) + + (with-test-sequences (seq2 '(3 1)) + (should-not (seq-set-equal-p seq1 seq2)) + (should-not (seq-set-equal-p seq2 seq1)))) + + (should (seq-set-equal-p '("a" "b" "c") + '("c" "b" "a"))) + (should-not (seq-set-equal-p '("a" "b" "c") + '("c" "b" "a") #'eq)) + (should-not (seq-set-equal-p '(("a" 1) ("b" 1) ("c" 1)) + '(("c" 2) ("b" 2) ("a" 2)))) + (should (seq-set-equal-p '(("a" 1) ("b" 1) ("c" 1)) + '(("c" 2) ("b" 2) ("a" 2)) + (lambda (i1 i2) (equal (car i1) (car i2)))))) + (ert-deftest test-seq-empty-p () (with-test-sequences (seq '(0)) (should-not (seq-empty-p seq))) @@ -337,5 +391,38 @@ Evaluate BODY for each created sequence. (should (= (seq-position seq 'a #'eq) 0)) (should (null (seq-position seq (make-symbol "a") #'eq))))) +(ert-deftest test-seq-sort-by () + (let ((seq ["x" "xx" "xxx"])) + (should (equal (seq-sort-by #'seq-length #'> seq) + ["xxx" "xx" "x"])))) + +(ert-deftest test-seq-random-elt-take-all () + (let ((seq '(a b c d e)) + (elts '())) + (should (= 0 (length elts))) + (dotimes (_ 1000) + (let ((random-elt (seq-random-elt seq))) + (add-to-list 'elts + random-elt))) + (should (= 5 (length elts))))) + +(ert-deftest test-seq-random-elt-signal-on-empty () + (should-error (seq-random-elt nil)) + (should-error (seq-random-elt [])) + (should-error (seq-random-elt ""))) + +(ert-deftest test-seq-mapn-circular-lists () + (let ((l1 '#1=(1 . #1#))) + (should (equal (seq-mapn #'+ '(3 4 5 7) l1) + '(4 5 6 8))))) + +(ert-deftest test-seq-into-and-identity () + (let ((lst '(1 2 3)) + (vec [1 2 3]) + (str "foo bar")) + (should (eq (seq-into lst 'list) lst)) + (should (eq (seq-into vec 'vector) vec)) + (should (eq (seq-into str 'string) str)))) + (provide 'seq-tests) ;;; seq-tests.el ends here diff --git a/test/automated/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el index 2b2a5cd0d71..2b2a5cd0d71 100644 --- a/test/automated/subr-x-tests.el +++ b/test/lisp/emacs-lisp/subr-x-tests.el diff --git a/test/automated/tabulated-list-test.el b/test/lisp/emacs-lisp/tabulated-list-test.el index b3a09ee375c..b3a09ee375c 100644 --- a/test/automated/tabulated-list-test.el +++ b/test/lisp/emacs-lisp/tabulated-list-test.el diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el b/test/lisp/emacs-lisp/testcover-resources/testcases.el new file mode 100644 index 00000000000..1eb791a993c --- /dev/null +++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el @@ -0,0 +1,493 @@ +;;;; testcases.el -- Test cases for testcover-tests.el + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Gemini Lasswell + +;; This file is part of GNU Emacs. + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;; * This file should not be loaded directly. It is meant to be read +;; by `testcover-tests-build-test-cases'. +;; +;; * Test cases begin with ;; ==== name ====. The symbol name between +;; the ===='s is used to create the name of the test. +;; +;; * Following the beginning comment place the test docstring and +;; any tags or keywords for ERT. These will be spliced into the +;; ert-deftest for the test. +;; +;; * To separate the above from the test case code, use another +;; comment: ;; ==== +;; +;; * These special comments should start at the beginning of a line. +;; +;; * `testcover-tests-skeleton' will prompt you for a test name and +;; insert the special comments. +;; +;; * The test case code should be annotated with %%% at the end of +;; each form where a tan splotch is expected, and !!! at the end +;; of each form where a red mark is expected. +;; +;; * If Testcover is working correctly on your code sample, using +;; `testcover-tests-markup-region' and +;; `testcover-tests-unmarkup-region' can make creating test cases +;; easier. + +;;; Code: +;;; Test Cases: + +;; ==== constants-bug-25316 ==== +"Testcover doesn't splotch constants." +:expected-result :failed +;; ==== +(defconst testcover-testcase-const "apples") +(defun testcover-testcase-zero () 0) +(defun testcover-testcase-list-consts () + (list + emacs-version 10 + "hello" + `(a b c ,testcover-testcase-const) + '(1 2 3) + testcover-testcase-const + (testcover-testcase-zero) + nil)) + +(defun testcover-testcase-add-to-const-list (arg) + (cons arg%%% (testcover-testcase-list-consts))%%%) + +(should (equal (testcover-testcase-add-to-const-list 'a) + `(a ,emacs-version 10 "hello" (a b c "apples") (1 2 3) + "apples" 0 nil))) + +;; ==== customize-defcustom-bug-25326 ==== +"Testcover doesn't prevent testing of defcustom values." +:expected-result :failed +;; ==== +(defgroup testcover-testcase nil + "Test case for testcover" + :group 'lisp + :prefix "testcover-testcase-" + :version "26.0") +(defcustom testcover-testcase-flag t + "Test value used by testcover-tests.el" + :type 'boolean + :group 'testcover-testcase) +(defun testcover-testcase-get-flag () + testcover-testcase-flag) + +(testcover-testcase-get-flag) +(setq testcover-testcase-flag (not testcover-testcase-flag)) +(testcover-testcase-get-flag) + +;; ==== no-returns ==== +"Testcover doesn't splotch functions which don't return." +;; ==== +(defun testcover-testcase-play-ball (retval) + (catch 'ball + (throw 'ball retval%%%))%%%) ; catch gets marked but not throw + +(defun testcover-testcase-not-my-favorite-error-message () + (signal 'wrong-type-argument (list 'consp nil))) + +(should (testcover-testcase-play-ball t)) +(condition-case nil + (testcover-testcase-not-my-favorite-error-message) + (error nil)) + +;; ==== noreturn-symbol ==== +"Wrapping a form with noreturn prevents splotching." +;; ==== +(defun testcover-testcase-cancel (spacecraft) + (error "no destination for %s" spacecraft)) +(defun testcover-testcase-launch (spacecraft planet) + (if (null planet) + (noreturn (testcover-testcase-cancel spacecraft%%%)) + (list spacecraft%%% planet%%%)%%%)%%%) +(defun testcover-testcase-launch-2 (spacecraft planet) + (if (null planet%%%)%%% + (testcover-testcase-cancel spacecraft%%%)!!! + (list spacecraft!!! planet!!!)!!!)!!!) +(should (equal (testcover-testcase-launch "Curiosity" "Mars") '("Curiosity" "Mars"))) +(condition-case err + (testcover-testcase-launch "Voyager" nil) + (error err)) +(condition-case err + (testcover-testcase-launch-2 "Voyager II" nil) + (error err)) + +(should-error (testcover-testcase-launch "Voyager" nil)) +(should-error (testcover-testcase-launch-2 "Voyager II" nil)) + +;; ==== 1-value-symbol-bug-25316 ==== +"Wrapping a form with 1value prevents splotching." +:expected-result :failed +;; ==== +(defun testcover-testcase-always-zero (num) + (- num%%% num%%%)%%%) +(defun testcover-testcase-still-always-zero (num) + (1value (- num%%% num%%% (- num%%% num%%%)%%%))) +(defun testcover-testcase-never-called (num) + (1value (/ num!!! num!!!)!!!)!!!) +(should (eql 0 (testcover-testcase-always-zero 3))) +(should (eql 0 (testcover-testcase-still-always-zero 5))) + +;; ==== dotimes-dolist ==== +"Dolist and dotimes with a 1valued return value are 1valued." +;; ==== +(defun testcover-testcase-do-over (things) + (dolist (thing things%%%) + (list thing)) + (dolist (thing things%%% 42) + (list thing)) + (dolist (thing things%%% things%%%) + (list thing))%%%) +(defun testcover-testcase-do-more (count) + (dotimes (num count%%%) + (+ num num)) + (dotimes (num count%%% count%%%) + (+ num num))%%% + (dotimes (num count%%% 0) + (+ num num))) +(should (equal '(a b c) (testcover-testcase-do-over '(a b c)))) +(should (eql 0 (testcover-testcase-do-more 2))) + +;; ==== let-last-form ==== +"A let form is 1valued if its last form is 1valued." +;; ==== +(defun testcover-testcase-double (num) + (let ((double (* num%%% 2)%%%)) + double%%%)%%%) +(defun testcover-testcase-nullbody-let (num) + (let* ((square (* num%%% num%%%)%%%) + (double (* 2 num%%%)%%%)))) +(defun testcover-testcase-answer () + (let ((num 100)) + 42)) +(should-not (testcover-testcase-nullbody-let 3)) +(should (eql (testcover-testcase-answer) 42)) +(should (eql (testcover-testcase-double 10) 20)) + +;; ==== if-with-1value-clauses ==== +"An if is 1valued if both then and else are 1valued." +;; ==== +(defun testcover-testcase-describe (val) + (if (zerop val%%%)%%% + "a number" + "a different number")) +(defun testcover-testcase-describe-2 (val) + (if (zerop val) + "zero" + "not zero")) +(defun testcover-testcase-describe-3 (val) + (if (zerop val%%%)%%% + "zero" + (format "%d" val%%%)%%%)%%%) +(should (equal (testcover-testcase-describe 0) "a number")) +(should (equal (testcover-testcase-describe-2 0) "zero")) +(should (equal (testcover-testcase-describe-2 1) "not zero")) +(should (equal (testcover-testcase-describe-3 1) "1")) + +;; ==== cond-with-1value-clauses ==== +"A cond form is marked 1valued if all clauses are 1valued." +;; ==== +(defun testcover-testcase-cond (num) + (cond + ((eql num%%% 0)%%% 'a) + ((eql num%%% 1)%%% 'b) + ((eql num!!! 2)!!! 'c))) +(defun testcover-testcase-cond-2 (num) + (cond + ((eql num%%% 0)%%% (cons 'a 0)!!!) + ((eql num%%% 1)%%% 'b))%%%) +(should (eql (testcover-testcase-cond 1) 'b)) +(should (eql (testcover-testcase-cond-2 1) 'b)) + +;; ==== condition-case-with-1value-components ==== +"A condition-case is marked 1valued if its body and handlers are." +;; ==== +(defun testcover-testcase-cc (arg) + (condition-case nil + (if (null arg%%%)%%% + (error "foo") + "0")!!! + (error nil))) +(should-not (testcover-testcase-cc nil)) + +;; ==== quotes-within-backquotes-bug-25316 ==== +"Forms to instrument are found within quotes within backquotes." +:expected-result :failed +;; ==== +(defun testcover-testcase-make-list () + (list 'defun 'defvar)) +(defmacro testcover-testcase-bq-macro (arg) + (declare (debug t)) + `(memq ,arg%%% '(defconst ,@(testcover-testcase-make-list)))%%%) +(defun testcover-testcase-use-bq-macro (arg) + (testcover-testcase-bq-macro arg%%%)%%%) +(should (equal '(defun defvar) (testcover-testcase-use-bq-macro 'defun))) + +;; ==== progn-functions ==== +"Some forms are 1value if their last argument is 1value." +;; ==== +(defun testcover-testcase-one (arg) + (progn + (setq arg (1- arg%%%)%%%)%%%)%%% + (progn + (setq arg (1+ arg%%%)%%%)%%% + 1)) + +(should (eql 1 (testcover-testcase-one 0))) +;; ==== prog1-functions ==== +"Some forms are 1value if their first argument is 1value." +;; ==== +(defun testcover-testcase-unwinder (arg) + (unwind-protect + (if ( > arg%%% 0)%%% + 1 + 0) + (format "unwinding %s!" arg%%%)%%%)) +(defun testcover-testcase-divider (arg) + (unwind-protect + (/ 100 arg%%%)%%% + (format "unwinding! %s" arg%%%)%%%)%%%) + +(should (eq 0 (testcover-testcase-unwinder 0))) +(should (eq 1 (testcover-testcase-divider 100))) + +;; ==== compose-functions ==== +"Some functions are 1value if all their arguments are 1value." +;; ==== +(defconst testcover-testcase-count 3) +(defun testcover-testcase-number () + (+ 1 testcover-testcase-count)) +(defun testcover-testcase-more () + (+ 1 (testcover-testcase-number) testcover-testcase-count)) + +(should (equal (testcover-testcase-more) 8)) + +;; ==== apply-quoted-symbol ==== +"Apply with a quoted function symbol treated as 1value if function is." +;; ==== +(defun testcover-testcase-numlist (flag) + (if flag%%% + '(1 2 3) + '(4 5 6))) +(defun testcover-testcase-sum (flag) + (apply '+ (testcover-testcase-numlist flag%%%))) +(defun testcover-testcase-label () + (apply 'message "edebug uses: %s %s" (list 1 2)!!!)!!!) + +(should (equal 6 (testcover-testcase-sum t))) + +;; ==== backquote-1value-bug-24509 ==== +"Commas within backquotes are recognized as non-1value." +:expected-result :failed +;; ==== +(defmacro testcover-testcase-lambda (&rest body) + `(lambda () ,@body)) + +(defun testcover-testcase-example () + (let ((lambda-1 (testcover-testcase-lambda (format "lambda-%d" 1))%%%) + (lambda-2 (testcover-testcase-lambda (format "lambda-%d" 2))%%%)) + (concat (funcall lambda-1%%%)%%% " " + (funcall lambda-2%%%)%%%)%%%)%%%) + +(defmacro testcover-testcase-message-symbol (name) + `(message "%s" ',name)) + +(defun testcover-testcase-example-2 () + (concat + (testcover-testcase-message-symbol foo)%%% + (testcover-testcase-message-symbol bar)%%%)%%%) + +(should (equal "lambda-1 lambda-2" (testcover-testcase-example))) +(should (equal "foobar" (testcover-testcase-example-2))) + +;; ==== pcase-bug-24688 ==== +"Testcover copes with condition-case within backquoted list." +:expected-result :failed +;; ==== +(defun testcover-testcase-pcase (form) + (pcase form%%% + (`(condition-case ,var ,protected-form . ,handlers) + (list var%%% protected-form%%% handlers%%%)%%%) + (_ nil))%%%) + +(should (equal (testcover-testcase-pcase '(condition-case a + (/ 5 a) + (error 0))) + '(a (/ 5 a) ((error 0))))) + +;; ==== defun-in-backquote-bug-11307-and-24743 ==== +"Testcover handles defun forms within backquoted list." +:expected-result :failed +;; ==== +(defmacro testcover-testcase-defun (name &rest body) + (declare (debug (symbolp def-body))) + `(defun ,name () ,@body)) + +(testcover-testcase-defun foo (+ 1 2)) +(testcover-testcase-defun bar (+ 3 4)) +(should (eql (foo) 3)) +(should (eql (bar) 7)) + +;; ==== closure-1value-bug ==== +"Testcover does not mark closures as 1value." +:expected-result :failed +;; ==== +;; -*- lexical-binding:t -*- +(setq testcover-testcase-foo nil) +(setq testcover-testcase-bar 0) + +(defun testcover-testcase-baz (arg) + (setq testcover-testcase-foo + (lambda () (+ arg testcover-testcase-bar%%%)))) + +(testcover-testcase-baz 2) +(should (equal 2 (funcall testcover-testcase-foo))) +(testcover-testcase-baz 3) +(should (equal 3 (funcall testcover-testcase-foo))) + +;; ==== by-value-vs-by-reference-bug-25351 ==== +"An object created by a 1value expression may be modified by other code." +:expected-result :failed +;; ==== +(defun testcover-testcase-ab () + (list 'a 'b)) +(defun testcover-testcase-change-it (arg) + (setf (cadr arg%%%)%%% 'c)%%% + arg%%%) + +(should (equal (testcover-testcase-change-it (testcover-testcase-ab)) '(a c))) +(should (equal (testcover-testcase-ab) '(a b))) + +;; ==== 1value-error-test ==== +"Forms wrapped by `1value' should always return the same value." +;; ==== +(defun testcover-testcase-thing (arg) + (1value (list 1 arg 3))) + +(should (equal '(1 2 3) (testcover-testcase-thing 2))) +(should-error (testcover-testcase-thing 3)) + +;; ==== dotted-backquote ==== +"Testcover correctly instruments dotted backquoted lists." +;; ==== +(defun testcover-testcase-dotted-bq (flag extras) + (let* ((bq + `(a b c . ,(and flag extras%%%)))) + bq)) + +(should (equal '(a b c) (testcover-testcase-dotted-bq nil '(d e)))) +(should (equal '(a b c d e) (testcover-testcase-dotted-bq t '(d e)))) + +;; ==== backquoted-vector-bug-25316 ==== +"Testcover reinstruments within backquoted vectors." +:expected-result :failed +;; ==== +(defun testcover-testcase-vec (a b c) + `[,a%%% ,(list b%%% c%%%)%%%]%%%) + +(defun testcover-testcase-vec-in-list (d e f) + `([[,d%%% ,e%%%] ,f%%%])%%%) + +(defun testcover-testcase-vec-arg (num) + (list `[,num%%%]%%%)%%%) + +(should (equal [1 (2 3)] (testcover-testcase-vec 1 2 3))) +(should (equal '([[4 5] 6]) (testcover-testcase-vec-in-list 4 5 6))) +(should (equal '([100]) (testcover-testcase-vec-arg 100))) + +;; ==== vector-in-macro-spec-bug-25316 ==== +"Testcover reinstruments within vectors." +:expected-result :failed +;; ==== +(defmacro testcover-testcase-nth-case (arg vec) + (declare (indent 1) + (debug (form (vector &rest form)))) + `(eval (aref ,vec%%% ,arg%%%))%%%) + +(defun testcover-testcase-use-nth-case (choice val) + (testcover-testcase-nth-case choice + [(+ 1 val!!!)!!! + (- 1 val%%%)%%% + (* 7 val) + (/ 4 val!!!)!!!])) + +(should (eql 42 (testcover-testcase-use-nth-case 2 6))) +(should (eql 49 (testcover-testcase-use-nth-case 2 7))) +(should (eql 0 (testcover-testcase-use-nth-case 1 1 ))) + +;; ==== mapcar-is-not-compose ==== +"Mapcar with 1value arguments is not 1value." +:expected-result :failed +;; ==== +(defvar testcover-testcase-num 0) +(defun testcover-testcase-add-num (n) + (+ testcover-testcase-num n)) +(defun testcover-testcase-mapcar-sides () + (mapcar 'testcover-testcase-add-num '(1 2 3))) + +(setq testcover-testcase-num 1) +(should (equal (testcover-testcase-mapcar-sides) '(2 3 4))) +(setq testcover-testcase-num 2) +(should (equal (testcover-testcase-mapcar-sides) '(3 4 5))) + +;; ==== function-with-edebug-spec-bug-25316 ==== +"Functions can have edebug specs too. +See c-make-font-lock-search-function for an example in the Emacs +sources. The other issue is that it's ok to use quote in an +edebug spec, so testcover needs to cope with that." +:expected-result :failed +;; ==== +(defun testcover-testcase-make-function (forms) + `(lambda (flag) (if flag 0 ,@forms%%%))%%%) + +(def-edebug-spec testcover-testcase-make-function + (("quote" (&rest def-form)))) + +(defun testcover-testcase-thing () + (testcover-testcase-make-function '((+ 1 (+ 2 (+ 3 (+ 4 5))))))%%%) + +(defun testcover-testcase-use-thing () + (funcall (testcover-testcase-thing)%%% nil)%%%) + +(should (equal (testcover-testcase-use-thing) 15)) + +;; ==== backquoted-dotted-alist ==== +"Testcover can instrument a dotted alist constructed with backquote." +;; ==== +(defun testcover-testcase-make-alist (expr entries) + `((0 . ,expr%%%) . ,entries%%%)%%%) + +(should (equal (testcover-testcase-make-alist "foo" '((1 . "bar") (2 . "baz"))) + '((0 . "foo") (1 . "bar") (2 . "baz")))) + +;; ==== coverage-of-the-unknown-symbol-bug-25471 ==== +"Testcover correctly records coverage of code which uses `unknown'" +:expected-result :failed +;; ==== +(defun testcover-testcase-how-do-i-know-you (name) + (let ((val 'unknown)) + (when (equal name%%% "Bob")%%% + (setq val 'known)!!!) + val%%%)%%%) + +(should (eq (testcover-testcase-how-do-i-know-you "Liz") 'unknown)) + +;; testcases.el ends here. diff --git a/test/lisp/emacs-lisp/testcover-tests.el b/test/lisp/emacs-lisp/testcover-tests.el new file mode 100644 index 00000000000..d31379c3aa2 --- /dev/null +++ b/test/lisp/emacs-lisp/testcover-tests.el @@ -0,0 +1,186 @@ +;;; testcover-tests.el --- Testcover test suite -*- lexical-binding:t -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Gemini Lasswell + +;; This file is part of GNU Emacs. + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;; Testcover test suite. +;; * All the test cases are in testcover-resources/testcover-cases.el. +;; See that file for an explanation of the test case format. +;; * `testcover-tests-define-tests', which is run when this file is +;; loaded, reads testcover-resources/testcover-cases.el and defines +;; ERT tests for each test case. + +;;; Code: + +(require 'ert) +(require 'testcover) +(require 'skeleton) + +;; Use `eval-and-compile' around all these definitions because they're +;; used by the macro `testcover-tests-define-tests'. + +(eval-and-compile + (defvar testcover-tests-file-dir + (expand-file-name + "testcover-resources/" + (file-name-directory (or (bound-and-true-p byte-compile-current-file) + load-file-name + buffer-file-name))) + "Directory of the \"testcover-tests.el\" file.")) + +(eval-and-compile + (defvar testcover-tests-test-cases + (expand-file-name "testcases.el" testcover-tests-file-dir) + "File containing marked up code to instrument and check.")) + +;; Convert Testcover's overlays to plain text. + +(eval-and-compile + (defun testcover-tests-markup-region (beg end &rest optargs) + "Mark up test code within region between BEG and END. +Convert Testcover's tan and red splotches to %%% and !!! for +testcases.el. This can be used to create test cases if Testcover +is working correctly on a code sample. OPTARGS are optional +arguments for `testcover-start'." + (interactive "r") + (let ((tempfile (make-temp-file "testcover-tests-" nil ".el")) + (code (buffer-substring beg end)) + (marked-up-code)) + (unwind-protect + (progn + (with-temp-file tempfile + (insert code)) + (save-current-buffer + (let ((buf (find-file-noselect tempfile))) + (set-buffer buf) + (apply 'testcover-start (cons tempfile optargs)) + (testcover-mark-all buf) + (dolist (overlay (overlays-in (point-min) (point-max))) + (let ((ov-face (overlay-get overlay 'face))) + (goto-char (overlay-end overlay)) + (cond + ((eq ov-face 'testcover-nohits) (insert "!!!")) + ((eq ov-face 'testcover-1value) (insert "%%%")) + (t nil)))) + (setq marked-up-code (buffer-string))) + (set-buffer-modified-p nil))) + (ignore-errors (kill-buffer (find-file-noselect tempfile))) + (ignore-errors (delete-file tempfile))) + + ;; Now replace the original code with the marked up code. + (delete-region beg end) + (insert marked-up-code)))) + +(eval-and-compile + (defun testcover-tests-unmarkup-region (beg end) + "Remove the markup used in testcases.el between BEG and END." + (interactive "r") + (save-excursion + (save-restriction + (narrow-to-region beg end) + (goto-char (point-min)) + (while (re-search-forward "!!!\\|%%%" nil t) + (replace-match "")))))) + +(define-skeleton testcover-tests-skeleton + "Write a testcase for testcover-tests.el." + "Enter name of test: " + ";; ==== " str " ====\n" + "\"docstring\"\n" + ";; Directives for ERT should go here, if any.\n" + ";; ====\n" + ";; Replace this line with annotated test code.\n") + +;; Check a test case. + +(eval-and-compile + (defun testcover-tests-run-test-case (marked-up-code) + "Test the operation of Testcover on the string MARKED-UP-CODE." + (let ((tempfile (make-temp-file "testcover-tests-" nil ".el"))) + (unwind-protect + (progn + (with-temp-file tempfile + (insert marked-up-code)) + ;; Remove the marks and mark the code up again. The original + ;; and recreated versions should match. + (save-current-buffer + (set-buffer (find-file-noselect tempfile)) + ;; Fail the test if the debugger tries to become active, + ;; which will happen if Testcover's reinstrumentation + ;; leaves an edebug-enter in the code. This will also + ;; prevent debugging these tests using Edebug. + (cl-letf (((symbol-function #'edebug-enter) + (lambda (&rest _args) + (ert-fail + (concat "Debugger invoked during test run " + "(possible edebug-enter not replaced)"))))) + (dolist (byte-compile '(t nil)) + (testcover-tests-unmarkup-region (point-min) (point-max)) + (unwind-protect + (testcover-tests-markup-region (point-min) (point-max) byte-compile) + (set-buffer-modified-p nil)) + (should (string= marked-up-code + (buffer-string))))))) + (ignore-errors (kill-buffer (find-file-noselect tempfile))) + (ignore-errors (delete-file tempfile)))))) + +;; Convert test case file to ert-defmethod. + +(eval-and-compile + (defun testcover-tests-build-test-cases () + "Parse the test case file and return a list of ERT test definitions. +Construct and return a list of `ert-deftest' forms. See testcases.el +for documentation of the test definition format." + (let (results) + (with-temp-buffer + (insert-file-contents testcover-tests-test-cases) + (goto-char (point-min)) + (while (re-search-forward + (concat "^;; ==== \\([^ ]+?\\) ====\n" + "\\(\\(?:.*\n\\)*?\\)" + ";; ====\n" + "\\(\\(?:.*\n\\)*?\\)" + "\\(\\'\\|;; ====\\)") + nil t) + (let ((name (match-string 1)) + (splice (car (read-from-string + (format "(%s)" (match-string 2))))) + (code (match-string 3))) + (push + `(ert-deftest ,(intern (concat "testcover-tests-" name)) () + ,@splice + (testcover-tests-run-test-case ,code)) + results)) + (beginning-of-line))) + results))) + +;; Define all the tests. + +(defmacro testcover-tests-define-tests () + "Construct and define ERT test methods using the test case file." + (let* ((test-cases (testcover-tests-build-test-cases))) + `(progn ,@test-cases))) + +(testcover-tests-define-tests) + +(provide 'testcover-tests) + +;;; testcover-tests.el ends here diff --git a/test/automated/thunk-tests.el b/test/lisp/emacs-lisp/thunk-tests.el index 89bf1f50113..89bf1f50113 100644 --- a/test/automated/thunk-tests.el +++ b/test/lisp/emacs-lisp/thunk-tests.el diff --git a/test/automated/timer-tests.el b/test/lisp/emacs-lisp/timer-tests.el index b12a365ff3b..b12a365ff3b 100644 --- a/test/automated/timer-tests.el +++ b/test/lisp/emacs-lisp/timer-tests.el diff --git a/test/automated/viper-tests.el b/test/lisp/emulation/viper-tests.el index 904b6377cf9..67ce5b6fbb0 100644 --- a/test/automated/viper-tests.el +++ b/test/lisp/emulation/viper-tests.el @@ -78,7 +78,7 @@ after itself, although it will leave a buffer called (viper-test-undo-kmacro []))) (ert-deftest viper-test-undo-1 () - "Test for VI like undo behaviour. + "Test for VI like undo behavior. Insert 1, then 2 on consecutive lines, followed by undo. This should leave just 1 in the buffer. @@ -100,7 +100,7 @@ Test for Bug #22295" )))) (ert-deftest viper-test-undo-2 () - "Test for VI like undo behaviour. + "Test for VI like undo behavior. Insert \"1 2 3 4 5\" then delete the 2, then the 4, and undo. Should restore the 4, but leave the 2 deleted. @@ -120,7 +120,7 @@ Test for Bug #22295" ])))) (ert-deftest viper-test-undo-3 () - "Test for VI like undo behaviour. + "Test for VI like undo behavior. Insert \"1 2 3 4 5 6\", delete the 2, then the 3 4 and 5. Should restore the 3 4 and 5 but not the 2. diff --git a/test/automated/epg-tests.el b/test/lisp/epg-tests.el index b6c65e04065..9dd093e7927 100644 --- a/test/automated/epg-tests.el +++ b/test/lisp/epg-tests.el @@ -30,16 +30,17 @@ (expand-file-name "data/epg" (getenv "EMACS_TEST_DIRECTORY")) "Directory containing epg test data.") -(defun epg-tests-gpg-usable (&optional require-passphrase) - (and (executable-find epg-gpg-program) - (condition-case nil - (progn - (epg-check-configuration (epg-configuration)) - (if require-passphrase - (string-match "\\`1\\." - (cdr (assq 'version (epg-configuration)))) - t)) - (error nil)))) +(defconst epg-tests-program-alist-for-passphrase-callback + '((OpenPGP + nil + ("gpg" . "1.4.3")))) + +(defun epg-tests-find-usable-gpg-configuration (&optional require-passphrase) + (epg-find-configuration + 'OpenPGP + 'no-cache + (if require-passphrase + epg-tests-program-alist-for-passphrase-callback))) (defun epg-tests-passphrase-callback (_c _k _d) ;; Need to create a copy here, since the string will be wiped out @@ -51,17 +52,32 @@ require-secret-key) &rest body) "Set up temporary locations and variables for testing." - (declare (indent 1)) - `(let* ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t))) + (declare (indent 1) (debug (sexp body))) + `(let* ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)) + (process-environment + (append + (list "GPG_AGENT_INFO" + (format "GNUPGHOME=%s" epg-tests-home-directory)) + process-environment))) (unwind-protect (let ((context (epg-make-context 'OpenPGP))) + (setf (epg-context-program context) + (alist-get 'program + (epg-tests-find-usable-gpg-configuration + ,(if require-passphrase + `'require-passphrase)))) (setf (epg-context-home-directory context) epg-tests-home-directory) - (setenv "GPG_AGENT_INFO") ,(if require-passphrase - `(epg-context-set-passphrase-callback - context - #'epg-tests-passphrase-callback)) + `(with-temp-file (expand-file-name + "gpg-agent.conf" epg-tests-home-directory) + (insert "pinentry-program " + (expand-file-name "dummy-pinentry" + epg-tests-data-directory) + "\n") + (epg-context-set-passphrase-callback + context + #'epg-tests-passphrase-callback))) ,(if require-public-key `(epg-import-keys-from-file context @@ -78,7 +94,7 @@ (delete-directory epg-tests-home-directory t))))) (ert-deftest epg-decrypt-1 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t) (should (equal "test" (epg-decrypt-string epg-tests-context "\ @@ -90,14 +106,14 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA== -----END PGP MESSAGE-----"))))) (ert-deftest epg-roundtrip-1 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t) (let ((cipher (epg-encrypt-string epg-tests-context "symmetric" nil))) (should (equal "symmetric" (epg-decrypt-string epg-tests-context cipher)))))) (ert-deftest epg-roundtrip-2 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t :require-public-key t :require-secret-key t) @@ -108,7 +124,7 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA== (epg-decrypt-string epg-tests-context cipher)))))) (ert-deftest epg-sign-verify-1 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t :require-public-key t :require-secret-key t) @@ -122,7 +138,7 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA== (should (eq 'good (epg-signature-status (car verify-result))))))) (ert-deftest epg-sign-verify-2 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t :require-public-key t :require-secret-key t) @@ -138,7 +154,7 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA== (should (eq 'good (epg-signature-status (car verify-result))))))) (ert-deftest epg-sign-verify-3 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase t :require-public-key t :require-secret-key t) @@ -153,7 +169,7 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA== (should (eq 'good (epg-signature-status (car verify-result))))))) (ert-deftest epg-import-1 () - (skip-unless (epg-tests-gpg-usable 'require-passphrase)) + (skip-unless (epg-tests-find-usable-gpg-configuration 'require-passphrase)) (with-epg-tests (:require-passphrase nil) (should (= 0 (length (epg-list-keys epg-tests-context)))) (should (= 0 (length (epg-list-keys epg-tests-context nil t))))) diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el new file mode 100644 index 00000000000..da119ed4b13 --- /dev/null +++ b/test/lisp/erc/erc-track-tests.el @@ -0,0 +1,122 @@ +;;; erc-track-tests.el --- Tests for erc-track. + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Mario Lang <mlang@delysid.org> +;; Author: Vivek Dasmohapatra <vivek@etla.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'erc-track) +(require 'font-core) + +(ert-deftest erc-track--shorten-aggressive-nil () + "Test non-aggressive erc track buffer name shortening." + (let (erc-track-shorten-aggressively) + (should + (equal (erc-unique-channel-names '("#emacs" "#vi" "#electronica" "#folk") + '("#emacs" "#vi")) + '("#em" "#vi"))) + (should + (equal (erc-unique-channel-names '("#linux-de" "#linux-fr") + '("#linux-de" "#linux-fr")) + '("#linux-de" "#linux-fr"))) + (should + (equal (erc-unique-channel-names + '("#dunnet" "#lisp" "#sawfish" "#fsf" "#guile" "#testgnome" + "#gnu" "#fsbot" "#hurd" "#hurd-bunny" "#emacs") + '("#hurd-bunny" "#hurd" "#sawfish" "#lisp")) + '("#hurd-" "#hurd" "#s" "#l"))) + (should + (equal (erc-unique-substrings '("#emacs" "#vi" "#electronica" "#folk")) + '("#em" "#vi" "#el" "#f"))) + (should + (equal (erc-unique-channel-names + '("#emacs" "#burse" "+linux.de" "#starwars" + "#bitlbee" "+burse" "#ratpoison") + '("+linux.de" "#starwars" "#burse")) + '("+l" "#s" "#bu"))) + (should + (equal (erc-unique-channel-names '("fsbot" "#emacs" "deego") '("fsbot")) + '("fs"))) + (should + (equal (erc-unique-channel-names '("fsbot" "#emacs" "deego") + '("fsbot") + (lambda (s) (> (length s) 4)) 1) + '("f"))) + (should + (equal (erc-unique-channel-names '("fsbot" "#emacs" "deego") + '("fsbot") + (lambda (s) (> (length s) 4)) 2) + '("fs"))) + (should + (equal (erc-unique-channel-names '("deego" "#hurd" "#hurd-bunny" "#emacs") + '("#hurd" "#hurd-bunny")) + '("#hurd" "#hurd-"))) + (should + (and + (equal (erc-unique-substring-1 "abc" '("ab" "abcd")) "abcd") + (not (erc-unique-substring-1 "a" '("xyz" "xab"))) + (equal (erc-unique-substrings '("abc" "xyz" "xab")) '("abc" "xyz" "xab")) + (equal (erc-unique-substrings '("abc" "abcdefg")) '("abc" "abcd")))) )) + +(ert-deftest erc-track--shorten-aggressive-t () + "Test aggressive erc track buffer name shortening." + (let ((erc-track-shorten-aggressively t)) + (should + (equal (erc-unique-channel-names '("#emacs" "#vi" "#electronica" "#folk") + '("#emacs" "#vi")) + '("#em" "#v"))) + (should + (equal (erc-unique-channel-names '("#linux-de" "#linux-fr") + '("#linux-de" "#linux-fr")) + '("#linux-d" "#linux-f"))) + (should + (equal (erc-unique-substrings '("#emacs" "#vi" "#electronica" "#folk")) + '("#em" "#v" "#el" "#f"))) + (should + (and + (equal (erc-unique-substring-1 "abc" '("ab" "abcd")) "abcd") + (not (erc-unique-substring-1 "a" '("xyz" "xab"))) + (equal (erc-unique-substrings '("abc" "xyz" "xab")) '("ab" "xy" "xa")) + (equal (erc-unique-substrings '("abc" "abcdefg")) '("abc" "abcd")))) )) + +(ert-deftest erc-track--shorten-aggressive-max () + "Test maximally aggressive erc track buffer name shortening." + (let ((erc-track-shorten-aggressively 'max)) + (should + (equal (erc-unique-channel-names '("#emacs" "#vi" "#electronica" "#folk") + '("#emacs" "#vi")) + '("#e" "#v"))) )) + +(ert-deftest erc-track--erc-faces-in () + "`erc-faces-in' should pick up both 'face and 'font-lock-face properties." + (let ((str0 "is bold") + (str1 "is bold")) + ;; Turn on Font Lock mode: this initialize `char-property-alias-alist' + ;; to '((face font-lock-face)). Note that `font-lock-mode' don't + ;; turn on the mode if the test is run on batch mode or if the + ;; buffer name starts with ?\s (Bug#23954). + (unless font-lock-mode (font-lock-default-function 1)) + (put-text-property 3 (length str0) 'font-lock-face + '(bold erc-current-nick-face) str0) + (put-text-property 3 (length str1) 'face + '(bold erc-current-nick-face) str1) + (should (erc-faces-in str0)) + (should (erc-faces-in str1)) )) diff --git a/test/automated/eshell.el b/test/lisp/eshell/eshell-tests.el index dee6c17e025..363ef525e1b 100644 --- a/test/automated/eshell.el +++ b/test/lisp/eshell/eshell-tests.el @@ -1,4 +1,4 @@ -;;; tests/eshell.el --- Eshell test suite +;;; tests/eshell-tests.el --- Eshell test suite ;; Copyright (C) 1999-2017 Free Software Foundation, Inc. @@ -249,4 +249,4 @@ chars" (provide 'esh-test) -;;; tests/eshell.el ends here +;;; tests/eshell-tests.el ends here diff --git a/test/automated/faces-tests.el b/test/lisp/faces-tests.el index a30ba25f8f0..2b3456d47f6 100644 --- a/test/automated/faces-tests.el +++ b/test/lisp/faces-tests.el @@ -23,13 +23,18 @@ (require 'ert) (require 'faces) +(defgroup faces--test nil "" + :group 'faces--test) + (defface faces--test1 '((t :background "black" :foreground "black")) - "") + "" + :group 'faces--test) (defface faces--test2 '((t :box 1)) - "") + "" + :group 'faces--test) (ert-deftest faces--test-color-at-point () (with-temp-buffer diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el new file mode 100644 index 00000000000..1862c6c3277 --- /dev/null +++ b/test/lisp/ffap-tests.el @@ -0,0 +1,84 @@ +;;; ffap-tests.el --- Test suite for ffap.el -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Tino Calancha <tino.calancha@gmail.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'cl-lib) +(require 'ert) +(require 'ffap) + +(ert-deftest ffap-tests-25243 () + "Test for http://debbugs.gnu.org/25243 ." + (let ((file (make-temp-file "test-Bug#25243"))) + (unwind-protect + (with-temp-file file + (let ((str "diff --git b/lisp/ffap.el a/lisp/ffap.el +index 3d7cebadcf..ad4b70d737 100644 +--- b/lisp/ffap.el ++++ a/lisp/ffap.el +@@ -203,6 +203,9 @@ ffap-foo-at-bar-prefix +")) + (transient-mark-mode 1) + (when (natnump ffap-max-region-length) + (insert + (concat + str + (make-string ffap-max-region-length #xa) + (format "%s ENDS HERE" file))) + (call-interactively 'mark-whole-buffer) + (should (equal "" (ffap-string-at-point))) + (should (equal '(1 1) ffap-string-at-point-region))))) + (and (file-exists-p file) (delete-file file))))) + +(ert-deftest ffap-gopher-at-point () + (with-temp-buffer + (insert "\ +Type = 1 +Name = foo +Path = /the/path +Port = 7070 +Host = example.com\n") + (should-not (ffap-gopher-at-point)) + (goto-char (point-min)) + (should (equal (ffap-gopher-at-point) + "gopher://example.com:7070/1/the/path")) + (should (equal ffap-string-at-point-region + (list (point-min) (point-max)))) + (let ((ffap-gopher-regexp nil)) + (should-not (ffap-gopher-at-point))))) + +(ert-deftest ffap-other-window--bug-25352 () + "Test for Bug#25352. Checks that the window configuration is +left alone when opening a URL in an external browser." + (cl-letf* ((old (current-window-configuration)) + ((symbol-function 'ffap-prompter) + (lambda () "http://www.gnu.org")) + (urls nil) + (ffap-url-fetcher (lambda (url) (push url urls) nil))) + (should-not (ffap-other-window)) + (should (equal (current-window-configuration) old)) + (should (equal urls '("http://www.gnu.org"))))) + +(provide 'ffap-tests) + +;;; ffap-tests.el ends here diff --git a/test/automated/file-notify-tests.el b/test/lisp/filenotify-tests.el index 1fc898809e8..8a31c2cd8b5 100644 --- a/test/automated/file-notify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -1,4 +1,4 @@ -;;; file-notify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*- +;;; filenotify-tests.el --- Tests of file notifications -*- lexical-binding: t; -*- ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. @@ -36,6 +36,7 @@ ;;; Code: (require 'ert) +(require 'ert-x) (require 'filenotify) (require 'tramp) @@ -63,19 +64,71 @@ (defvar file-notify--test-results nil) (defvar file-notify--test-event nil) (defvar file-notify--test-events nil) - -(defconst file-notify--test-read-event-timeout 0.01 - "Timeout for `read-event' calls. -It is different for local and remote file notification libraries.") +(defvar file-notify--test-monitors nil) + +(defun file-notify--test-read-event () + "Read one event. +There are different timeouts for local and remote file notification libraries." + (read-event + nil nil + (cond + ;; gio/gpollfilemonitor.c declares POLL_TIME_SECS 5. So we must + ;; wait at least this time in the GPollFileMonitor case. A + ;; similar timeout seems to be needed in the GFamFileMonitor case, + ;; at least on Cygwin. + ((and (string-equal (file-notify--test-library) "gfilenotify") + (memq (file-notify--test-monitor) + '(GFamFileMonitor GPollFileMonitor))) + 7) + ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") 1) + ((file-remote-p temporary-file-directory) 0.1) + (t 0.01)))) (defun file-notify--test-timeout () - "Timeout to wait for arriving events, in seconds." + "Timeout to wait for arriving a bunch of events, in seconds." (cond ((file-remote-p temporary-file-directory) 6) ((string-equal (file-notify--test-library) "w32notify") 4) - ((eq system-type 'cygwin) 10) + ((eq system-type 'cygwin) 6) (t 3))) +(defmacro file-notify--wait-for-events (timeout until) + "Wait for and return file notification events until form UNTIL is true. +TIMEOUT is the maximum time to wait for, in seconds." + `(with-timeout (,timeout (ignore)) + (while (null ,until) + (file-notify--test-read-event)))) + +(defun file-notify--test-no-descriptors () + "Check that `file-notify-descriptors' is an empty hash table. +Return nil when any other file notification watch is still active." + ;; Give read events a last chance. + (file-notify--wait-for-events + (file-notify--test-timeout) + (zerop (hash-table-count file-notify-descriptors))) + ;; Now check. + (zerop (hash-table-count file-notify-descriptors))) + +(defun file-notify--test-no-descriptors-explainer () + "Explain why `file-notify--test-no-descriptors' fails." + (let ((result (list "Watch descriptor(s) existent:"))) + (maphash + (lambda (key value) (push (cons key value) result)) + file-notify-descriptors) + (nreverse result))) + +(put 'file-notify--test-no-descriptors 'ert-explainer + 'file-notify--test-no-descriptors-explainer) + +(defun file-notify--test-cleanup-p () + "Check, that the test has cleaned up the environment as much as needed." + ;; `file-notify--test-event' should not be set but bound + ;; dynamically. + (should-not file-notify--test-event) + ;; The test should have cleaned up this already. Let's check + ;; nevertheless. + (should (file-notify--test-no-descriptors))) + (defun file-notify--test-cleanup () "Cleanup after a test." (file-notify-rm-watch file-notify--test-desc) @@ -97,15 +150,17 @@ It is different for local and remote file notification libraries.") (tramp-cleanup-connection (tramp-dissect-file-name temporary-file-directory) nil 'keep-password))) + (when (hash-table-p file-notify-descriptors) + (clrhash file-notify-descriptors)) + (setq file-notify--test-tmpfile nil file-notify--test-tmpfile1 nil file-notify--test-desc nil file-notify--test-desc1 nil file-notify--test-desc2 nil file-notify--test-results nil - file-notify--test-events nil) - (when file-notify--test-event - (error "file-notify--test-event should not be set but bound dynamically"))) + file-notify--test-events nil + file-notify--test-monitors nil)) (setq password-cache-expiry nil tramp-verbose 0 @@ -140,7 +195,7 @@ being the result.") (setq desc (file-notify-add-watch file-notify-test-remote-temporary-file-directory - '(change) 'ignore)))) + '(change) #'ignore)))) (setq file-notify--test-remote-enabled-checked (cons t desc)) (when desc (file-notify-rm-watch desc)))) ;; Return result. @@ -158,6 +213,21 @@ remote host, or nil." "<[[:digit:]]+>\\'" "" (process-name (cdr file-notify--test-remote-enabled-checked)))))) +(defun file-notify--test-monitor () + "The used monitor for the test, as a symbol. +This returns only for the local case and gfilenotify; otherwise it is nil. +`file-notify--test-desc' must be a valid watch descriptor." + ;; We cache the result, because after `file-notify-rm-watch', + ;; `gfile-monitor-name' does not return a proper result anymore. + ;; But we still need this information. + (unless (file-remote-p temporary-file-directory) + (or (cdr (assq file-notify--test-desc file-notify--test-monitors)) + (when (functionp 'gfile-monitor-name) + (add-to-list 'file-notify--test-monitors + (cons file-notify--test-desc + (gfile-monitor-name file-notify--test-desc))) + (cdr (assq file-notify--test-desc file-notify--test-monitors)))))) + (defmacro file-notify--deftest-remote (test docstring) "Define ert `TEST-remote' for remote files." (declare (indent 1)) @@ -166,7 +236,6 @@ remote host, or nil." :tags '(:expensive-test) (let* ((temporary-file-directory file-notify-test-remote-temporary-file-directory) - (file-notify--test-read-event-timeout 0.1) (ert-test (ert-get-test ',test))) (skip-unless (file-notify--test-remote-enabled)) (tramp-cleanup-connection @@ -176,14 +245,24 @@ remote host, or nil." (ert-deftest file-notify-test00-availability () "Test availability of `file-notify'." (skip-unless (file-notify--test-local-enabled)) - ;; Report the native library which has been used. - (message "Library: `%s'" (file-notify--test-library)) - (should - (setq file-notify--test-desc - (file-notify-add-watch temporary-file-directory '(change) 'ignore))) - ;; Cleanup. - (file-notify--test-cleanup)) + (unwind-protect + (progn + ;; Report the native library which has been used. + (message "Library: `%s'" (file-notify--test-library)) + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(change) #'ignore))) + (when (file-notify--test-monitor) + (message "Monitor: `%s'" (file-notify--test-monitor))) + (file-notify-rm-watch file-notify--test-desc) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) + + ;; Cleanup. + (file-notify--test-cleanup))) (file-notify--deftest-remote file-notify-test00-availability "Test availability of `file-notify' for remote files.") @@ -192,62 +271,180 @@ remote host, or nil." "Check `file-notify-add-watch'." (skip-unless (file-notify--test-local-enabled)) - (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) - file-notify--test-tmpfile1 - (format "%s/%s" file-notify--test-tmpfile (md5 (current-time-string)))) + (unwind-protect + (progn + (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) + file-notify--test-tmpfile1 + (format + "%s/%s" file-notify--test-tmpfile (md5 (current-time-string)))) - ;; Check, that different valid parameters are accepted. - (should - (setq file-notify--test-desc - (file-notify-add-watch temporary-file-directory '(change) 'ignore))) - (file-notify-rm-watch file-notify--test-desc) - (should - (setq file-notify--test-desc - (file-notify-add-watch - temporary-file-directory '(attribute-change) 'ignore))) - (file-notify-rm-watch file-notify--test-desc) - (should - (setq file-notify--test-desc - (file-notify-add-watch - temporary-file-directory '(change attribute-change) 'ignore))) - (file-notify-rm-watch file-notify--test-desc) - (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (should - (setq file-notify--test-desc - (file-notify-add-watch - file-notify--test-tmpfile '(change attribute-change) 'ignore))) - (file-notify-rm-watch file-notify--test-desc) - (delete-file file-notify--test-tmpfile) + ;; Check, that different valid parameters are accepted. + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(change) #'ignore))) + (file-notify-rm-watch file-notify--test-desc) + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(attribute-change) #'ignore))) + (file-notify-rm-watch file-notify--test-desc) + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(change attribute-change) #'ignore))) + (file-notify-rm-watch file-notify--test-desc) - ;; Check error handling. - (should-error (file-notify-add-watch 1 2 3 4) - :type 'wrong-number-of-arguments) - (should - (equal (should-error - (file-notify-add-watch 1 2 3)) - '(wrong-type-argument 1))) - (should - (equal (should-error - (file-notify-add-watch temporary-file-directory 2 3)) - '(wrong-type-argument 2))) - (should - (equal (should-error - (file-notify-add-watch temporary-file-directory '(change) 3)) - '(wrong-type-argument 3))) - ;; The upper directory of a file must exist. - (should - (equal (should-error - (file-notify-add-watch - file-notify--test-tmpfile1 '(change attribute-change) 'ignore)) - `(file-notify-error - "Directory does not exist" ,file-notify--test-tmpfile))) + ;; File monitors like kqueue insist, that the watched file + ;; exists. Directory monitors are not bound to this + ;; restriction. + (when (string-equal (file-notify--test-library) "kqueue") + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message)) + (should + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile '(change attribute-change) #'ignore))) + (file-notify-rm-watch file-notify--test-desc) + (when (string-equal (file-notify--test-library) "kqueue") + (delete-file file-notify--test-tmpfile)) + + ;; Check error handling. + (should-error (file-notify-add-watch 1 2 3 4) + :type 'wrong-number-of-arguments) + (should + (equal (should-error + (file-notify-add-watch 1 2 3)) + '(wrong-type-argument 1))) + (should + (equal (should-error + (file-notify-add-watch temporary-file-directory 2 3)) + '(wrong-type-argument 2))) + (should + (equal (should-error + (file-notify-add-watch temporary-file-directory '(change) 3)) + '(wrong-type-argument 3))) + ;; The upper directory of a file must exist. + (should + (equal (should-error + (file-notify-add-watch + file-notify--test-tmpfile1 + '(change attribute-change) #'ignore)) + `(file-notify-error + "Directory does not exist" ,file-notify--test-tmpfile))) - ;; Cleanup. - (file-notify--test-cleanup)) + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) + + ;; Cleanup. + (file-notify--test-cleanup))) (file-notify--deftest-remote file-notify-test01-add-watch "Check `file-notify-add-watch' for remote files.") +(defun file-notify--test-make-temp-name () + "Create a temporary file name for test." + (expand-file-name + (make-temp-name "file-notify-test") temporary-file-directory)) + +;; This test is inspired by Bug#26126 and Bug#26127. +(ert-deftest file-notify-test02-rm-watch () + "Check `file-notify-rm-watch'." + (skip-unless (file-notify--test-local-enabled)) + + (unwind-protect + ;; Check, that `file-notify-rm-watch' works. + (progn + (should + (setq file-notify--test-desc + (file-notify-add-watch + temporary-file-directory '(change) #'ignore))) + (file-notify-rm-watch file-notify--test-desc) + ;; Check, that any parameter is accepted. + (condition-case err + (progn + (file-notify-rm-watch nil) + (file-notify-rm-watch 0) + (file-notify-rm-watch "foo") + (file-notify-rm-watch 'foo)) + (error (ert-fail err))) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) + + ;; Cleanup. + (file-notify--test-cleanup)) + + (unwind-protect + ;; Check, that no error is returned removing a watch descriptor twice. + (progn + (setq file-notify--test-tmpfile (file-notify--test-make-temp-name) + file-notify--test-tmpfile1 (file-notify--test-make-temp-name)) + (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) + (write-region "any text" nil file-notify--test-tmpfile1 nil 'no-message) + (should + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile '(change) #'ignore))) + (should + (setq file-notify--test-desc1 + (file-notify-add-watch + file-notify--test-tmpfile1 '(change) #'ignore))) + ;; Remove `file-notify--test-desc' twice. + (file-notify-rm-watch file-notify--test-desc) + (file-notify-rm-watch file-notify--test-desc) + (file-notify-rm-watch file-notify--test-desc1) + (delete-file file-notify--test-tmpfile) + (delete-file file-notify--test-tmpfile1) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) + + ;; Cleanup. + (file-notify--test-cleanup)) + + (unwind-protect + ;; Check, that removing watch descriptors out of order do not + ;; harm. This fails on Cygwin because of timing issues unless a + ;; long `sit-for' is added before the call to + ;; `file-notify--test-read-event'. + (if (not (eq system-type 'cygwin)) + (let (results) + (cl-flet ((first-callback (event) + (when (eq (nth 1 event) 'deleted) (push 1 results))) + (second-callback (event) + (when (eq (nth 1 event) 'deleted) (push 2 results)))) + (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (should + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'first-callback))) + (should + (setq file-notify--test-desc1 + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'second-callback))) + ;; Remove first watch. + (file-notify-rm-watch file-notify--test-desc) + ;; Only the second callback shall run. + (file-notify--test-read-event) + (delete-file file-notify--test-tmpfile) + (file-notify--wait-for-events + (file-notify--test-timeout) results) + (should (equal results (list 2))) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)))) + + ;; Cleanup. + (file-notify--test-cleanup))) + +(file-notify--deftest-remote file-notify-test02-rm-watch + "Check `file-notify-rm-watch' for remote files.") + (defun file-notify--test-event-test () "Ert test function to be called by `file-notify--test-event-handler'. We cannot pass arguments, so we assume that `file-notify--test-event' @@ -284,33 +481,25 @@ and the event to `file-notify--test-events'." file-notify--test-results (append file-notify--test-results `(,result)))))) -(defun file-notify--test-make-temp-name () - "Create a temporary file name for test." - (expand-file-name - (make-temp-name "file-notify-test") temporary-file-directory)) - -(defmacro file-notify--wait-for-events (timeout until) - "Wait for and return file notification events until form UNTIL is true. -TIMEOUT is the maximum time to wait for, in seconds." - `(with-timeout (,timeout (ignore)) - (while (null ,until) - (read-event nil nil file-notify--test-read-event-timeout)))) - (defun file-notify--test-with-events-check (events) "Check whether received events match one of the EVENTS alternatives." (let (result) (dolist (elt events result) (setq result (or result - (equal elt (mapcar #'cadr file-notify--test-events))))))) + (if (eq (car elt) :random) + (equal (sort (cdr elt) 'string-lessp) + (sort (mapcar #'cadr file-notify--test-events) + 'string-lessp)) + (equal elt (mapcar #'cadr file-notify--test-events)))))))) (defun file-notify--test-with-events-explainer (events) "Explain why `file-notify--test-with-events-check' fails." (if (null (cdr events)) - (format "Received events `%s' do not match expected events `%s'" + (format "Received events do not match expected events\n%s\n%s" (mapcar #'cadr file-notify--test-events) (car events)) (format - "Received events `%s' do not match any sequence of expected events `%s'" + "Received events do not match any sequence of expected events\n%s\n%s" (mapcar #'cadr file-notify--test-events) events))) (put 'file-notify--test-with-events-check 'ert-explainer @@ -319,16 +508,26 @@ TIMEOUT is the maximum time to wait for, in seconds." (defmacro file-notify--test-with-events (events &rest body) "Run BODY collecting events and then compare with EVENTS. EVENTS is either a simple list of events, or a list of lists of -events, which represent different possible results. Don't wait -longer than timeout seconds for the events to be delivered." +events, which represent different possible results. The first +event of a list could be the pseudo event `:random', which is +just an indicator for comparison. + +Don't wait longer than timeout seconds for the events to be +delivered." (declare (indent 1)) `(let* ((events (if (consp (car ,events)) ,events (list ,events))) - (max-length (apply 'max (mapcar 'length events))) + (max-length + (apply + 'max + (mapcar + (lambda (x) (length (if (eq (car x) :random) (cdr x) x))) + events))) create-lockfiles) ;; Flush pending events. + (file-notify--test-read-event) (file-notify--wait-for-events (file-notify--test-timeout) - (input-pending-p)) + (not (input-pending-p))) (setq file-notify--test-events nil file-notify--test-results nil) ,@body @@ -345,32 +544,37 @@ longer than timeout seconds for the events to be delivered." ;; One of the possible event sequences shall match. (should (file-notify--test-with-events-check events)))) -(ert-deftest file-notify-test02-events () +(ert-deftest file-notify-test03-events () "Check file creation/change/removal notifications." (skip-unless (file-notify--test-local-enabled)) (unwind-protect (progn ;; Check file creation, change and deletion. It doesn't work - ;; for cygwin and kqueue, because we don't use an implicit - ;; directory monitor (kqueue), or the timings are too bad (cygwin). - (unless (or (eq system-type 'cygwin) - (string-equal (file-notify--test-library) "kqueue")) + ;; for kqueue, because we don't use an implicit directory + ;; monitor. + (unless (string-equal (file-notify--test-library) "kqueue") (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) (should (setq file-notify--test-desc (file-notify-add-watch file-notify--test-tmpfile - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond - ;; cygwin recognizes only `deleted' and `stopped' events. + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `created' event reliably. + ((string-equal + (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (created deleted stopped))) + ;; cygwin does not raise a `changed' event. ((eq system-type 'cygwin) - '(deleted stopped)) + '(created deleted stopped)) (t '(created changed deleted stopped))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) (file-notify-rm-watch file-notify--test-desc)) @@ -381,26 +585,20 @@ longer than timeout seconds for the events to be delivered." (setq file-notify--test-desc (file-notify-add-watch file-notify--test-tmpfile - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) - ;; inotify and kqueue raise just one `changed' event. - ((or (string-equal "inotify" (file-notify--test-library)) - (string-equal "kqueue" (file-notify--test-library))) - '(changed deleted stopped)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed deleted stopped) - (changed changed deleted stopped))) - (t '(changed changed deleted stopped))) - (read-event nil nil file-notify--test-read-event-timeout) + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `changed' event reliably. + ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (changed deleted stopped))) + ;; There could be one or two `changed' events. + (t '((changed deleted stopped) + (changed changed deleted stopped)))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) (file-notify-rm-watch file-notify--test-desc) @@ -414,26 +612,31 @@ longer than timeout seconds for the events to be delivered." file-notify--test-desc (file-notify-add-watch temporary-file-directory - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond ;; w32notify does not raise `deleted' and `stopped' ;; events for the watched directory. ((string-equal (file-notify--test-library) "w32notify") '(created changed deleted)) - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `created' event reliably. + ((string-equal + (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (created deleted stopped))) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for kqueue. + ;; the directory. Except for cygwin and kqueue. And + ;; cygwin does not raise a `changed' event. + ((eq system-type 'cygwin) + '(created deleted stopped)) ((string-equal (file-notify--test-library) "kqueue") '(created changed deleted stopped)) (t '(created changed deleted deleted stopped))) - (read-event nil nil file-notify--test-read-event-timeout) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) - (delete-directory temporary-file-directory 'recursive)) + (file-notify--test-read-event) + (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) ;; Check copy of files inside a directory. @@ -445,7 +648,7 @@ longer than timeout seconds for the events to be delivered." file-notify--test-desc (file-notify-add-watch temporary-file-directory - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond ;; w32notify does not distinguish between `changed' and @@ -455,27 +658,31 @@ longer than timeout seconds for the events to be delivered." '(created changed created changed changed changed changed deleted deleted)) - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `created' event reliably. + ((string-equal + (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (created created deleted stopped))) ;; There are three `deleted' events, for two files and - ;; for the directory. Except for kqueue. + ;; for the directory. Except for cygwin and kqueue. + ((eq system-type 'cygwin) + '(created created changed changed deleted stopped)) ((string-equal (file-notify--test-library) "kqueue") '(created changed created changed deleted stopped)) (t '(created changed created changed deleted deleted deleted stopped))) - (read-event nil nil file-notify--test-read-event-timeout) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; The next two events shall not be visible. - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-modes file-notify--test-tmpfile 000) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-times file-notify--test-tmpfile '(0 0)) - (read-event nil nil file-notify--test-read-event-timeout) - (delete-directory temporary-file-directory 'recursive)) + (file-notify--test-read-event) + (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) ;; Check rename of files inside a directory. @@ -487,29 +694,35 @@ longer than timeout seconds for the events to be delivered." file-notify--test-desc (file-notify-add-watch temporary-file-directory - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond ;; w32notify does not raise `deleted' and `stopped' ;; events for the watched directory. ((string-equal (file-notify--test-library) "w32notify") '(created changed renamed deleted)) - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `created' event reliably. + ((string-equal + (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (created deleted stopped))) ;; There are two `deleted' events, for the file and for - ;; the directory. Except for kqueue. + ;; the directory. Except for cygwin and kqueue. And + ;; cygwin raises `created' and `deleted' events instead + ;; of a `renamed' event. + ((eq system-type 'cygwin) + '(created created deleted deleted stopped)) ((string-equal (file-notify--test-library) "kqueue") '(created changed renamed deleted stopped)) (t '(created changed renamed deleted deleted stopped))) - (read-event nil nil file-notify--test-read-event-timeout) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) ;; After the rename, we won't get events anymore. - (read-event nil nil file-notify--test-read-event-timeout) - (delete-directory temporary-file-directory 'recursive)) + (file-notify--test-read-event) + (delete-directory temporary-file-directory 'recursive)) (file-notify-rm-watch file-notify--test-desc)) ;; Check attribute change. Does not work for cygwin. @@ -521,34 +734,39 @@ longer than timeout seconds for the events to be delivered." (setq file-notify--test-desc (file-notify-add-watch file-notify--test-tmpfile - '(attribute-change) 'file-notify--test-event-handler))) + '(attribute-change) #'file-notify--test-event-handler))) (file-notify--test-with-events (cond ;; w32notify does not distinguish between `changed' and - ;; `attribute-changed'. + ;; `attribute-changed'. Under MS Windows 7, we get + ;; four `changed' events, and under MS Windows 10 just + ;; two. Strange. ((string-equal (file-notify--test-library) "w32notify") - '(changed changed changed changed)) + '((changed changed) + (changed changed changed changed))) ;; For kqueue and in the remote case, `write-region' ;; raises also an `attribute-changed' event. ((or (string-equal (file-notify--test-library) "kqueue") (file-remote-p temporary-file-directory)) '(attribute-changed attribute-changed attribute-changed)) (t '(attribute-changed attribute-changed))) - (read-event nil nil file-notify--test-read-event-timeout) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-modes file-notify--test-tmpfile 000) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (set-file-times file-notify--test-tmpfile '(0 0)) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) - (file-notify-rm-watch file-notify--test-desc))) + (file-notify-rm-watch file-notify--test-desc)) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test02-events +(file-notify--deftest-remote file-notify-test03-events "Check file creation/change/removal notifications for remote files.") (require 'autorevert) @@ -556,17 +774,20 @@ longer than timeout seconds for the events to be delivered." auto-revert-remote-files t auto-revert-stop-on-user-input nil) -(ert-deftest file-notify-test03-autorevert () +(ert-deftest file-notify-test04-autorevert () "Check autorevert via file notification." (skip-unless (file-notify--test-local-enabled)) + ;; `auto-revert-buffers' runs every 5". And we must wait, until the ;; file has been reverted. (let ((timeout (if (file-remote-p temporary-file-directory) 60 10)) buf) (unwind-protect (progn + ;; In the remote case, `vc-refresh-state' returns undesired + ;; error messages. Let's suppress them. + (advice-add 'vc-refresh-state :around 'ignore) (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) (setq buf (find-file-noselect file-notify--test-tmpfile)) @@ -583,27 +804,30 @@ longer than timeout seconds for the events to be delivered." (while (null auto-revert-notify-watch-descriptor) (sleep-for 1))) + ;; `file-notify--test-monitor' needs to know + ;; `file-notify--test-desc' in order to compute proper + ;; timeouts. + (setq file-notify--test-desc auto-revert-notify-watch-descriptor) + ;; Check, that file notification has been used. (should auto-revert-mode) (should auto-revert-use-notify) (should auto-revert-notify-watch-descriptor) ;; Modify file. We wait for a second, in order to have - ;; another timestamp. - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (sleep-for 1) - (write-region - "another text" nil file-notify--test-tmpfile nil 'no-message) - - ;; Check, that the buffer has been reverted. - (with-current-buffer (get-buffer-create "*Messages*") - (file-notify--wait-for-events - timeout - (string-match + ;; another timestamp. + (ert-with-message-capture captured-messages + (sleep-for 1) + (write-region + "another text" nil file-notify--test-tmpfile nil 'no-message) + + ;; Check, that the buffer has been reverted. + (file-notify--wait-for-events + timeout + (string-match (format-message "Reverting buffer `%s'." (buffer-name buf)) - (buffer-string)))) - (should (string-match "another text" (buffer-string))) + captured-messages)) + (should (string-match "another text" (buffer-string)))) ;; Stop file notification. Autorevert shall still work via polling. (file-notify-rm-watch auto-revert-notify-watch-descriptor) @@ -614,31 +838,32 @@ longer than timeout seconds for the events to be delivered." ;; Modify file. We wait for two seconds, in order to ;; have another timestamp. One second seems to be too - ;; short. - (with-current-buffer (get-buffer-create "*Messages*") - (narrow-to-region (point-max) (point-max))) - (sleep-for 2) - (write-region - "foo bla" nil file-notify--test-tmpfile nil 'no-message) + ;; short. + (ert-with-message-capture captured-messages + (sleep-for 2) + (write-region + "foo bla" nil file-notify--test-tmpfile nil 'no-message) + + ;; Check, that the buffer has been reverted. + (file-notify--wait-for-events + timeout + (string-match + (format-message "Reverting buffer `%s'." (buffer-name buf)) + captured-messages)) + (should (string-match "foo bla" (buffer-string))))) - ;; Check, that the buffer has been reverted. - (with-current-buffer (get-buffer-create "*Messages*") - (file-notify--wait-for-events - timeout - (string-match - (format-message "Reverting buffer `%s'." (buffer-name buf)) - (buffer-string)))) - (should (string-match "foo bla" (buffer-string))))) + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. - (with-current-buffer "*Messages*" (widen)) + (advice-remove 'vc-refresh-state 'ignore) (ignore-errors (kill-buffer buf)) (file-notify--test-cleanup)))) -(file-notify--deftest-remote file-notify-test03-autorevert +(file-notify--deftest-remote file-notify-test04-autorevert "Check autorevert via file notification for remote files.") -(ert-deftest file-notify-test04-file-validity () +(ert-deftest file-notify-test05-file-validity () "Check `file-notify-valid-p' for files." (skip-unless (file-notify--test-local-enabled)) @@ -649,14 +874,16 @@ longer than timeout seconds for the events to be delivered." (should (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) #'file-notify--test-event-handler))) + file-notify--test-tmpfile '(change) #'ignore))) (should (file-notify-valid-p file-notify--test-desc)) ;; After calling `file-notify-rm-watch', the descriptor is not ;; valid anymore. (file-notify-rm-watch file-notify--test-desc) (should-not (file-notify-valid-p file-notify--test-desc)) - (delete-file file-notify--test-tmpfile)) + (delete-file file-notify--test-tmpfile) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup)) @@ -670,30 +897,27 @@ longer than timeout seconds for the events to be delivered." (file-notify-add-watch file-notify--test-tmpfile '(change) #'file-notify--test-event-handler))) + (should (file-notify-valid-p file-notify--test-desc)) (file-notify--test-with-events - (cond - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) - ;; inotify and kqueue raise just one `changed' event. - ((or (string-equal "inotify" (file-notify--test-library)) - (string-equal "kqueue" (file-notify--test-library))) - '(changed deleted stopped)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed deleted stopped) - (changed changed deleted stopped))) - (t '(changed changed deleted stopped))) - (should (file-notify-valid-p file-notify--test-desc)) - (read-event nil nil file-notify--test-read-event-timeout) + (cond + ;; gvfs-monitor-dir on cygwin does not detect the + ;; `changed' event reliably. + ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (changed deleted stopped))) + ;; There could be one or two `changed' events. + (t '((changed deleted stopped) + (changed changed deleted stopped)))) (write-region "another text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-file file-notify--test-tmpfile)) ;; After deleting the file, the descriptor is not valid anymore. (should-not (file-notify-valid-p file-notify--test-desc)) - (file-notify-rm-watch file-notify--test-desc)) + (file-notify-rm-watch file-notify--test-desc) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup)) @@ -707,50 +931,63 @@ longer than timeout seconds for the events to be delivered." (file-notify-add-watch temporary-file-directory '(change) #'file-notify--test-event-handler))) + (should (file-notify-valid-p file-notify--test-desc)) (file-notify--test-with-events (cond ;; w32notify does not raise `deleted' and `stopped' events ;; for the watched directory. ((string-equal (file-notify--test-library) "w32notify") '(created changed deleted)) - ;; cygwin recognizes only `deleted' and `stopped' events. - ((eq system-type 'cygwin) - '(deleted stopped)) + ;; gvfs-monitor-dir on cygwin does not detect the `created' + ;; event reliably. + ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe") + '((deleted stopped) + (created deleted stopped))) ;; There are two `deleted' events, for the file and for the - ;; directory. Except for kqueue. + ;; directory. Except for cygwin and kqueue. And cygwin + ;; does not raise a `changed' event. + ((eq system-type 'cygwin) + '(created deleted stopped)) ((string-equal (file-notify--test-library) "kqueue") '(created changed deleted stopped)) (t '(created changed deleted deleted stopped))) - (should (file-notify-valid-p file-notify--test-desc)) - (read-event nil nil file-notify--test-read-event-timeout) (write-region "any text" nil file-notify--test-tmpfile nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (delete-directory temporary-file-directory t)) ;; After deleting the parent directory, the descriptor must ;; not be valid anymore. - (should-not (file-notify-valid-p file-notify--test-desc))) + (should-not (file-notify-valid-p file-notify--test-desc)) + ;; w32notify doesn't generate `stopped' events when the parent + ;; directory is deleted, which doesn't provide a chance for + ;; filenotify.el to remove the descriptor from the internal + ;; hash table it maintains. So we must remove the descriptor + ;; manually. + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test04-file-validity +(file-notify--deftest-remote file-notify-test05-file-validity "Check `file-notify-valid-p' via file notification for remote files.") -(ert-deftest file-notify-test05-dir-validity () +(ert-deftest file-notify-test06-dir-validity () "Check `file-notify-valid-p' for directories." (skip-unless (file-notify--test-local-enabled)) (unwind-protect (progn - (setq file-notify--test-tmpfile - (file-name-as-directory (file-notify--test-make-temp-name))) - (make-directory file-notify--test-tmpfile) + (should + (setq file-notify--test-tmpfile + (make-temp-file "file-notify-test-parent" t))) (should (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) #'file-notify--test-event-handler))) + file-notify--test-tmpfile '(change) #'ignore))) (should (file-notify-valid-p file-notify--test-desc)) ;; After removing the watch, the descriptor must not be valid ;; anymore. @@ -758,21 +995,24 @@ longer than timeout seconds for the events to be delivered." (file-notify--wait-for-events (file-notify--test-timeout) (not (file-notify-valid-p file-notify--test-desc))) - (should-not (file-notify-valid-p file-notify--test-desc))) + (should-not (file-notify-valid-p file-notify--test-desc)) + (delete-directory file-notify--test-tmpfile t) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup)) (unwind-protect (progn - (setq file-notify--test-tmpfile - (file-name-as-directory (file-notify--test-make-temp-name))) - (make-directory file-notify--test-tmpfile) + (should + (setq file-notify--test-tmpfile + (make-temp-file "file-notify-test-parent" t))) (should (setq file-notify--test-desc (file-notify-add-watch - file-notify--test-tmpfile - '(change) #'file-notify--test-event-handler))) + file-notify--test-tmpfile '(change) #'ignore))) (should (file-notify-valid-p file-notify--test-desc)) ;; After deleting the directory, the descriptor must not be ;; valid anymore. @@ -780,28 +1020,32 @@ longer than timeout seconds for the events to be delivered." (file-notify--wait-for-events (file-notify--test-timeout) (not (file-notify-valid-p file-notify--test-desc))) - (should-not (file-notify-valid-p file-notify--test-desc))) + (should-not (file-notify-valid-p file-notify--test-desc)) + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test05-dir-validity +(file-notify--deftest-remote file-notify-test06-dir-validity "Check `file-notify-valid-p' via file notification for remote directories.") -(ert-deftest file-notify-test06-many-events () +(ert-deftest file-notify-test07-many-events () "Check that events are not dropped." :tags '(:expensive-test) (skip-unless (file-notify--test-local-enabled)) - ;; Under cygwin events arrive in random order. Impossible to define a test. - (skip-unless (not (eq system-type 'cygwin))) - (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (make-directory file-notify--test-tmpfile) + (should + (setq file-notify--test-tmpfile + (make-temp-file "file-notify-test-parent" t))) (should (setq file-notify--test-desc (file-notify-add-watch file-notify--test-tmpfile - '(change) 'file-notify--test-event-handler))) + '(change) #'file-notify--test-event-handler))) (unwind-protect (let ((n 1000) source-file-list target-file-list @@ -820,9 +1064,9 @@ longer than timeout seconds for the events to be delivered." (let ((source-file-list source-file-list) (target-file-list target-file-list)) (while (and source-file-list target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (write-region "" nil (pop source-file-list) nil 'no-message) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (write-region "" nil (pop target-file-list) nil 'no-message)))) (file-notify--test-with-events (cond @@ -831,24 +1075,36 @@ longer than timeout seconds for the events to be delivered." (let (r) (dotimes (_i n r) (setq r (append '(deleted renamed) r))))) + ;; cygwin fires `changed' and `deleted' events, sometimes + ;; in random order. + ((eq system-type 'cygwin) + (let (r) + (dotimes (_i n (cons :random r)) + (setq r (append '(changed deleted) r))))) (t (make-list n 'renamed))) (let ((source-file-list source-file-list) (target-file-list target-file-list)) (while (and source-file-list target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) + (file-notify--test-read-event) (rename-file (pop source-file-list) (pop target-file-list) t)))) (file-notify--test-with-events (make-list n 'deleted) (dolist (file target-file-list) - (read-event nil nil file-notify--test-read-event-timeout) - (delete-file file) file-notify--test-read-event-timeout))) + (file-notify--test-read-event) + (delete-file file))) + (delete-directory file-notify--test-tmpfile) + (if (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc)) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test06-many-events +(file-notify--deftest-remote file-notify-test07-many-events "Check that events are not dropped for remote directories.") -(ert-deftest file-notify-test07-backup () +(ert-deftest file-notify-test08-backup () "Check that backup keeps file notification." (skip-unless (file-notify--test-local-enabled)) @@ -863,18 +1119,9 @@ longer than timeout seconds for the events to be delivered." '(change) #'file-notify--test-event-handler))) (should (file-notify-valid-p file-notify--test-desc)) (file-notify--test-with-events - (cond - ;; For w32notify and in the remote case, there are two - ;; `changed' events. - ((or (string-equal (file-notify--test-library) "w32notify") - (file-remote-p temporary-file-directory)) - '(changed changed)) - ;; gfilenotify raises one or two `changed' events - ;; randomly, no chance to test. So we accept both cases. - ((string-equal "gfilenotify" (file-notify--test-library)) - '((changed) - (changed changed))) - (t '(changed))) + ;; There could be one or two `changed' events. + '((changed) + (changed changed)) ;; There shouldn't be any problem, because the file is kept. (with-temp-buffer (let ((buffer-file-name file-notify--test-tmpfile) @@ -886,48 +1133,57 @@ longer than timeout seconds for the events to be delivered." (save-buffer)))) ;; After saving the buffer, the descriptor is still valid. (should (file-notify-valid-p file-notify--test-desc)) - (delete-file file-notify--test-tmpfile)) + (delete-file file-notify--test-tmpfile) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup)) (unwind-protect - (progn - ;; It doesn't work for kqueue, because we don't use an - ;; implicit directory monitor. - (unless (string-equal (file-notify--test-library) "kqueue") - (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) - (write-region - "any text" nil file-notify--test-tmpfile nil 'no-message) - (should - (setq file-notify--test-desc - (file-notify-add-watch - file-notify--test-tmpfile - '(change) #'file-notify--test-event-handler))) - (should (file-notify-valid-p file-notify--test-desc)) - (file-notify--test-with-events '(renamed created changed) - ;; The file is renamed when creating a backup. It shall - ;; still be watched. - (with-temp-buffer - (let ((buffer-file-name file-notify--test-tmpfile) - (make-backup-files t) - (backup-by-copying nil) - (backup-by-copying-when-mismatch nil) - (kept-new-versions 1) - (delete-old-versions t)) - (insert "another text") - (save-buffer)))) - ;; After saving the buffer, the descriptor is still valid. - (should (file-notify-valid-p file-notify--test-desc)) - (delete-file file-notify--test-tmpfile))) + ;; It doesn't work for kqueue, because we don't use an implicit + ;; directory monitor. + (unless (string-equal (file-notify--test-library) "kqueue") + (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) + (write-region + "any text" nil file-notify--test-tmpfile nil 'no-message) + (should + (setq file-notify--test-desc + (file-notify-add-watch + file-notify--test-tmpfile + '(change) #'file-notify--test-event-handler))) + (should (file-notify-valid-p file-notify--test-desc)) + (file-notify--test-with-events + (cond + ;; On cygwin we only get the `changed' event. + ((eq system-type 'cygwin) '(changed)) + (t '(renamed created changed))) + ;; The file is renamed when creating a backup. It shall + ;; still be watched. + (with-temp-buffer + (let ((buffer-file-name file-notify--test-tmpfile) + (make-backup-files t) + (backup-by-copying nil) + (backup-by-copying-when-mismatch nil) + (kept-new-versions 1) + (delete-old-versions t)) + (insert "another text") + (save-buffer)))) + ;; After saving the buffer, the descriptor is still valid. + (should (file-notify-valid-p file-notify--test-desc)) + (delete-file file-notify--test-tmpfile) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test07-backup +(file-notify--deftest-remote file-notify-test08-backup "Check that backup keeps file notification for remote files.") -(ert-deftest file-notify-test08-watched-file-in-watched-dir () +(ert-deftest file-notify-test09-watched-file-in-watched-dir () "Watches a directory and a file in that directory separately. Checks that the callbacks are only called with events with descriptors that were issued when registering the watches. This @@ -960,7 +1216,9 @@ the file watch." (setq file-notify--test-desc1 (file-notify-add-watch file-notify--test-tmpfile - '(change) #'dir-callback))) + '(change) #'dir-callback) + ;; This is needed for `file-notify--test-monitor'. + file-notify--test-desc file-notify--test-desc1)) (should (setq file-notify--test-desc2 (file-notify-add-watch @@ -969,58 +1227,51 @@ the file watch." (should (file-notify-valid-p file-notify--test-desc1)) (should (file-notify-valid-p file-notify--test-desc2)) (should-not (equal file-notify--test-desc1 file-notify--test-desc2)) - ;; gfilenotify raises one or two `changed' events randomly in - ;; the file monitor, no chance to test. - (unless (string-equal "gfilenotify" (file-notify--test-library)) - (let ((n 100) events) - ;; Compute the expected events. - (dotimes (_i (/ n 2)) - (setq events - (append - (append - ;; Directory monitor and file monitor. - (cond - ;; In the remote case, there are two `changed' - ;; events. - ((file-remote-p temporary-file-directory) - '(changed changed changed changed)) - ;; The directory monitor in kqueue does not - ;; raise any `changed' event. Just the file - ;; monitor event is received. - ((string-equal (file-notify--test-library) "kqueue") - '(changed)) - ;; Otherwise, both monitors report the - ;; `changed' event. - (t '(changed changed))) - ;; Just the directory monitor. - (cond - ;; In kqueue, there is an additional `changed' - ;; event. Why? - ((string-equal (file-notify--test-library) "kqueue") - '(changed created changed)) - (t '(created changed)))) - events))) - - ;; Run the test. - (file-notify--test-with-events events - (dotimes (i n) - (read-event nil nil file-notify--test-read-event-timeout) - (if (zerop (mod i 2)) - (write-region - "any text" nil file-notify--test-tmpfile1 t 'no-message) - (let ((temporary-file-directory file-notify--test-tmpfile)) - (write-region - "any text" nil - (file-notify--test-make-temp-name) nil 'no-message))))))) + (let ((n 100)) + ;; Run the test. + (file-notify--test-with-events + ;; There could be one or two `changed' events. + (list + ;; cygwin. + (append + '(:random) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)) + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed)) + (append + '(:random) + ;; Directory monitor and file monitor. + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + (make-list (/ n 2) 'changed) + ;; Just the directory monitor. + (make-list (/ n 2) 'created) + (make-list (/ n 2) 'changed))) + (dotimes (i n) + (file-notify--test-read-event) + (if (zerop (mod i 2)) + (write-region + "any text" nil file-notify--test-tmpfile1 t 'no-message) + (let ((temporary-file-directory file-notify--test-tmpfile)) + (write-region + "any text" nil + (file-notify--test-make-temp-name) nil 'no-message)))))) ;; If we delete the file, the directory monitor shall still be ;; active. We receive the `deleted' event from both the ;; directory and the file monitor. The `stopped' event is ;; from the file monitor. It's undecided in which order the ;; the directory and the file monitor are triggered. - (file-notify--test-with-events - '((deleted deleted stopped) - (deleted stopped deleted)) + (file-notify--test-with-events '(:random deleted deleted stopped) (delete-file file-notify--test-tmpfile1)) (should (file-notify-valid-p file-notify--test-desc1)) (should-not (file-notify-valid-p file-notify--test-desc2)) @@ -1028,9 +1279,10 @@ the file watch." ;; Now we delete the directory. (file-notify--test-with-events (cond - ;; In kqueue, just one `deleted' event for the directory - ;; is received. - ((string-equal (file-notify--test-library) "kqueue") + ;; In kqueue and for cygwin, just one `deleted' event for + ;; the directory is received. + ((or (eq system-type 'cygwin) + (string-equal (file-notify--test-library) "kqueue")) '(deleted stopped)) (t (append ;; The directory monitor raises a `deleted' event for @@ -1050,13 +1302,63 @@ the file watch." (t '(deleted stopped)))))) (delete-directory file-notify--test-tmpfile 'recursive)) (should-not (file-notify-valid-p file-notify--test-desc1)) - (should-not (file-notify-valid-p file-notify--test-desc2))) + (should-not (file-notify-valid-p file-notify--test-desc2)) + (when (string-equal (file-notify--test-library) "w32notify") + (file-notify--rm-descriptor file-notify--test-desc1) + (file-notify--rm-descriptor file-notify--test-desc2)) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) + + ;; Cleanup. + (file-notify--test-cleanup))) + +(file-notify--deftest-remote file-notify-test09-watched-file-in-watched-dir + "Check `file-notify-test09-watched-file-in-watched-dir' for remote files.") + +(ert-deftest file-notify-test10-sufficient-resources () + "Check that file notification does not use too many resources." + :tags '(:expensive-test) + (skip-unless (file-notify--test-local-enabled)) + ;; This test is intended for kqueue only. + (skip-unless (string-equal (file-notify--test-library) "kqueue")) + + (should + (setq file-notify--test-tmpfile + (make-temp-file "file-notify-test-parent" t))) + (unwind-protect + (let ((temporary-file-directory file-notify--test-tmpfile) + descs) + (should-error + (while t + ;; We watch directories, because we want to reach the upper + ;; limit. Watching a file might not be sufficient, because + ;; most of the libraries implement this as watching the + ;; upper directory. + (setq file-notify--test-tmpfile1 + (make-temp-file "file-notify-test-parent" t) + descs + (cons + (should + (file-notify-add-watch + file-notify--test-tmpfile1 '(change) #'ignore)) + descs))) + :type 'file-notify-error) + ;; Remove watches. If we don't do it prior removing + ;; directories, Emacs crashes in batch mode. + (dolist (desc descs) + (file-notify-rm-watch desc)) + ;; Remove directories. + (delete-directory file-notify--test-tmpfile 'recursive) + + ;; The environment shall be cleaned up. + (file-notify--test-cleanup-p)) ;; Cleanup. (file-notify--test-cleanup))) -(file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir - "Check `file-notify-test08-watched-file-in-watched-dir' for remote files.") +(file-notify--deftest-remote file-notify-test10-sufficient-resources + "Check `file-notify-test10-sufficient-resources' for remote files.") (defun file-notify-test-all (&optional interactive) "Run all tests for \\[file-notify]." @@ -1071,9 +1373,10 @@ the file watch." ;; the missing directory monitor. ;; * For w32notify, no `deleted' and `stopped' events arrive when a ;; directory is removed. -;; * For w32notify, no `attribute-changed' events arrive. Its sends -;; `changed' events instead. -;; * Check, why cygwin recognizes only `deleted' and `stopped' events. +;; * For cygwin and w32notify, no `attribute-changed' events arrive. +;; They send `changed' events instead. +;; * cygwin does not send all expected `changed' and `deleted' events. +;; Probably due to timing issues. (provide 'file-notify-tests) -;;; file-notify-tests.el ends here +;;; filenotify-tests.el ends here diff --git a/test/automated/files.el b/test/lisp/files-tests.el index 6abb4b43e1e..4583b1af3c3 100644 --- a/test/automated/files.el +++ b/test/lisp/files-tests.el @@ -1,4 +1,4 @@ -;;; files.el --- tests for file handling. +;;; files-tests.el --- tests for files.el. -*- lexical-binding: t; -*- ;; Copyright (C) 2012-2017 Free Software Foundation, Inc. @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) +(require 'nadvice) ;; Set to t if the local variable was set, `query' if the query was ;; triggered. @@ -169,4 +170,148 @@ form.") ;; Stop the above "Local Var..." confusing Emacs. -;;; files.el ends here +(ert-deftest files-test-bug-21454 () + "Test for http://debbugs.gnu.org/21454 ." + :expected-result :failed + (let ((input-result + '(("/foo/bar//baz/:/bar/foo/baz//" nil ("/foo/bar/baz/" "/bar/foo/baz/")) + ("/foo/bar/:/bar/qux/:/qux/foo" nil ("/foo/bar/" "/bar/qux/" "/qux/foo/")) + ("//foo/bar/:/bar/qux/:/qux/foo/" nil ("/foo/bar/" "/bar/qux/" "/qux/foo/")) + ("/foo/bar/:/bar/qux/:/qux/foo/" nil ("/foo/bar/" "/bar/qux/" "/qux/foo/")) + ("/foo//bar/:/bar/qux/:/qux/foo/" nil ("/foo/bar/" "/bar/qux/" "/qux/foo/")) + ("/foo//bar/:/bar/qux/:/qux/foo" nil ("/foo/bar/" "/bar/qux/" "/qux/foo/")) + ("/foo/bar" "$FOO/baz/:/qux/foo/" ("/foo/bar/baz/" "/qux/foo/")) + ("//foo/bar/" "$FOO/baz/:/qux/foo/" ("/foo/bar/baz/" "/qux/foo/")))) + (foo-env (getenv "FOO")) + (bar-env (getenv "BAR"))) + (unwind-protect + (dolist (test input-result) + (let ((foo (nth 0 test)) + (bar (nth 1 test)) + (res (nth 2 test))) + (setenv "FOO" foo) + (if bar + (progn + (setenv "BAR" bar) + (should (equal res (parse-colon-path (getenv "BAR"))))) + (should (equal res (parse-colon-path "$FOO")))))) + (setenv "FOO" foo-env) + (setenv "BAR" bar-env)))) + +(ert-deftest files-test--save-buffers-kill-emacs--confirm-kill-processes () + "Test that `save-buffers-kill-emacs' honors +`confirm-kill-processes'." + (cl-letf* ((yes-or-no-p-prompts nil) + ((symbol-function #'yes-or-no-p) + (lambda (prompt) + (push prompt yes-or-no-p-prompts) + nil)) + (kill-emacs-args nil) + ((symbol-function #'kill-emacs) + (lambda (&optional arg) (push arg kill-emacs-args))) + (process + (make-process + :name "sleep" + :command (list + (expand-file-name invocation-name invocation-directory) + "-batch" "-Q" "-eval" "(sleep-for 1000)"))) + (confirm-kill-processes nil)) + (save-buffers-kill-emacs) + (kill-process process) + (should-not yes-or-no-p-prompts) + (should (equal kill-emacs-args '(nil))))) + +(ert-deftest files-test-read-file-in-~ () + "Test file prompting in directory named '~'. +If we are in a directory named '~', the default value should not +be $HOME." + (cl-letf (((symbol-function 'completing-read) + (lambda (_prompt _coll &optional _pred _req init _hist def _) + (or def init))) + (dir (make-temp-file "read-file-name-test" t))) + (unwind-protect + (let ((subdir (expand-file-name "./~/" dir))) + (make-directory subdir t) + (with-temp-buffer + (setq default-directory subdir) + (should-not (equal + (expand-file-name (read-file-name "File: ")) + (expand-file-name "~/"))) + ;; Don't overquote either! + (setq default-directory (concat "/:" subdir)) + (should-not (equal + (expand-file-name (read-file-name "File: ")) + (concat "/:/:" subdir))))) + (delete-directory dir 'recursive)))) + +(ert-deftest files-tests--file-name-non-special--subprocess () + "Check that Bug#25949 is fixed." + (skip-unless (executable-find "true")) + (should (eq (let ((default-directory "/:/")) (process-file "true")) 0)) + (should (processp (let ((default-directory "/:/")) + (start-file-process "foo" nil "true")))) + (should (eq (let ((default-directory "/:/")) (shell-command "true")) 0))) + +(defmacro files-tests--with-advice (symbol where function &rest body) + (declare (indent 3)) + (cl-check-type symbol symbol) + (cl-check-type where keyword) + (cl-check-type function function) + (macroexp-let2 nil function function + `(progn + (advice-add #',symbol ,where ,function) + (unwind-protect + (progn ,@body) + (advice-remove #',symbol ,function))))) + +(defmacro files-tests--with-temp-file (name &rest body) + (declare (indent 1)) + (cl-check-type name symbol) + `(let ((,name (make-temp-file "emacs"))) + (unwind-protect + (progn ,@body) + (delete-file ,name)))) + +(ert-deftest files-tests--file-name-non-special--buffers () + "Check that Bug#25951 is fixed. +We call `verify-visited-file-modtime' on a buffer visiting a file +with a quoted name. We use two different variants: first with +the buffer current and a nil argument, second passing the buffer +object explicitly. In both cases no error should be raised and +the `file-name-non-special' handler for quoted file names should +be invoked with the right arguments." + (files-tests--with-temp-file temp-file-name + (with-temp-buffer + (let* ((buffer-visiting-file (current-buffer)) + (actual-args ()) + (log (lambda (&rest args) (push args actual-args)))) + (insert-file-contents (concat "/:" temp-file-name) :visit) + (should (stringp buffer-file-name)) + (should (string-prefix-p "/:" buffer-file-name)) + (should (consp (visited-file-modtime))) + (should (equal (find-file-name-handler buffer-file-name + #'verify-visited-file-modtime) + #'file-name-non-special)) + (files-tests--with-advice file-name-non-special :before log + ;; This should call the file name handler with the right + ;; buffer and not signal an error. The file hasn't been + ;; modified, so `verify-visited-file-modtime' should return + ;; t. + (should (equal (verify-visited-file-modtime) t)) + (with-temp-buffer + (should (stringp (buffer-file-name buffer-visiting-file))) + ;; This should call the file name handler with the right + ;; buffer and not signal an error. The file hasn't been + ;; modified, so `verify-visited-file-modtime' should return + ;; t. + (should (equal (verify-visited-file-modtime buffer-visiting-file) + t)))) + ;; Verify that the handler was actually called. We called + ;; `verify-visited-file-modtime' twice, so both calls should be + ;; recorded in reverse order. + (should (equal actual-args + `((verify-visited-file-modtime ,buffer-visiting-file) + (verify-visited-file-modtime nil)))))))) + +(provide 'files-tests) +;;; files-tests.el ends here diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el new file mode 100644 index 00000000000..21d0087ebcf --- /dev/null +++ b/test/lisp/files-x-tests.el @@ -0,0 +1,333 @@ +;;; files-x-tests.el --- tests for files-x.el. + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Michael Albinus <michael.albinus@gmx.de> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'files-x) + +(defconst files-x-test--variables1 + '((remote-shell-file-name . "/bin/bash") + (remote-shell-command-switch . "-c") + (remote-shell-interactive-switch . "-i") + (remote-shell-login-switch . "-l"))) +(defconst files-x-test--variables2 + '((remote-shell-file-name . "/bin/ksh"))) +(defconst files-x-test--variables3 + '((remote-null-device . "/dev/null"))) +(defconst files-x-test--variables4 + '((remote-null-device . "null"))) + +(defconst files-x-test--application '(:application 'my-application)) +(defconst files-x-test--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")) + +(defvar files-x-test--criteria nil) +(defconst files-x-test--criteria1 + (append files-x-test--application files-x-test--protocol + files-x-test--user files-x-test--machine)) +(defconst files-x-test--criteria2 + (append files-x-test--another-application files-x-test--protocol + files-x-test--user files-x-test--machine)) + +(ert-deftest files-x-test-connection-local-set-profile-variables () + "Test setting connection-local profile variables." + + ;; Declare (PROFILE VARIABLES) objects. + (let (connection-local-profile-alist connection-local-criteria-alist) + (connection-local-set-profile-variables + 'remote-bash files-x-test--variables1) + (should + (equal + (connection-local-get-profile-variables 'remote-bash) + files-x-test--variables1)) + + (connection-local-set-profile-variables + 'remote-ksh files-x-test--variables2) + (should + (equal + (connection-local-get-profile-variables 'remote-ksh) + files-x-test--variables2)) + + (connection-local-set-profile-variables + 'remote-nullfile files-x-test--variables3) + (should + (equal + (connection-local-get-profile-variables 'remote-nullfile) + files-x-test--variables3)) + + ;; A redefinition overwrites existing values. + (connection-local-set-profile-variables + 'remote-nullfile files-x-test--variables4) + (should + (equal + (connection-local-get-profile-variables 'remote-nullfile) + files-x-test--variables4)))) + +(ert-deftest files-x-test-connection-local-set-profiles () + "Test setting connection-local profiles." + + ;; Declare (CRITERIA PROFILES) objects. + (let (connection-local-profile-alist connection-local-criteria-alist) + (connection-local-set-profile-variables + 'remote-bash files-x-test--variables1) + (connection-local-set-profile-variables + 'remote-ksh files-x-test--variables2) + (connection-local-set-profile-variables + 'remote-nullfile files-x-test--variables3) + + ;; Use a criteria with all properties. + (setq files-x-test--criteria + (append files-x-test--application files-x-test--protocol + files-x-test--user files-x-test--machine)) + ;; An empty variable list is accepted (but makes no sense). + (connection-local-set-profiles files-x-test--criteria) + (should-not (connection-local-get-profiles files-x-test--criteria)) + (connection-local-set-profiles + files-x-test--criteria 'remote-bash 'remote-ksh) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-bash remote-ksh))) + ;; Changing the order of properties doesn't matter. + (setq files-x-test--criteria + (append files-x-test--protocol files-x-test--application + files-x-test--machine files-x-test--user)) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-bash remote-ksh))) + ;; A further call adds profiles. + (connection-local-set-profiles files-x-test--criteria 'remote-nullfile) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-bash remote-ksh remote-nullfile))) + ;; Adding existing profiles doesn't matter. + (connection-local-set-profiles + files-x-test--criteria 'remote-bash 'remote-nullfile) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-bash remote-ksh remote-nullfile))) + + ;; Use a criteria without application. + (setq files-x-test--criteria + (append files-x-test--protocol + files-x-test--user files-x-test--machine)) + (connection-local-set-profiles files-x-test--criteria 'remote-ksh) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-ksh))) + ;; An application not used in any registered criteria matches also this. + (setq files-x-test--criteria + (append files-x-test--another-application files-x-test--protocol + files-x-test--user files-x-test--machine)) + (should + (equal + (connection-local-get-profiles files-x-test--criteria) + '(remote-ksh))) + + ;; Using a nil criteria also works. Duplicate profiles are trashed. + (connection-local-set-profiles + nil 'remote-bash 'remote-ksh 'remote-ksh 'remote-bash) + (should + (equal + (connection-local-get-profiles nil) + '(remote-bash remote-ksh))) + + ;; A criteria other than plist is wrong. + (should-error (connection-local-set-profiles 'dummy)))) + +(ert-deftest files-x-test-hack-connection-local-variables-apply () + "Test setting connection-local variables." + + (let (connection-local-profile-alist connection-local-criteria-alist) + + (connection-local-set-profile-variables + 'remote-bash files-x-test--variables1) + (connection-local-set-profile-variables + 'remote-ksh files-x-test--variables2) + (connection-local-set-profile-variables + 'remote-nullfile files-x-test--variables3) + + (connection-local-set-profiles + files-x-test--criteria1 'remote-bash 'remote-ksh) + (connection-local-set-profiles + files-x-test--criteria2 'remote-ksh 'remote-nullfile) + + ;; Apply the variables. + (with-temp-buffer + (let ((enable-connection-local-variables t)) + (should-not connection-local-variables-alist) + (should-not (local-variable-p 'remote-shell-file-name)) + (should-not (boundp 'remote-shell-file-name)) + (hack-connection-local-variables-apply files-x-test--criteria1) + ;; All connection-local variables are set. They apply in + ;; reverse order in `connection-local-variables-alist'. The + ;; settings from `remote-ksh' are not contained, because they + ;; declare same variables as in `remote-bash'. + (should + (equal connection-local-variables-alist + (nreverse (copy-tree files-x-test--variables1)))) + ;; The variables exist also as local variables. + (should (local-variable-p 'remote-shell-file-name)) + ;; The proper variable value is set. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash")))) + + ;; The second test case. + (with-temp-buffer + (let ((enable-connection-local-variables t)) + (should-not connection-local-variables-alist) + (should-not (local-variable-p 'remote-shell-file-name)) + (should-not (boundp 'remote-shell-file-name)) + (hack-connection-local-variables-apply files-x-test--criteria2) + ;; 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)) + ;; The proper variable value is set. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")))) + + ;; The third test case. Both criteria `files-x-test--criteria1' + ;; and `files-x-test--criteria2' apply, but there are no double + ;; entries. + (connection-local-set-profiles + nil 'remote-bash 'remote-ksh) + (with-temp-buffer + (let ((enable-connection-local-variables t)) + (should-not connection-local-variables-alist) + (should-not (local-variable-p 'remote-shell-file-name)) + (should-not (boundp 'remote-shell-file-name)) + (hack-connection-local-variables-apply nil) + ;; All connection-local variables are set. They apply in + ;; reverse order in `connection-local-variables-alist'. The + ;; settings from `remote-ksh' are not contained, because they + ;; declare same variables as in `remote-bash'. + (should + (equal connection-local-variables-alist + (nreverse (copy-tree files-x-test--variables1)))) + ;; The variables exist also as local variables. + (should (local-variable-p 'remote-shell-file-name)) + ;; The proper variable value is set. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash")))) + + ;; When `enable-connection-local-variables' is nil, nothing happens. + (with-temp-buffer + (let ((enable-connection-local-variables nil)) + (should-not connection-local-variables-alist) + (should-not (local-variable-p 'remote-shell-file-name)) + (should-not (boundp 'remote-shell-file-name)) + (hack-connection-local-variables-apply nil) + (should-not connection-local-variables-alist) + (should-not (local-variable-p 'remote-shell-file-name)) + (should-not (boundp 'remote-shell-file-name)))))) + +(ert-deftest files-x-test-with-connection-local-profiles () + "Test setting connection-local variables." + + (let (connection-local-profile-alist connection-local-criteria-alist) + (connection-local-set-profile-variables + 'remote-bash files-x-test--variables1) + (connection-local-set-profile-variables + 'remote-ksh files-x-test--variables2) + (connection-local-set-profile-variables + 'remote-nullfile files-x-test--variables3) + + (connection-local-set-profiles + 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)) + + ;; Use the macro. + (with-connection-local-profiles '(remote-bash remote-ksh) + ;; All connection-local variables are set. They apply in + ;; reverse order in `connection-local-variables-alist'. + ;; This variable keeps only the variables to be set inside + ;; the macro. + (should + (equal connection-local-variables-alist + (nreverse (copy-tree files-x-test--variables1)))) + ;; The variables exist also as local variables. + (should (local-variable-p 'remote-shell-file-name)) + (should (local-variable-p 'remote-shell-command-switch)) + ;; The proper variable values are set. The settings from + ;; `remote-bash' overwrite the same variables as in + ;; `remote-ksh'. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash")) + (should + (string-equal (symbol-value 'remote-shell-command-switch) "-c"))) + + ;; Everything is rewound. The old variable values are reset. + (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. The settings from + ;; `remote-ksh' are back. + (should + (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh")) + (should + (string-equal (symbol-value 'remote-null-device) "/dev/null")) + + ;; The variable set temporarily is not unbound, again. + (should-not (local-variable-p 'remote-shell-command-switch)))))) + +(provide 'files-x-tests) +;;; files-x-tests.el ends here diff --git a/test/automated/gnus-tests.el b/test/lisp/gnus/gnus-tests.el index 47c49b38c42..47c49b38c42 100644 --- a/test/automated/gnus-tests.el +++ b/test/lisp/gnus/gnus-tests.el diff --git a/test/automated/message-mode-tests.el b/test/lisp/gnus/message-tests.el index a34ea8045a8..40367251420 100644 --- a/test/automated/message-mode-tests.el +++ b/test/lisp/gnus/message-tests.el @@ -55,6 +55,49 @@ (point))))) (set-buffer-modified-p nil)))) + +(ert-deftest message-strip-subject-trailing-was () + (cl-letf (((symbol-function 'message-talkative-question) nil)) + (with-temp-buffer + (let ((no-was "Re: Foo ") + (with-was "Re: Foo \t (was: Bar ) ") + (stripped-was "Re: Foo") + reply) + + ;; Test unconditional stripping + (setq-local message-subject-trailing-was-query t) + (should (string= no-was (message-strip-subject-trailing-was no-was))) + (should (string= stripped-was + (message-strip-subject-trailing-was with-was))) + + ;; Test asking + (setq-local message-subject-trailing-was-query 'ask) + (fset 'message-talkative-question + (lambda (_ question show text) + (should (string= "Strip `(was: <old subject>)' in subject? " + question)) + (should show) + (should (string-match + (concat + "Strip `(was: <old subject>)' in subject " + "and use the new one instead\\?\n\n" + "Current subject is: \"\\(.*\\)\"\n\n" + "New subject would be: \"\\(.*\\)\"\n\n" + "See the variable " + "`message-subject-trailing-was-query' " + "to get rid of this query.") + text)) + (should (string= (match-string 1 text) with-was)) + (should (string= (match-string 2 text) stripped-was)) + reply)) + (message-strip-subject-trailing-was with-was) + (should (string= with-was + (message-strip-subject-trailing-was with-was))) + (setq reply t) + (should (string= stripped-was + (message-strip-subject-trailing-was with-was))))))) + + (provide 'message-mode-tests) ;;; message-mode-tests.el ends here diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el new file mode 100644 index 00000000000..0ab6c3cae76 --- /dev/null +++ b/test/lisp/help-fns-tests.el @@ -0,0 +1,121 @@ +;;; help-fns.el --- tests for help-fns.el + +;; Copyright (C) 2014-2017 Free Software Foundation, Inc. + +;; Maintainer: emacs-devel@gnu.org + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(autoload 'help-fns-test--macro "help-fns" nil nil t) + + +;;; Several tests for describe-function + +(defun help-fns-tests--describe-function (func) + "Helper function for `describe-function' tests. +FUNC is the function to describe, a symbol. +Return first line of the output of (describe-function-1 FUNC)." + (let ((string (with-output-to-string + (describe-function-1 func)))) + (string-match "\\(.+\\)\n" string) + (match-string-no-properties 1 string))) + +(ert-deftest help-fns-test-bug17410 () + "Test for http://debbugs.gnu.org/17410 ." + (let ((regexp "autoloaded Lisp macro") + (result (help-fns-tests--describe-function 'help-fns-test--macro))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-built-in () + (let ((regexp "a built-in function in .C source code") + (result (help-fns-tests--describe-function 'mapcar))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-interactive-built-in () + (let ((regexp "an interactive built-in function in .C source code") + (result (help-fns-tests--describe-function 're-search-forward))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-lisp-macro () + (let ((regexp "a Lisp macro in .subr\.el") + (result (help-fns-tests--describe-function 'when))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-lisp-defun () + (let ((regexp "a compiled Lisp function in .subr\.el") + (result (help-fns-tests--describe-function 'last))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-lisp-defsubst () + (let ((regexp "a compiled Lisp function in .subr\.el") + (result (help-fns-tests--describe-function 'posn-window))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-alias-to-defun () + (let ((regexp "an alias for .set-file-modes. in .subr\.el") + (result (help-fns-tests--describe-function 'chmod))) + (should (string-match regexp result)))) + +(ert-deftest help-fns-test-bug23887 () + "Test for http://debbugs.gnu.org/23887 ." + (let ((regexp "an alias for .re-search-forward. in .subr\.el") + (result (help-fns-tests--describe-function 'search-forward-regexp))) + (should (string-match regexp result)))) + + +;;; Test describe-function over functions with funny names +(defun abc\\\[universal-argument\]b\`c\'d\\e\"f (x) + "A function with a funny name. + +\(fn XYZZY)" + x) + +(defun defgh\\\[universal-argument\]b\`c\'d\\e\"f (x) + "Another function with a funny name." + x) + +(ert-deftest help-fns-test-funny-names () + "Test for help with functions with funny names." + (describe-function 'abc\\\[universal-argument\]b\`c\'d\\e\"f) + (with-current-buffer "*Help*" + (goto-char (point-min)) + (should (search-forward + "(abc\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f XYZZY)"))) + (describe-function 'defgh\\\[universal-argument\]b\`c\'d\\e\"f) + (with-current-buffer "*Help*" + (goto-char (point-min)) + (should (search-forward + "(defgh\\\\\\[universal-argument\\]b\\`c\\'d\\\\e\\\"f X)")))) + + +;;; Test for describe-symbol +(ert-deftest help-fns-test-describe-symbol () + "Test the `describe-symbol' function." + ;; 'describe-symbol' would originally signal an error for + ;; 'font-lock-comment-face'. + (describe-symbol 'font-lock-comment-face) + (with-current-buffer "*Help*" + (should (> (point-max) 1)) + (goto-char (point-min)) + (should (looking-at "^font-lock-comment-face is ")))) + +;;; help-fns.el ends here diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el new file mode 100644 index 00000000000..2cb662cfaca --- /dev/null +++ b/test/lisp/hi-lock-tests.el @@ -0,0 +1,40 @@ +;;; hi-lock-tests.el --- Tests for hi-lock.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Tino Calancha <tino.calancha@gmail.com> +;; Keywords: + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'hi-lock) + +(ert-deftest hi-lock-bug26666 () + "Test for http://debbugs.gnu.org/26666 ." + (let ((faces hi-lock-face-defaults)) + (with-temp-buffer + (insert "a A b B\n") + (cl-letf (((symbol-function 'completing-read) + (lambda (prompt coll x y z hist defaults) + (car defaults)))) + (dotimes (_ 2) + (let ((face (hi-lock-read-face-name))) + (hi-lock-set-pattern "a" face)))) + (should (equal hi-lock--unused-faces (cdr faces)))))) + +(provide 'hi-lock-tests) +;;; hi-lock-tests.el ends here diff --git a/test/lisp/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el new file mode 100644 index 00000000000..4a1d566e96c --- /dev/null +++ b/test/lisp/htmlfontify-tests.el @@ -0,0 +1,46 @@ +;;; htmlfontify-tests.el --- Test suite. -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: +(require 'ert) +(require 'htmlfontify) + +(ert-deftest htmlfontify-autoload () + "Tests to see whether reftex-auc has been autoloaded" + (should + (fboundp 'htmlfontify-load-rgb-file)) + (should + (autoloadp + (symbol-function + 'htmlfontify-load-rgb-file)))) + +(ert-deftest htmlfontify-bug25468 () + "Tests that htmlfontify can be loaded even if no shell is +available (Bug#25468)." + (should (equal (let ((process-environment + (cons "SHELL=/does/not/exist" process-environment))) + (call-process + (expand-file-name (invocation-name) (invocation-directory)) + nil nil nil + "--quick" "--batch" + (concat "--load=" (locate-library "htmlfontify")))) + 0))) + +(provide 'htmlfontify-tests) +;; htmlfontify-tests.el ends here diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el new file mode 100644 index 00000000000..b9f7fe7cde8 --- /dev/null +++ b/test/lisp/ibuffer-tests.el @@ -0,0 +1,816 @@ +;;; ibuffer-tests.el --- Test suite. -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: +(require 'ert) +(require 'ibuffer) +(eval-when-compile + (require 'ibuf-macs)) + +(defvar ibuffer-filter-groups) +(defvar ibuffer-filtering-alist) +(defvar ibuffer-filtering-qualifiers) +(defvar ibuffer-save-with-custom) +(defvar ibuffer-saved-filter-groups) +(defvar ibuffer-saved-filters) +(declare-function ibuffer-format-qualifier "ibuf-ext" (qualifier)) +(declare-function ibuffer-unary-operand "ibuf-ext" (filter)) + +(ert-deftest ibuffer-autoload () + "Tests to see whether ibuffer has been autoloaded" + (skip-unless (not (featurep 'ibuf-ext))) + (should + (fboundp 'ibuffer-mark-unsaved-buffers)) + (should + (autoloadp + (symbol-function + 'ibuffer-mark-unsaved-buffers)))) + +(ert-deftest ibuffer-test-Bug24997 () + "Test for http://debbugs.gnu.org/24997 ." + (ibuffer) + (let ((orig ibuffer-filtering-qualifiers)) + (unwind-protect + (progn + (setq ibuffer-filtering-qualifiers + '((size-gt . 10) + (used-mode . lisp-interaction-mode))) + (ibuffer-update nil t) + (ignore-errors (ibuffer-decompose-filter)) + (should (cdr ibuffer-filtering-qualifiers))) + (setq ibuffer-filtering-qualifiers orig) + (ibuffer-update nil t)))) + +(ert-deftest ibuffer-test-Bug25000 () + "Test for http://debbugs.gnu.org/25000 ." + (let ((case-fold-search t) + (buf1 (generate-new-buffer "ibuffer-test-Bug25000-buf1")) + (buf2 (generate-new-buffer "ibuffer-test-Bug25000-buf2"))) + (ibuffer) + (unwind-protect + (ibuffer-save-marks + (ibuffer-unmark-all-marks) + (ibuffer-mark-by-name-regexp (buffer-name buf1)) + (ibuffer-change-marks ibuffer-marked-char ?L) + (ibuffer-mark-by-name-regexp (buffer-name buf2)) + (ibuffer-change-marks ibuffer-marked-char ?l) + (should-not (cdr (ibuffer-buffer-names-with-mark ?l)))) + (mapc (lambda (buf) (when (buffer-live-p buf) + (kill-buffer buf))) (list buf1 buf2))))) + +(ert-deftest ibuffer-save-filters () + "Tests that `ibuffer-save-filters' saves in the proper format." + (skip-unless (featurep 'ibuf-ext)) + (let ((ibuffer-save-with-custom nil) + (ibuffer-saved-filters nil) + (test1 '((mode . org-mode) + (or (size-gt . 10000) + (and (not (starred-name)) + (directory . "\<org\>"))))) + (test2 '((or (mode . emacs-lisp-mode) (file-extension . "elc?") + (and (starred-name) (name . "elisp")) + (mode . lisp-interaction-mode)))) + (test3 '((size-lt . 100) (derived-mode . prog-mode) + (or (filename . "scratch") + (filename . "bonz") + (filename . "temp"))))) + (ibuffer-save-filters "test1" test1) + (should (equal (car ibuffer-saved-filters) (cons "test1" test1))) + (ibuffer-save-filters "test2" test2) + (should (equal (car ibuffer-saved-filters) (cons "test2" test2))) + (should (equal (cadr ibuffer-saved-filters) (cons "test1" test1))) + (ibuffer-save-filters "test3" test3) + (should (equal (car ibuffer-saved-filters) (cons "test3" test3))) + (should (equal (cadr ibuffer-saved-filters) (cons "test2" test2))) + (should (equal (car (cddr ibuffer-saved-filters)) (cons "test1" test1))) + (should (equal (cdr (assoc "test1" ibuffer-saved-filters)) test1)) + (should (equal (cdr (assoc "test2" ibuffer-saved-filters)) test2)) + (should (equal (cdr (assoc "test3" ibuffer-saved-filters)) test3)))) + +(ert-deftest ibuffer-test-Bug25058 () + "Test for http://debbugs.gnu.org/25058 ." + (ibuffer) + (let ((orig-filters ibuffer-saved-filter-groups) + (tmp-filters '(("saved-filters" + ("Shell" + (used-mode . shell-mode)) + ("Elisp" + (or + (used-mode . emacs-lisp-mode) + (used-mode . lisp-interaction-mode))) + ("Dired" + (used-mode . dired-mode)) + ("Info" + (or + (used-mode . help-mode) + (used-mode . debugger-mode) + (used-mode . Custom-mode) + (used-mode . completion-list-mode) + (name . "\\`[*]Messages[*]\\'"))))))) + (unwind-protect + (progn + (setq ibuffer-saved-filter-groups tmp-filters) + (ibuffer-switch-to-saved-filter-groups "saved-filters") + (ibuffer-decompose-filter-group "Elisp") + (ibuffer-filter-disable) + (ibuffer-switch-to-saved-filter-groups "saved-filters") + (should (assoc "Elisp" (cdar ibuffer-saved-filter-groups)))) + (setq ibuffer-saved-filter-groups orig-filters) + (ibuffer-awhen (get-buffer "*Ibuffer*") + (and (buffer-live-p it) (kill-buffer it)))))) + + +(ert-deftest ibuffer-test-Bug25042 () + "Test for http://debbugs.gnu.org/25042 ." + (ibuffer) + (let ((filters ibuffer-filtering-qualifiers)) + (unwind-protect + (progn + (ignore-errors ; Mistyped `match-string' instead of `string-match'. + (setq ibuffer-filtering-qualifiers nil) + (ibuffer-filter-by-predicate '(match-string "foo" (buffer-name)))) + (should-not ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers filters)))) + +;; Test Filter Inclusion +(let* (test-buffer-list ; accumulated buffers to clean up + ;; Utility functions without polluting the environment + (set-buffer-mode + (lambda (buffer mode) + "Set BUFFER's major mode to MODE, a mode function, or fundamental." + (with-current-buffer buffer + (funcall (or mode #'fundamental-mode))))) + (set-buffer-contents + (lambda (buffer size include-content) + "Add exactly SIZE bytes to BUFFER, including INCLUDE-CONTENT." + (when (or size include-content) + (let* ((unit "\n") + (chunk "ccccccccccccccccccccccccccccccc\n") + (chunk-size (length chunk)) + (size (if (and size include-content (stringp include-content)) + (- size (length include-content)) + size))) + (unless (or (null size) (> size 0)) + (error "size argument must be nil or positive")) + (with-current-buffer buffer + (when include-content + (insert include-content)) + (when size + (dotimes (_ (floor size chunk-size)) + (insert chunk)) + (dotimes (_ (mod size chunk-size)) + (insert unit))) + ;; prevent query on cleanup + (set-buffer-modified-p nil)))))) + (create-file-buffer + (lambda (prefix &rest args-plist) + "Create a file and buffer with designated properties. + PREFIX is a string giving the beginning of the name, and ARGS-PLIST + is a series of keyword-value pairs, with allowed keywords + :suffix STRING, :size NUMBER, :mode MODE-FUNC, :include-content STRING. + Returns the created buffer." + (let* ((suffix (plist-get args-plist :suffix)) + (size (plist-get args-plist :size)) + (include (plist-get args-plist :include-content)) + (mode (plist-get args-plist :mode)) + (file (make-temp-file prefix nil suffix)) + (buf (find-file-noselect file t))) + (push buf test-buffer-list) ; record for cleanup + (funcall set-buffer-mode buf mode) + (funcall set-buffer-contents buf size include) + buf))) + (create-non-file-buffer + (lambda (prefix &rest args-plist) + "Create a non-file and buffer with designated properties. + PREFIX is a string giving the beginning of the name, and ARGS-PLIST + is a series of keyword-value pairs, with allowed keywords + :size NUMBER, :mode MODE-FUNC, :include-content STRING. + Returns the created buffer." + (let* ((size (plist-get args-plist :size)) + (include (plist-get args-plist :include-content)) + (mode (plist-get args-plist :mode)) + (buf (generate-new-buffer prefix))) + (push buf test-buffer-list) ; record for cleanup + (funcall set-buffer-mode buf mode) + (funcall set-buffer-contents buf size include) + buf))) + (clean-up + (lambda () + "Restore all emacs state modified during the tests" + (while test-buffer-list ; created temporary buffers + (let ((buf (pop test-buffer-list))) + (with-current-buffer buf (bury-buffer)) ; ensure not selected + (kill-buffer buf)))))) + ;; Tests + (ert-deftest ibuffer-filter-inclusion-1 () + "Tests inclusion using basic filter combinators with a single buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-file-buffer "ibuf-test-1" :size 100 + :include-content "One ring to rule them all\n"))) + (should (ibuffer-included-in-filters-p buf '((size-gt . 99)))) + (should (ibuffer-included-in-filters-p buf '((size-lt . 101)))) + (should (ibuffer-included-in-filters-p + buf '((mode . fundamental-mode)))) + (should (ibuffer-included-in-filters-p + buf '((content . "ring to rule them all")))) + (should (ibuffer-included-in-filters-p + buf '((and (content . "ring to rule them all"))))) + (should (ibuffer-included-in-filters-p + buf '((and (and (content . "ring to rule them all")))))) + (should (ibuffer-included-in-filters-p + buf '((and (and (and (content . "ring to rule them all"))))))) + (should (ibuffer-included-in-filters-p + buf '((or (content . "ring to rule them all"))))) + (should (ibuffer-included-in-filters-p + buf '((not (not (content . "ring to rule them all")))))) + (should (ibuffer-included-in-filters-p + buf '((and (size-gt . 99) + (content . "ring to rule them all") + (mode . fundamental-mode) + (basename . "\\`ibuf-test-1"))))) + (should (ibuffer-included-in-filters-p + buf '((not (or (not (size-gt . 99)) + (not (content . "ring to rule them all")) + (not (mode . fundamental-mode)) + (not (basename . "\\`ibuf-test-1"))))))) + (should (ibuffer-included-in-filters-p + buf '((and (or (size-gt . 99) (size-lt . 10)) + (and (content . "ring.*all") + (content . "rule") + (content . "them all") + (content . "One")) + (not (mode . text-mode)) + (basename . "\\`ibuf-test-1")))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-2 () + "Tests inclusion of basic filters in combination on a single buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-file-buffer "ibuf-test-2" :size 200 + :mode #'text-mode + :include-content "and in the darkness find them\n"))) + (should (ibuffer-included-in-filters-p buf '((size-gt . 199)))) + (should (ibuffer-included-in-filters-p buf '((size-lt . 201)))) + (should (ibuffer-included-in-filters-p buf '((not size-gt . 200)))) + (should (ibuffer-included-in-filters-p buf '((not (size-gt . 200))))) + (should (ibuffer-included-in-filters-p + buf '((and (size-gt . 199) (size-lt . 201))))) + (should (ibuffer-included-in-filters-p + buf '((or (size-gt . 199) (size-gt . 201))))) + (should (ibuffer-included-in-filters-p + buf '((or (size-gt . 201) (size-gt . 199))))) + (should (ibuffer-included-in-filters-p + buf '((size-gt . 199) (mode . text-mode) + (content . "darkness find them")))) + (should (ibuffer-included-in-filters-p + buf '((and (size-gt . 199) (mode . text-mode) + (content . "darkness find them"))))) + (should (ibuffer-included-in-filters-p + buf '((not (or (not (size-gt . 199)) (not (mode . text-mode)) + (not (content . "darkness find them"))))))) + (should (ibuffer-included-in-filters-p + buf '((or (size-gt . 200) (content . "darkness find them") + (derived-mode . emacs-lisp-mode))))) + (should-not (ibuffer-included-in-filters-p + buf '((or (size-gt . 200) (content . "rule them all") + (derived-mode . emacs-lisp-mode)))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-3 () + "Tests inclusion with filename filters on specified buffers." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let* ((bufA + (funcall create-file-buffer "ibuf-test-3.a" :size 50 + :mode #'text-mode + :include-content "...but a multitude of drops?\n")) + (bufB + (funcall create-non-file-buffer "ibuf-test-3.b" :size 50 + :mode #'text-mode + :include-content "...but a multitude of drops?\n")) + (dirA (with-current-buffer bufA default-directory)) + (dirB (with-current-buffer bufB default-directory))) + (should (ibuffer-included-in-filters-p + bufA '((basename . "ibuf-test-3")))) + (should (ibuffer-included-in-filters-p + bufA '((basename . "test-3\\.a")))) + (should (ibuffer-included-in-filters-p + bufA '((file-extension . "a")))) + (should (ibuffer-included-in-filters-p + bufA (list (cons 'directory dirA)))) + (should-not (ibuffer-included-in-filters-p + bufB '((basename . "ibuf-test-3")))) + (should-not (ibuffer-included-in-filters-p + bufB '((file-extension . "b")))) + (should (ibuffer-included-in-filters-p + bufB (list (cons 'directory dirB)))) + (should (ibuffer-included-in-filters-p + bufA '((name . "ibuf-test-3")))) + (should (ibuffer-included-in-filters-p + bufB '((name . "ibuf-test-3"))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-4 () + "Tests inclusion with various filters on a single buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-file-buffer "ibuf-test-4" + :mode #'emacs-lisp-mode :suffix ".el" + :include-content "(message \"--%s--\" 'emacs-rocks)\n"))) + (should (ibuffer-included-in-filters-p + buf '((file-extension . "el")))) + (should (ibuffer-included-in-filters-p + buf '((derived-mode . prog-mode)))) + (should (ibuffer-included-in-filters-p + buf '((used-mode . emacs-lisp-mode)))) + (should (ibuffer-included-in-filters-p + buf '((mode . emacs-lisp-mode)))) + (with-current-buffer buf (set-buffer-modified-p t)) + (should (ibuffer-included-in-filters-p buf '((modified)))) + (with-current-buffer buf (set-buffer-modified-p nil)) + (should (ibuffer-included-in-filters-p buf '((not modified)))) + (should (ibuffer-included-in-filters-p + buf '((and (file-extension . "el") + (derived-mode . prog-mode) + (not modified))))) + (should (ibuffer-included-in-filters-p + buf '((or (file-extension . "tex") + (derived-mode . prog-mode) + (modified))))) + (should (ibuffer-included-in-filters-p + buf '((file-extension . "el") + (derived-mode . prog-mode) + (not modified))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-5 () + "Tests inclusion with various filters on a single buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-non-file-buffer "ibuf-test-5.el" + :mode #'emacs-lisp-mode + :include-content + "(message \"--%s--\" \"It really does!\")\n"))) + (should-not (ibuffer-included-in-filters-p + buf '((file-extension . "el")))) + (should (ibuffer-included-in-filters-p + buf '((size-gt . 18)))) + (should (ibuffer-included-in-filters-p + buf '((predicate . (lambda () + (> (- (point-max) (point-min)) 18)))))) + (should (ibuffer-included-in-filters-p + buf '((and (mode . emacs-lisp-mode) + (or (starred-name) + (size-gt . 18)) + (and (not (size-gt . 100)) + (content . "[Ii]t *really does!") + (or (name . "test-5") + (not (filename . "test-5"))))))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-6 () + "Tests inclusion using saved filters and DeMorgan's laws." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-non-file-buffer "*ibuf-test-6*" :size 65 + :mode #'text-mode)) + (buf2 + (funcall create-file-buffer "ibuf-test-6a" :suffix ".html" + :mode #'html-mode + :include-content + "<HTML><BODY><H1>Hello, World!</H1></BODY></HTML>"))) + (should (ibuffer-included-in-filters-p buf '((starred-name)))) + (should-not (ibuffer-included-in-filters-p + buf '((saved . "text document")))) + (should (ibuffer-included-in-filters-p buf2 '((saved . "web")))) + (should (ibuffer-included-in-filters-p + buf2 '((not (and (not (derived-mode . sgml-mode)) + (not (derived-mode . css-mode)) + (not (mode . javascript-mode)) + (not (mode . js2-mode)) + (not (mode . scss-mode)) + (not (derived-mode . haml-mode)) + (not (mode . sass-mode))))))) + (should (ibuffer-included-in-filters-p + buf '((and (starred-name) + (or (size-gt . 50) (filename . "foo")))))) + (should (ibuffer-included-in-filters-p + buf '((not (or (not starred-name) + (and (size-lt . 51) + (not (filename . "foo"))))))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-7 () + "Tests inclusion with various filters on a single buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((buf + (funcall create-non-file-buffer "ibuf-test-7" + :mode #'artist-mode))) + (should (ibuffer-included-in-filters-p + buf '((not (starred-name))))) + (should (ibuffer-included-in-filters-p + buf '((not starred-name)))) + (should (ibuffer-included-in-filters-p + buf '((not (not (not starred-name)))))) + (should (ibuffer-included-in-filters-p + buf '((not (modified))))) + (should (ibuffer-included-in-filters-p + buf '((not modified)))) + (should (ibuffer-included-in-filters-p + buf '((not (not (not modified))))))) + (funcall clean-up))) + + (ert-deftest ibuffer-filter-inclusion-8 () + "Tests inclusion with various filters." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((bufA + (funcall create-non-file-buffer "ibuf-test-8a" + :mode #'artist-mode)) + (bufB (funcall create-non-file-buffer "*ibuf-test-8b*" :size 32)) + (bufC (funcall create-file-buffer "ibuf-test8c" :suffix "*" + :size 64)) + (bufD (funcall create-file-buffer "*ibuf-test8d" :size 128)) + (bufE (funcall create-file-buffer "*ibuf-test8e" :suffix "*<2>" + :size 16)) + (bufF (and (funcall create-non-file-buffer "*ibuf-test8f*") + (funcall create-non-file-buffer "*ibuf-test8f*" + :size 8)))) + (with-current-buffer bufA (set-buffer-modified-p t)) + (should (ibuffer-included-in-filters-p + bufA '((and (not starred-name) + (modified) + (name . "test-8") + (not (size-gt . 100)) + (mode . picture-mode))))) + (with-current-buffer bufA (set-buffer-modified-p nil)) + (should-not (ibuffer-included-in-filters-p + bufA '((or (starred-name) (visiting-file) (modified))))) + (should (ibuffer-included-in-filters-p + bufB '((and (starred-name) + (name . "test.*8b") + (size-gt . 31) + (not visiting-file))))) + (should (ibuffer-included-in-filters-p + bufC '((and (not (starred-name)) + (visiting-file) + (name . "8c[^*]*\\*") + (size-lt . 65))))) + (should (ibuffer-included-in-filters-p + bufD '((and (not (starred-name)) + (visiting-file) + (name . "\\`\\*.*test8d") + (size-lt . 129) + (size-gt . 127))))) + (should (ibuffer-included-in-filters-p + bufE '((and (starred-name) + (visiting-file) + (name . "8e.*?\\*<[[:digit:]]+>") + (size-gt . 10))))) + (should (ibuffer-included-in-filters-p + bufF '((and (starred-name) + (not (visiting-file)) + (name . "8f\\*<[[:digit:]]>") + (size-lt . 10)))))) + (funcall clean-up)))) + +;; Test Filter Combination and Decomposition +(let* (ibuffer-to-kill ; if non-nil, kill this buffer at cleanup + (ibuffer-already 'check) ; existing ibuffer buffer to use but not kill + ;; Utility functions without polluting the environment + (get-test-ibuffer + (lambda () + "Returns a test ibuffer-mode buffer, creating one if necessary. + If a new buffer is created, it is named \"*Test-Ibuffer*\" and is + saved to `ibuffer-to-kill' for later cleanup." + (when (eq ibuffer-already 'check) + (setq ibuffer-already + (catch 'found-buf + (dolist (buf (buffer-list) nil) + (when (with-current-buffer buf + (derived-mode-p 'ibuffer-mode)) + (throw 'found-buf buf)))))) + (or ibuffer-already + ibuffer-to-kill + (let ((test-ibuf-name "*Test-Ibuffer*")) + (ibuffer nil test-ibuf-name nil t) + (setq ibuffer-to-kill (get-buffer test-ibuf-name)))))) + (clean-up + (lambda () + "Restore all emacs state modified during the tests" + (when ibuffer-to-kill ; created ibuffer + (with-current-buffer ibuffer-to-kill + (set-buffer-modified-p nil) + (bury-buffer)) + (kill-buffer ibuffer-to-kill) + (setq ibuffer-to-kill nil)) + (when (and ibuffer-already (not (eq ibuffer-already 'check))) + ;; restore existing ibuffer state + (ibuffer-update nil t))))) + ;; Tests + (ert-deftest ibuffer-decompose-filter () + "Tests `ibuffer-decompose-filter' for and, or, not, and saved." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((ibuf (funcall get-test-ibuffer))) + (with-current-buffer ibuf + (let ((ibuffer-filtering-qualifiers nil) + (ibuffer-filter-groups nil) + (filters '((size-gt . 100) (not (starred-name)) + (name . "foo")))) + (progn + (push (cons 'or filters) ibuffer-filtering-qualifiers) + (ibuffer-decompose-filter) + (should (equal filters ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers nil)) + (progn + (push (cons 'and filters) ibuffer-filtering-qualifiers) + (ibuffer-decompose-filter) + (should (equal filters ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers nil)) + (progn + (push (list 'not (car filters)) ibuffer-filtering-qualifiers) + (ibuffer-decompose-filter) + (should (equal (list (car filters)) + ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers nil)) + (progn + (push (cons 'not (car filters)) ibuffer-filtering-qualifiers) + (ibuffer-decompose-filter) + (should (equal (list (car filters)) + ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers nil)) + (let ((gnus (assoc "gnus" ibuffer-saved-filters))) + (push '(saved . "gnus") ibuffer-filtering-qualifiers) + (ibuffer-decompose-filter) + (should (equal (cdr gnus) ibuffer-filtering-qualifiers)) + (ibuffer-decompose-filter) + (should (equal (cdr (cadr gnus)) ibuffer-filtering-qualifiers)) + (setq ibuffer-filtering-qualifiers nil)) + (when (not (assoc "__unknown__" ibuffer-saved-filters)) + (push '(saved . "__uknown__") ibuffer-filtering-qualifiers) + (should-error (ibuffer-decompose-filter) :type 'error) + (setq ibuffer-filtering-qualifiers nil)) + (progn + (push (car filters) ibuffer-filtering-qualifiers) + (should-error (ibuffer-decompose-filter) :type 'error) + (setq ibuffer-filtering-qualifiers nil))))) + (funcall clean-up))) + + (ert-deftest ibuffer-and-filter () + "Tests `ibuffer-and-filter' in an Ibuffer buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((ibuf (funcall get-test-ibuffer))) + (with-current-buffer ibuf + (let ((ibuffer-filtering-qualifiers nil) + (ibuffer-filter-groups nil) + (filters [(size-gt . 100) (not (starred-name)) + (filename . "A") (mode . text-mode)])) + (should-error (ibuffer-and-filter) :type 'error) + (progn + (push (aref filters 1) ibuffer-filtering-qualifiers) + (should-error (ibuffer-and-filter) :type 'error)) + (should (progn + (push (aref filters 0) ibuffer-filtering-qualifiers) + (ibuffer-and-filter) + (and (equal (list 'and (aref filters 0) (aref filters 1)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (should (progn + (ibuffer-and-filter 'decompose) + (and (equal (aref filters 0) + (pop ibuffer-filtering-qualifiers)) + (equal (aref filters 1) + (pop ibuffer-filtering-qualifiers)) + (null ibuffer-filtering-qualifiers)))) + (should (progn + (push (list 'and (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'and (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-and-filter) + (and (equal (list 'and (aref filters 0) (aref filters 1) + (aref filters 2) (aref filters 3)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'or (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'and (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-and-filter) + (and (equal (list 'and (aref filters 0) (aref filters 1) + (list 'or (aref filters 2) + (aref filters 3))) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'and (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'or (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-and-filter) + (and (equal (list 'and (list 'or (aref filters 0) + (aref filters 1)) + (aref filters 2) (aref filters 3)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'or (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'or (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-and-filter) + (and (equal (list 'and + (list 'or (aref filters 0) + (aref filters 1)) + (list 'or (aref filters 2) + (aref filters 3))) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers)))))))) + (funcall clean-up))) + + (ert-deftest ibuffer-or-filter () + "Tests `ibuffer-or-filter' in an Ibuffer buffer." + (skip-unless (featurep 'ibuf-ext)) + (unwind-protect + (let ((ibuf (funcall get-test-ibuffer))) + (with-current-buffer ibuf + (let ((ibuffer-filtering-qualifiers nil) + (ibuffer-filter-groups nil) + (filters [(size-gt . 100) (not (starred-name)) + (filename . "A") (mode . text-mode)])) + (should-error (ibuffer-or-filter) :type 'error) + (progn + (push (aref filters 1) ibuffer-filtering-qualifiers) + (should-error (ibuffer-or-filter) :type 'error)) + (should (progn + (push (aref filters 0) ibuffer-filtering-qualifiers) + (ibuffer-or-filter) + (and (equal (list 'or (aref filters 0) (aref filters 1)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (should (progn + (ibuffer-or-filter 'decompose) + (and (equal (aref filters 0) + (pop ibuffer-filtering-qualifiers)) + (equal (aref filters 1) + (pop ibuffer-filtering-qualifiers)) + (null ibuffer-filtering-qualifiers)))) + (should (progn + (push (list 'or (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'or (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-or-filter) + (and (equal (list 'or (aref filters 0) (aref filters 1) + (aref filters 2) (aref filters 3)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'and (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'or (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-or-filter) + (and (equal (list 'or (aref filters 0) (aref filters 1) + (list 'and (aref filters 2) + (aref filters 3))) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'or (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'and (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-or-filter) + (and (equal (list 'or (list 'and (aref filters 0) + (aref filters 1)) + (aref filters 2) (aref filters 3)) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers))))) + (pop ibuffer-filtering-qualifiers) + (should (progn + (push (list 'and (aref filters 2) (aref filters 3)) + ibuffer-filtering-qualifiers) + (push (list 'and (aref filters 0) (aref filters 1)) + ibuffer-filtering-qualifiers) + (ibuffer-or-filter) + (and (equal (list 'or + (list 'and (aref filters 0) + (aref filters 1)) + (list 'and (aref filters 2) + (aref filters 3))) + (car ibuffer-filtering-qualifiers)) + (null (cdr ibuffer-filtering-qualifiers)))))))) + (funcall clean-up)))) + +(ert-deftest ibuffer-format-qualifier () + "Tests string recommendation of filter from `ibuffer-format-qualifier'." + (skip-unless (featurep 'ibuf-ext)) + (let ((test1 '(mode . org-mode)) + (test2 '(size-lt . 100)) + (test3 '(derived-mode . prog-mode)) + (test4 '(or (size-gt . 10000) + (and (not (starred-name)) + (directory . "\\<org\\>")))) + (test5 '(or (filename . "scratch") + (filename . "bonz") + (filename . "temp"))) + (test6 '(or (mode . emacs-lisp-mode) (file-extension . "elc?") + (and (starred-name) (name . "elisp")) + (mode . lisp-interaction-mode))) + (description (lambda (q) + (cadr (assq q ibuffer-filtering-alist)))) + (tag (lambda (&rest args ) + (concat " [" (apply #'concat args) "]")))) + (should (equal (ibuffer-format-qualifier test1) + (funcall tag (funcall description 'mode) + ": " "org-mode"))) + (should (equal (ibuffer-format-qualifier test2) + (funcall tag (funcall description 'size-lt) + ": " "100"))) + (should (equal (ibuffer-format-qualifier test3) + (funcall tag (funcall description 'derived-mode) + ": " "prog-mode"))) + (should (equal (ibuffer-format-qualifier test4) + (funcall tag "OR" + (funcall tag (funcall description 'size-gt) + ": " (format "%s" 10000)) + (funcall tag "AND" + (funcall tag "NOT" + (funcall tag + (funcall description + 'starred-name) + ": " "nil")) + (funcall tag + (funcall description 'directory) + ": " "\\<org\\>"))))) + (should (equal (ibuffer-format-qualifier test5) + (funcall tag "OR" + (funcall tag (funcall description 'filename) + ": " "scratch") + (funcall tag (funcall description 'filename) + ": " "bonz") + (funcall tag (funcall description 'filename) + ": " "temp")))) + (should (equal (ibuffer-format-qualifier test6) + (funcall tag "OR" + (funcall tag (funcall description 'mode) + ": " "emacs-lisp-mode") + (funcall tag (funcall description 'file-extension) + ": " "elc?") + (funcall tag "AND" + (funcall tag + (funcall description 'starred-name) + ": " "nil") + (funcall tag + (funcall description 'name) + ": " "elisp")) + (funcall tag (funcall description 'mode) + ": " "lisp-interaction-mode")))))) + +(ert-deftest ibuffer-unary-operand () + "Tests `ibuffer-unary-operand': (not cell) or (not . cell) -> cell." + (skip-unless (featurep 'ibuf-ext)) + (should (equal (ibuffer-unary-operand '(not . (mode "foo"))) + '(mode "foo"))) + (should (equal (ibuffer-unary-operand '(not (mode "foo"))) + '(mode "foo"))) + (should (equal (ibuffer-unary-operand '(not "cdr")) + '("cdr"))) + (should (equal (ibuffer-unary-operand '(not)) nil)) + (should (equal (ibuffer-unary-operand '(not . a)) 'a))) + +(provide 'ibuffer-tests) +;; ibuffer-tests.el ends here diff --git a/test/lisp/ido-tests.el b/test/lisp/ido-tests.el new file mode 100644 index 00000000000..df110969312 --- /dev/null +++ b/test/lisp/ido-tests.el @@ -0,0 +1,47 @@ +;;; ido-tests.el --- unit tests for ido.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for ido.el. + +;;; Code: + +(ert-deftest ido-tests--other-window-frame () + "Verifies that Bug#26360 is fixed." + (should-not ido-mode) + (unwind-protect + (progn + (ido-mode) + (should (equal ido-mode 'both)) + (should (equal (key-binding [remap find-alternate-file-other-window]) + #'ido-find-alternate-file-other-window)) + (should (commandp #'ido-find-alternate-file-other-window)) + (should (equal (key-binding (kbd "C-x 4 d")) #'ido-dired-other-window)) + (should (commandp #'ido-dired-other-window)) + (should (equal (key-binding (kbd "C-x 5 d")) #'ido-dired-other-frame)) + (should (commandp #'ido-dired-other-frame)) + (should (equal (key-binding (kbd "C-x 5 C-o")) + #'ido-display-buffer-other-frame)) + (should (commandp #'ido-display-buffer-other-frame))) + (ido-mode 0))) + +;;; ido-tests.el ends here diff --git a/test/automated/imenu-test.el b/test/lisp/imenu-tests.el index 480368fcbb6..93090947139 100644 --- a/test/automated/imenu-test.el +++ b/test/lisp/imenu-tests.el @@ -83,6 +83,16 @@ function ABC_D() } " '("a" "b" "c" "ABC_D")) +(ert-deftest imenu--sort-by-position-pairs () + (should (imenu--sort-by-position '("a" . 2) '("a" . 3))) + (should-not (imenu--sort-by-position '("a" . 3) '("a" . 2)))) + +;; Regression test for bug#26457: 25.2; Cannot pass a function to +;; imenu-generic-expression +(ert-deftest imenu--sort-by-position-list () + (should (imenu--sort-by-position '("a" 2 nil) '("a" 3 nil))) + (should-not (imenu--sort-by-position '("a" 3 nil) '("a" 2 nil)))) + (provide 'imenu-tests) ;;; imenu-tests.el ends here diff --git a/test/automated/info-xref.el b/test/lisp/info-xref-tests.el index 9ae07c33fd9..9ae07c33fd9 100644 --- a/test/automated/info-xref.el +++ b/test/lisp/info-xref-tests.el diff --git a/test/automated/mule-util.el b/test/lisp/international/mule-util-tests.el index 356ee33232f..356ee33232f 100644 --- a/test/automated/mule-util.el +++ b/test/lisp/international/mule-util-tests.el diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el new file mode 100644 index 00000000000..d85efe2d7bf --- /dev/null +++ b/test/lisp/international/ucs-normalize-tests.el @@ -0,0 +1,277 @@ +;;; ucs-normalize --- tests for international/ucs-normalize.el -*- lexical-binding: t -*- + +;; Copyright (C) 2002-2017 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; The Part1 test takes a long time because it goes over the whole +;; unicode character set; you should build Emacs with optimization +;; enabled before running it. +;; +;; If there are lines marked as failing (see +;; `ucs-normalize-tests--failing-lines-part1' and +;; `ucs-normalize-tests--failing-lines-part2'), they may need to be +;; adjusted when NormalizationTest.txt is updated. To get a list of +;; currently failing lines, set those 2 variables to nil, run the +;; tests, and inspect the values of +;; `ucs-normalize-tests--part1-rule1-failed-lines' and +;; `ucs-normalize-tests--part1-rule2-failed-chars', respectively. + +;;; Code: + +(eval-when-compile (require 'cl-lib)) +(require 'ert) +(require 'ucs-normalize) + +(defconst ucs-normalize-test-data-file + (expand-file-name "admin/unidata/NormalizationTest.txt" source-directory)) + +(defun ucs-normalize-tests--parse-column () + (let ((chars nil) + (term nil)) + (while (and (not (equal term ";")) + (looking-at "\\([[:xdigit:]]\\{4,6\\}\\)\\([; ]\\)")) + (let ((code-point (match-string 1))) + (setq term (match-string 2)) + (goto-char (match-end 0)) + (push (string-to-number code-point 16) chars))) + (nreverse chars))) + +(defmacro ucs-normalize-tests--normalize (norm str) + "Like `ucs-normalize-string' but reuse current buffer for efficiency. +And NORM is one of the symbols `NFC', `NFD', `NFKC', `NFKD' for brevity." + (let ((norm-alist '((NFC . ucs-normalize-NFC-region) + (NFD . ucs-normalize-NFD-region) + (NFKC . ucs-normalize-NFKC-region) + (NFKD . ucs-normalize-NFKD-region)))) + `(save-restriction + (narrow-to-region (point) (point)) + (insert ,str) + (funcall #',(cdr (assq norm norm-alist)) (point-min) (point-max)) + (delete-and-extract-region (point-min) (point-max))))) + +(defvar ucs-normalize-tests--chars-part1 nil) + +(defun ucs-normalize-tests--invariants-hold-p (&rest columns) + "Check 1st conformance rule. +The following invariants must be true for all conformant implementations..." + (when ucs-normalize-tests--chars-part1 + ;; See `ucs-normalize-tests--invariants-rule2-hold-p'. + (aset ucs-normalize-tests--chars-part1 + (caar columns) 1)) + (cl-destructuring-bind (source nfc nfd nfkc nfkd) + (mapcar (lambda (c) (apply #'string c)) columns) + (and + ;; c2 == toNFC(c1) == toNFC(c2) == toNFC(c3) + (equal nfc (ucs-normalize-tests--normalize NFC source)) + (equal nfc (ucs-normalize-tests--normalize NFC nfc)) + (equal nfc (ucs-normalize-tests--normalize NFC nfd)) + ;; c4 == toNFC(c4) == toNFC(c5) + (equal nfkc (ucs-normalize-tests--normalize NFC nfkc)) + (equal nfkc (ucs-normalize-tests--normalize NFC nfkd)) + + ;; c3 == toNFD(c1) == toNFD(c2) == toNFD(c3) + (equal nfd (ucs-normalize-tests--normalize NFD source)) + (equal nfd (ucs-normalize-tests--normalize NFD nfc)) + (equal nfd (ucs-normalize-tests--normalize NFD nfd)) + ;; c5 == toNFD(c4) == toNFD(c5) + (equal nfkd (ucs-normalize-tests--normalize NFD nfkc)) + (equal nfkd (ucs-normalize-tests--normalize NFD nfkd)) + + ;; c4 == toNFKC(c1) == toNFKC(c2) == toNFKC(c3) == toNFKC(c4) == toNFKC(c5) + (equal nfkc (ucs-normalize-tests--normalize NFKC source)) + (equal nfkc (ucs-normalize-tests--normalize NFKC nfc)) + (equal nfkc (ucs-normalize-tests--normalize NFKC nfd)) + (equal nfkc (ucs-normalize-tests--normalize NFKC nfkc)) + (equal nfkc (ucs-normalize-tests--normalize NFKC nfkd)) + + ;; c5 == toNFKD(c1) == toNFKD(c2) == toNFKD(c3) == toNFKD(c4) == toNFKD(c5) + (equal nfkd (ucs-normalize-tests--normalize NFKD source)) + (equal nfkd (ucs-normalize-tests--normalize NFKD nfc)) + (equal nfkd (ucs-normalize-tests--normalize NFKD nfd)) + (equal nfkd (ucs-normalize-tests--normalize NFKD nfkc)) + (equal nfkd (ucs-normalize-tests--normalize NFKD nfkd))))) + +(defun ucs-normalize-tests--invariants-rule2-hold-p (char) + "Check 2nd conformance rule. +For every code point X assigned in this version of Unicode that is not specifically +listed in Part 1, the following invariants must be true for all conformant +implementations: + + X == toNFC(X) == toNFD(X) == toNFKC(X) == toNFKD(X)" + (let ((X (string char))) + (and (equal X (ucs-normalize-tests--normalize NFC X)) + (equal X (ucs-normalize-tests--normalize NFD X)) + (equal X (ucs-normalize-tests--normalize NFKC X)) + (equal X (ucs-normalize-tests--normalize NFKD X))))) + +(cl-defun ucs-normalize-tests--invariants-failing-for-part (part &optional skip-lines &key progress-str) + "Returns a list of failed line numbers." + (with-temp-buffer + (insert-file-contents ucs-normalize-test-data-file) + (let ((beg-line (progn (search-forward (format "@Part%d" part)) + (forward-line) + (line-number-at-pos))) + (end-line (progn (or (search-forward (format "@Part%d" (1+ part)) nil t) + (goto-char (point-max))) + (line-number-at-pos)))) + (goto-char (point-min)) + (forward-line (1- beg-line)) + (cl-loop with reporter = (if progress-str (make-progress-reporter + progress-str beg-line end-line + 0 nil 0.5)) + for line from beg-line to (1- end-line) + unless (or (= (following-char) ?#) + (ucs-normalize-tests--invariants-hold-p + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column)) + (memq line skip-lines)) + collect line + do (forward-line) + if reporter do (progress-reporter-update reporter line))))) + +(defun ucs-normalize-tests--invariants-failing-for-lines (lines) + "Returns a list of failed line numbers." + (with-temp-buffer + (insert-file-contents ucs-normalize-test-data-file) + (goto-char (point-min)) + (cl-loop for prev-line = 1 then line + for line in lines + do (forward-line (- line prev-line)) + unless (ucs-normalize-tests--invariants-hold-p + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column) + (ucs-normalize-tests--parse-column)) + collect line))) + +(ert-deftest ucs-normalize-part0 () + (should-not (ucs-normalize-tests--invariants-failing-for-part 0))) + +(defconst ucs-normalize-tests--failing-lines-part1 + (list 15131 15132 15133 15134 15135 15136 15137 15138 + 15139 + 16149 16150 16151 16152 16153 16154 16155 16156 + 16157 16158 16159 16160 16161 16162 16163 16164 + 16165 16166 16167 16168 16169 16170 16171 16172 + 16173 16174 16175 16176 16177 16178 16179 16180 + 16181 16182 16183 16184 16185 16186 16187 16188 + 16189 16190 16191 16192 16193 16194 16195 16196 + 16197 16198 16199 16200 16201 16202 16203 16204 + 16205 16206 16207 16208 16209 16210 16211 16212 + 16213 16214 16215 16216 16217 16218 16219 16220 + 16221 16222 16223 16224 16225 16226 16227 16228 + 16229 16230 16231 16232 16233 16234 16235 16236 + 16237 16238 16239 16240 16241 16242 16243 16244 + 16245 16246 16247 16248 16249 16250 16251 16252 + 16253 16254 16255 16256 16257 16258 16259 16260 + 16261 16262 16263 16264 16265 16266 16267 16268 + 16269 16270 16271 16272 16273 16274 16275 16276 + 16277 16278 16279 16280 16281 16282 16283 16284 + 16285 16286 16287 16288 16289)) + +;; Keep a record of failures, for consulting afterwards (the ert +;; backtrace only shows a truncated version of these lists). +(defvar ucs-normalize-tests--part1-rule1-failed-lines nil + "A list of line numbers.") +(defvar ucs-normalize-tests--part1-rule2-failed-chars nil + "A list of code points.") + +(defun ucs-normalize-tests--part1-rule2 (chars-part1) + (let ((reporter (make-progress-reporter "UCS Normalize Test Part1, rule 2" + 0 (max-char))) + (failed-chars nil)) + (map-char-table + (lambda (char-range listed-in-part) + (unless (eq listed-in-part 1) + (if (characterp char-range) + (progn (unless (ucs-normalize-tests--invariants-rule2-hold-p char-range) + (push char-range failed-chars)) + (progress-reporter-update reporter char-range)) + (cl-loop for char from (car char-range) to (cdr char-range) + unless (ucs-normalize-tests--invariants-rule2-hold-p char) + do (push char failed-chars) + do (progress-reporter-update reporter char))))) + chars-part1) + (progress-reporter-done reporter) + failed-chars)) + +(ert-deftest ucs-normalize-part1 () + :tags '(:expensive-test) + ;; This takes a long time, so make sure we're compiled. + (dolist (fun '(ucs-normalize-tests--part1-rule2 + ucs-normalize-tests--invariants-failing-for-part + ucs-normalize-tests--invariants-hold-p + ucs-normalize-tests--invariants-rule2-hold-p)) + (or (byte-code-function-p (symbol-function fun)) + (byte-compile fun))) + (let ((ucs-normalize-tests--chars-part1 (make-char-table 'ucs-normalize-tests t))) + (should-not + (setq ucs-normalize-tests--part1-rule1-failed-lines + (ucs-normalize-tests--invariants-failing-for-part + 1 ucs-normalize-tests--failing-lines-part1 + :progress-str "UCS Normalize Test Part1, rule 1"))) + (should-not (setq ucs-normalize-tests--part1-rule2-failed-chars + (ucs-normalize-tests--part1-rule2 + ucs-normalize-tests--chars-part1))))) + +(ert-deftest ucs-normalize-part1-failing () + :expected-result :failed + (skip-unless ucs-normalize-tests--failing-lines-part1) + (should-not + (ucs-normalize-tests--invariants-failing-for-lines + ucs-normalize-tests--failing-lines-part1))) + +(defconst ucs-normalize-tests--failing-lines-part2 + (list 18328 18330 18332 18334 18336 18338 18340 18342 + 18344 18346 18348 18350 18352 18354 18356 18358 + 18360 18362 18364 18366 18368 18370 18372 18374 + 18376 18378 18380 18382 18384 18386 18388 18390 + 18392 18394 18396 18398 18400 18402 18404 18406 + 18408 18410 18412 18414 18416 18418 18420 18422 + 18424 18426 18494 18496 18498 18500 18502 18504 + 18506 18508 18510 18512 18514 18516 18518 18520 + 18522 18524 18526 18528 18530 18532 18534 18536 + 18538 18540 18542 18544 18546 18548 18550 18552 + 18554 18556 18558 18560 18562 18564 18566 18568 + 18570 18572 18574 18576 18578 18580 18582 18584 + 18586 18588 18590 18592 18594 18596)) + +(ert-deftest ucs-normalize-part2 () + :tags '(:expensive-test) + (should-not + (ucs-normalize-tests--invariants-failing-for-part + 2 ucs-normalize-tests--failing-lines-part2 + :progress-str "UCS Normalize Test Part2"))) + +(ert-deftest ucs-normalize-part2-failing () + :expected-result :failed + (skip-unless ucs-normalize-tests--failing-lines-part2) + (should-not + (ucs-normalize-tests--invariants-failing-for-lines + ucs-normalize-tests--failing-lines-part2))) + +(ert-deftest ucs-normalize-part3 () + (should-not + (ucs-normalize-tests--invariants-failing-for-part 3))) + +;;; ucs-normalize-tests.el ends here diff --git a/test/automated/isearch-tests.el b/test/lisp/isearch-tests.el index e5cae8237e1..e5cae8237e1 100644 --- a/test/automated/isearch-tests.el +++ b/test/lisp/isearch-tests.el diff --git a/test/lisp/jit-lock-tests.el b/test/lisp/jit-lock-tests.el new file mode 100644 index 00000000000..22d1e015db4 --- /dev/null +++ b/test/lisp/jit-lock-tests.el @@ -0,0 +1,60 @@ +;;; jit-lock-tests.el --- tests for jit-lock + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Dmitry Gutov <dgutov@yandex.ru> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'jit-lock) +(require 'ert-x) + +(defun jit-lock-tests--setup-buffer () + (setq font-lock-defaults '(nil t)) + (let (noninteractive) + (font-lock-mode))) + +(ert-deftest jit-lock-fontify-now-fontifies-a-new-buffer () + (ert-with-test-buffer (:name "xxx") + (jit-lock-tests--setup-buffer) + (insert "xyz") + (jit-lock-fontify-now (point-min) (point-max)) + (should-not (text-property-not-all (point-min) (point-max) 'fontified t)))) + +(ert-deftest jit-lock-fontify-now-mends-the-gaps () + (ert-with-test-buffer (:name "xxx") + (jit-lock-tests--setup-buffer) + (insert "aaabbbcccddd") + (with-silent-modifications + (put-text-property 1 4 'fontified t) + (put-text-property 7 10 'fontified t)) + (jit-lock-fontify-now (point-min) (point-max)) + (should-not (text-property-not-all (point-min) (point-max) 'fontified t)))) + +(ert-deftest jit-lock-fontify-now-does-not-refontify-unnecessarily () + (ert-with-test-buffer (:name "xxx") + (setq font-lock-defaults + (list '(((lambda () (error "Don't call me")))) t)) + (let (noninteractive) + (font-lock-mode)) + (insert "aaa") + (with-silent-modifications + (put-text-property (point-min) (point-max) 'fontified t)) + (jit-lock-fontify-now (point-min) (point-max)))) diff --git a/test/automated/json-tests.el b/test/lisp/json-tests.el index 66fc25ad1c0..c6bd295d667 100644 --- a/test/automated/json-tests.el +++ b/test/lisp/json-tests.el @@ -89,7 +89,10 @@ Point is moved to beginning of the buffer." (ert-deftest test-json-skip-whitespace () (json-tests--with-temp-buffer "\t\r\n\f\b { \"a\": 1 }" (json-skip-whitespace) - (should (equal (char-after (point)) ?{)))) + (should (equal (char-after) ?\f))) + (json-tests--with-temp-buffer "\t\r\n\t { \"a\": 1 }" + (json-skip-whitespace) + (should (equal (char-after) ?{)))) ;;; Paths @@ -167,6 +170,9 @@ Point is moved to beginning of the buffer." (should (equal (json-read-string) "abcαβγ"))) (json-tests--with-temp-buffer "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\"" (should (equal (json-read-string) "\nasdфывfgh\t"))) + ;; Bug#24784 + (json-tests--with-temp-buffer "\"\\uD834\\uDD1E\"" + (should (equal (json-read-string) "\U0001D11E"))) (json-tests--with-temp-buffer "foo" (should-error (json-read-string) :type 'json-string-format))) diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el new file mode 100644 index 00000000000..04a4271734c --- /dev/null +++ b/test/lisp/kmacro-tests.el @@ -0,0 +1,891 @@ +;;; kmacro-tests.el --- Tests for kmacro.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Gemini Lasswell <gazally@runbox.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'kmacro) +(require 'seq) +(require 'ert) +(require 'ert-x) + +;;; Test fixtures: + +(defmacro kmacro-tests-with-kmacro-clean-slate (&rest body) + "Create a clean environment for a kmacro test BODY to run in." + (declare (debug (body))) + `(cl-letf* ((kmacro-execute-before-append t) + (kmacro-ring-max 8) + (kmacro-repeat-no-prefix t) + (kmacro-call-repeat-key nil) + (kmacro-call-repeat-with-arg nil) + + (kbd-macro-termination-hook nil) + (defining-kbd-macro nil) + (executing-kbd-macro nil) + (executing-kbd-macro-index 0) + (last-kbd-macro nil) + + (kmacro-ring nil) + + (kmacro-counter 0) + (kmacro-default-counter-format "%d") + (kmacro-counter-format "%d") + (kmacro-counter-format-start "%d") + (kmacro-counter-value-start 0) + (kmacro-last-counter 0) + (kmacro-initial-counter-value nil) + + (kmacro-tests-macros nil) + (kmacro-tests-events nil) + (kmacro-tests-sequences nil)) + (advice-add 'end-kbd-macro :after #'kmacro-tests-end-macro-advice) + (advice-add 'read-event :around #'kmacro-tests-read-event-advice ) + (advice-add 'read-key-sequence :around #'kmacro-tests-read-key-sequence-advice) + (unwind-protect + (ert-with-test-buffer (:name "") + (switch-to-buffer (current-buffer)) + ,@body) + (advice-remove 'read-key-sequence #'kmacro-tests-read-key-sequence-advice) + (advice-remove 'read-event #'kmacro-tests-read-event-advice) + (advice-remove 'end-kbd-macro #'kmacro-tests-end-macro-advice)))) + +(defmacro kmacro-tests-deftest (name _args docstring &rest keys-and-body) + "Define a kmacro unit test. +NAME is the name of the test, _ARGS should be nil, and DOCSTRING +is required. To avoid having to duplicate ert's keyword parsing +here, its keywords and values (if any) must be inside a list +after the docstring, preceding the body, here combined with the +body in KEYS-AND-BODY." + (declare (debug (&define name sexp stringp + [&optional (&rest &or [keywordp sexp])] + def-body)) + (doc-string 3) + (indent 2)) + + (let* ((keys (when (and (listp (car keys-and-body)) + (keywordp (caar keys-and-body))) + (car keys-and-body))) + (body (if keys (cdr keys-and-body) + keys-and-body))) + `(ert-deftest ,name () + ,docstring ,@keys + (kmacro-tests-with-kmacro-clean-slate ,@body)))) + +(defvar kmacro-tests-keymap + (let ((map (make-sparse-keymap))) + (dotimes (i 26) + (define-key map (string (+ ?a i)) 'self-insert-command)) + (dotimes (i 10) + (define-key map (string (+ ?0 i)) 'self-insert-command)) + ;; Define a few key sequences of different lengths. + (dolist (item '(("\C-a" . beginning-of-line) + ("\C-b" . backward-char) + ("\C-e" . end-of-line) + ("\C-f" . forward-char) + ("\C-r" . isearch-backward) + ("\C-u" . universal-argument) + ("\C-w" . kill-region) + ("\C-SPC" . set-mark-command) + ("\M-w" . kill-ring-save) + ("\M-x" . execute-extended-command) + ("\C-cd" . downcase-word) + ("\C-cxu" . upcase-word) + ("\C-cxq" . quoted-insert) + ("\C-cxi" . kmacro-insert-counter) + ("\C-x\C-k" . kmacro-keymap))) + (define-key map (car item) (cdr item))) + map) + "Keymap to use for testing keyboard macros. +This is used to obtain consistent results even if tests are run +in an environment with rebound keys.") + +(defvar kmacro-tests-events nil + "Input events used by the kmacro test in progress.") + +(defun kmacro-tests-read-event-advice (orig-func &rest args) + "Pop and return an event from `kmacro-tests-events'. +Return the result of calling ORIG-FUNC with ARGS if +`kmacro-tests-events' is empty, or if a keyboard macro is +running." + (if (or executing-kbd-macro (null kmacro-tests-events)) + (apply orig-func args) + (pop kmacro-tests-events))) + +(defvar kmacro-tests-sequences nil + "Input sequences used by the kmacro test in progress.") + +(defun kmacro-tests-read-key-sequence-advice (orig-func &rest args) + "Pop and return a string from `kmacro-tests-sequences'. +Return the result of calling ORIG-FUNC with ARGS if +`kmacro-tests-sequences' is empty, or if a keyboard macro is +running." + (if (or executing-kbd-macro (null kmacro-tests-sequences)) + (apply orig-func args) + (pop kmacro-tests-sequences))) + +(defvar kmacro-tests-macros nil + "Keyboard macros (in vector form) used by the kmacro test in progress.") + +(defun kmacro-tests-end-macro-advice (&rest _args) + "Pop a macro from `kmacro-tests-macros' and assign it to `last-kbd-macro'. +If `kmacro-tests-macros' is empty, do nothing." + (when kmacro-tests-macros + (setq last-kbd-macro (pop kmacro-tests-macros)))) + +;;; Some more powerful expectations: + +(defmacro kmacro-tests-should-insert (value &rest body) + "Verify that VALUE is inserted by the execution of BODY. +Execute BODY, then check that the string VALUE was inserted +into the current buffer at point." + (declare (debug (stringp body)) + (indent 1)) + (let ((g-p (cl-gensym)) + (g-bsize (cl-gensym))) + `(let ((,g-p (point)) + (,g-bsize (buffer-size))) + ,@body + (should (equal (buffer-substring ,g-p (point)) ,value)) + (should (equal (- (buffer-size) ,g-bsize) (length ,value)))))) + +(defmacro kmacro-tests-should-match-message (value &rest body) + "Verify that a message matching VALUE is issued while executing BODY. +Execute BODY, and then if there is not a regexp match between +VALUE and any text written to *Messages* during the execution, +cause the current test to fail." + (declare (debug (form body)) + (indent 1)) + (let ((g-captured-messages (cl-gensym))) + `(ert-with-message-capture ,g-captured-messages + ,@body + (should (string-match-p ,value ,g-captured-messages))))) + +;;; Tests: + +(kmacro-tests-deftest kmacro-tests-test-insert-counter-01-nil () + "`kmacro-insert-counter' adds one to macro counter with nil arg." + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil))) + (kmacro-tests-should-insert "1" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil)))) + +(kmacro-tests-deftest kmacro-tests-test-insert-counter-02-int () + "`kmacro-insert-counter' increments by value of list argument." + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-insert-counter 2))) + (kmacro-tests-should-insert "2" + (kmacro-tests-simulate-command '(kmacro-insert-counter 3))) + (kmacro-tests-should-insert "5" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil)))) + +(kmacro-tests-deftest kmacro-tests-test-insert-counter-03-list () + "`kmacro-insert-counter' doesn't increment when given universal argument." + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-insert-counter (16)))) + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-insert-counter (4))))) + +(kmacro-tests-deftest kmacro-tests-test-insert-counter-04-neg () + "`kmacro-insert-counter' decrements with '- prefix argument" + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-insert-counter -))) + (kmacro-tests-should-insert "-1" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil)))) + +(kmacro-tests-deftest kmacro-tests-test-start-format-counter () + "`kmacro-insert-counter' uses start value and format." + (kmacro-tests-simulate-command '(kmacro-set-counter 10)) + (kmacro-tests-should-insert "10" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil))) + (kmacro-tests-should-insert "11" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil))) + (kmacro-set-format "c=%s") + (kmacro-tests-simulate-command '(kmacro-set-counter 50)) + (kmacro-tests-should-insert "c=50" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil)))) + +(kmacro-tests-deftest kmacro-tests-test-start-macro-when-defining-macro () + "Starting a macro while defining a macro does not start a second macro." + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + ;; We should now be in the macro-recording state. + (should defining-kbd-macro) + (should-not last-kbd-macro) + ;; Calling it again should leave us in the same state. + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + (should defining-kbd-macro) + (should-not last-kbd-macro)) + + +(kmacro-tests-deftest kmacro-tests-set-macro-counter-while-defining () + "Use of the prefix arg with kmacro-start sets kmacro-counter." + ;; Give kmacro-start-macro an argument. + (kmacro-tests-simulate-command '(kmacro-start-macro 5)) + (should defining-kbd-macro) + ;; Verify that the counter is set to that value. + (kmacro-tests-should-insert "5" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil))) + ;; Change it while defining a macro. + (kmacro-tests-simulate-command '(kmacro-set-counter 1)) + (kmacro-tests-should-insert "1" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil))) + ;; Using universal arg to to set counter should reset to starting value. + (kmacro-tests-simulate-command '(kmacro-set-counter (4)) '(4)) + (kmacro-tests-should-insert "5" + (kmacro-tests-simulate-command '(kmacro-insert-counter nil)))) + + +(kmacro-tests-deftest kmacro-tests-start-insert-counter-appends-to-macro () + "Use of the universal arg appends to the previous macro." + (let ((kmacro-tests-macros (list (string-to-vector "hello")))) + ;; Start recording a macro. + (kmacro-tests-simulate-command '(kmacro-start-macro-or-insert-counter nil)) + ;; Make sure we are recording. + (should defining-kbd-macro) + ;; Call it again and it should insert the counter. + (kmacro-tests-should-insert "0" + (kmacro-tests-simulate-command '(kmacro-start-macro-or-insert-counter nil))) + ;; We should still be in the recording state. + (should defining-kbd-macro) + ;; End recording with repeat count. + (kmacro-tests-simulate-command '(kmacro-end-or-call-macro 3)) + ;; Recording should be finished. + (should-not defining-kbd-macro) + ;; Now use prefix arg to append to the previous macro. + ;; This should run the previous macro first. + (kmacro-tests-should-insert "hello" + (kmacro-tests-simulate-command + '(kmacro-start-macro-or-insert-counter (4)))) + ;; Verify that the recording state has changed. + (should (equal defining-kbd-macro 'append)))) + +(kmacro-tests-deftest kmacro-tests-end-call-macro-prefix-args () + "kmacro-end-call-macro changes behavior based on prefix arg." + ;; "Record" two macros. + (dotimes (i 2) + (kmacro-tests-define-macro (vconcat (format "macro #%d" (1+ i))))) + ;; With no prefix arg, it should call the second macro. + (kmacro-tests-should-insert "macro #2" + (kmacro-tests-simulate-command '(kmacro-end-or-call-macro nil))) + ;; With universal arg, it should call the first one. + (kmacro-tests-should-insert "macro #1" + (kmacro-tests-simulate-command '(kmacro-end-or-call-macro (4))))) + +(kmacro-tests-deftest kmacro-tests-end-and-call-macro () + "Keyboard command to end and call macro works under various conditions." + ;; First, try it with no macro to record. + (setq kmacro-tests-macros '("")) + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + (condition-case err + (kmacro-tests-simulate-command '(kmacro-end-and-call-macro 2) 2) + (error (should (string= (cadr err) + "No kbd macro has been defined")))) + + ;; Check that it stopped defining and that no macro was recorded. + (should-not defining-kbd-macro) + (should-not last-kbd-macro) + + ;; Now try it while not recording, but first record a non-nil macro. + (kmacro-tests-define-macro "macro") + (kmacro-tests-should-insert "macro" + (kmacro-tests-simulate-command '(kmacro-end-and-call-macro nil)))) + +(kmacro-tests-deftest kmacro-tests-end-and-call-macro-mouse () + "Commands to end and call macro work under various conditions. +This is a regression test for Bug#24992." + (:expected-result :failed) + (cl-letf (((symbol-function #'mouse-set-point) #'ignore)) + ;; First, try it with no macro to record. + (setq kmacro-tests-macros '("")) + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + (condition-case err + (kmacro-tests-simulate-command '(kmacro-end-call-mouse 2) 2) + (error (should (string= (cadr err) + "No kbd macro has been defined")))) + + ;; Check that it stopped defining and that no macro was recorded. + (should-not defining-kbd-macro) + (should-not last-kbd-macro) + + ;; Now try it while not recording, but first record a non-nil macro. + (kmacro-tests-define-macro "macro") + (kmacro-tests-should-insert "macro" + (kmacro-tests-simulate-command '(kmacro-end-call-mouse nil))))) + +(kmacro-tests-deftest kmacro-tests-call-macro-hint-and-repeat () + "`kmacro-call-macro' gives hint in Messages and sets up repeat keymap. +This is a regression test for: Bug#3412, Bug#11817." + (kmacro-tests-define-macro [?m]) + (let ((kmacro-call-repeat-key t) + (kmacro-call-repeat-with-arg t) + (overriding-terminal-local-map overriding-terminal-local-map) + (last-input-event ?e)) + (message "") ; Clear the echo area. (Bug#3412) + (kmacro-tests-should-match-message "Type e to repeat macro" + (kmacro-tests-should-insert "mmmmmm" + (cl-letf (((symbol-function #'this-single-command-keys) (lambda () + [?\C-x ?e]))) + (kmacro-call-macro 3)) + ;; Check that it set up for repeat, and run the repeat. + (funcall (lookup-key overriding-terminal-local-map "e")))))) + +(kmacro-tests-deftest + kmacro-tests-run-macro-command-recorded-in-macro () + "No infinite loop if `kmacro-end-and-call-macro' is recorded in the macro. +\(Bug#15126)" + (:expected-result :failed) + (ert-skip "Skipping due to Bug#24921 (an ERT bug)") + (kmacro-tests-define-macro (vconcat "foo" [return] "\M-x" + "kmacro-end-and-call-macro")) + (use-local-map kmacro-tests-keymap) + (kmacro-tests-simulate-command '(kmacro-end-and-call-macro nil))) + + +(kmacro-tests-deftest kmacro-tests-test-ring-2nd-commands () + "2nd macro in ring is displayed and executed normally and on repeat." + (use-local-map kmacro-tests-keymap) + ;; Record one macro, with count. + (push (vconcat "\C-cxi" "\C-u\C-cxi") kmacro-tests-macros) + (kmacro-tests-simulate-command '(kmacro-start-macro 1)) + (kmacro-tests-simulate-command '(kmacro-end-macro nil)) + ;; Check that execute and display do nothing with no 2nd macro. + (kmacro-tests-should-insert "" + (kmacro-tests-simulate-command '(kmacro-call-ring-2nd nil))) + (kmacro-tests-should-match-message "Only one keyboard macro defined" + (kmacro-tests-simulate-command '(kmacro-view-ring-2nd))) + ;; Record another one, with format. + (kmacro-set-format "=%d=") + (kmacro-tests-define-macro (vconcat "bar")) + ;; Execute the first one, mocked up to insert counter. + ;; Should get default format. + (kmacro-tests-should-insert "11" + (kmacro-tests-simulate-command '(kmacro-call-ring-2nd nil))) + ;; Now display the 2nd ring macro and check result. + (kmacro-tests-should-match-message "C-c x i C-u C-c x i" + (kmacro-view-ring-2nd))) + +(kmacro-tests-deftest kmacro-tests-fill-ring-and-rotate () + "Macro ring can shift one way, shift the other way, swap and pop." + (cl-letf ((kmacro-ring-max 4)) + ;; Record enough macros that the first one drops off the history. + (dotimes (n (1+ kmacro-ring-max)) + (kmacro-tests-define-macro (make-vector (1+ n) (+ ?a n)))) + ;; Cycle the ring and check that #2 comes up. + (kmacro-tests-should-match-message "2*b" + (kmacro-tests-simulate-command '(kmacro-cycle-ring-next nil))) + ;; Execute the current macro and check arguments. + (kmacro-tests-should-insert "bbbb" + (kmacro-call-macro 2 t)) + ;; Cycle the ring the other way; #5 expected. + (kmacro-tests-should-match-message "5*e" (kmacro-cycle-ring-previous nil)) + ;; Swapping the top two should give #4. + (kmacro-tests-should-match-message "4*d" (kmacro-swap-ring)) + ;; Delete the top and expect #5. + (kmacro-tests-should-match-message "5*e" (kmacro-delete-ring-head)))) + + +(kmacro-tests-deftest kmacro-tests-test-ring-commands-when-no-macros () + "Ring commands give appropriate message when no macros exist." + (dolist (cmd '((kmacro-cycle-ring-next nil) + (kmacro-cycle-ring-previous nil) + (kmacro-swap-ring) + (kmacro-delete-ring-head) + (kmacro-view-ring-2nd) + (kmacro-call-ring-2nd nil) + (kmacro-view-macro))) + (kmacro-tests-should-match-message "No keyboard macro defined" + (kmacro-tests-simulate-command cmd)))) + +(kmacro-tests-deftest kmacro-tests-repeat-on-last-key () + "Kmacro commands can be run in sequence without prefix keys." + (let* ((prefix (where-is-internal 'kmacro-keymap nil t)) + ;; Make a sequence of events to run. + ;; Comments are expected output of mock macros + ;; on the first and second run of the sequence (see below). + (events (mapcar #'kmacro-tests-get-kmacro-key + '(kmacro-end-or-call-macro-repeat ;c / b + kmacro-end-or-call-macro-repeat ;c / b + kmacro-call-ring-2nd-repeat ;b / a + kmacro-cycle-ring-next + kmacro-end-or-call-macro-repeat ;a / a + kmacro-cycle-ring-previous + kmacro-end-or-call-macro-repeat ;c / b + kmacro-delete-ring-head + kmacro-end-or-call-macro-repeat ;b / a + ))) + (kmacro-tests-macros (list [?a] [?b] [?c])) + ;; What we want kmacro to see as keyboard command sequence + (first-event (seq-concatenate + 'vector + prefix + (vector (kmacro-tests-get-kmacro-key + 'kmacro-end-or-call-macro-repeat))))) + (cl-letf + ;; standardize repeat options + ((kmacro-repeat-no-prefix t) + (kmacro-call-repeat-key t) + (kmacro-call-repeat-with-arg nil)) + ;; "Record" two macros + (dotimes (_n 2) + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + (kmacro-tests-simulate-command '(kmacro-end-macro nil))) + ;; Start recording #3 + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + + ;; Set up pending keyboard events and a fresh buffer + ;; kmacro-set-counter is not one of the repeating kmacro + ;; commands so it should end the sequence. + (let* ((end-key (kmacro-tests-get-kmacro-key 'kmacro-set-counter)) + (kmacro-tests-events (append events (list end-key)))) + (cl-letf (((symbol-function #'this-single-command-keys) + (lambda () first-event))) + (use-local-map kmacro-tests-keymap) + (kmacro-tests-should-insert "ccbacb" + ;; End #3 and launch loop to read events. + (kmacro-end-or-call-macro-repeat nil)))) + + ;; `kmacro-edit-macro-repeat' should also stop the sequence, + ;; so run it again with that at the end. + (let* ((end-key (kmacro-tests-get-kmacro-key 'kmacro-edit-macro-repeat)) + (kmacro-tests-events (append events (list end-key)))) + (cl-letf (((symbol-function #'edit-kbd-macro) #'ignore) + ((symbol-function #'this-single-command-keys) + (lambda () first-event))) + (use-local-map kmacro-tests-keymap) + (kmacro-tests-should-insert "bbbbbaaba" + (kmacro-end-or-call-macro-repeat 3))))))) + +(kmacro-tests-deftest kmacro-tests-repeat-view-and-run () + "Kmacro view cycles through ring and executes macro just viewed." + (let* ((prefix (where-is-internal 'kmacro-keymap nil t)) + (kmacro-tests-events + (mapcar #'kmacro-tests-get-kmacro-key + (append (make-list 5 'kmacro-view-macro-repeat) + '(kmacro-end-or-call-macro-repeat + kmacro-set-counter)))) + ;; Make kmacro see this as keyboard command sequence. + (first-event (seq-concatenate + 'vector + prefix + (vector (kmacro-tests-get-kmacro-key + 'kmacro-view-macro-repeat)))) + ;; Construct a regexp to match the messages which should be + ;; produced by repeated view-repeats. + (macros-regexp (apply #'concat + (mapcar (lambda (c) (format ".+%s\n" c)) + '("d" "c" "b" "a" "d" "c"))))) + (cl-letf ((kmacro-repeat-no-prefix t) + (kmacro-call-repeat-key t) + (kmacro-call-repeat-with-arg nil) + ((symbol-function #'this-single-command-keys) (lambda () + first-event))) + ;; "Record" some macros. + (dotimes (n 4) + (kmacro-tests-define-macro (make-vector 1 (+ ?a n)))) + + (use-local-map kmacro-tests-keymap) + ;; 6 views (the direct call plus the 5 in events) should + ;; cycle through the ring and get to the second-to-last + ;; macro defined. + (kmacro-tests-should-insert "c" + (kmacro-tests-should-match-message macros-regexp + (kmacro-tests-simulate-command '(kmacro-view-macro-repeat nil))))))) + +(kmacro-tests-deftest kmacro-tests-bind-to-key-when-recording () + "Bind to key doesn't bind a key during macro recording." + (cl-letf ((global-map global-map) + (saved-binding (key-binding "\C-a")) + (kmacro-tests-sequences (list "\C-a"))) + (kmacro-tests-simulate-command '(kmacro-start-macro 1)) + (kmacro-bind-to-key nil) + (should (eq saved-binding (key-binding "\C-a"))))) + +(kmacro-tests-deftest kmacro-tests-name-or-bind-to-key-when-no-macro () + "Bind to key, symbol or register fails when when no macro exists." + (should-error (kmacro-bind-to-key nil)) + (should-error (kmacro-name-last-macro 'kmacro-tests-symbol-for-test)) + (should-error (kmacro-to-register))) + +(kmacro-tests-deftest kmacro-tests-bind-to-key-bad-key-sequence () + "Bind to key fails to bind to ^G." + (let ((global-map global-map) + (saved-binding (key-binding "\C-g")) + (kmacro-tests-sequences (list "\C-g"))) + (kmacro-tests-define-macro [1]) + (kmacro-bind-to-key nil) + (should (eq saved-binding (key-binding "\C-g"))))) + +(kmacro-tests-deftest kmacro-tests-bind-to-key-with-key-sequence-in-use () + "Bind to key respects yes-or-no-p when given already bound key sequence." + (kmacro-tests-define-macro (vconcat "abaab")) + (let ((global-map global-map) + (map (make-sparse-keymap)) + (kmacro-tests-sequences (make-list 2 "\C-hi"))) + (define-key map "\C-hi" 'info) + (use-local-map map) + ;; Try the command with yes-or-no-p set up to say no. + (cl-letf (((symbol-function #'yes-or-no-p) + (lambda (prompt) + (should (string-match-p "info" prompt)) + (should (string-match-p "C-h i" prompt)) + nil))) + (kmacro-bind-to-key nil)) + + (should (equal (where-is-internal 'info nil t) + (vconcat "\C-hi"))) + ;; Try it again with yes. + (cl-letf (((symbol-function #' yes-or-no-p) + (lambda (_prompt) t))) + (kmacro-bind-to-key nil)) + + (should-not (equal (where-is-internal 'info global-map t) + (vconcat "\C-hi"))) + (use-local-map nil) + (kmacro-tests-should-insert "abaab" + (funcall (key-binding "\C-hi"))))) + +(kmacro-tests-deftest kmacro-tests-kmacro-bind-to-single-key () + "Bind to key uses C-x C-k A when asked to bind to A." + (let ((global-map global-map) + (kmacro-tests-macros (list (string-to-vector "\C-cxi")))) + (use-local-map kmacro-tests-keymap) + + ;; Record a macro with counter and format set. + (kmacro-set-format "<%d>") + (kmacro-tests-simulate-command '(kmacro-start-macro-or-insert-counter 5)) + (kmacro-tests-simulate-command '(kmacro-end-macro nil)) + + (let ((kmacro-tests-sequences (list "A"))) + (kmacro-bind-to-key nil)) + + ;; Record a second macro with different counter and format. + (kmacro-set-format "%d") + (kmacro-tests-define-macro [2]) + + ;; Check the bound key and run it and verify correct counter + ;; and format. + (should (equal (string-to-vector "\C-cxi") + (car (kmacro-extract-lambda + (key-binding "\C-x\C-kA"))))) + (kmacro-tests-should-insert "<5>" + (funcall (key-binding "\C-x\C-kA"))))) + +(kmacro-tests-deftest kmacro-tests-name-last-macro-unable-to-bind () + "Name last macro won't bind to symbol which is already bound." + (kmacro-tests-define-macro [1]) + ;; Set up a test symbol which looks like a function. + (setplist 'kmacro-tests-symbol-for-test nil) + (fset 'kmacro-tests-symbol-for-test #'ignore) + (should-error (kmacro-name-last-macro 'kmacro-tests-symbol-for-test)) + ;; The empty string symbol also can't be bound. + (should-error (kmacro-name-last-macro (make-symbol "")))) + +(kmacro-tests-deftest kmacro-tests-name-last-macro-bind-and-rebind () + "Name last macro can rebind a symbol it binds." + ;; Make sure our symbol is unbound. + (when (fboundp 'kmacro-tests-symbol-for-test) + (fmakunbound 'kmacro-tests-symbol-for-test)) + (setplist 'kmacro-tests-symbol-for-test nil) + ;; Make two macros and bind them to the same symbol. + (dotimes (i 2) + (kmacro-tests-define-macro (make-vector (1+ i) (+ ?a i))) + (kmacro-name-last-macro 'kmacro-tests-symbol-for-test) + (should (fboundp 'kmacro-tests-symbol-for-test))) + + ;; Now run the function bound to the symbol. Result should be the + ;; second macro. + (kmacro-tests-should-insert "bb" + (kmacro-tests-simulate-command '(kmacro-tests-symbol-for-test)))) + +(kmacro-tests-deftest kmacro-tests-store-in-register () + "Macro can be stored in and retrieved from a register." + (use-local-map kmacro-tests-keymap) + ;; Save and restore register 200 so we can use it for the test. + (let ((saved-reg-contents (get-register 200))) + (unwind-protect + (progn + ;; Define a macro, and save it to a register. + (kmacro-tests-define-macro (vconcat "a\C-a\C-cxu")) + (kmacro-to-register 200) + ;; Then make a new different macro. + (kmacro-tests-define-macro (vconcat "bb\C-a\C-cxu")) + ;; When called from the register, result should be first macro. + (kmacro-tests-should-insert "AAA" + (kmacro-tests-simulate-command '(jump-to-register 200 3) 3)) + (kmacro-tests-should-insert "a C-a C-c x u" + (kmacro-tests-simulate-command '(insert-register 200 t) '(4)))) + (set-register 200 saved-reg-contents)))) + +(kmacro-tests-deftest kmacro-tests-step-edit-act () + "Step-edit steps-through a macro with act and act-repeat." + (kmacro-tests-run-step-edit "he\C-u2lo" + :events (make-list 6 'act) + :result "hello" + :macro-result "he\C-u2lo") + + (kmacro-tests-run-step-edit "f\C-aoo\C-abar" + :events (make-list 5 'act-repeat) + :result "baroof" + :macro-result "f\C-aoo\C-abar")) + +(kmacro-tests-deftest kmacro-tests-step-edit-skip () + "Step-editing can skip parts of macro." + (kmacro-tests-run-step-edit "ofoofff" + :events '(skip skip-keep skip-keep skip-keep + skip-rest) + :result "" + :macro-result "foo")) + +(kmacro-tests-deftest kmacro-tests-step-edit-quit () + "Quit while step-editing leaves macro unchanged." + (kmacro-tests-run-step-edit "bar" + :events '(help insert skip help quit) + :sequences '("f" "o" "o" "\C-j") + :result "foo" + :macro-result "bar")) + +(kmacro-tests-deftest kmacro-tests-step-insert () + "Step edit can insert in macro." + (kmacro-tests-run-step-edit "fbazbop" + :events '(insert act insert-1 act-repeat) + :sequences '("o" "o" "\C-a" "\C-j" "\C-e") + :result "foobazbop" + :macro-result "oo\C-af\C-ebazbop")) + +(kmacro-tests-deftest kmacro-tests-step-edit-replace-digit-argument () + "Step-edit replace can replace a numeric argument in a macro. +This is a regression for item 1 in Bug#24991." + (:expected-result :failed) + (kmacro-tests-run-step-edit "\C-u3b\C-a\C-cxu" + :events '(act replace automatic) + :sequences '("8" "x" "\C-j") + :result "XXXXXXXX" + :macro-result "\C-u8x\C-a\C-cxu")) + +(kmacro-tests-deftest kmacro-tests-step-edit-replace () + "Step-edit replace and replace-1 can replace parts of a macro." + (kmacro-tests-run-step-edit "a\C-a\C-cxu" + :events '(act act replace) + :sequences '("b" "c" "\C-j") + :result "bca" + :macro-result "a\C-abc") + (kmacro-tests-run-step-edit "a\C-a\C-cxucd" + :events '(act replace-1 automatic) + :sequences '("b") + :result "abcd" + :macro-result "ab\C-cxucd") + (kmacro-tests-run-step-edit "by" + :events '(act replace) + :sequences '("a" "r" "\C-j") + :result "bar" + :macro-result "bar")) + +(kmacro-tests-deftest kmacro-tests-step-edit-append () + "Step edit append inserts after point, and append-end inserts at end." + (kmacro-tests-run-step-edit "f-b" + :events '(append append-end) + :sequences '("o" "o" "\C-j" "a" "r" "\C-j") + :result "foo-bar" + :macro-result "foo-bar") + (kmacro-tests-run-step-edit "x" + :events '(append) + :sequences '("\C-a" "\C-cxu" "\C-e" "y" "\C-j") + :result "Xy" + :macro-result "x\C-a\C-cxu\C-ey")) + +(kmacro-tests-deftest kmacro-tests-append-end-at-end-appends () + "Append-end when already at end of macro appends to end of macro. +This is a regression for item 2 in Bug#24991." + (:expected-result :failed) + (kmacro-tests-run-step-edit "x" + :events '(append-end) + :sequences '("\C-a" "\C-cxu" "\C-e" "y" "\C-j") + :result "Xy" + :macro-result "x\C-a\C-cxu\C-ey")) + + +(kmacro-tests-deftest kmacro-tests-step-edit-skip-entire () + "Skipping a whole macro in step-edit leaves macro unchanged. +This is a regression for item 3 in Bug#24991." + (:expected-result :failed) + (kmacro-tests-run-step-edit "xyzzy" + :events '(skip-rest) + :result "" + :macro-result "xyzzy")) + +(kmacro-tests-deftest kmacro-tests-step-edit-step-through-negative-argument () + "Step edit works on macros using negative universal argument. +This is a regression for item 4 in Bug#24991." + (:expected-result :failed) + (kmacro-tests-run-step-edit "boo\C-u-\C-cu" + :events '(act-repeat automatic) + :result "BOO" + :macro-result "boo\C-u-\C-cd")) + +(kmacro-tests-deftest kmacro-tests-step-edit-with-quoted-insert () + "Stepping through a macro that uses quoted insert leaves macro unchanged. +This is a regression for item 5 in Bug#24991." + (:expected-result :failed) + (let ((read-quoted-char-radix 8)) + (kmacro-tests-run-step-edit "\C-cxq17051i there" + :events '(act automatic) + :result "ḩi there" + :macro-result "\C-cxq17051i there") + (kmacro-tests-run-step-edit "g\C-cxq17051i" + :events '(act insert-1 automatic) + :sequences '("-") + :result "g-ḩi" + :macro-result "g-\C-cxq17051i"))) + +(kmacro-tests-deftest kmacro-tests-step-edit-can-replace-meta-keys () + "Replacing C-w with M-w produces the expected result. +This is a regression for item 7 in Bug#24991." + (:expected-result :failed) + (kmacro-tests-run-step-edit "abc\C-b\C-b\C-SPC\C-f\C-w\C-e\C-y" + :events '(act-repeat act-repeat + act-repeat act-repeat + replace automatic) + :sequences '("\M-w" "\C-j") + :result "abcb" + :macro-result "abc\C-b\C-b\C-SPC\C-f\M-w\C-e\C-y") + (kmacro-tests-should-insert "abcb" (kmacro-call-macro nil))) + +(kmacro-tests-deftest kmacro-tests-step-edit-ignores-qr-map-commands () + "Unimplemented commands from `query-replace-map' are ignored." + (kmacro-tests-run-step-edit "yep" + :events '(edit-replacement + act-and-show act-and-exit + delete-and-edit + recenter backup + scroll-up scroll-down + scroll-other-window + scroll-other-window-down + exit-prefix + act act act) + :result "yep" + :macro-result "yep")) + +(kmacro-tests-deftest + kmacro-tests-step-edit-edits-macro-with-extended-command () + "Step-editing a macro which uses the minibuffer can change the macro." + (let ((mac (vconcat [?\M-x] "eval-expression" '[return] + "(insert-char (+ ?a \C-e" [?1] "))" '[return])) + (mac-after (vconcat [?\M-x] "eval-expression" '[return] + "(insert-char (+ ?a \C-e" [?2] "))" '[return]))) + + (kmacro-tests-run-step-edit mac + :events '(act act-repeat + act act-repeat act + replace-1 act-repeat act) + :sequences '("2") + :result "c" + :macro-result mac-after))) + +(kmacro-tests-deftest kmacro-tests-step-edit-step-through-isearch () + "Step-editing can edit a macro which uses `isearch-backward' (Bug#22488)." + (:expected-result :failed) + (let ((mac (vconcat "test Input" '[return] + [?\C-r] "inp" '[return] "\C-cxu")) + (mac-after (vconcat "test input" '[return] + [?\C-r] "inp" '[return] "\C-cd"))) + + (kmacro-tests-run-step-edit mac + :events '(act-repeat act act + act-repeat act + replace-1) + :sequences '("\C-cd") + :result "test input\n" + :macro-result mac-after))) + +(kmacro-tests-deftest kmacro-tests-step-edit-cleans-up-hook () + "Step-editing properly cleans up `post-command-hook.' (Bug #18708)" + (:expected-result :failed) + (let (post-command-hook) + (setq-local post-command-hook '(t)) + (kmacro-tests-run-step-edit "x" + :events '(act) + :result "x" + :macro-result "x") + (kmacro-tests-simulate-command '(beginning-of-line)))) + +(cl-defun kmacro-tests-run-step-edit + (macro &key events sequences result macro-result) + "Set up and run a test of `kmacro-step-edit-macro'. + +Run `kmacro-step-edit-macro' with MACRO defined as a keyboard macro +and `read-event' and `read-key-sequence' set up to return items from +EVENTS and SEQUENCES respectively. SEQUENCES may be nil, but +EVENTS should not be. EVENTS should be a list of symbols bound +in `kmacro-step-edit-map' or `query-replace' map, and this function +will do the keymap lookup for you. SEQUENCES should contain +return values for `read-key-sequence'. + +Before running the macro, the current buffer will be erased. +RESULT is the string that should be inserted during the +step-editing process, and MACRO-RESULT is the expected value of +`last-kbd-macro' after the editing is complete." + + (let* ((kmacro-tests-events (mapcar #'kmacro-tests-get-kmacro-step-edit-key events)) + (kmacro-tests-sequences sequences)) + + (kmacro-tests-define-macro (string-to-vector macro)) + (use-local-map kmacro-tests-keymap) + (erase-buffer) + (kmacro-step-edit-macro) + (when result + (should (equal result (buffer-string)))) + (when macro-result + (should (equal last-kbd-macro (string-to-vector macro-result)))))) + +;;; Utilities: + +(defun kmacro-tests-simulate-command (command &optional arg) + "Call `ert-simulate-command' after setting `current-prefix-arg'. +Sets `current-prefix-arg' to ARG if it is non-nil, otherwise to +the second element of COMMAND, before executing COMMAND using +`ert-simulate-command'." + (let ((current-prefix-arg (or arg (cadr command)))) + (ert-simulate-command command))) + +(defun kmacro-tests-define-macro (mac) + "Define MAC as a keyboard macro using kmacro commands." + (push mac kmacro-tests-macros) + (kmacro-tests-simulate-command '(kmacro-start-macro nil)) + (should defining-kbd-macro) + (kmacro-tests-simulate-command '(kmacro-end-macro nil)) + (should (equal mac last-kbd-macro))) + +(defun kmacro-tests-get-kmacro-key (sym) + "Look up kmacro command SYM in kmacro's keymap. +Return the integer key value found." + (aref (where-is-internal sym kmacro-keymap t) 0)) + +(defun kmacro-tests-get-kmacro-step-edit-key (sym) + "Return the first key bound to SYM in `kmacro-step-edit-map'." + (let ((where (aref (where-is-internal sym kmacro-step-edit-map t) 0))) + (if (consp where) + (car where) + where))) + +(provide 'kmacro-tests) + +;;; kmacro-tests.el ends here diff --git a/test/automated/finalizer-tests.el b/test/lisp/mail/rmail-tests.el index ca8c8cb866f..6cf9053bc0d 100644 --- a/test/automated/finalizer-tests.el +++ b/test/lisp/mail/rmail-tests.el @@ -1,10 +1,7 @@ -;;; finalizer-tests.el --- Finalizer tests -*- lexical-binding: t -*- +;;; rmail-tests.el --- Test suite. -*- lexical-binding: t -*- ;; Copyright (C) 2015-2017 Free Software Foundation, Inc. -;; Author: Daniel Colascione <dancol@dancol.org> -;; Keywords: - ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify @@ -20,14 +17,19 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. -;;; Commentary: - -;; - ;;; Code: - (require 'ert) -(require 'cl-lib) +(require 'rmail) + + +(ert-deftest rmail-autoload () + "Tests to see whether reftex-auc has been autoloaded" + (should + (fboundp 'rmail-edit-current-message)) + (should + (autoloadp + (symbol-function + 'rmail-edit-current-message)))) -(ert-deftest finalizer-object-type () - (should (equal (type-of (make-finalizer nil)) 'finalizer))) +(provide 'rmail-tests) +;; rmail-tests.el ends here diff --git a/test/automated/man-tests.el b/test/lisp/man-tests.el index b9f47f50c20..b9f47f50c20 100644 --- a/test/automated/man-tests.el +++ b/test/lisp/man-tests.el diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el new file mode 100644 index 00000000000..169ed83448f --- /dev/null +++ b/test/lisp/md4-tests.el @@ -0,0 +1,61 @@ +;;; md4-tests.el --- tests for md4.el -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Mark Oteiza <mvoteiza@udel.edu> +;; Maintainer: emacs-devel@gnu.org + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'md4) + +(defun md4-tests-digest->hex (str) + "Print digest STR in hexadecimal." + (mapconcat (lambda (x) (format "%02x" x)) str "")) + +(ert-deftest md4-test-rfc1320 () + "Verify the test suite results in RFC 1320. +See <https://tools.ietf.org/html/rfc1320>." + (should + (equal (md4-tests-digest->hex (md4 "" 0)) + "31d6cfe0d16ae931b73c59d7e0c089c0")) + (should + (equal (md4-tests-digest->hex (md4 "a" 1)) + "bde52cb31de33e46245e05fbdbd6fb24")) + (should + (equal (md4-tests-digest->hex (md4 "abc" 3)) + "a448017aaf21d8525fc10ae87aa6729d")) + (should + (equal (md4-tests-digest->hex (md4 "message digest" 14)) + "d9130a8164549fe818874806e1c7014b")) + (should + (equal (md4-tests-digest->hex (md4 "abcdefghijklmnopqrstuvwxyz" 26)) + "d79e1c308aa5bbcdeea8ed63df412da9")) + (should + (equal (md4-tests-digest->hex + (md4 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 62)) + "043f8582f241db351ce627e153e7f0e4")) + (should + (equal (md4-tests-digest->hex + (md4 "12345678901234567890123456789012345678901234567890123456789012345678901234567890" 80)) + "e33b4ddc9c38f2199c3e7b164fcc0536"))) + +;;; md4-tests.el ends here diff --git a/test/automated/completion-tests.el b/test/lisp/minibuffer-tests.el index efed8f8bed4..7c5fcb4838f 100644 --- a/test/automated/completion-tests.el +++ b/test/lisp/minibuffer-tests.el @@ -28,7 +28,7 @@ (ert-deftest completion-test1 () (with-temp-buffer - (cl-flet* ((test/completion-table (string pred action) + (cl-flet* ((test/completion-table (_string _pred action) (if (eq action 'lambda) nil "test: ")) diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el new file mode 100644 index 00000000000..a8eca28365e --- /dev/null +++ b/test/lisp/mouse-tests.el @@ -0,0 +1,59 @@ +;;; mouse-tests.el --- unit tests for mouse.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for lisp/mouse.el. + +;;; Code: + +(ert-deftest bug23288-use-return-value () + "If ‘mouse-on-link-p’ returns a string, its first character is +used." + (cl-letf ((last-input-event '(down-mouse-1 nil 1)) + (unread-command-events '((mouse-1 nil 1))) + (mouse-1-click-follows-link t) + (mouse-1-click-in-non-selected-windows t) + ((symbol-function 'mouse-on-link-p) (lambda (_pos) "abc"))) + (should-not (mouse--down-1-maybe-follows-link)) + (should (equal unread-command-events '(?a))))) + +(ert-deftest bug23288-translate-to-mouse-2 () + "If ‘mouse-on-link-p’ doesn’t return a string or vector, +translate ‘mouse-1’ events into ‘mouse-2’ events." + (cl-letf ((last-input-event '(down-mouse-1 nil 1)) + (unread-command-events '((mouse-1 nil 1))) + (mouse-1-click-follows-link t) + (mouse-1-click-in-non-selected-windows t) + ((symbol-function 'mouse-on-link-p) (lambda (_pos) t))) + (should-not (mouse--down-1-maybe-follows-link)) + (should (equal unread-command-events '((mouse-2 nil 1)))))) + +(ert-deftest bug26816-mouse-frame-movement () + "Mouse moves relative to frame." + (skip-unless (display-graphic-p)) + (let ((frame (selected-frame))) + (set-mouse-position frame 0 0) + (should (equal (mouse-position) + (cons frame (cons 0 0)))))) + + +;;; mouse-tests.el ends here diff --git a/test/automated/dbus-tests.el b/test/lisp/net/dbus-tests.el index 525709b92e7..0a59e3b42d1 100644 --- a/test/automated/dbus-tests.el +++ b/test/lisp/net/dbus-tests.el @@ -22,7 +22,8 @@ (require 'ert) (require 'dbus) -(setq dbus-debug nil) +(defvar dbus-debug nil) +(declare-function dbus-get-unique-name "dbusbind.c" (bus)) (defvar dbus--test-enabled-session-bus (and (featurep 'dbusbind) diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el new file mode 100644 index 00000000000..e7bb3e8ccf9 --- /dev/null +++ b/test/lisp/net/network-stream-tests.el @@ -0,0 +1,294 @@ +;;; network-stream-tests.el --- tests for network processes -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Lars Ingebrigtsen <larsi@gnus.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + + +;;; Code: + +(require 'gnutls) + +(ert-deftest make-local-unix-server () + (skip-unless (featurep 'make-network-process '(:family local))) + (let* ((file (make-temp-name "/tmp/server-test")) + (server + (make-network-process + :name "server" + :server t + :buffer (get-buffer-create "*server*") + :noquery t + :family 'local + :service file))) + (should (equal (process-contact server :local) file)) + (delete-file (process-contact server :local)))) + +(ert-deftest make-ipv4-tcp-server-with-unspecified-port () + (let ((server + (make-network-process + :name "server" + :server t + :noquery t + :family 'ipv4 + :service t + :host 'local))) + (should (and (arrayp (process-contact server :local)) + (numberp (aref (process-contact server :local) 4)) + (> (aref (process-contact server :local) 4) 0))) + (delete-process server))) + +(ert-deftest make-ipv4-tcp-server-with-specified-port () + (let ((server + (make-network-process + :name "server" + :server t + :noquery t + :family 'ipv4 + :service 57869 + :host 'local))) + (should (and (arrayp (process-contact server :local)) + (= (aref (process-contact server :local) 4) 57869))) + (delete-process server))) + +(defun make-server (host) + (make-network-process + :name "server" + :server t + :noquery t + :family 'ipv4 + :coding 'raw-text-unix + :buffer (get-buffer-create "*server*") + :service t + :sentinel 'server-sentinel + :filter 'server-process-filter + :host host)) + +(defun server-sentinel (_proc _msg) + ) + +(defun server-process-filter (proc string) + (message "Received %s" string) + (let ((prev (process-get proc 'previous-string))) + (when prev + (setq string (concat prev string)) + (process-put proc 'previous-string nil))) + (if (and (not (string-match "\n" string)) + (> (length string) 0)) + (process-put proc 'previous-string string)) + (let ((command (split-string string))) + (cond + ((equal (car command) "echo") + (process-send-string proc (concat (cadr command) "\n"))) + (t + )))) + +(ert-deftest echo-server-with-dns () + (let* ((server (make-server (system-name))) + (port (aref (process-contact server :local) 4)) + (proc (make-network-process :name "foo" + :buffer (generate-new-buffer "*foo*") + :host (system-name) + :service port))) + (with-current-buffer (process-buffer proc) + (process-send-string proc "echo foo") + (sleep-for 0.1) + (should (equal (buffer-string) "foo\n"))) + (delete-process server))) + +(ert-deftest echo-server-with-localhost () + (let* ((server (make-server 'local)) + (port (aref (process-contact server :local) 4)) + (proc (make-network-process :name "foo" + :buffer (generate-new-buffer "*foo*") + :host "localhost" + :service port))) + (with-current-buffer (process-buffer proc) + (process-send-string proc "echo foo") + (sleep-for 0.1) + (should (equal (buffer-string) "foo\n"))) + (delete-process server))) + +(ert-deftest echo-server-with-ip () + (let* ((server (make-server 'local)) + (port (aref (process-contact server :local) 4)) + (proc (make-network-process :name "foo" + :buffer (generate-new-buffer "*foo*") + :host "127.0.0.1" + :service port))) + (with-current-buffer (process-buffer proc) + (process-send-string proc "echo foo") + (sleep-for 0.1) + (should (equal (buffer-string) "foo\n"))) + (delete-process server))) + +(ert-deftest echo-server-nowait () + (let* ((server (make-server 'local)) + (port (aref (process-contact server :local) 4)) + (proc (make-network-process :name "foo" + :buffer (generate-new-buffer "*foo*") + :host "localhost" + :nowait t + :family 'ipv4 + :service port)) + (times 0)) + (should (eq (process-status proc) 'connect)) + (while (and (eq (process-status proc) 'connect) + (< (setq times (1+ times)) 10)) + (sit-for 0.1)) + (skip-unless (not (eq (process-status proc) 'connect))) + (with-current-buffer (process-buffer proc) + (process-send-string proc "echo foo") + (sleep-for 0.1) + (should (equal (buffer-string) "foo\n"))) + (delete-process server))) + +(defconst network-stream-tests--datadir + (expand-file-name "test/data/net" source-directory)) + +(defun make-tls-server (port) + (start-process "gnutls" (generate-new-buffer "*tls*") + "gnutls-serv" "--http" + "--x509keyfile" + (concat network-stream-tests--datadir "/key.pem") + "--x509certfile" + (concat network-stream-tests--datadir "/cert.pem") + "--port" (format "%s" port))) + +(ert-deftest connect-to-tls-ipv4-wait () + (skip-unless (executable-find "gnutls-serv")) + (skip-unless (gnutls-available-p)) + (let ((server (make-tls-server 44332)) + (times 0) + proc status) + (unwind-protect + (progn + (sleep-for 1) + (with-current-buffer (process-buffer server) + (message "gnutls-serv: %s" (buffer-string))) + + ;; It takes a while for gnutls-serv to start. + (while (and (null (ignore-errors + (setq proc (make-network-process + :name "bar" + :buffer (generate-new-buffer "*foo*") + :host "localhost" + :service 44332)))) + (< (setq times (1+ times)) 10)) + (sit-for 0.1)) + (should proc) + (gnutls-negotiate :process proc + :type 'gnutls-x509pki + :hostname "localhost")) + (if (process-live-p server) (delete-process server))) + (setq status (gnutls-peer-status proc)) + (should (consp status)) + (delete-process proc) + ;; This sleep-for is needed for the native MS-Windows build. If + ;; it is removed, the next test mysteriously fails because the + ;; initial part of the echo is not received. + (sleep-for 0.1) + (let ((issuer (plist-get (plist-get status :certificate) :issuer))) + (should (stringp issuer)) + (setq issuer (split-string issuer ",")) + (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))) + +(ert-deftest connect-to-tls-ipv4-nowait () + (skip-unless (executable-find "gnutls-serv")) + (skip-unless (gnutls-available-p)) + (let ((server (make-tls-server 44331)) + (times 0) + proc status) + (unwind-protect + (progn + (sleep-for 1) + (with-current-buffer (process-buffer server) + (message "gnutls-serv: %s" (buffer-string))) + + ;; It takes a while for gnutls-serv to start. + (while (and (null (ignore-errors + (setq proc (make-network-process + :name "bar" + :buffer (generate-new-buffer "*foo*") + :nowait t + :tls-parameters + (cons 'gnutls-x509pki + (gnutls-boot-parameters + :hostname "localhost")) + :host "localhost" + :service 44331)))) + (< (setq times (1+ times)) 10)) + (sit-for 0.1)) + (should proc) + (setq times 0) + (while (and (eq (process-status proc) 'connect) + (< (setq times (1+ times)) 10)) + (sit-for 0.1)) + (skip-unless (not (eq (process-status proc) 'connect)))) + (if (process-live-p server) (delete-process server))) + (setq status (gnutls-peer-status proc)) + (should (consp status)) + (delete-process proc) + (let ((issuer (plist-get (plist-get status :certificate) :issuer))) + (should (stringp issuer)) + (setq issuer (split-string issuer ",")) + (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))) + +(ert-deftest connect-to-tls-ipv6-nowait () + (skip-unless (executable-find "gnutls-serv")) + (skip-unless (gnutls-available-p)) + (skip-unless (not (eq system-type 'windows-nt))) + (skip-unless (featurep 'make-network-process '(:family ipv6))) + (let ((server (make-tls-server 44333)) + (times 0) + proc status) + (unwind-protect + (progn + (sleep-for 1) + (with-current-buffer (process-buffer server) + (message "gnutls-serv: %s" (buffer-string))) + + ;; It takes a while for gnutls-serv to start. + (while (and (null (ignore-errors + (setq proc (make-network-process + :name "bar" + :buffer (generate-new-buffer "*foo*") + :family 'ipv6 + :nowait t + :tls-parameters + (cons 'gnutls-x509pki + (gnutls-boot-parameters + :hostname "localhost")) + :host "::1" + :service 44333)))) + (< (setq times (1+ times)) 10)) + (sit-for 0.1)) + (should proc) + (while (eq (process-status proc) 'connect) + (sit-for 0.1))) + (if (process-live-p server) (delete-process server))) + (setq status (gnutls-peer-status proc)) + (should (consp status)) + (delete-process proc) + (let ((issuer (plist-get (plist-get status :certificate) :issuer))) + (should (stringp issuer)) + (setq issuer (split-string issuer ",")) + (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))) + +;;; network-stream-tests.el ends here diff --git a/test/automated/newsticker-tests.el b/test/lisp/net/newsticker-tests.el index 56064f781de..56064f781de 100644 --- a/test/automated/newsticker-tests.el +++ b/test/lisp/net/newsticker-tests.el diff --git a/test/lisp/net/puny-tests.el b/test/lisp/net/puny-tests.el new file mode 100644 index 00000000000..b06364e3b37 --- /dev/null +++ b/test/lisp/net/puny-tests.el @@ -0,0 +1,41 @@ +;;; puny-tests.el --- tests for net/puny.el -*- coding: utf-8; -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'puny) + +(ert-deftest puny-test-encode () + "Test puny encoding." + (should (string= (puny-encode-string "bücher") "xn--bcher-kva"))) + +(ert-deftest puny-test-decode () + "Test puny decoding." + (should (string= (puny-decode-string "xn--bcher-kva") "bücher"))) + +(ert-deftest puny-test-encode2 () + "Test puny encoding." + (should (string= (puny-encode-string "חנוך") "xn--9dbdkw"))) + +(ert-deftest puny-test-decode2 () + "Test puny decoding." + (should (string= (puny-decode-string "xn--9dbdkw") "חנוך"))) + +;;; puny-tests.el ends here diff --git a/test/automated/sasl-scram-rfc-tests.el b/test/lisp/net/sasl-scram-rfc-tests.el index 96cec77c56d..96cec77c56d 100644 --- a/test/automated/sasl-scram-rfc-tests.el +++ b/test/lisp/net/sasl-scram-rfc-tests.el diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el new file mode 100644 index 00000000000..c82338af73e --- /dev/null +++ b/test/lisp/net/shr-tests.el @@ -0,0 +1,58 @@ +;;; network-stream-tests.el --- tests for network processes -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Lars Ingebrigtsen <larsi@gnus.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'shr) + +(defconst shr-tests--datadir + (expand-file-name "test/data/shr" source-directory)) + +(defun shr-test (name) + (with-temp-buffer + (insert-file-contents (format (concat shr-tests--datadir "/%s.html") name)) + (let ((dom (libxml-parse-html-region (point-min) (point-max))) + (shr-width 80) + (shr-use-fonts nil)) + (erase-buffer) + (shr-insert-document dom) + (cons (buffer-substring-no-properties (point-min) (point-max)) + (with-temp-buffer + (insert-file-contents + (format (concat shr-tests--datadir "/%s.txt") name)) + (while (re-search-forward "%\\([0-9A-F][0-9A-F]\\)" nil t) + (replace-match (string (string-to-number (match-string 1) 16)) + t t)) + (buffer-string)))))) + +(ert-deftest rendering () + (skip-unless (fboundp 'libxml-parse-html-region)) + (dolist (file (directory-files shr-tests--datadir nil "\\.html\\'")) + (let* ((name (replace-regexp-in-string "\\.html\\'" "" file)) + (result (shr-test name))) + (unless (equal (car result) (cdr result)) + (should (not (list name (car result) (cdr result)))))))) + +(require 'shr) + +;;; shr-stream-tests.el ends here diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el new file mode 100644 index 00000000000..28147c48d6c --- /dev/null +++ b/test/lisp/net/tramp-tests.el @@ -0,0 +1,3827 @@ +;;; tramp-tests.el --- Tests of remote file access -*- lexical-binding:t -*- + +;; Copyright (C) 2013-2017 Free Software Foundation, Inc. + +;; Author: Michael Albinus <michael.albinus@gmx.de> + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;; The tests require a recent ert.el from Emacs 24.4. + +;; Some of the tests require access to a remote host files. Since +;; this could be problematic, a mock-up connection method "mock" is +;; used. Emulating a remote connection, it simply calls "sh -i". +;; Tramp's file name handlers still run, so this test is sufficient +;; except for connection establishing. + +;; If you want to test a real Tramp connection, set +;; $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable value in order to +;; overwrite the default value. If you want to skip tests accessing a +;; remote host, set this environment variable to "/dev/null" or +;; whatever is appropriate on your system. + +;; A whole test run can be performed calling the command `tramp-test-all'. + +;;; Code: + +(require 'dired) +(require 'ert) +(require 'tramp) +(require 'vc) +(require 'vc-bzr) +(require 'vc-git) +(require 'vc-hg) + +(declare-function tramp-find-executable "tramp-sh") +(declare-function tramp-get-remote-path "tramp-sh") +(declare-function tramp-get-remote-stat "tramp-sh") +(declare-function tramp-get-remote-perl "tramp-sh") +(defvar auto-save-file-name-transforms) +(defvar tramp-copy-size-limit) +(defvar tramp-persistency-file-name) +(defvar tramp-remote-process-environment) + +;; There is no default value on w32 systems, which could work out of the box. +(defconst tramp-test-temporary-file-directory + (cond + ((getenv "REMOTE_TEMPORARY_FILE_DIRECTORY")) + ((eq system-type 'windows-nt) null-device) + (t (add-to-list + 'tramp-methods + '("mock" + (tramp-login-program "sh") + (tramp-login-args (("-i"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")) + (tramp-connection-timeout 10))) + (add-to-list + 'tramp-default-host-alist + `("\\`mock\\'" nil ,(system-name))) + (format "/mock::%s" temporary-file-directory))) + "Temporary directory for Tramp tests.") + +(setq password-cache-expiry nil + tramp-verbose 0 + tramp-copy-size-limit nil + tramp-message-show-message nil + tramp-persistency-file-name nil) + +;; This shall happen on hydra only. +(when (getenv "NIX_STORE") + (add-to-list 'tramp-remote-path 'tramp-own-remote-path)) + +(defvar tramp--test-expensive-test + (null + (string-equal (getenv "SELECTOR") "(quote (not (tag :expensive-test)))")) + "Whether expensive tests are run.") + +(defvar tramp--test-enabled-checked nil + "Cached result of `tramp--test-enabled'. +If the function did run, the value is a cons cell, the `cdr' +being the result.") + +(defun tramp--test-enabled () + "Whether remote file access is enabled." + (unless (consp tramp--test-enabled-checked) + (setq + tramp--test-enabled-checked + (cons + t (ignore-errors + (and + (file-remote-p tramp-test-temporary-file-directory) + (file-directory-p tramp-test-temporary-file-directory) + (file-writable-p tramp-test-temporary-file-directory)))))) + + (when (cdr tramp--test-enabled-checked) + ;; Cleanup connection. + (ignore-errors + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + nil 'keep-password))) + + ;; Return result. + (cdr tramp--test-enabled-checked)) + +(defun tramp--test-make-temp-name (&optional local quoted) + "Create a temporary file name for test. +If LOCAL is non-nil, a local file is created. +If QUOTED is non-nil, the local part of the file is quoted." + (funcall + (if quoted 'tramp-compat-file-name-quote 'identity) + (expand-file-name + (make-temp-name "tramp-test") + (if local temporary-file-directory tramp-test-temporary-file-directory)))) + +(defmacro tramp--instrument-test-case (verbose &rest body) + "Run BODY with `tramp-verbose' equal VERBOSE. +Print the the content of the Tramp debug buffer, if BODY does not +eval properly in `should' or `should-not'. `should-error' is not +handled properly. BODY shall not contain a timeout." + (declare (indent 1) (debug (natnump body))) + `(let ((tramp-verbose ,verbose) + (tramp-debug-on-error t) + (debug-ignored-errors + (cons "^make-symbolic-link not supported$" debug-ignored-errors))) + (unwind-protect + (progn ,@body) + (when (> tramp-verbose 3) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (with-current-buffer (tramp-get-connection-buffer v) + (message "%s" (buffer-string))) + (with-current-buffer (tramp-get-debug-buffer v) + (message "%s" (buffer-string)))))))) + +(ert-deftest tramp-test00-availability () + "Test availability of Tramp functions." + :expected-result (if (tramp--test-enabled) :passed :failed) + (message "Remote directory: `%s'" tramp-test-temporary-file-directory) + (should (ignore-errors + (and + (file-remote-p tramp-test-temporary-file-directory) + (file-directory-p tramp-test-temporary-file-directory) + (file-writable-p tramp-test-temporary-file-directory))))) + +(ert-deftest tramp-test01-file-name-syntax () + "Check remote file name syntax." + ;; Simple cases. + (should (tramp-tramp-file-p "/method::")) + (should (tramp-tramp-file-p "/method:host:")) + (should (tramp-tramp-file-p "/method:user@:")) + (should (tramp-tramp-file-p "/method:user@host:")) + (should (tramp-tramp-file-p "/method:user@email@host:")) + + ;; Using a port. + (should (tramp-tramp-file-p "/method:host#1234:")) + (should (tramp-tramp-file-p "/method:user@host#1234:")) + + ;; Using an IPv4 address. + (should (tramp-tramp-file-p "/method:1.2.3.4:")) + (should (tramp-tramp-file-p "/method:user@1.2.3.4:")) + + ;; Using an IPv6 address. + (should (tramp-tramp-file-p "/method:[::1]:")) + (should (tramp-tramp-file-p "/method:user@[::1]:")) + + ;; Local file name part. + (should (tramp-tramp-file-p "/method:::")) + (should (tramp-tramp-file-p "/method::/:")) + (should (tramp-tramp-file-p "/method::/path/to/file")) + (should (tramp-tramp-file-p "/method::/:/path/to/file")) + (should (tramp-tramp-file-p "/method::file")) + (should (tramp-tramp-file-p "/method::/:file")) + + ;; Multihop. + (should (tramp-tramp-file-p "/method1:|method2::")) + (should (tramp-tramp-file-p "/method1:host1|method2:host2:")) + (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) + (should (tramp-tramp-file-p + "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) + + ;; No strings. + (should-not (tramp-tramp-file-p nil)) + (should-not (tramp-tramp-file-p 'symbol)) + ;; Ange-ftp syntax. + (should-not (tramp-tramp-file-p "/host:")) + (should-not (tramp-tramp-file-p "/user@host:")) + (should-not (tramp-tramp-file-p "/1.2.3.4:")) + (should-not (tramp-tramp-file-p "/[]:")) + (should-not (tramp-tramp-file-p "/[::1]:")) + (should-not (tramp-tramp-file-p "/host:/:")) + (should-not (tramp-tramp-file-p "/host1|host2:")) + (should-not (tramp-tramp-file-p "/user1@host1|user2@host2:")) + ;; Quote with "/:" suppresses file name handlers. + (should-not (tramp-tramp-file-p "/::")) + (should-not (tramp-tramp-file-p "/:@:")) + (should-not (tramp-tramp-file-p "/:[]:")) + ;; Methods shall be at least two characters on MS Windows, except + ;; the default method. + (let ((system-type 'windows-nt)) + (should-not (tramp-tramp-file-p "/c:/path/to/file")) + (should-not (tramp-tramp-file-p "/c::/path/to/file")) + (should (tramp-tramp-file-p "/-::/path/to/file"))) + (let ((system-type 'gnu/linux)) + (should (tramp-tramp-file-p "/-:h:/path/to/file")) + (should (tramp-tramp-file-p "/m::/path/to/file")))) + +(ert-deftest tramp-test01-file-name-syntax-simplified () + "Check simplified file name syntax." + :tags '(:expensive-test) + (let ((syntax tramp-syntax)) + (unwind-protect + (progn + (tramp-change-syntax 'simplified) + ;; Simple cases. + (should (tramp-tramp-file-p "/host:")) + (should (tramp-tramp-file-p "/user@:")) + (should (tramp-tramp-file-p "/user@host:")) + (should (tramp-tramp-file-p "/user@email@host:")) + + ;; Using a port. + (should (tramp-tramp-file-p "/host#1234:")) + (should (tramp-tramp-file-p "/user@host#1234:")) + + ;; Using an IPv4 address. + (should (tramp-tramp-file-p "/1.2.3.4:")) + (should (tramp-tramp-file-p "/user@1.2.3.4:")) + + ;; Using an IPv6 address. + (should (tramp-tramp-file-p "/[::1]:")) + (should (tramp-tramp-file-p "/user@[::1]:")) + + ;; Local file name part. + (should (tramp-tramp-file-p "/host::")) + (should (tramp-tramp-file-p "/host:/:")) + (should (tramp-tramp-file-p "/host:/path/to/file")) + (should (tramp-tramp-file-p "/host:/:/path/to/file")) + (should (tramp-tramp-file-p "/host:file")) + (should (tramp-tramp-file-p "/host:/:file")) + + ;; Multihop. + (should (tramp-tramp-file-p "/host1|host2:")) + (should (tramp-tramp-file-p "/user1@host1|user2@host2:")) + (should (tramp-tramp-file-p "/user1@host1|user2@host2|user3@host3:")) + + ;; No strings. + (should-not (tramp-tramp-file-p nil)) + (should-not (tramp-tramp-file-p 'symbol)) + ;; Quote with "/:" suppresses file name handlers. + (should-not (tramp-tramp-file-p "/::")) + (should-not (tramp-tramp-file-p "/:@:")) + (should-not (tramp-tramp-file-p "/:[]:"))) + + ;; Exit. + (tramp-change-syntax syntax)))) + +(ert-deftest tramp-test01-file-name-syntax-separate () + "Check separate file name syntax." + :tags '(:expensive-test) + (let ((syntax tramp-syntax)) + (unwind-protect + (progn + (tramp-change-syntax 'separate) + ;; Simple cases. + (should (tramp-tramp-file-p "/[method/]")) + (should (tramp-tramp-file-p "/[method/host]")) + (should (tramp-tramp-file-p "/[method/user@]")) + (should (tramp-tramp-file-p "/[method/user@host]")) + (should (tramp-tramp-file-p "/[method/user@email@host]")) + + ;; Using a port. + (should (tramp-tramp-file-p "/[method/host#1234]")) + (should (tramp-tramp-file-p "/[method/user@host#1234]")) + + ;; Using an IPv4 address. + (should (tramp-tramp-file-p "/[method/1.2.3.4]")) + (should (tramp-tramp-file-p "/[method/user@1.2.3.4]")) + + ;; Using an IPv6 address. + (should (tramp-tramp-file-p "/[method/::1]")) + (should (tramp-tramp-file-p "/[method/user@::1]")) + + ;; Local file name part. + (should (tramp-tramp-file-p "/[method/]")) + (should (tramp-tramp-file-p "/[method/]/:")) + (should (tramp-tramp-file-p "/[method/]/path/to/file")) + (should (tramp-tramp-file-p "/[method/]/:/path/to/file")) + (should (tramp-tramp-file-p "/[method/]file")) + (should (tramp-tramp-file-p "/[method/]/:file")) + + ;; Multihop. + (should (tramp-tramp-file-p "/[method1/|method2/]")) + (should (tramp-tramp-file-p "/[method1/host1|method2/host2]")) + (should + (tramp-tramp-file-p + "/[method1/user1@host1|method2/user2@host2]")) + (should + (tramp-tramp-file-p + "/[method1/user1@host1|method2/user2@host2|method3/user3@host3]")) + + ;; No strings. + (should-not (tramp-tramp-file-p nil)) + (should-not (tramp-tramp-file-p 'symbol)) + ;; Ange-ftp syntax. + (should-not (tramp-tramp-file-p "/host:")) + (should-not (tramp-tramp-file-p "/user@host:")) + (should-not (tramp-tramp-file-p "/1.2.3.4:")) + (should-not (tramp-tramp-file-p "/host:/:")) + (should-not (tramp-tramp-file-p "/host1|host2:")) + (should-not (tramp-tramp-file-p "/user1@host1|user2@host2:")) + ;; Quote with "/:" suppresses file name handlers. + (should-not (tramp-tramp-file-p "/:[]"))) + + ;; Exit. + (tramp-change-syntax syntax)))) + +(ert-deftest tramp-test02-file-name-dissect () + "Check remote file name components." + (let ((tramp-default-method "default-method") + (tramp-default-user "default-user") + (tramp-default-host "default-host")) + ;; Expand `tramp-default-user' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/method::") + (format "/%s:%s@%s:" "method" "default-user" "default-host"))) + (should (string-equal (file-remote-p "/method::" 'method) "method")) + (should (string-equal (file-remote-p "/method::" 'user) "default-user")) + (should (string-equal (file-remote-p "/method::" 'host) "default-host")) + (should (string-equal (file-remote-p "/method::" 'localname) "")) + (should (string-equal (file-remote-p "/method::" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/-:host:") + (format "/%s:%s@%s:" "default-method" "default-user" "host"))) + (should (string-equal (file-remote-p "/-:host:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:host:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:host:" 'host) "host")) + (should (string-equal (file-remote-p "/-:host:" 'localname) "")) + (should (string-equal (file-remote-p "/-:host:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/-:user@:") + (format "/%s:%s@%s:" "default-method" "user" "default-host"))) + (should (string-equal (file-remote-p "/-:user@:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:user@:" 'user) "user")) + (should (string-equal (file-remote-p "/-:user@:" 'host) "default-host")) + (should (string-equal (file-remote-p "/-:user@:" 'localname) "")) + (should (string-equal (file-remote-p "/-:user@:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/-:user@host:") + (format "/%s:%s@%s:" "default-method" "user" "host"))) + (should (string-equal + (file-remote-p "/-:user@host:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:user@host:" 'user) "user")) + (should (string-equal (file-remote-p "/-:user@host:" 'host) "host")) + (should (string-equal (file-remote-p "/-:user@host:" 'localname) "")) + (should (string-equal (file-remote-p "/-:user@host:" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/method:host:") + (format "/%s:%s@%s:" "method" "default-user" "host"))) + (should (string-equal (file-remote-p "/method:host:" 'method) "method")) + (should (string-equal (file-remote-p "/method:host:" 'user) "default-user")) + (should (string-equal (file-remote-p "/method:host:" 'host) "host")) + (should (string-equal (file-remote-p "/method:host:" 'localname) "")) + (should (string-equal (file-remote-p "/method:host:" 'hop) nil)) + + ;; Expand `tramp-default-host'. + (should (string-equal + (file-remote-p "/method:user@:") + (format "/%s:%s@%s:" "method" "user" "default-host"))) + (should (string-equal (file-remote-p "/method:user@:" 'method) "method")) + (should (string-equal (file-remote-p "/method:user@:" 'user) "user")) + (should (string-equal (file-remote-p "/method:user@:" 'host) + "default-host")) + (should (string-equal (file-remote-p "/method:user@:" 'localname) "")) + (should (string-equal (file-remote-p "/method:user@:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/method:user@host:") + (format "/%s:%s@%s:" "method" "user" "host"))) + (should (string-equal + (file-remote-p "/method:user@host:" 'method) "method")) + (should (string-equal (file-remote-p "/method:user@host:" 'user) "user")) + (should (string-equal (file-remote-p "/method:user@host:" 'host) "host")) + (should (string-equal (file-remote-p "/method:user@host:" 'localname) "")) + (should (string-equal (file-remote-p "/method:user@host:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/method:user@email@host:") + (format "/%s:%s@%s:" "method" "user@email" "host"))) + (should (string-equal + (file-remote-p "/method:user@email@host:" 'method) "method")) + (should (string-equal + (file-remote-p "/method:user@email@host:" 'user) "user@email")) + (should (string-equal + (file-remote-p "/method:user@email@host:" 'host) "host")) + (should (string-equal + (file-remote-p "/method:user@email@host:" 'localname) "")) + (should (string-equal + (file-remote-p "/method:user@email@host:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/-:host#1234:") + (format "/%s:%s@%s:" "default-method" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/-:host#1234:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:host#1234:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:host#1234:" 'host) "host#1234")) + (should (string-equal (file-remote-p "/-:host#1234:" 'localname) "")) + (should (string-equal (file-remote-p "/-:host#1234:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/-:user@host#1234:") + (format "/%s:%s@%s:" "default-method" "user" "host#1234"))) + (should (string-equal + (file-remote-p "/-:user@host#1234:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:user@host#1234:" 'user) "user")) + (should (string-equal (file-remote-p "/-:user@host#1234:" 'host) "host#1234")) + (should (string-equal (file-remote-p "/-:user@host#1234:" 'localname) "")) + (should (string-equal (file-remote-p "/-:user@host#1234:" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/method:host#1234:") + (format "/%s:%s@%s:" "method" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/method:host#1234:" 'method) "method")) + (should (string-equal + (file-remote-p "/method:host#1234:" 'user) "default-user")) + (should (string-equal + (file-remote-p "/method:host#1234:" 'host) "host#1234")) + (should (string-equal (file-remote-p "/method:host#1234:" 'localname) "")) + (should (string-equal (file-remote-p "/method:host#1234:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/method:user@host#1234:") + (format "/%s:%s@%s:" "method" "user" "host#1234"))) + (should (string-equal + (file-remote-p "/method:user@host#1234:" 'method) "method")) + (should (string-equal + (file-remote-p "/method:user@host#1234:" 'user) "user")) + (should (string-equal + (file-remote-p "/method:user@host#1234:" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/method:user@host#1234:" 'localname) "")) + (should (string-equal + (file-remote-p "/method:user@host#1234:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/-:1.2.3.4:") + (format "/%s:%s@%s:" "default-method" "default-user" "1.2.3.4"))) + (should (string-equal (file-remote-p "/-:1.2.3.4:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:1.2.3.4:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/-:1.2.3.4:" 'localname) "")) + (should (string-equal (file-remote-p "/-:1.2.3.4:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/-:user@1.2.3.4:") + (format "/%s:%s@%s:" "default-method" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/-:user@1.2.3.4:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'user) "user")) + (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'localname) "")) + (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/method:1.2.3.4:") + (format "/%s:%s@%s:" "method" "default-user" "1.2.3.4"))) + (should (string-equal (file-remote-p "/method:1.2.3.4:" 'method) "method")) + (should (string-equal + (file-remote-p "/method:1.2.3.4:" 'user) "default-user")) + (should (string-equal (file-remote-p "/method:1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/method:1.2.3.4:" 'localname) "")) + (should (string-equal (file-remote-p "/method:1.2.3.4:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/method:user@1.2.3.4:") + (format "/%s:%s@%s:" "method" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/method:user@1.2.3.4:" 'method) "method")) + (should (string-equal (file-remote-p "/method:user@1.2.3.4:" 'user) "user")) + (should (string-equal + (file-remote-p "/method:user@1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal + (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) + (should (string-equal + (file-remote-p "/method:user@1.2.3.4:" 'hop) nil)) + + ;; Expand `tramp-default-method', `tramp-default-user' and + ;; `tramp-default-host'. + (should (string-equal + (file-remote-p "/-:[]:") + (format + "/%s:%s@%s:" "default-method" "default-user" "default-host"))) + (should (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:[]:" 'host) "default-host")) + (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) + (should (string-equal (file-remote-p "/-:[]:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (let ((tramp-default-host "::1")) + (should (string-equal + (file-remote-p "/-:[]:") + (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) + (should (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:[]:" 'host) "::1")) + (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) + (should (string-equal (file-remote-p "/-:[]:" 'hop) nil))) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/-:[::1]:") + (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) + (should (string-equal (file-remote-p "/-:[::1]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:[::1]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/-:[::1]:" 'host) "::1")) + (should (string-equal (file-remote-p "/-:[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/-:[::1]:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/-:user@[::1]:") + (format "/%s:%s@%s:" "default-method" "user" "[::1]"))) + (should (string-equal + (file-remote-p "/-:user@[::1]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/-:user@[::1]:" 'user) "user")) + (should (string-equal (file-remote-p "/-:user@[::1]:" 'host) "::1")) + (should (string-equal (file-remote-p "/-:user@[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/-:user@[::1]:" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/method:[::1]:") + (format "/%s:%s@%s:" "method" "default-user" "[::1]"))) + (should (string-equal (file-remote-p "/method:[::1]:" 'method) "method")) + (should (string-equal + (file-remote-p "/method:[::1]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/method:[::1]:" 'host) "::1")) + (should (string-equal (file-remote-p "/method:[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/method:[::1]:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/method:user@[::1]:") + (format "/%s:%s@%s:" "method" "user" "[::1]"))) + (should (string-equal + (file-remote-p "/method:user@[::1]:" 'method) "method")) + (should (string-equal (file-remote-p "/method:user@[::1]:" 'user) "user")) + (should (string-equal (file-remote-p "/method:user@[::1]:" 'host) "::1")) + (should (string-equal + (file-remote-p "/method:user@[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/method:user@[::1]:" 'hop) nil)) + + ;; Local file name part. + (should (string-equal (file-remote-p "/-:host:/:" 'localname) "/:")) + (should (string-equal (file-remote-p "/method:::" 'localname) ":")) + (should (string-equal (file-remote-p "/method:: " 'localname) " ")) + (should (string-equal (file-remote-p "/method::file" 'localname) "file")) + (should (string-equal + (file-remote-p "/method::/path/to/file" 'localname) + "/path/to/file")) + + ;; Multihop. + (should + (string-equal + (file-remote-p "/method1:user1@host1|method2:user2@host2:/path/to/file") + (format "/%s:%s@%s|%s:%s@%s:" + "method1" "user1" "host1" "method2" "user2" "host2"))) + (should + (string-equal + (file-remote-p + "/method1:user1@host1|method2:user2@host2:/path/to/file" 'method) + "method2")) + (should + (string-equal + (file-remote-p + "/method1:user1@host1|method2:user2@host2:/path/to/file" 'user) + "user2")) + (should + (string-equal + (file-remote-p + "/method1:user1@host1|method2:user2@host2:/path/to/file" 'host) + "host2")) + (should + (string-equal + (file-remote-p + "/method1:user1@host1|method2:user2@host2:/path/to/file" 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + "/method1:user1@host1|method2:user2@host2:/path/to/file" 'hop) + (format "%s:%s@%s|" + "method1" "user1" "host1"))) + + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file")) + (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" + "method1" "user1" "host1" + "method2" "user2" "host2" + "method3" "user3" "host3"))) + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file") + 'method) + "method3")) + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file") + 'user) + "user3")) + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file") + 'host) + "host3")) + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file") + 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + (concat + "/method1:user1@host1" + "|method2:user2@host2" + "|method3:user3@host3:/path/to/file") + 'hop) + (format "%s:%s@%s|%s:%s@%s|" + "method1" "user1" "host1" "method2" "user2" "host2"))))) + +(ert-deftest tramp-test02-file-name-dissect-simplified () + "Check simplified file name components." + :tags '(:expensive-test) + (let ((tramp-default-method "default-method") + (tramp-default-user "default-user") + (tramp-default-host "default-host") + (syntax tramp-syntax)) + (unwind-protect + (progn + (tramp-change-syntax 'simplified) + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/host:") + (format "/%s@%s:" "default-user" "host"))) + (should (string-equal + (file-remote-p "/host:" 'method) "default-method")) + (should (string-equal (file-remote-p "/host:" 'user) "default-user")) + (should (string-equal (file-remote-p "/host:" 'host) "host")) + (should (string-equal (file-remote-p "/host:" 'localname) "")) + (should (string-equal (file-remote-p "/host:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/user@:") + (format "/%s@%s:" "user" "default-host"))) + (should (string-equal + (file-remote-p "/user@:" 'method) "default-method")) + (should (string-equal (file-remote-p "/user@:" 'user) "user")) + (should (string-equal (file-remote-p "/user@:" 'host) "default-host")) + (should (string-equal (file-remote-p "/user@:" 'localname) "")) + (should (string-equal (file-remote-p "/user@:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/user@host:") + (format "/%s@%s:" "user" "host"))) + (should (string-equal + (file-remote-p "/user@host:" 'method) "default-method")) + (should (string-equal (file-remote-p "/user@host:" 'user) "user")) + (should (string-equal (file-remote-p "/user@host:" 'host) "host")) + (should (string-equal (file-remote-p "/user@host:" 'localname) "")) + (should (string-equal (file-remote-p "/user@host:" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/user@email@host:") + (format "/%s@%s:" "user@email" "host"))) + (should (string-equal + (file-remote-p + "/user@email@host:" 'method) "default-method")) + (should (string-equal + (file-remote-p "/user@email@host:" 'user) "user@email")) + (should (string-equal + (file-remote-p "/user@email@host:" 'host) "host")) + (should (string-equal + (file-remote-p "/user@email@host:" 'localname) "")) + (should (string-equal + (file-remote-p "/user@email@host:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/host#1234:") + (format "/%s@%s:" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/host#1234:" 'method) "default-method")) + (should (string-equal + (file-remote-p "/host#1234:" 'user) "default-user")) + (should (string-equal + (file-remote-p "/host#1234:" 'host) "host#1234")) + (should (string-equal (file-remote-p "/host#1234:" 'localname) "")) + (should (string-equal (file-remote-p "/host#1234:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/user@host#1234:") + (format "/%s@%s:" "user" "host#1234"))) + (should (string-equal + (file-remote-p "/user@host#1234:" 'method) "default-method")) + (should (string-equal + (file-remote-p "/user@host#1234:" 'user) "user")) + (should (string-equal + (file-remote-p "/user@host#1234:" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/user@host#1234:" 'localname) "")) + (should (string-equal (file-remote-p "/user@host#1234:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/1.2.3.4:") + (format "/%s@%s:" "default-user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/1.2.3.4:" 'method) "default-method")) + (should (string-equal + (file-remote-p "/1.2.3.4:" 'user) "default-user")) + (should (string-equal (file-remote-p "/1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/1.2.3.4:" 'localname) "")) + (should (string-equal (file-remote-p "/1.2.3.4:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/user@1.2.3.4:") + (format "/%s@%s:" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/user@1.2.3.4:" 'method) "default-method")) + (should (string-equal (file-remote-p "/user@1.2.3.4:" 'user) "user")) + (should (string-equal + (file-remote-p "/user@1.2.3.4:" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/user@1.2.3.4:" 'localname) "")) + (should (string-equal (file-remote-p "/user@1.2.3.4:" 'hop) nil)) + + ;; Expand `tramp-default-method', `tramp-default-user' and + ;; `tramp-default-host'. + (should (string-equal + (file-remote-p "/[]:") + (format + "/%s@%s:" "default-user" "default-host"))) + (should (string-equal + (file-remote-p "/[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/[]:" 'host) "default-host")) + (should (string-equal (file-remote-p "/[]:" 'localname) "")) + (should (string-equal (file-remote-p "/[]:" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (let ((tramp-default-host "::1")) + (should (string-equal + (file-remote-p "/[]:") + (format "/%s@%s:" "default-user" "[::1]"))) + (should (string-equal + (file-remote-p "/[]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/[]:" 'host) "::1")) + (should (string-equal (file-remote-p "/[]:" 'localname) "")) + (should (string-equal (file-remote-p "/[]:" 'hop) nil))) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[::1]:") + (format "/%s@%s:" "default-user" "[::1]"))) + (should (string-equal + (file-remote-p "/[::1]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/[::1]:" 'user) "default-user")) + (should (string-equal (file-remote-p "/[::1]:" 'host) "::1")) + (should (string-equal (file-remote-p "/[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/[::1]:" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/user@[::1]:") + (format "/%s@%s:" "user" "[::1]"))) + (should (string-equal + (file-remote-p "/user@[::1]:" 'method) "default-method")) + (should (string-equal (file-remote-p "/user@[::1]:" 'user) "user")) + (should (string-equal (file-remote-p "/user@[::1]:" 'host) "::1")) + (should (string-equal (file-remote-p "/user@[::1]:" 'localname) "")) + (should (string-equal (file-remote-p "/user@[::1]:" 'hop) nil)) + + ;; Local file name part. + (should (string-equal (file-remote-p "/host:/:" 'localname) "/:")) + (should (string-equal (file-remote-p "/host::" 'localname) ":")) + (should (string-equal (file-remote-p "/host: " 'localname) " ")) + (should (string-equal (file-remote-p "/host:file" 'localname) "file")) + (should (string-equal + (file-remote-p "/host:/path/to/file" 'localname) + "/path/to/file")) + + ;; Multihop. + (should + (string-equal + (file-remote-p "/user1@host1|user2@host2:/path/to/file") + (format "/%s@%s|%s@%s:" "user1" "host1" "user2" "host2"))) + (should + (string-equal + (file-remote-p + "/user1@host1|user2@host2:/path/to/file" 'method) + "default-method")) + (should + (string-equal + (file-remote-p + "/user1@host1|user2@host2:/path/to/file" 'user) + "user2")) + (should + (string-equal + (file-remote-p + "/user1@host1|user2@host2:/path/to/file" 'host) + "host2")) + (should + (string-equal + (file-remote-p + "/user1@host1|user2@host2:/path/to/file" 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + "/user1@host1|user2@host2:/path/to/file" 'hop) + (format "%s@%s|" "user1" "host1"))) + + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file")) + (format "/%s@%s|%s@%s|%s@%s:" + "user1" "host1" + "user2" "host2" + "user3" "host3"))) + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file") + 'method) + "default-method")) + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file") + 'user) + "user3")) + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file") + 'host) + "host3")) + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file") + 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + (concat + "/user1@host1" + "|user2@host2" + "|user3@host3:/path/to/file") + 'hop) + (format "%s@%s|%s@%s|" + "user1" "host1" "user2" "host2")))) + + ;; Exit. + (tramp-change-syntax syntax)))) + +(ert-deftest tramp-test02-file-name-dissect-separate () + "Check separate file name components." + :tags '(:expensive-test) + (let ((tramp-default-method "default-method") + (tramp-default-user "default-user") + (tramp-default-host "default-host") + (syntax tramp-syntax)) + (unwind-protect + (progn + (tramp-change-syntax 'separate) + ;; Expand `tramp-default-user' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/[method/]") + (format + "/[%s/%s@%s]" "method" "default-user" "default-host"))) + (should (string-equal (file-remote-p "/[method/]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[method/]" 'host) "default-host")) + (should (string-equal (file-remote-p "/[method/]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[/host]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "host"))) + (should (string-equal + (file-remote-p "/[/host]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[/host]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[/host]" 'host) "host")) + (should (string-equal (file-remote-p "/[/host]" 'localname) "")) + (should (string-equal (file-remote-p "/[/host]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/[/user@]") + (format + "/[%s/%s@%s]" "default-method" "user" "default-host"))) + (should (string-equal + (file-remote-p "/[/user@]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[/user@]" 'user) "user")) + (should (string-equal + (file-remote-p "/[/user@]" 'host) "default-host")) + (should (string-equal (file-remote-p "/[/user@]" 'localname) "")) + (should (string-equal (file-remote-p "/[/user@]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[/user@host]") + (format "/[%s/%s@%s]" "default-method" "user" "host"))) + (should (string-equal + (file-remote-p "/[/user@host]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[/user@host]" 'user) "user")) + (should (string-equal (file-remote-p "/[/user@host]" 'host) "host")) + (should (string-equal (file-remote-p "/[/user@host]" 'localname) "")) + (should (string-equal (file-remote-p "/[/user@host]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[-/host]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "host"))) + (should (string-equal + (file-remote-p "/[-/host]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[-/host]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[-/host]" 'host) "host")) + (should (string-equal (file-remote-p "/[-/host]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/host]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-host'. + (should (string-equal + (file-remote-p "/[-/user@]") + (format + "/[%s/%s@%s]" "default-method" "user" "default-host"))) + (should (string-equal + (file-remote-p "/[-/user@]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[-/user@]" 'user) "user")) + (should (string-equal + (file-remote-p "/[-/user@]" 'host) "default-host")) + (should (string-equal (file-remote-p "/[-/user@]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/user@]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[-/user@host]") + (format "/[%s/%s@%s]" "default-method" "user" "host"))) + (should (string-equal + (file-remote-p "/[-/user@host]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[-/user@host]" 'user) "user")) + (should (string-equal (file-remote-p "/[-/user@host]" 'host) "host")) + (should (string-equal (file-remote-p "/[-/user@host]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/user@host]" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/[method/host]") + (format "/[%s/%s@%s]" "method" "default-user" "host"))) + (should (string-equal + (file-remote-p "/[method/host]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/host]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[method/host]" 'host) "host")) + (should (string-equal (file-remote-p "/[method/host]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/host]" 'hop) nil)) + + ;; Expand `tramp-default-host'. + (should (string-equal + (file-remote-p "/[method/user@]") + (format "/[%s/%s@%s]" "method" "user" "default-host"))) + (should (string-equal + (file-remote-p "/[method/user@]" 'method) "method")) + (should (string-equal (file-remote-p "/[method/user@]" 'user) "user")) + (should (string-equal + (file-remote-p "/[method/user@]" 'host) "default-host")) + (should (string-equal + (file-remote-p "/[method/user@]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/user@]" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/[method/user@host]") + (format "/[%s/%s@%s]" "method" "user" "host"))) + (should (string-equal + (file-remote-p "/[method/user@host]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/user@host]" 'user) "user")) + (should (string-equal + (file-remote-p "/[method/user@host]" 'host) "host")) + (should (string-equal + (file-remote-p "/[method/user@host]" 'localname) "")) + (should (string-equal + (file-remote-p "/[method/user@host]" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/[method/user@email@host]") + (format "/[%s/%s@%s]" "method" "user@email" "host"))) + (should (string-equal + (file-remote-p + "/[method/user@email@host]" 'method) "method")) + (should (string-equal + (file-remote-p + "/[method/user@email@host]" 'user) "user@email")) + (should (string-equal + (file-remote-p "/[method/user@email@host]" 'host) "host")) + (should (string-equal + (file-remote-p "/[method/user@email@host]" 'localname) "")) + (should (string-equal + (file-remote-p "/[method/user@email@host]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[/host#1234]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/[/host#1234]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[/host#1234]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[/host#1234]" 'host) "host#1234")) + (should (string-equal (file-remote-p "/[/host#1234]" 'localname) "")) + (should (string-equal (file-remote-p "/[/host#1234]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[/user@host#1234]") + (format "/[%s/%s@%s]" "default-method" "user" "host#1234"))) + (should (string-equal + (file-remote-p + "/[/user@host#1234]" 'method) "default-method")) + (should (string-equal + (file-remote-p + "/[/user@host#1234]" 'user) "user")) + (should (string-equal + (file-remote-p "/[/user@host#1234]" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/[/user@host#1234]" 'localname) "")) + (should (string-equal (file-remote-p "/[/user@host#1234]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[-/host#1234]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/[-/host#1234]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[-/host#1234]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[-/host#1234]" 'host) "host#1234")) + (should (string-equal (file-remote-p "/[-/host#1234]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/host#1234]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[-/user@host#1234]") + (format "/[%s/%s@%s]" "default-method" "user" "host#1234"))) + (should (string-equal + (file-remote-p + "/[-/user@host#1234]" 'method) "default-method")) + (should (string-equal + (file-remote-p + "/[-/user@host#1234]" 'user) "user")) + (should (string-equal + (file-remote-p "/[-/user@host#1234]" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/[-/user@host#1234]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/user@host#1234]" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/[method/host#1234]") + (format "/[%s/%s@%s]" "method" "default-user" "host#1234"))) + (should (string-equal + (file-remote-p "/[method/host#1234]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/host#1234]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[method/host#1234]" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/[method/host#1234]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/host#1234]" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/[method/user@host#1234]") + (format "/[%s/%s@%s]" "method" "user" "host#1234"))) + (should (string-equal + (file-remote-p "/[method/user@host#1234]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/user@host#1234]" 'user) "user")) + (should (string-equal + (file-remote-p + "/[method/user@host#1234]" 'host) "host#1234")) + (should (string-equal + (file-remote-p "/[method/user@host#1234]" 'localname) "")) + (should (string-equal + (file-remote-p "/[method/user@host#1234]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[/1.2.3.4]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/[/1.2.3.4]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[/1.2.3.4]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[/1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/[/1.2.3.4]" 'localname) "")) + (should (string-equal (file-remote-p "/[/1.2.3.4]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[/user@1.2.3.4]") + (format "/[%s/%s@%s]" "default-method" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p + "/[/user@1.2.3.4]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[/user@1.2.3.4]" 'user) "user")) + (should (string-equal + (file-remote-p "/[/user@1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal + (file-remote-p "/[/user@1.2.3.4]" 'localname) "")) + (should (string-equal (file-remote-p "/[/user@1.2.3.4]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[-/1.2.3.4]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/[-/1.2.3.4]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[-/1.2.3.4]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[-/1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal (file-remote-p "/[-/1.2.3.4]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/1.2.3.4]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[-/user@1.2.3.4]") + (format "/[%s/%s@%s]" "default-method" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p + "/[-/user@1.2.3.4]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[-/user@1.2.3.4]" 'user) "user")) + (should (string-equal + (file-remote-p "/[-/user@1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal + (file-remote-p "/[-/user@1.2.3.4]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/user@1.2.3.4]" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/[method/1.2.3.4]") + (format "/[%s/%s@%s]" "method" "default-user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/[method/1.2.3.4]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/1.2.3.4]" 'user) "default-user")) + (should (string-equal + (file-remote-p "/[method/1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal + (file-remote-p "/[method/1.2.3.4]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/1.2.3.4]" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]") + (format "/[%s/%s@%s]" "method" "user" "1.2.3.4"))) + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]" 'user) "user")) + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]" 'host) "1.2.3.4")) + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]" 'localname) "")) + (should (string-equal + (file-remote-p "/[method/user@1.2.3.4]" 'hop) nil)) + + ;; Expand `tramp-default-method', `tramp-default-user' and + ;; `tramp-default-host'. + (should (string-equal + (file-remote-p "/[/]") + (format + "/[%s/%s@%s]" + "default-method" "default-user" "default-host"))) + (should (string-equal + (file-remote-p "/[/]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[/]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[/]" 'host) "default-host")) + (should (string-equal (file-remote-p "/[/]" 'localname) "")) + (should (string-equal (file-remote-p "/[/]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (let ((tramp-default-host "::1")) + (should (string-equal + (file-remote-p "/[/]") + (format + "/[%s/%s@%s]" + "default-method" "default-user" "::1"))) + (should (string-equal + (file-remote-p "/[/]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[/]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[/]" 'host) "::1")) + (should (string-equal (file-remote-p "/[/]" 'localname) "")) + (should (string-equal (file-remote-p "/[/]" 'hop) nil))) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[/::1]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "::1"))) + (should (string-equal + (file-remote-p "/[/::1]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[/::1]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[/::1]" 'host) "::1")) + (should (string-equal (file-remote-p "/[/::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[/::1]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[/user@::1]") + (format "/[%s/%s@%s]" "default-method" "user" "::1"))) + (should (string-equal + (file-remote-p "/[/user@::1]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[/user@::1]" 'user) "user")) + (should (string-equal (file-remote-p "/[/user@::1]" 'host) "::1")) + (should (string-equal (file-remote-p "/[/user@::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[/user@::1]" 'hop) nil)) + + ;; Expand `tramp-default-method', `tramp-default-user' and + ;; `tramp-default-host'. + (should (string-equal + (file-remote-p "/[-/]") + (format + "/[%s/%s@%s]" + "default-method" "default-user" "default-host"))) + (should (string-equal + (file-remote-p "/[-/]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[-/]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[-/]" 'host) "default-host")) + (should (string-equal (file-remote-p "/[-/]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/]" 'hop) nil)) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (let ((tramp-default-host "::1")) + (should (string-equal + (file-remote-p "/[-/]") + (format + "/[%s/%s@%s]" + "default-method" "default-user" "::1"))) + (should (string-equal + (file-remote-p "/[-/]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[-/]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[-/]" 'host) "::1")) + (should (string-equal (file-remote-p "/[-/]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/]" 'hop) nil))) + + ;; Expand `tramp-default-method' and `tramp-default-user'. + (should (string-equal + (file-remote-p "/[-/::1]") + (format + "/[%s/%s@%s]" "default-method" "default-user" "::1"))) + (should (string-equal + (file-remote-p "/[-/::1]" 'method) "default-method")) + (should (string-equal + (file-remote-p "/[-/::1]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[-/::1]" 'host) "::1")) + (should (string-equal (file-remote-p "/[-/::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/::1]" 'hop) nil)) + + ;; Expand `tramp-default-method'. + (should (string-equal + (file-remote-p "/[-/user@::1]") + (format "/[%s/%s@%s]" "default-method" "user" "::1"))) + (should (string-equal + (file-remote-p "/[-/user@::1]" 'method) "default-method")) + (should (string-equal (file-remote-p "/[-/user@::1]" 'user) "user")) + (should (string-equal (file-remote-p "/[-/user@::1]" 'host) "::1")) + (should (string-equal (file-remote-p "/[-/user@::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[-/user@::1]" 'hop) nil)) + + ;; Expand `tramp-default-user'. + (should (string-equal + (file-remote-p "/[method/::1]") + (format "/[%s/%s@%s]" "method" "default-user" "::1"))) + (should (string-equal + (file-remote-p "/[method/::1]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/::1]" 'user) "default-user")) + (should (string-equal (file-remote-p "/[method/::1]" 'host) "::1")) + (should (string-equal (file-remote-p "/[method/::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/::1]" 'hop) nil)) + + ;; No expansion. + (should (string-equal + (file-remote-p "/[method/user@::1]") + (format "/[%s/%s@%s]" "method" "user" "::1"))) + (should (string-equal + (file-remote-p "/[method/user@::1]" 'method) "method")) + (should (string-equal + (file-remote-p "/[method/user@::1]" 'user) "user")) + (should (string-equal + (file-remote-p "/[method/user@::1]" 'host) "::1")) + (should (string-equal + (file-remote-p "/[method/user@::1]" 'localname) "")) + (should (string-equal (file-remote-p "/[method/user@::1]" 'hop) nil)) + + ;; Local file name part. + (should (string-equal (file-remote-p "/[/host]/:" 'localname) "/:")) + (should (string-equal (file-remote-p "/[-/host]/:" 'localname) "/:")) + (should (string-equal (file-remote-p "/[method/]:" 'localname) ":")) + (should (string-equal (file-remote-p "/[method/] " 'localname) " ")) + (should (string-equal + (file-remote-p "/[method/]file" 'localname) "file")) + (should (string-equal + (file-remote-p "/[method/]/path/to/file" 'localname) + "/path/to/file")) + + ;; Multihop. + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file") + (format "/[%s/%s@%s|%s/%s@%s]" + "method1" "user1" "host1" "method2" "user2" "host2"))) + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file" 'method) + "method2")) + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file" 'user) + "user2")) + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file" 'host) + "host2")) + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file" + 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + "/[method1/user1@host1|method2/user2@host2]/path/to/file" 'hop) + (format "%s/%s@%s|" + "method1" "user1" "host1"))) + + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file")) + (format "/[%s/%s@%s|%s/%s@%s|%s/%s@%s]" + "method1" "user1" "host1" + "method2" "user2" "host2" + "method3" "user3" "host3"))) + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file") + 'method) + "method3")) + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file") + 'user) + "user3")) + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file") + 'host) + "host3")) + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file") + 'localname) + "/path/to/file")) + (should + (string-equal + (file-remote-p + (concat + "/[method1/user1@host1" + "|method2/user2@host2" + "|method3/user3@host3]/path/to/file") + 'hop) + (format "%s/%s@%s|%s/%s@%s|" + "method1" "user1" "host1" "method2" "user2" "host2")))) + + ;; Exit. + (tramp-change-syntax syntax)))) + +(ert-deftest tramp-test03-file-name-defaults () + "Check default values for some methods." + ;; Default values in tramp-adb.el. + (should (string-equal (file-remote-p "/adb::" 'host) "")) + ;; Default values in tramp-ftp.el. + (should (string-equal (file-remote-p "/-:ftp.host:" 'method) "ftp")) + (dolist (u '("ftp" "anonymous")) + (should (string-equal (file-remote-p (format "/-:%s@:" u) 'method) "ftp"))) + ;; Default values in tramp-gvfs.el. + (when (and (load "tramp-gvfs" 'noerror 'nomessage) + (symbol-value 'tramp-gvfs-enabled)) + (should (string-equal (file-remote-p "/synce::" 'user) nil))) + ;; Default values in tramp-sh.el. + (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) + (should + (string-equal (file-remote-p (format "/-:root@%s:" h) 'method) "su"))) + (dolist (m '("su" "sudo" "ksu")) + (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))) + (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) + (should + (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) + ;; Default values in tramp-smb.el. + (should (string-equal (file-remote-p "/smb::" 'user) nil))) + +(ert-deftest tramp-test04-substitute-in-file-name () + "Check `substitute-in-file-name'." + (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path//foo") "/method:host:/foo")) + (should + (string-equal (substitute-in-file-name "/method:host:/path///foo") "/foo")) + ;; Quoting local part. + (should + (string-equal + (substitute-in-file-name "/method:host:/://foo") "/method:host:/://foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path//foo") + "/method:host:/:/path//foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path///foo") + "/method:host:/:/path///foo")) + + (should + (string-equal + (substitute-in-file-name "/method:host:/path/~/foo") "/method:host:~/foo")) + (should + (string-equal (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) + ;; Quoting local part. + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path/~/foo") + "/method:host:/:/path/~/foo")) + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path//~/foo") + "/method:host:/:/path//~/foo")) + + (let (process-environment) + (should + (string-equal + (substitute-in-file-name "/method:host:/path/$FOO") + "/method:host:/path/$FOO")) + (setenv "FOO" "bla") + (should + (string-equal + (substitute-in-file-name "/method:host:/path/$FOO") + "/method:host:/path/bla")) + (should + (string-equal + (substitute-in-file-name "/method:host:/path/$$FOO") + "/method:host:/path/$FOO")) + ;; Quoting local part. + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path/$FOO") + "/method:host:/:/path/$FOO")) + (setenv "FOO" "bla") + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path/$FOO") + "/method:host:/:/path/$FOO")) + (should + (string-equal + (substitute-in-file-name "/method:host:/:/path/$$FOO") + "/method:host:/:/path/$$FOO")))) + +(ert-deftest tramp-test05-expand-file-name () + "Check `expand-file-name'." + (should + (string-equal + (expand-file-name "/method:host:/path/./file") "/method:host:/path/file")) + (should + (string-equal + (expand-file-name "/method:host:/path/../file") "/method:host:/file")) + ;; Quoting local part. + (should + (string-equal + (expand-file-name "/method:host:/:/path/./file") + "/method:host:/:/path/file")) + (should + (string-equal + (expand-file-name "/method:host:/:/path/../file") "/method:host:/:/file")) + (should + (string-equal + (expand-file-name "/method:host:/:/~/path/./file") + "/method:host:/:/~/path/file"))) + +;; The following test is inspired by Bug#26911. It is rather a bug in +;; `expand-file-name', and it fails for all Emacs versions. Test +;; added for later, when it is fixed. +(ert-deftest tramp-test05-expand-file-name-relative () + "Check `expand-file-name'." + ;; Mark as failed until bug has been fixed. + :expected-result :failed + (skip-unless (tramp--test-enabled)) + ;; These are the methods the test doesn't fail. + (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) + (tramp-smb-file-name-p tramp-test-temporary-file-directory)) + (setf (ert-test-expected-result-type + (ert-get-test 'tramp-test05-expand-file-name-relative)) + :passed)) + + (should + (string-equal + (let ((default-directory + (concat + (file-remote-p tramp-test-temporary-file-directory) "/path"))) + (expand-file-name ".." "./")) + (concat (file-remote-p tramp-test-temporary-file-directory) "/")))) + +(ert-deftest tramp-test06-directory-file-name () + "Check `directory-file-name'. +This checks also `file-name-as-directory', `file-name-directory', +`file-name-nondirectory' and `unhandled-file-name-directory'." + (should + (string-equal + (directory-file-name "/method:host:/path/to/file") + "/method:host:/path/to/file")) + (should + (string-equal + (directory-file-name "/method:host:/path/to/file/") + "/method:host:/path/to/file")) + (should + (string-equal + (file-name-as-directory "/method:host:/path/to/file") + "/method:host:/path/to/file/")) + (should + (string-equal + (file-name-as-directory "/method:host:/path/to/file/") + "/method:host:/path/to/file/")) + (should + (string-equal + (file-name-directory "/method:host:/path/to/file") + "/method:host:/path/to/")) + (should + (string-equal + (file-name-directory "/method:host:/path/to/file/") + "/method:host:/path/to/file/")) + (should + (string-equal (file-name-nondirectory "/method:host:/path/to/file") "file")) + (should + (string-equal (file-name-nondirectory "/method:host:/path/to/file/") "")) + (should-not + (unhandled-file-name-directory "/method:host:/path/to/file")) + + ;; Bug#10085. + (when (tramp--test-enabled) ;; Packages like tramp-gvfs.el might be disabled. + (dolist (n-e '(nil t)) + ;; We must clear `tramp-default-method'. On hydra, it is "ftp", + ;; which ruins the tests. + (let ((non-essential n-e) + tramp-default-method) + (dolist + (file + `(,(format + "/%s::" + (file-remote-p tramp-test-temporary-file-directory 'method)) + ,(format + "/-:%s:" + (file-remote-p tramp-test-temporary-file-directory 'host)))) + (should (string-equal (directory-file-name file) file)) + (should + (string-equal + (file-name-as-directory file) + (if (tramp-completion-mode-p) + file (concat file "./")))) + (should (string-equal (file-name-directory file) file)) + (should (string-equal (file-name-nondirectory file) ""))))))) + +(ert-deftest tramp-test07-file-exists-p () + "Check `file-exist-p', `write-region' and `delete-file'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (should-not (file-exists-p tmp-name)) + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (delete-file tmp-name) + (should-not (file-exists-p tmp-name))))) + +(ert-deftest tramp-test08-file-local-copy () + "Check `file-local-copy'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + tmp-name2) + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (should (setq tmp-name2 (file-local-copy tmp-name1))) + (with-temp-buffer + (insert-file-contents tmp-name2) + (should (string-equal (buffer-string) "foo"))) + ;; Check also that a file transfer with compression works. + (let ((default-directory tramp-test-temporary-file-directory) + (tramp-copy-size-limit 4) + (tramp-inline-compress-start-size 2)) + (delete-file tmp-name2) + (should (setq tmp-name2 (file-local-copy tmp-name1))))) + + ;; Cleanup. + (ignore-errors + (delete-file tmp-name1) + (delete-file tmp-name2)))))) + +(ert-deftest tramp-test09-insert-file-contents () + "Check `insert-file-contents'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + (write-region "foo" nil tmp-name) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foo")) + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foofoo")) + ;; Insert partly. + (insert-file-contents tmp-name nil 1 3) + (should (string-equal (buffer-string) "oofoofoo")) + ;; Replace. + (insert-file-contents tmp-name nil nil nil 'replace) + (should (string-equal (buffer-string) "foo")))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(ert-deftest tramp-test10-write-region () + "Check `write-region'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + ;; Write buffer. Use absolute and relative file name. + (with-temp-buffer + (insert "foo") + (write-region nil nil tmp-name)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foo"))) + (delete-file tmp-name) + (with-temp-buffer + (insert "foo") + (should-not (file-exists-p tmp-name)) + (let ((default-directory (file-name-directory tmp-name))) + (should-not (file-exists-p (file-name-nondirectory tmp-name))) + (write-region nil nil (file-name-nondirectory tmp-name)) + (should (file-exists-p (file-name-nondirectory tmp-name)))) + (should (file-exists-p tmp-name))) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foo"))) + + ;; Append. + (with-temp-buffer + (insert "bla") + (write-region nil nil tmp-name 'append)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foobla"))) + (with-temp-buffer + (insert "baz") + (write-region nil nil tmp-name 3)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foobaz"))) + + ;; Write string. + (write-region "foo" nil tmp-name) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "foo"))) + + ;; Write partly. + (with-temp-buffer + (insert "123456789") + (write-region 3 5 tmp-name)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (string-equal (buffer-string) "34")))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(ert-deftest tramp-test11-copy-file () + "Check `copy-file'." + (skip-unless (tramp--test-enabled)) + + ;; TODO: The quoted case does not work. + ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let (quoted) + (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (tmp-name3 (tramp--test-make-temp-name nil quoted)) + (tmp-name4 (tramp--test-make-temp-name 'local quoted)) + (tmp-name5 (tramp--test-make-temp-name 'local quoted))) + + ;; Copy on remote side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (copy-file tmp-name1 tmp-name2) + (should (file-exists-p tmp-name2)) + (with-temp-buffer + (insert-file-contents tmp-name2) + (should (string-equal (buffer-string) "foo"))) + (should-error (copy-file tmp-name1 tmp-name2)) + (copy-file tmp-name1 tmp-name2 'ok) + (make-directory tmp-name3) + (copy-file tmp-name1 tmp-name3) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name2)) + (ignore-errors (delete-directory tmp-name3 'recursive))) + + ;; Copy from remote side to local side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (copy-file tmp-name1 tmp-name4) + (should (file-exists-p tmp-name4)) + (with-temp-buffer + (insert-file-contents tmp-name4) + (should (string-equal (buffer-string) "foo"))) + (should-error (copy-file tmp-name1 tmp-name4)) + (copy-file tmp-name1 tmp-name4 'ok) + (make-directory tmp-name5) + (copy-file tmp-name1 tmp-name5) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name4)) + (ignore-errors (delete-directory tmp-name5 'recursive))) + + ;; Copy from local side to remote side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name4 nil 'nomessage) + (copy-file tmp-name4 tmp-name1) + (should (file-exists-p tmp-name1)) + (with-temp-buffer + (insert-file-contents tmp-name1) + (should (string-equal (buffer-string) "foo"))) + (should-error (copy-file tmp-name4 tmp-name1)) + (copy-file tmp-name4 tmp-name1 'ok) + (make-directory tmp-name3) + (copy-file tmp-name4 tmp-name3) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name4)) + (ignore-errors (delete-directory tmp-name3 'recursive)))))) + +(ert-deftest tramp-test12-rename-file () + "Check `rename-file'." + (skip-unless (tramp--test-enabled)) + + ;; TODO: The quoted case does not work. + ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let (quoted) + (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (tmp-name3 (tramp--test-make-temp-name nil quoted)) + (tmp-name4 (tramp--test-make-temp-name 'local quoted)) + (tmp-name5 (tramp--test-make-temp-name 'local quoted))) + + ;; Rename on remote side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (rename-file tmp-name1 tmp-name2) + (should-not (file-exists-p tmp-name1)) + (should (file-exists-p tmp-name2)) + (with-temp-buffer + (insert-file-contents tmp-name2) + (should (string-equal (buffer-string) "foo"))) + (write-region "foo" nil tmp-name1) + (should-error (rename-file tmp-name1 tmp-name2)) + (rename-file tmp-name1 tmp-name2 'ok) + (should-not (file-exists-p tmp-name1)) + (write-region "foo" nil tmp-name1) + (make-directory tmp-name3) + (rename-file tmp-name1 tmp-name3) + (should-not (file-exists-p tmp-name1)) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name1) tmp-name3)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name2)) + (ignore-errors (delete-directory tmp-name3 'recursive))) + + ;; Rename from remote side to local side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (rename-file tmp-name1 tmp-name4) + (should-not (file-exists-p tmp-name1)) + (should (file-exists-p tmp-name4)) + (with-temp-buffer + (insert-file-contents tmp-name4) + (should (string-equal (buffer-string) "foo"))) + (write-region "foo" nil tmp-name1) + (should-error (rename-file tmp-name1 tmp-name4)) + (rename-file tmp-name1 tmp-name4 'ok) + (should-not (file-exists-p tmp-name1)) + (write-region "foo" nil tmp-name1) + (make-directory tmp-name5) + (rename-file tmp-name1 tmp-name5) + (should-not (file-exists-p tmp-name1)) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name1) tmp-name5)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name4)) + (ignore-errors (delete-directory tmp-name5 'recursive))) + + ;; Rename from local side to remote side. + (unwind-protect + (progn + (write-region "foo" nil tmp-name4 nil 'nomessage) + (rename-file tmp-name4 tmp-name1) + (should-not (file-exists-p tmp-name4)) + (should (file-exists-p tmp-name1)) + (with-temp-buffer + (insert-file-contents tmp-name1) + (should (string-equal (buffer-string) "foo"))) + (write-region "foo" nil tmp-name4 nil 'nomessage) + (should-error (rename-file tmp-name4 tmp-name1)) + (rename-file tmp-name4 tmp-name1 'ok) + (should-not (file-exists-p tmp-name4)) + (write-region "foo" nil tmp-name4 nil 'nomessage) + (make-directory tmp-name3) + (rename-file tmp-name4 tmp-name3) + (should-not (file-exists-p tmp-name4)) + (should + (file-exists-p + (expand-file-name (file-name-nondirectory tmp-name4) tmp-name3)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name4)) + (ignore-errors (delete-directory tmp-name3 'recursive)))))) + +(ert-deftest tramp-test13-make-directory () + "Check `make-directory'. +This tests also `file-directory-p' and `file-accessible-directory-p'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (expand-file-name "foo/bar" tmp-name1))) + (unwind-protect + (progn + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (should (file-accessible-directory-p tmp-name1)) + (should-error (make-directory tmp-name2)) + (make-directory tmp-name2 'parents) + (should (file-directory-p tmp-name2)) + (should (file-accessible-directory-p tmp-name2))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)))))) + +(ert-deftest tramp-test14-delete-directory () + "Check `delete-directory'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + ;; Delete empty directory. + (make-directory tmp-name) + (should (file-directory-p tmp-name)) + (delete-directory tmp-name) + (should-not (file-directory-p tmp-name)) + ;; Delete non-empty directory. + (make-directory tmp-name) + (should (file-directory-p tmp-name)) + (write-region "foo" nil (expand-file-name "bla" tmp-name)) + (should (file-exists-p (expand-file-name "bla" tmp-name))) + (should-error (delete-directory tmp-name)) + (delete-directory tmp-name 'recursive) + (should-not (file-directory-p tmp-name))))) + +(ert-deftest tramp-test15-copy-directory () + "Check `copy-directory'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (tmp-name3 (expand-file-name + (file-name-nondirectory tmp-name1) tmp-name2)) + (tmp-name4 (expand-file-name "foo" tmp-name1)) + (tmp-name5 (expand-file-name "foo" tmp-name2)) + (tmp-name6 (expand-file-name "foo" tmp-name3))) + + ;; Copy complete directory. + (unwind-protect + (progn + ;; Copy empty directory. + (make-directory tmp-name1) + (write-region "foo" nil tmp-name4) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name4)) + (copy-directory tmp-name1 tmp-name2) + (should (file-directory-p tmp-name2)) + (should (file-exists-p tmp-name5)) + ;; Target directory does exist already. + (copy-directory tmp-name1 tmp-name2) + (should (file-directory-p tmp-name3)) + (should (file-exists-p tmp-name6))) + + ;; Cleanup. + (ignore-errors + (delete-directory tmp-name1 'recursive) + (delete-directory tmp-name2 'recursive))) + + ;; Copy directory contents. + (unwind-protect + (progn + ;; Copy empty directory. + (make-directory tmp-name1) + (write-region "foo" nil tmp-name4) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name4)) + (copy-directory tmp-name1 tmp-name2 nil 'parents 'contents) + (should (file-directory-p tmp-name2)) + (should (file-exists-p tmp-name5)) + ;; Target directory does exist already. + (delete-file tmp-name5) + (should-not (file-exists-p tmp-name5)) + (copy-directory tmp-name1 tmp-name2 nil 'parents 'contents) + (should (file-directory-p tmp-name2)) + (should (file-exists-p tmp-name5)) + (should-not (file-directory-p tmp-name3)) + (should-not (file-exists-p tmp-name6))) + + ;; Cleanup. + (ignore-errors + (delete-directory tmp-name1 'recursive) + (delete-directory tmp-name2 'recursive)))))) + +(ert-deftest tramp-test16-directory-files () + "Check `directory-files'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((tmp-name1 + (expand-file-name (tramp--test-make-temp-name nil quoted))) + (tmp-name2 (expand-file-name "bla" tmp-name1)) + (tmp-name3 (expand-file-name "foo" tmp-name1))) + (unwind-protect + (progn + (make-directory tmp-name1) + (write-region "foo" nil tmp-name2) + (write-region "bla" nil tmp-name3) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name2)) + (should (file-exists-p tmp-name3)) + (should (equal (directory-files tmp-name1) '("." ".." "bla" "foo"))) + (should (equal (directory-files tmp-name1 'full) + `(,(concat tmp-name1 "/.") + ,(concat tmp-name1 "/..") + ,tmp-name2 ,tmp-name3))) + (should (equal (directory-files + tmp-name1 nil directory-files-no-dot-files-regexp) + '("bla" "foo"))) + (should (equal (directory-files + tmp-name1 'full directory-files-no-dot-files-regexp) + `(,tmp-name2 ,tmp-name3)))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)))))) + +(ert-deftest tramp-test17-insert-directory () + "Check `insert-directory'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((tmp-name1 + (expand-file-name (tramp--test-make-temp-name nil quoted))) + (tmp-name2 (expand-file-name "foo" tmp-name1)) + ;; We test for the summary line. Keyword "total" could be localized. + (process-environment + (append '("LANG=C" "LANGUAGE=C" "LC_ALL=C") process-environment))) + (unwind-protect + (progn + (make-directory tmp-name1) + (write-region "foo" nil tmp-name2) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name2)) + (with-temp-buffer + (insert-directory tmp-name1 nil) + (goto-char (point-min)) + (should (looking-at-p (regexp-quote tmp-name1)))) + (with-temp-buffer + (insert-directory tmp-name1 "-al") + (goto-char (point-min)) + (should + (looking-at-p (format "^.+ %s$" (regexp-quote tmp-name1))))) + (with-temp-buffer + (insert-directory (file-name-as-directory tmp-name1) "-al") + (goto-char (point-min)) + (should + (looking-at-p (format "^.+ %s/$" (regexp-quote tmp-name1))))) + (with-temp-buffer + (insert-directory + (file-name-as-directory tmp-name1) "-al" nil 'full-directory-p) + (goto-char (point-min)) + (should + (looking-at-p + (concat + ;; There might be a summary line. + "\\(total.+[[:digit:]]+\n\\)?" + ;; We don't know in which order ".", ".." and "foo" appear. + "\\(.+ \\(\\.?\\.\\|foo\\)\n\\)\\{3\\}"))))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)))))) + +(ert-deftest tramp-test18-file-attributes () + "Check `file-attributes'. +This tests also `file-readable-p', `file-regular-p' and +`file-ownership-preserved-p'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + ;; We must use `file-truename' for the temporary directory, + ;; because it could be located on a symlinked directory. This + ;; would let the test fail. + (let* ((tramp-test-temporary-file-directory + (file-truename tramp-test-temporary-file-directory)) + (tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + ;; File name with "//". + (tmp-name3 + (format + "%s%s" + (file-remote-p tmp-name1) + (replace-regexp-in-string + "/" "//" (file-remote-p tmp-name1 'localname)))) + attr) + (unwind-protect + (progn + ;; `file-ownership-preserved-p' should return t for + ;; non-existing files. It is implemented only in tramp-sh.el. + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name1 'group))) + (write-region "foo" nil tmp-name1) + (should (file-exists-p tmp-name1)) + (should (file-readable-p tmp-name1)) + (should (file-regular-p tmp-name1)) + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name1 'group))) + + ;; We do not test inodes and device numbers. + (setq attr (file-attributes tmp-name1)) + (should (consp attr)) + (should (null (car attr))) + (should (numberp (nth 1 attr))) ;; Link. + (should (numberp (nth 2 attr))) ;; Uid. + (should (numberp (nth 3 attr))) ;; Gid. + ;; Last access time. + (should (stringp (current-time-string (nth 4 attr)))) + ;; Last modification time. + (should (stringp (current-time-string (nth 5 attr)))) + ;; Last status change time. + (should (stringp (current-time-string (nth 6 attr)))) + (should (numberp (nth 7 attr))) ;; Size. + (should (stringp (nth 8 attr))) ;; Modes. + + (setq attr (file-attributes tmp-name1 'string)) + (should (stringp (nth 2 attr))) ;; Uid. + (should (stringp (nth 3 attr))) ;; Gid. + + (condition-case err + (progn + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name2 'group))) + (make-symbolic-link tmp-name1 tmp-name2) + (should (file-exists-p tmp-name2)) + (should (file-symlink-p tmp-name2)) + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name2 'group))) + (setq attr (file-attributes tmp-name2)) + (should + (string-equal + (funcall + (if quoted 'tramp-compat-file-name-quote 'identity) + (car attr)) + (file-remote-p (file-truename tmp-name1) 'localname))) + (delete-file tmp-name2)) + (file-error + (should (string-equal (error-message-string err) + "make-symbolic-link not supported")))) + + ;; Check, that "//" in symlinks are handled properly. + (with-temp-buffer + (let ((default-directory tramp-test-temporary-file-directory)) + (shell-command + (format + "ln -s %s %s" + (tramp-file-name-localname + (tramp-dissect-file-name tmp-name3)) + (tramp-file-name-localname + (tramp-dissect-file-name tmp-name2))) + t))) + (when (file-symlink-p tmp-name2) + (setq attr (file-attributes tmp-name2)) + (should + (string-equal + (car attr) + (tramp-file-name-localname + (tramp-dissect-file-name tmp-name3)))) + (delete-file tmp-name2)) + + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name1 'group))) + (delete-file tmp-name1) + (make-directory tmp-name1) + (should (file-exists-p tmp-name1)) + (should (file-readable-p tmp-name1)) + (should-not (file-regular-p tmp-name1)) + (when (tramp--test-sh-p) + (should (file-ownership-preserved-p tmp-name1 'group))) + (setq attr (file-attributes tmp-name1)) + (should (eq (car attr) t))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1)) + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-file tmp-name2)))))) + +(ert-deftest tramp-test19-directory-files-and-attributes () + "Check `directory-files-and-attributes'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + ;; `directory-files-and-attributes' contains also values for + ;; "../". Ensure that this doesn't change during tests, for + ;; example due to handling temporary files. + (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (expand-file-name "bla" tmp-name1)) + attr) + (unwind-protect + (progn + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (make-directory tmp-name2) + (should (file-directory-p tmp-name2)) + (write-region "foo" nil (expand-file-name "foo" tmp-name2)) + (write-region "bar" nil (expand-file-name "bar" tmp-name2)) + (write-region "boz" nil (expand-file-name "boz" tmp-name2)) + (setq attr (directory-files-and-attributes tmp-name2)) + (should (consp attr)) + ;; Dumb remote shells without perl(1) or stat(1) are not + ;; able to return the date correctly. They say "don't know". + (dolist (elt attr) + (unless + (equal + (nth + 5 (file-attributes (expand-file-name (car elt) tmp-name2))) + '(0 0)) + (should + (equal (file-attributes (expand-file-name (car elt) tmp-name2)) + (cdr elt))))) + (setq attr (directory-files-and-attributes tmp-name2 'full)) + (dolist (elt attr) + (unless (equal (nth 5 (file-attributes (car elt))) '(0 0)) + (should + (equal (file-attributes (car elt)) (cdr elt))))) + (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) + (should (equal (mapcar 'car attr) '("bar" "boz")))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)))))) + +(ert-deftest tramp-test20-file-modes () + "Check `file-modes'. +This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (set-file-modes tmp-name #o777) + (should (= (file-modes tmp-name) #o777)) + (should (file-executable-p tmp-name)) + (should (file-writable-p tmp-name)) + (set-file-modes tmp-name #o444) + (should (= (file-modes tmp-name) #o444)) + (should-not (file-executable-p tmp-name)) + ;; A file is always writable for user "root". + (unless (zerop (nth 2 (file-attributes tmp-name))) + (should-not (file-writable-p tmp-name)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(ert-deftest tramp-test21-file-links () + "Check `file-symlink-p'. +This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + ;; We must use `file-truename' for the temporary directory, + ;; because it could be located on a symlinked directory. This + ;; would let the test fail. + (let* ((tramp-test-temporary-file-directory + (file-truename tramp-test-temporary-file-directory)) + (tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (tmp-name3 (tramp--test-make-temp-name 'local quoted))) + + ;; Check `make-symbolic-link'. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (should (file-exists-p tmp-name1)) + ;; Method "smb" supports `make-symbolic-link' only if the + ;; remote host has CIFS capabilities. tramp-adb.el and + ;; tramp-gvfs.el do not support symbolic links at all. + (condition-case err + (make-symbolic-link tmp-name1 tmp-name2) + (file-error + (skip-unless + (not (string-equal (error-message-string err) + "make-symbolic-link not supported"))))) + (should (file-symlink-p tmp-name2)) + (should-error (make-symbolic-link tmp-name1 tmp-name2)) + (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists) + (should (file-symlink-p tmp-name2)) + ;; `tmp-name3' is a local file name. + (should-error (make-symbolic-link tmp-name1 tmp-name3))) + + ;; Cleanup. + (ignore-errors + (delete-file tmp-name1) + (delete-file tmp-name2))) + + ;; Check `add-name-to-file'. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (should (file-exists-p tmp-name1)) + (add-name-to-file tmp-name1 tmp-name2) + (should-not (file-symlink-p tmp-name2)) + (should-error (add-name-to-file tmp-name1 tmp-name2)) + (add-name-to-file tmp-name1 tmp-name2 'ok-if-already-exists) + (should-not (file-symlink-p tmp-name2)) + ;; `tmp-name3' is a local file name. + (should-error (add-name-to-file tmp-name1 tmp-name3))) + + ;; Cleanup. + (ignore-errors + (delete-file tmp-name1) + (delete-file tmp-name2))) + + ;; Check `file-truename'. + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (should (file-exists-p tmp-name1)) + (make-symbolic-link tmp-name1 tmp-name2) + (should (file-symlink-p tmp-name2)) + (should-not (string-equal tmp-name2 (file-truename tmp-name2))) + (should + (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) + (should (file-equal-p tmp-name1 tmp-name2))) + (ignore-errors + (delete-file tmp-name1) + (delete-file tmp-name2))) + + ;; `file-truename' shall preserve trailing link of directories. + (unless (file-symlink-p tramp-test-temporary-file-directory) + (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory)) + (dir2 (file-name-as-directory dir1))) + (should (string-equal (file-truename dir1) (expand-file-name dir1))) + (should + (string-equal (file-truename dir2) (expand-file-name dir2)))))))) + +(ert-deftest tramp-test22-file-times () + "Check `set-file-times' and `file-newer-than-file-p'." + (skip-unless (tramp--test-enabled)) + (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p))) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted)) + (tmp-name3 (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + (write-region "foo" nil tmp-name1) + (should (file-exists-p tmp-name1)) + (should (consp (nth 5 (file-attributes tmp-name1)))) + ;; '(0 0) means don't know, and will be replaced by + ;; `current-time'. Therefore, we use '(0 1). We skip the + ;; test, if the remote handler is not able to set the + ;; correct time. + (skip-unless (set-file-times tmp-name1 '(0 1))) + ;; Dumb remote shells without perl(1) or stat(1) are not + ;; able to return the date correctly. They say "don't know". + (unless (equal (nth 5 (file-attributes tmp-name1)) '(0 0)) + (should (equal (nth 5 (file-attributes tmp-name1)) '(0 1))) + (write-region "bla" nil tmp-name2) + (should (file-exists-p tmp-name2)) + (should (file-newer-than-file-p tmp-name2 tmp-name1)) + ;; `tmp-name3' does not exist. + (should (file-newer-than-file-p tmp-name2 tmp-name3)) + (should-not (file-newer-than-file-p tmp-name3 tmp-name1)))) + + ;; Cleanup. + (ignore-errors + (delete-file tmp-name1) + (delete-file tmp-name2)))))) + +(ert-deftest tramp-test23-visited-file-modtime () + "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (with-temp-buffer + (insert-file-contents tmp-name) + (should (verify-visited-file-modtime)) + (set-visited-file-modtime '(0 1)) + (should (verify-visited-file-modtime)) + (should (equal (visited-file-modtime) '(0 1 0 0))))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(ert-deftest tramp-test24-file-name-completion () + "Check `file-name-completion' and `file-name-all-completions'." + (skip-unless (tramp--test-enabled)) + + ;; Method and host name in completion mode. This kind of completion + ;; does not work on MS Windows. + (when (not (memq system-type '(cygwin windows-nt))) + (let ((method (file-remote-p tramp-test-temporary-file-directory 'method)) + (host (file-remote-p tramp-test-temporary-file-directory 'host)) + (orig-syntax tramp-syntax)) + (when (and (stringp host) (string-match tramp-host-with-port-regexp host)) + (setq host (match-string 1 host))) + + (unwind-protect + (dolist + (syntax + (if tramp--test-expensive-test + (tramp-syntax-values) `(,orig-syntax))) + (tramp-change-syntax syntax) + (let ;; This is needed for the `simplified' syntax. + ((method-marker + (if (zerop (length (tramp-method-regexp))) + "" tramp-default-method-marker)) + ;; This is needed for the `separate' syntax. + (prefix-format (substring (tramp-prefix-format) 1))) + ;; Complete method name. + (unless (or (zerop (length method)) + (zerop (length (tramp-method-regexp)))) + (should + (member + (concat prefix-format method (tramp-postfix-method-format)) + (file-name-all-completions + (concat prefix-format (substring method 0 1)) "/")))) + ;; Complete host name for default method. With gvfs + ;; based methods, host name will be determined as + ;; host.local, so we omit the test. + (let ((tramp-default-method (or method tramp-default-method))) + (unless (or (zerop (length host)) + (tramp--test-gvfs-p tramp-default-method)) + (should + (member + (concat + prefix-format method-marker (tramp-postfix-method-format) + host (tramp-postfix-host-format)) + (file-name-all-completions + (concat + prefix-format method-marker (tramp-postfix-method-format) + (substring host 0 1)) + "/"))))) + ;; Complete host name. + (unless (or (zerop (length method)) + (zerop (length (tramp-method-regexp))) + (zerop (length host)) + (tramp--test-gvfs-p method)) + (should + (member + (concat + prefix-format method (tramp-postfix-method-format) + host (tramp-postfix-host-format)) + (file-name-all-completions + (concat prefix-format method (tramp-postfix-method-format)) + "/")))))) + + ;; Cleanup. + (tramp-change-syntax orig-syntax)))) + + (dolist (n-e '(nil t)) + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((non-essential n-e) + (tmp-name (tramp--test-make-temp-name nil quoted))) + + (unwind-protect + (progn + ;; Local files. + (make-directory tmp-name) + (should (file-directory-p tmp-name)) + (write-region "foo" nil (expand-file-name "foo" tmp-name)) + (should (file-exists-p (expand-file-name "foo" tmp-name))) + (write-region "bar" nil (expand-file-name "bold" tmp-name)) + (should (file-exists-p (expand-file-name "bold" tmp-name))) + (make-directory (expand-file-name "boz" tmp-name)) + (should (file-directory-p (expand-file-name "boz" tmp-name))) + (should (equal (file-name-completion "fo" tmp-name) "foo")) + (should (equal (file-name-completion "foo" tmp-name) t)) + (should (equal (file-name-completion "b" tmp-name) "bo")) + (should-not (file-name-completion "a" tmp-name)) + (should + (equal + (file-name-completion "b" tmp-name 'file-directory-p) "boz/")) + (should + (equal (file-name-all-completions "fo" tmp-name) '("foo"))) + (should + (equal + (sort (file-name-all-completions "b" tmp-name) 'string-lessp) + '("bold" "boz/"))) + (should-not (file-name-all-completions "a" tmp-name)) + ;; `completion-regexp-list' restricts the completion to + ;; files which match all expressions in this list. + (let ((completion-regexp-list + `(,directory-files-no-dot-files-regexp "b"))) + (should + (equal (file-name-completion "" tmp-name) "bo")) + (should + (equal + (sort (file-name-all-completions "" tmp-name) 'string-lessp) + '("bold" "boz/")))) + ;; `file-name-completion' ignores file names that end in + ;; any string in `completion-ignored-extensions'. + (let ((completion-ignored-extensions '(".ext"))) + (write-region "foo" nil (expand-file-name "foo.ext" tmp-name)) + (should (file-exists-p (expand-file-name "foo.ext" tmp-name))) + (should (equal (file-name-completion "fo" tmp-name) "foo")) + (should (equal (file-name-completion "foo" tmp-name) t)) + (should + (equal (file-name-completion "foo." tmp-name) "foo.ext")) + (should (equal (file-name-completion "foo.ext" tmp-name) t)) + ;; `file-name-all-completions' is not affected. + (should + (equal + (sort (file-name-all-completions "" tmp-name) 'string-lessp) + '("../" "./" "bold" "boz/" "foo" "foo.ext"))))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name 'recursive))))))) + +(ert-deftest tramp-test25-load () + "Check `load'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted))) + (unwind-protect + (progn + (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)) + (load tmp-name nil 'nomessage 'nosuffix) + (should (featurep 'tramp-test-load))) + + ;; Cleanup. + (ignore-errors + (and (featurep 'tramp-test-load) (unload-feature 'tramp-test-load)) + (delete-file tmp-name)))))) + +(ert-deftest tramp-test26-process-file () + "Check `process-file'." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p))) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((tmp-name (tramp--test-make-temp-name nil quoted)) + (fnnd (file-name-nondirectory tmp-name)) + (default-directory tramp-test-temporary-file-directory) + kill-buffer-query-functions) + (unwind-protect + (progn + ;; We cannot use "/bin/true" and "/bin/false"; those paths + ;; do not exist on hydra. + (should (zerop (process-file "true"))) + (should-not (zerop (process-file "false"))) + (should-not (zerop (process-file "binary-does-not-exist"))) + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (should (zerop (process-file "ls" nil t nil fnnd))) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while + (re-search-forward tramp-display-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + (should (string-equal (format "%s\n" fnnd) (buffer-string))) + (should-not (get-buffer-window (current-buffer) t)) + + ;; Second run. The output must be appended. + (goto-char (point-max)) + (should (zerop (process-file "ls" nil t t fnnd))) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while + (re-search-forward tramp-display-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + (should + (string-equal (format "%s\n%s\n" fnnd fnnd) (buffer-string))) + ;; A non-nil DISPLAY must not raise the buffer. + (should-not (get-buffer-window (current-buffer) t)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(ert-deftest tramp-test27-start-file-process () + "Check `start-file-process'." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((default-directory tramp-test-temporary-file-directory) + (tmp-name (tramp--test-make-temp-name nil quoted)) + kill-buffer-query-functions proc) + (unwind-protect + (with-temp-buffer + (setq proc (start-file-process "test1" (current-buffer) "cat")) + (should (processp proc)) + (should (equal (process-status proc) 'run)) + (process-send-string proc "foo") + (process-send-eof proc) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 0.1))) + (should (string-equal (buffer-string) "foo"))) + + ;; Cleanup. + (ignore-errors (delete-process proc))) + + (unwind-protect + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (setq proc + (start-file-process + "test2" (current-buffer) + "cat" (file-name-nondirectory tmp-name))) + (should (processp proc)) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 0.1))) + (should (string-equal (buffer-string) "foo"))) + + ;; Cleanup. + (ignore-errors + (delete-process proc) + (delete-file tmp-name))) + + (unwind-protect + (with-temp-buffer + (setq proc (start-file-process "test3" (current-buffer) "cat")) + (should (processp proc)) + (should (equal (process-status proc) 'run)) + (set-process-filter + proc + (lambda (p s) (with-current-buffer (process-buffer p) (insert s)))) + (process-send-string proc "foo") + (process-send-eof proc) + ;; Read output. + (with-timeout (10 (ert-fail "`start-file-process' timed out")) + (while (< (- (point-max) (point-min)) (length "foo")) + (accept-process-output proc 0.1))) + (should (string-equal (buffer-string) "foo"))) + + ;; Cleanup. + (ignore-errors (delete-process proc)))))) + +(ert-deftest tramp-test28-shell-command () + "Check `shell-command'." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name (tramp--test-make-temp-name nil quoted)) + (default-directory tramp-test-temporary-file-directory) + kill-buffer-query-functions) + (unwind-protect + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (shell-command + (format "ls %s" (file-name-nondirectory tmp-name)) + (current-buffer)) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while + (re-search-forward tramp-display-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + (should + (string-equal + (format "%s\n" (file-name-nondirectory tmp-name)) + (buffer-string)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name))) + + (unwind-protect + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (async-shell-command + (format "ls %s" (file-name-nondirectory tmp-name)) + (current-buffer)) + (set-process-sentinel (get-buffer-process (current-buffer)) nil) + ;; Read output. + (with-timeout (10 (ert-fail "`async-shell-command' timed out")) + (while (< (- (point-max) (point-min)) + (1+ (length (file-name-nondirectory tmp-name)))) + (accept-process-output + (get-buffer-process (current-buffer)) 0.1))) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while + (re-search-forward tramp-display-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + ;; There might be a nasty "Process *Async Shell* finished" message. + (goto-char (point-min)) + (forward-line) + (narrow-to-region (point-min) (point)) + (should + (string-equal + (format "%s\n" (file-name-nondirectory tmp-name)) + (buffer-string)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name))) + + (unwind-protect + (with-temp-buffer + (write-region "foo" nil tmp-name) + (should (file-exists-p tmp-name)) + (async-shell-command "read line; ls $line" (current-buffer)) + (set-process-sentinel (get-buffer-process (current-buffer)) nil) + (process-send-string + (get-buffer-process (current-buffer)) + (format "%s\n" (file-name-nondirectory tmp-name))) + ;; Read output. + (with-timeout (10 (ert-fail "`async-shell-command' timed out")) + (while (< (- (point-max) (point-min)) + (1+ (length (file-name-nondirectory tmp-name)))) + (accept-process-output + (get-buffer-process (current-buffer)) 0.1))) + ;; `ls' could produce colorized output. + (goto-char (point-min)) + (while + (re-search-forward tramp-display-escape-sequence-regexp nil t) + (replace-match "" nil nil)) + ;; There might be a nasty "Process *Async Shell* finished" message. + (goto-char (point-min)) + (forward-line) + (narrow-to-region (point-min) (point)) + (should + (string-equal + (format "%s\n" (file-name-nondirectory tmp-name)) + (buffer-string)))) + + ;; Cleanup. + (ignore-errors (delete-file tmp-name)))))) + +(defun tramp--test-shell-command-to-string-asynchronously (command) + "Like `shell-command-to-string', but for asynchronous processes." + (with-temp-buffer + (async-shell-command command (current-buffer)) + ;; Suppress nasty messages. + (set-process-sentinel (get-buffer-process (current-buffer)) nil) + (with-timeout (10) + (while (get-buffer-process (current-buffer)) + (accept-process-output (get-buffer-process (current-buffer)) 0.1))) + (accept-process-output nil 0.1) + (buffer-substring-no-properties (point-min) (point-max)))) + +;; This test is inspired by Bug#23952. +(ert-deftest tramp-test29-environment-variables () + "Check that remote processes set / unset environment variables properly." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + (dolist (this-shell-command-to-string + '(;; Synchronously. + shell-command-to-string + ;; Asynchronously. + tramp--test-shell-command-to-string-asynchronously)) + + (let ((default-directory tramp-test-temporary-file-directory) + (shell-file-name "/bin/sh") + (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) + kill-buffer-query-functions) + + (unwind-protect + ;; Set a value. + (let ((process-environment + (cons (concat envvar "=foo") process-environment))) + ;; Default value. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}" envvar)))))) + + (unwind-protect + ;; Set the empty value. + (let ((process-environment + (cons (concat envvar "=") process-environment))) + ;; Value is null. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}" envvar)))) + ;; Variable is set. + (should + (string-match + (regexp-quote envvar) + (funcall this-shell-command-to-string "set"))))) + + ;; We force a reconnect, in order to have a clean environment. + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + 'keep-debug 'keep-password) + (unwind-protect + ;; Unset the variable. + (let ((tramp-remote-process-environment + (cons (concat envvar "=foo") + tramp-remote-process-environment))) + ;; Set the initial value, we want to unset below. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}" envvar)))) + (let ((process-environment + (cons envvar process-environment))) + ;; Variable is unset. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:?bla}" envvar)))) + ;; Variable is unset. + (should-not + (string-match + (regexp-quote envvar) + (funcall this-shell-command-to-string "set"))))))))) + +;; This test is inspired by Bug#27009. +(ert-deftest tramp-test29-environment-variables-and-port-numbers () + "Check that two connections with separate ports are different." + (skip-unless (tramp--test-enabled)) + ;; We test it only for the mock-up connection; otherwise there might + ;; be problems with the used ports. + (skip-unless + (and + (eq tramp-syntax 'default) + (string-equal + "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))) + + ;; We force a reconnect, in order to have a clean environment. + (dolist (dir `(,tramp-test-temporary-file-directory + "/mock:localhost#11111:" "/mock:localhost#22222:")) + (tramp-cleanup-connection + (tramp-dissect-file-name dir) 'keep-debug 'keep-password)) + + (unwind-protect + (dolist (port '(11111 22222)) + (let* ((default-directory + (format "/mock:localhost#%d:%s" port temporary-file-directory)) + (shell-file-name "/bin/sh") + (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) + ;; We cannot use `process-environment', because this + ;; would be applied in `process-file'. + (tramp-remote-process-environment + (cons + (format "%s=%d" envvar port) + tramp-remote-process-environment))) + (should + (string-equal + (number-to-string port) + (shell-command-to-string (format "echo -n $%s" envvar)))))) + + ;; Cleanup. + (dolist (dir '("/mock:localhost#11111:" "/mock:localhost#22222:")) + (tramp-cleanup-connection (tramp-dissect-file-name dir))))) + +;; The functions were introduced in Emacs 26.1. +(ert-deftest tramp-test30-explicit-shell-file-name () + "Check that connection-local `explicit-shell-file-name' is set." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (and (fboundp 'connection-local-set-profile-variables) + (fboundp 'connection-local-set-profiles))) + + ;; `connection-local-set-profile-variables' and + ;; `connection-local-set-profiles' exists since Emacs 26. We don't + ;; want to see compiler warnings for older Emacsen. + (let ((default-directory tramp-test-temporary-file-directory) + explicit-shell-file-name kill-buffer-query-functions) + (unwind-protect + (progn + ;; `shell-mode' would ruin our test, because it deletes all + ;; buffer local variables. + (put 'explicit-shell-file-name 'permanent-local t) + ;; Declare connection-local variable `explicit-shell-file-name'. + (with-no-warnings + (connection-local-set-profile-variables + 'remote-sh + '((explicit-shell-file-name . "/bin/sh") + (explicit-sh-args . ("-i")))) + (connection-local-set-profiles + `(:application tramp + :protocol ,(file-remote-p default-directory 'method) + :user ,(file-remote-p default-directory 'user) + :machine ,(file-remote-p default-directory 'host)) + 'remote-sh)) + + ;; Run interactive shell. Since the default directory is + ;; remote, `explicit-shell-file-name' shall be set in order + ;; to avoid a question. + (with-current-buffer (get-buffer-create "*shell*") + (ignore-errors (kill-process (current-buffer))) + (should-not explicit-shell-file-name) + (call-interactively 'shell) + (should explicit-shell-file-name))) + + (put 'explicit-shell-file-name 'permanent-local nil) + (kill-buffer "*shell*")))) + +(ert-deftest tramp-test31-vc-registered () + "Check `vc-registered'." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + ;; TODO: This test fails. + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let* ((default-directory tramp-test-temporary-file-directory) + (tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (expand-file-name "foo" tmp-name1)) + (tramp-remote-process-environment tramp-remote-process-environment) + (vc-handled-backends + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (cond + ((tramp-find-executable + v vc-git-program (tramp-get-remote-path v)) + '(Git)) + ((tramp-find-executable + v vc-hg-program (tramp-get-remote-path v)) + '(Hg)) + ((tramp-find-executable + v vc-bzr-program (tramp-get-remote-path v)) + (setq tramp-remote-process-environment + (cons (format "BZR_HOME=%s" + (file-remote-p tmp-name1 'localname)) + tramp-remote-process-environment)) + ;; We must force a reconnect, in order to activate $BZR_HOME. + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + nil 'keep-password) + '(Bzr)) + (t nil))))) + (skip-unless vc-handled-backends) + (message "%s" vc-handled-backends) + + (unwind-protect + (progn + (make-directory tmp-name1) + (write-region "foo" nil tmp-name2) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name2)) + (should-not (vc-registered tmp-name1)) + (should-not (vc-registered tmp-name2)) + + (let ((default-directory tmp-name1)) + ;; Create empty repository, and register the file. + ;; Sometimes, creation of repository fails (bzr!); we + ;; skip the test then. + (condition-case nil + (vc-create-repo (car vc-handled-backends)) + (error (skip-unless nil))) + ;; The structure of VC-FILESET is not documented. Let's + ;; hope it won't change. + (condition-case nil + (vc-register + (list (car vc-handled-backends) + (list (file-name-nondirectory tmp-name2)))) + ;; `vc-register' has changed its arguments in Emacs 25.1. + (error + (vc-register + nil (list (car vc-handled-backends) + (list (file-name-nondirectory tmp-name2)))))) + ;; vc-git uses an own process sentinel, Tramp's sentinel + ;; for flushing the cache isn't used. + (dired-uncache (concat (file-remote-p default-directory) "/")) + (should (vc-registered (file-name-nondirectory tmp-name2))))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)))))) + +(ert-deftest tramp-test32-make-auto-save-file-name () + "Check `make-auto-save-file-name'." + (skip-unless (tramp--test-enabled)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name nil quoted))) + + (unwind-protect + (progn + ;; Use default `auto-save-file-name-transforms' mechanism. + (let (tramp-auto-save-directory) + (with-temp-buffer + (setq buffer-file-name tmp-name1) + (should + (string-equal + (make-auto-save-file-name) + ;; This is taken from original `make-auto-save-file-name'. + ;; We call `convert-standard-filename', because on + ;; MS Windows the (local) colons must be replaced by + ;; exclamation marks. + (convert-standard-filename + (expand-file-name + (format + "#%s#" + (subst-char-in-string + ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) + temporary-file-directory)))))) + + ;; No mapping. + (let (tramp-auto-save-directory auto-save-file-name-transforms) + (with-temp-buffer + (setq buffer-file-name tmp-name1) + (should + (string-equal + (make-auto-save-file-name) + (funcall + (if quoted 'tramp-compat-file-name-quote 'identity) + (expand-file-name + (format "#%s#" (file-name-nondirectory tmp-name1)) + tramp-test-temporary-file-directory)))))) + + ;; TODO: The following two cases don't work yet. + (when nil + ;; Use default `tramp-auto-save-directory' mechanism. + (let ((tramp-auto-save-directory tmp-name2)) + (with-temp-buffer + (setq buffer-file-name tmp-name1) + (should + (string-equal + (make-auto-save-file-name) + ;; This is taken from Tramp. + (expand-file-name + (format + "#%s#" + (tramp-subst-strs-in-string + '(("_" . "|") + ("/" . "_a") + (":" . "_b") + ("|" . "__") + ("[" . "_l") + ("]" . "_r")) + (tramp-compat-file-name-unquote tmp-name1))) + tmp-name2))) + (should (file-directory-p tmp-name2)))) + + ;; Relative file names shall work, too. + (let ((tramp-auto-save-directory ".")) + (with-temp-buffer + (setq buffer-file-name tmp-name1 + default-directory tmp-name2) + (should + (string-equal + (make-auto-save-file-name) + ;; This is taken from Tramp. + (expand-file-name + (format + "#%s#" + (tramp-subst-strs-in-string + '(("_" . "|") + ("/" . "_a") + (":" . "_b") + ("|" . "__") + ("[" . "_l") + ("]" . "_r")) + (tramp-compat-file-name-unquote tmp-name1))) + tmp-name2))) + (should (file-directory-p tmp-name2))))) + ) ;; TODO + + ;; Cleanup. + (ignore-errors (delete-file tmp-name1)) + (ignore-errors (delete-directory tmp-name2 'recursive)))))) + +;; The functions were introduced in Emacs 26.1. +(ert-deftest tramp-test33-make-nearby-temp-file () + "Check `make-nearby-temp-file' and `temporary-file-directory'." + (skip-unless (tramp--test-enabled)) + (skip-unless + (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory))) + + ;; `make-nearby-temp-file' and `temporary-file-directory' exists + ;; since Emacs 26. We don't want to see compiler warnings for older + ;; Emacsen. + (let ((default-directory tramp-test-temporary-file-directory) + tmp-file) + ;; The remote host shall know a temporary file directory. + (should (stringp (with-no-warnings (temporary-file-directory)))) + (should + (string-equal + (file-remote-p default-directory) + (file-remote-p (with-no-warnings (temporary-file-directory))))) + + ;; The temporary file shall be located on the remote host. + (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test"))) + (should (file-exists-p tmp-file)) + (should (file-regular-p tmp-file)) + (should + (string-equal + (file-remote-p default-directory) + (file-remote-p tmp-file))) + (delete-file tmp-file) + (should-not (file-exists-p tmp-file)) + + (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test" 'dir))) + (should (file-exists-p tmp-file)) + (should (file-directory-p tmp-file)) + (delete-directory tmp-file) + (should-not (file-exists-p tmp-file)))) + +(defun tramp--test-adb-p () + "Check, whether the remote host runs Android. +This requires restrictions of file name syntax." + (tramp-adb-file-name-p tramp-test-temporary-file-directory)) + +(defun tramp--test-docker-p () + "Check, whether the docker method is used. +This does not support some special file names." + (string-equal + "docker" (file-remote-p tramp-test-temporary-file-directory 'method))) + +(defun tramp--test-ftp-p () + "Check, whether an FTP-like method is used. +This does not support globbing characters in file names (yet)." + ;; Globbing characters are ??, ?* and ?\[. + (string-match + "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))) + +(defun tramp--test-gvfs-p (&optional method) + "Check, whether the remote host runs a GVFS based method. +This requires restrictions of file name syntax." + (or (member method tramp-gvfs-methods) + (tramp-gvfs-file-name-p tramp-test-temporary-file-directory))) + +(defun tramp--test-hpux-p () + "Check, whether the remote host runs HP-UX. +Several special characters do not work properly there." + ;; We must refill the cache. `file-truename' does it. + (with-parsed-tramp-file-name + (file-truename tramp-test-temporary-file-directory) nil + (string-match "^HP-UX" (tramp-get-connection-property v "uname" "")))) + +(defun tramp--test-rsync-p () + "Check, whether the rsync method is used. +This does not support special file names." + (string-equal + "rsync" (file-remote-p tramp-test-temporary-file-directory 'method))) + +(defun tramp--test-sh-p () + "Check, whether the remote host runs a based method from tramp-sh.el." + (eq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + 'tramp-sh-file-name-handler)) + +(defun tramp--test-windows-nt-and-batch () + "Check, whether the locale host runs MS Windows in batch mode. +This does not support special characters." + (and (eq system-type 'windows-nt) noninteractive)) + +(defun tramp--test-windows-nt-and-pscp-psftp-p () + "Check, whether the locale host runs MS Windows, and ps{cp,ftp} is used. +This does not support utf8 based file transfer." + (and (eq system-type 'windows-nt) + (string-match + (regexp-opt '("pscp" "psftp")) + (file-remote-p tramp-test-temporary-file-directory 'method)))) + +(defun tramp--test-windows-nt-or-smb-p () + "Check, whether the locale or remote host runs MS Windows. +This requires restrictions of file name syntax." + (or (eq system-type 'windows-nt) + (tramp-smb-file-name-p tramp-test-temporary-file-directory))) + +(defun tramp--test-check-files (&rest files) + "Run a simple but comprehensive test over every file in FILES." + ;; TODO: The quoted case does not work. + ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + (let (quoted) + ;; We must use `file-truename' for the temporary directory, + ;; because it could be located on a symlinked directory. This + ;; would let the test fail. + (let* ((tramp-test-temporary-file-directory + (file-truename tramp-test-temporary-file-directory)) + (tmp-name1 (tramp--test-make-temp-name nil quoted)) + (tmp-name2 (tramp--test-make-temp-name 'local quoted)) + (files (delq nil files)) + (process-environment process-environment)) + (unwind-protect + (progn + (make-directory tmp-name1) + (make-directory tmp-name2) + + (dolist (elt files) + (let* ((file1 (expand-file-name elt tmp-name1)) + (file2 (expand-file-name elt tmp-name2)) + (file3 (expand-file-name (concat elt "foo") tmp-name1))) + (write-region elt nil file1) + (should (file-exists-p file1)) + + ;; Check file contents. + (with-temp-buffer + (insert-file-contents file1) + (should (string-equal (buffer-string) elt))) + + ;; Copy file both directions. + (copy-file file1 tmp-name2) + (should (file-exists-p file2)) + (delete-file file1) + (should-not (file-exists-p file1)) + (copy-file file2 tmp-name1) + (should (file-exists-p file1)) + + ;; Method "smb" supports `make-symbolic-link' only if the + ;; remote host has CIFS capabilities. tramp-adb.el and + ;; tramp-gvfs.el do not support symbolic links at all. + (condition-case err + (progn + (make-symbolic-link file1 file3) + (should (file-symlink-p file3)) + (should + (string-equal + (expand-file-name file1) (file-truename file3))) + (should + (string-equal + (funcall + (if quoted 'tramp-compat-file-name-quote 'identity) + (car (file-attributes file3))) + (file-remote-p (file-truename file1) 'localname))) + ;; Check file contents. + (with-temp-buffer + (insert-file-contents file3) + (should (string-equal (buffer-string) elt))) + (delete-file file3)) + (file-error + (should + (string-equal (error-message-string err) + "make-symbolic-link not supported")))))) + + ;; Check file names. + (should (equal (directory-files + tmp-name1 nil directory-files-no-dot-files-regexp) + (sort (copy-sequence files) 'string-lessp))) + (should (equal (directory-files + tmp-name2 nil directory-files-no-dot-files-regexp) + (sort (copy-sequence files) 'string-lessp))) + + ;; `substitute-in-file-name' could return different + ;; values. For `adb', there could be strange file + ;; permissions preventing overwriting a file. We don't + ;; care in this testcase. + (dolist (elt files) + (let ((file1 + (substitute-in-file-name (expand-file-name elt tmp-name1))) + (file2 + (substitute-in-file-name + (expand-file-name elt tmp-name2)))) + (ignore-errors (write-region elt nil file1)) + (should (file-exists-p file1)) + (ignore-errors (write-region elt nil file2 nil 'nomessage)) + (should (file-exists-p file2)))) + + (should (equal (directory-files + tmp-name1 nil directory-files-no-dot-files-regexp) + (directory-files + tmp-name2 nil directory-files-no-dot-files-regexp))) + + ;; Check directory creation. We use a subdirectory "foo" + ;; in order to avoid conflicts with previous file name tests. + (dolist (elt files) + (let* ((elt1 (concat elt "foo")) + (file1 (expand-file-name (concat "foo/" elt) tmp-name1)) + (file2 (expand-file-name elt file1)) + (file3 (expand-file-name elt1 file1))) + (make-directory file1 'parents) + (should (file-directory-p file1)) + (write-region elt nil file2) + (should (file-exists-p file2)) + (should + (equal + (directory-files + file1 nil directory-files-no-dot-files-regexp) + `(,elt))) + (should + (equal + (caar (directory-files-and-attributes + file1 nil directory-files-no-dot-files-regexp)) + elt)) + + ;; Check symlink in `directory-files-and-attributes'. + (condition-case err + (progn + (make-symbolic-link file2 file3) + (should (file-symlink-p file3)) + (should + (string-equal + (caar (directory-files-and-attributes + file1 nil (regexp-quote elt1))) + elt1)) + (should + (string-equal + (funcall + (if quoted 'tramp-compat-file-name-quote 'identity) + (cadr (car (directory-files-and-attributes + file1 nil (regexp-quote elt1))))) + (file-remote-p (file-truename file2) 'localname))) + (delete-file file3) + (should-not (file-exists-p file3))) + (file-error + (should (string-equal (error-message-string err) + "make-symbolic-link not supported")))) + + (delete-file file2) + (should-not (file-exists-p file2)) + (delete-directory file1) + (should-not (file-exists-p file1)))) + + ;; Check, that environment variables are set correctly. + (when (and tramp--test-expensive-test (tramp--test-sh-p)) + (dolist (elt files) + (let ((envvar (concat "VAR_" (upcase (md5 elt)))) + (default-directory tramp-test-temporary-file-directory) + (process-environment process-environment)) + (setenv envvar elt) + ;; The value of PS1 could confuse Tramp's detection + ;; of process output. So we unset it temporarily. + (setenv "PS1") + (with-temp-buffer + (should (zerop (process-file "env" nil t nil))) + (goto-char (point-min)) + (should + (re-search-forward + (format + "^%s=%s$" + (regexp-quote envvar) + (regexp-quote (getenv envvar)))))))))) + + ;; Cleanup. + (ignore-errors (delete-directory tmp-name1 'recursive)) + (ignore-errors (delete-directory tmp-name2 'recursive)))))) + +(defun tramp--test-special-characters () + "Perform the test in `tramp-test34-special-characters*'." + ;; Newlines, slashes and backslashes in file names are not + ;; supported. So we don't test. And we don't test the tab + ;; character on Windows or Cygwin, because the backslash is + ;; interpreted as a path separator, preventing "\t" from being + ;; expanded to <TAB>. + (tramp--test-check-files + (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) + "foo bar baz" + (if (or (tramp--test-adb-p) + (tramp--test-docker-p) + (eq system-type 'cygwin)) + " foo bar baz " + " foo\tbar baz\t")) + "$foo$bar$$baz$" + "-foo-bar-baz-" + "%foo%bar%baz%" + "&foo&bar&baz&" + (unless (or (tramp--test-ftp-p) + (tramp--test-gvfs-p) + (tramp--test-windows-nt-or-smb-p)) + "?foo?bar?baz?") + (unless (or (tramp--test-ftp-p) + (tramp--test-gvfs-p) + (tramp--test-windows-nt-or-smb-p)) + "*foo*bar*baz*") + (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) + "'foo'bar'baz'" + "'foo\"bar'baz\"") + "#foo~bar#baz~" + (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) + "!foo!bar!baz!" + "!foo|bar!baz|") + (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) + ";foo;bar;baz;" + ":foo;bar:baz;") + (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p)) + "<foo>bar<baz>") + "(foo)bar(baz)" + (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]") + "{foo}bar{baz}")) + +;; These tests are inspired by Bug#17238. +(ert-deftest tramp-test34-special-characters () + "Check special characters in file names." + (skip-unless (tramp--test-enabled)) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + + (tramp--test-special-characters)) + +(ert-deftest tramp-test34-special-characters-with-stat () + "Check special characters in file names. +Use the `stat' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (skip-unless (tramp-get-remote-stat v))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) + +(ert-deftest tramp-test34-special-characters-with-perl () + "Check special characters in file names. +Use the `perl' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (skip-unless (tramp-get-remote-perl v))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil) + ;; See `tramp-sh-handle-file-truename'. + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "readlink" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) + +(ert-deftest tramp-test34-special-characters-with-ls () + "Check special characters in file names. +Use the `ls' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-batch))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil) + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil) + ;; See `tramp-sh-handle-file-truename'. + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "readlink" nil)) + tramp-connection-properties))) + (tramp--test-special-characters))) + +(defun tramp--test-utf8 () + "Perform the test in `tramp-test35-utf8*'." + (let* ((utf8 (if (and (eq system-type 'darwin) + (memq 'utf-8-hfs (coding-system-list))) + 'utf-8-hfs 'utf-8)) + (coding-system-for-read utf8) + (coding-system-for-write utf8) + (file-name-coding-system utf8)) + (tramp--test-check-files + (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ") + (unless (tramp--test-hpux-p) + "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت") + "银河系漫游指南系列" + "Автостопом по гала́ктике"))) + +(ert-deftest tramp-test35-utf8 () + "Check UTF8 encoding in file names and file contents." + (skip-unless (tramp--test-enabled)) + (skip-unless (not (tramp--test-docker-p))) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-batch))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + + (tramp--test-utf8)) + +(ert-deftest tramp-test35-utf8-with-stat () + "Check UTF8 encoding in file names and file contents. +Use the `stat' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-docker-p))) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-batch))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (skip-unless (tramp-get-remote-stat v))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) + +(ert-deftest tramp-test35-utf8-with-perl () + "Check UTF8 encoding in file names and file contents. +Use the `perl' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-docker-p))) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-batch))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (skip-unless (tramp-get-remote-perl v))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil) + ;; See `tramp-sh-handle-file-truename'. + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "readlink" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) + +(ert-deftest tramp-test35-utf8-with-ls () + "Check UTF8 encoding in file names and file contents. +Use the `ls' command." + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + (skip-unless (not (tramp--test-docker-p))) + (skip-unless (not (tramp--test-rsync-p))) + (skip-unless (not (tramp--test-windows-nt-and-batch))) + (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p))) + + (let ((tramp-connection-properties + (append + `((,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "perl" nil) + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "stat" nil) + ;; See `tramp-sh-handle-file-truename'. + (,(regexp-quote (file-remote-p tramp-test-temporary-file-directory)) + "readlink" nil)) + tramp-connection-properties))) + (tramp--test-utf8))) + +;; This test is inspired by Bug#16928. +(ert-deftest tramp-test36-asynchronous-requests () + "Check parallel asynchronous requests. +Such requests could arrive from timers, process filters and +process sentinels. They shall not disturb each other." + ;; Mark as failed until bug has been fixed. + :expected-result :failed + :tags '(:expensive-test) + (skip-unless (tramp--test-enabled)) + (skip-unless (tramp--test-sh-p)) + + (dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) + ;; Keep instrumentation verbosity 0 until Tramp bug is fixed. + ;; This has the side effect, that this test fails instead to + ;; abort. Good for hydra. + (tramp--instrument-test-case 0 + (let* ((tmp-name (tramp--test-make-temp-name nil quoted)) + (default-directory tmp-name) + (remote-file-name-inhibit-cache t) + timer buffers kill-buffer-query-functions) + + (unwind-protect + (progn + (make-directory tmp-name) + + ;; Setup a timer in order to raise an ordinary command + ;; again and again. `vc-registered' is well suited, + ;; because there are many checks. + (setq + timer + (run-at-time + 0 1 + (lambda () + (when buffers + (vc-registered + (buffer-name (nth (random (length buffers)) buffers))))))) + + ;; Create temporary buffers. The number of buffers + ;; corresponds to the number of processes; it could be + ;; increased in order to make pressure on Tramp. + (dotimes (_i 5) + (add-to-list 'buffers (generate-new-buffer "*temp*"))) + + ;; Open asynchronous processes. Set process sentinel. + (dolist (buf buffers) + (async-shell-command "read line; touch $line; echo $line" buf) + (set-process-sentinel + (get-buffer-process buf) + (lambda (proc _state) + (delete-file (buffer-name (process-buffer proc)))))) + + ;; Send a string. Use a random order of the buffers. Mix + ;; with regular operation. + (let ((buffers (copy-sequence buffers)) + buf) + (while buffers + (setq buf (nth (random (length buffers)) buffers)) + (process-send-string + (get-buffer-process buf) (format "'%s'\n" buf)) + (file-attributes (buffer-name buf)) + (setq buffers (delq buf buffers)))) + + ;; Wait until the whole output has been read. + (with-timeout ((* 10 (length buffers)) + (ert-fail "`async-shell-command' timed out")) + (let ((buffers (copy-sequence buffers)) + buf) + (while buffers + (setq buf (nth (random (length buffers)) buffers)) + (if (ignore-errors + (memq (process-status (get-buffer-process buf)) + '(run open))) + (accept-process-output (get-buffer-process buf) 0.1) + (setq buffers (delq buf buffers)))))) + + ;; Check. + (dolist (buf buffers) + (with-current-buffer buf + (should + (string-equal (format "'%s'\n" buf) (buffer-string))))) + (should-not + (directory-files + tmp-name nil directory-files-no-dot-files-regexp))) + + ;; Cleanup. + (ignore-errors (cancel-timer timer)) + (ignore-errors (delete-directory tmp-name 'recursive)) + (dolist (buf buffers) + (ignore-errors (kill-buffer buf)))))))) + +(ert-deftest tramp-test37-recursive-load () + "Check that Tramp does not fail due to recursive load." + (skip-unless (tramp--test-enabled)) + + (dolist (code + (list + (format "(expand-file-name %S)" tramp-test-temporary-file-directory) + (format + "(let ((default-directory %S)) (expand-file-name %S))" + tramp-test-temporary-file-directory + temporary-file-directory))) + (should-not + (string-match + "Recursive load" + (shell-command-to-string + (format + "%s -batch -Q -L %s --eval %s" + (expand-file-name invocation-name invocation-directory) + (mapconcat 'shell-quote-argument load-path " -L ") + (shell-quote-argument code))))))) + +(ert-deftest tramp-test38-unload () + "Check that Tramp and its subpackages unload completely. +Since it unloads Tramp, it shall be the last test to run." + ;; Mark as failed until all symbols are unbound. + :expected-result (if (featurep 'tramp) :failed :passed) + :tags '(:expensive-test) + (skip-unless noninteractive) + + (when (featurep 'tramp) + (unload-feature 'tramp 'force) + ;; No Tramp feature must be left. + (should-not (featurep 'tramp)) + (should-not (all-completions "tramp" (delq 'tramp-tests features))) + ;; `file-name-handler-alist' must be clean. + (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist))) + ;; There shouldn't be left a bound symbol. We do not regard our + ;; test symbols, and the Tramp unload hooks. + (mapatoms + (lambda (x) + (and (or (boundp x) (functionp x)) + (string-match "^tramp" (symbol-name x)) + (not (string-match "^tramp--?test" (symbol-name x))) + (not (string-match "unload-hook$" (symbol-name x))) + (ert-fail (format "`%s' still bound" x))))) + ;; There shouldn't be left a hook function containing a Tramp + ;; function. We do not regard the Tramp unload hooks. + (mapatoms + (lambda (x) + (and (boundp x) + (string-match "-hooks?$" (symbol-name x)) + (not (string-match "unload-hook$" (symbol-name x))) + (consp (symbol-value x)) + (ignore-errors (all-completions "tramp" (symbol-value x))) + (ert-fail (format "Hook `%s' still contains Tramp function" x))))))) + +;; TODO: + +;; * dired-compress-file +;; * dired-uncache +;; * file-acl +;; * file-name-case-insensitive-p +;; * file-selinux-context +;; * find-backup-file-name +;; * set-file-acl +;; * set-file-selinux-context + +;; * Work on skipped tests. Make a comment, when it is impossible. +;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'. +;; * Fix `tramp-test06-directory-file-name' for `ftp'. +;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). +;; * Fix Bug#27009. Set expected error of +;; `tramp-test29-environment-variables-and-port-numbers'. +;; * Fix Bug#16928. Set expected error of `tramp-test36-asynchronous-requests'. +;; * Fix `tramp-test38-unload' (Not all symbols are unbound). Set +;; expected error. + +(defun tramp-test-all (&optional interactive) + "Run all tests for \\[tramp]." + (interactive "p") + (funcall + (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) "^tramp")) + +(provide 'tramp-tests) +;;; tramp-tests.el ends here diff --git a/test/automated/obarray-tests.el b/test/lisp/obarray-tests.el index 9a2d65d8b41..4908b883240 100644 --- a/test/automated/obarray-tests.el +++ b/test/lisp/obarray-tests.el @@ -43,14 +43,16 @@ (ert-deftest obarray-make-default-test () (let ((table (obarray-make))) (should (obarrayp table)) - (should (equal (make-vector 59 0) table)))) + (should (eq (obarray-size table) obarray-default-size)))) (ert-deftest obarray-make-with-size-test () + ;; FIXME: Actually, `wrong-type-argument' is not the right error to signal, + ;; so we shouldn't enforce this misbehavior in tests! (should-error (obarray-make -1) :type 'wrong-type-argument) (should-error (obarray-make 0) :type 'wrong-type-argument) (let ((table (obarray-make 1))) (should (obarrayp table)) - (should (equal (make-vector 1 0) table)))) + (should (eq (obarray-size table) 1)))) (ert-deftest obarray-get-test () (let ((table (obarray-make 3))) diff --git a/test/lisp/progmodes/bat-mode-tests.el b/test/lisp/progmodes/bat-mode-tests.el new file mode 100644 index 00000000000..565718eea41 --- /dev/null +++ b/test/lisp/progmodes/bat-mode-tests.el @@ -0,0 +1,86 @@ +;;; bat-mode-tests.el --- Tests for bat-mode.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Vladimir Panteleev <vladimir@thecybershadow.net> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'bat-mode) +(require 'htmlfontify) + +(defun bat-test-fontify (str) + "Fontify STR in `bat-mode' to a HTML string using `htmlfontify' and return it." + (with-temp-buffer + (insert str) + (bat-mode) + (let ((hfy-optimizations '(body-text-only merge-adjacent-tags))) + (with-current-buffer (htmlfontify-buffer) (buffer-string))))) + +(ert-deftest bat-test-fontification-var-decl () + "Test fontification of variable declarations." + (should + (equal + (bat-test-fontify "set a_b-c{d}e=f") + "<span class=\"builtin\">set</span> <span class=\"variable-name\">a_b-c{d}e</span>=f"))) + +(ert-deftest bat-test-fontification-var-exp () + "Test fontification of variable expansions." + (should + (equal + (bat-test-fontify "echo %a_b-c{d}e%") + "<span class=\"builtin\">echo</span> %<span class=\"variable-name\">a_b-c{d}e</span>%"))) + +(ert-deftest bat-test-fontification-var-delayed-exp () + "Test fontification of delayed variable expansions." + (should + (equal + (bat-test-fontify "echo !a_b-c{d}e!") + "<span class=\"builtin\">echo</span> !<span class=\"variable-name\">a_b-c{d}e</span>!"))) + +(ert-deftest bat-test-fontification-iter-var-1 () + "Test fontification of iteration variables." + (should + (equal + (bat-test-fontify "echo %%a\necho %%~dp1\necho %%~$PATH:I") + "<span class=\"builtin\">echo</span> %%<span class=\"variable-name\">a</span> +<span class=\"builtin\">echo</span> %%~dp<span class=\"variable-name\">1</span> +<span class=\"builtin\">echo</span> %%~$<span class=\"variable-name\">PATH</span>:<span class=\"variable-name\">I</span>"))) + +(defun bat-test-fill-paragraph (str) + "Return the result of invoking `fill-paragraph' on STR in a `bat-mode' buffer." + (with-temp-buffer + (bat-mode) + (insert str) + (goto-char 1) + (font-lock-ensure) + (fill-paragraph) + (buffer-string))) + +(ert-deftest bat-test-fill-paragraph-comment () + "Test `fill-paragraph' in a comment block." + (should (equal (bat-test-fill-paragraph "rem foo\nrem bar\n") "rem foo bar\n"))) + +(provide 'bat-tests) +;;; bat-mode-tests.el ends here diff --git a/test/lisp/progmodes/cc-mode-tests.el b/test/lisp/progmodes/cc-mode-tests.el new file mode 100644 index 00000000000..10f424f5282 --- /dev/null +++ b/test/lisp/progmodes/cc-mode-tests.el @@ -0,0 +1,72 @@ +;;; cc-mode-tests.el --- Test suite for cc-mode. -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Michal Nazarewicz <mina86@mina86.com> +;; Keywords: internal +;; Human-Keywords: internal + +;; 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 <http://www.gnu.org/licenses/>. + + +;;; Commentary: + +;; Unit tests for cc-mode.el. + +;;; Code: + +(require 'ert) +(require 'ert-x) +(require 'cc-mode) + +(ert-deftest c-or-c++-mode () + "Test c-or-c++-mode language detection." + (cl-letf* ((mode nil) + (do-test (lambda (content expected) + (delete-region (point-min) (point-max)) + (insert content) + (setq mode nil) + (c-or-c++-mode) + (unless(eq expected mode) + (ert-fail + (format "expected %s but got %s when testing '%s'" + expected mode content))))) + ((symbol-function 'c-mode) (lambda () (setq mode 'c-mode))) + ((symbol-function 'c++-mode) (lambda () (setq mode 'c++-mode)))) + (with-temp-buffer + (mapc (lambda (content) + (funcall do-test content 'c++-mode) + (funcall do-test (concat "// " content) 'c-mode) + (funcall do-test (concat " * " content) 'c-mode)) + '("using \t namespace \t std;" + "using \t std::string;" + "namespace \t {" + "namespace \t foo \t {" + "class \t Blah_42 \t {" + "class \t Blah_42 \t \n" + "class \t _42_Blah:public Foo {" + "template \t < class T >" + "template< class T >" + "#include <string>" + "#include<iostream>" + "#include \t <map>")) + + (mapc (lambda (content) (funcall do-test content 'c-mode)) + '("struct \t Blah_42 \t {" + "struct template {" + "#include <string.h>"))))) + +;;; cc-mode-tests.el ends here diff --git a/test/automated/compile-tests.el b/test/lisp/progmodes/compile-tests.el index edd260d52b3..5c8c9c2a81f 100644 --- a/test/automated/compile-tests.el +++ b/test/lisp/progmodes/compile-tests.el @@ -1,4 +1,4 @@ -;;; compile-tests.el --- Test suite for font parsing. +;;; compile-tests.el --- Test suite for compile.el. -*- lexical-binding: t; -*- ;; Copyright (C) 2011-2017 Free Software Foundation, Inc. @@ -21,6 +21,10 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +;;; Commentary: + +;; Unit tests for lisp/progmodes/compile.el. + ;;; Code: (require 'ert) @@ -79,6 +83,16 @@ 1 nil 302 "\\lib\\python\\Products\\PythonScripts\\PythonScript.py") ("File \"/tmp/foo.py\", line 10" 1 nil 10 "/tmp/foo.py") + ;; clang-include + ("In file included from foo.cpp:2:" + 1 nil 2 "foo.cpp" 0) + ;; cmake cmake-info + ("CMake Error at CMakeLists.txt:23 (hurz):" + 1 nil 23 "CMakeLists.txt") + ("CMake Warning at cmake/modules/UseUG.cmake:73 (find_package):" + 1 nil 73 "cmake/modules/UseUG.cmake") + (" cmake/modules/DuneGridMacros.cmake:19 (include)" + 1 nil 19 "cmake/modules/DuneGridMacros.cmake") ;; comma ("\"foo.f\", line 3: Error: syntax error near end of statement" 1 nil 3 "foo.f") @@ -316,15 +330,18 @@ ("index.html (13:1) Unknown element <fdjsk>" 1 1 13 "index.html")) "List of tests for `compilation-error-regexp-alist'. -Each element has the form (STR POS COLUMN LINE FILENAME), where -STR is an error string, POS is the position of the error in STR, -COLUMN and LINE are the reported column and line numbers (or nil) -for that error, and FILENAME is the reported filename. +Each element has the form (STR POS COLUMN LINE FILENAME [TYPE]), +where STR is an error string, POS is the position of the error in +STR, COLUMN and LINE are the reported column and line numbers (or +nil) for that error, FILENAME is the reported filename, and TYPE +is 0 for an information message, 1 for a warning, and 2 for an +error. LINE can also be of the form (LINE . END-LINE) meaning a range of lines. COLUMN can also be of the form (COLUMN . END-COLUMN) meaning a range of columns starting on LINE and ending on -END-LINE, if that matched.") +END-LINE, if that matched. TYPE can be left out, in which case +any message type is accepted.") (defun compile--test-error-line (test) (erase-buffer) @@ -332,35 +349,34 @@ END-LINE, if that matched.") (insert (car test)) (compilation-parse-errors (point-min) (point-max)) (let ((msg (get-text-property (nth 1 test) 'compilation-message))) - (when msg - (let ((loc (compilation--message->loc msg)) - (col (nth 2 test)) - (line (nth 3 test)) - (file (nth 4 test)) - (type (nth 5 test)) - end-col end-line) - (if (consp col) - (setq end-col (cdr col) col (car col))) - (if (consp line) - (setq end-line (cdr line) line (car line))) - (and (equal (compilation--loc->col loc) col) - (equal (compilation--loc->line loc) line) - (or (not file) - (equal (caar (compilation--loc->file-struct loc)) file)) - (or (null end-col) - (equal (car (cadr (nth 2 (compilation--loc->file-struct loc)))) - end-col)) - (equal (car (nth 2 (compilation--loc->file-struct loc))) - (or end-line line)) - (or (null type) - (equal type (compilation--message->type msg)))))))) + (should msg) + (let ((loc (compilation--message->loc msg)) + (col (nth 2 test)) + (line (nth 3 test)) + (file (nth 4 test)) + (type (nth 5 test)) + end-col end-line) + (if (consp col) + (setq end-col (cdr col) col (car col))) + (if (consp line) + (setq end-line (cdr line) line (car line))) + (should (equal (compilation--loc->col loc) col)) + (should (equal (compilation--loc->line loc) line)) + (when file + (should (equal (caar (compilation--loc->file-struct loc)) file))) + (when end-col + (should (equal (car (cadr (nth 2 (compilation--loc->file-struct loc)))) + end-col))) + (should (equal (car (nth 2 (compilation--loc->file-struct loc))) + (or end-line line))) + (when type + (should (equal type (compilation--message->type msg))))))) (ert-deftest compile-test-error-regexps () "Test the `compilation-error-regexp-alist' regexps. The test data is in `compile-tests--test-regexps-data'." (with-temp-buffer (font-lock-mode -1) - (dolist (test compile-tests--test-regexps-data) - (should (compile--test-error-line test))))) + (mapc #'compile--test-error-line compile-tests--test-regexps-data))) -;;; compile-tests.el ends here. +;;; compile-tests.el ends here diff --git a/test/automated/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index 605f9ca08df..ee0837f2c4c 100644 --- a/test/automated/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -114,6 +114,72 @@ (should (member "backup-buffer" comps)) (should-not (member "backup-inhibited" comps))))) +;;; eval-last-sexp + +(ert-deftest eval-last-sexp-print-format-sym () + (with-temp-buffer + (let ((current-prefix-arg '(4))) + (erase-buffer) (insert "t") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "tt"))))) + +(ert-deftest eval-last-sexp-print-format-sym-echo () + ;; We can only check the echo area when running interactive. + (skip-unless (not noninteractive)) + (with-temp-buffer + (let ((current-prefix-arg nil)) + (erase-buffer) (insert "t") (message nil) + (call-interactively #'eval-last-sexp) + (should (equal (current-message) "t"))))) + +(ert-deftest eval-last-sexp-print-format-small-int () + (with-temp-buffer + (let ((current-prefix-arg '(4))) + (erase-buffer) (insert "?A") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "?A65"))) + (let ((current-prefix-arg 0)) + (erase-buffer) (insert "?A") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "?A65 (#o101, #x41, ?A)"))))) + +(ert-deftest eval-last-sexp-print-format-small-int-echo () + (skip-unless (not noninteractive)) + (with-temp-buffer + (let ((current-prefix-arg nil)) + (erase-buffer) (insert "?A") (message nil) + (call-interactively #'eval-last-sexp) + (should (equal (current-message) "65 (#o101, #x41, ?A)"))))) + +(ert-deftest eval-last-sexp-print-format-large-int () + (with-temp-buffer + (let ((eval-expression-print-maximum-character ?A)) + (let ((current-prefix-arg '(4))) + (erase-buffer) (insert "?B") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "?B66"))) + (let ((current-prefix-arg 0)) + (erase-buffer) (insert "?B") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "?B66 (#o102, #x42)"))) + (let ((current-prefix-arg -1)) + (erase-buffer) (insert "?B") + (call-interactively #'eval-last-sexp) + (should (equal (buffer-string) "?B66 (#o102, #x42, ?B)")))))) + +(ert-deftest eval-last-sexp-print-format-large-int-echo () + (skip-unless (not noninteractive)) + (with-temp-buffer + (let ((eval-expression-print-maximum-character ?A)) + (let ((current-prefix-arg nil)) + (erase-buffer) (insert "?B") (message nil) + (call-interactively #'eval-last-sexp) + (should (equal (current-message) "66 (#o102, #x42)"))) + (let ((current-prefix-arg '-)) + (erase-buffer) (insert "?B") (message nil) + (call-interactively #'eval-last-sexp) + (should (equal (current-message) "66 (#o102, #x42, ?B)")))))) + ;;; xref (defun xref-elisp-test-descr-to-target (xref) @@ -224,7 +290,10 @@ to (xref-elisp-test-descr-to-target xref)." ;; `load-path' has the correct case, so this causes the expected test ;; values to have the wrong case). This is handled in ;; `xref-elisp-test-run'. -(defconst emacs-test-dir (downcase (file-name-directory (or load-file-name (buffer-file-name))))) +(defconst emacs-test-dir + (downcase + (file-truename (file-name-directory + (or load-file-name (buffer-file-name)))))) ;; alphabetical by test name @@ -244,7 +313,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(cl-defstruct (xref-elisp-location (:constructor xref-make-elisp-location)))" (xref-make-elisp-location 'xref-elisp-location 'define-type - (expand-file-name "../../lisp/progmodes/elisp-mode.el" emacs-test-dir))) + (expand-file-name "../../../lisp/progmodes/elisp-mode.el" emacs-test-dir))) ;; It's not worth adding another special case to `xref-elisp-test-descr-to-target' for this "(cl-defstruct (xref-elisp-location") )) @@ -255,11 +324,11 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defalias Buffer-menu-sort)" (xref-make-elisp-location 'Buffer-menu-sort 'defalias - (expand-file-name "../../lisp/buff-menu.elc" emacs-test-dir))) + (expand-file-name "../../../lisp/buff-menu.elc" emacs-test-dir))) (xref-make "(defun tabulated-list-sort)" (xref-make-elisp-location 'tabulated-list-sort nil - (expand-file-name "../../lisp/emacs-lisp/tabulated-list.el" emacs-test-dir))) + (expand-file-name "../../../lisp/emacs-lisp/tabulated-list.el" emacs-test-dir))) )) ;; FIXME: defconst @@ -347,7 +416,9 @@ to (xref-elisp-test-descr-to-target xref)." (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-elisp-generic-no-default ((this xref-elisp-root-type) arg2))" (xref-make-elisp-location - '(xref-elisp-generic-no-default xref-elisp-root-type t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-no-default nil '(xref-elisp-root-type t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) )) @@ -360,7 +431,10 @@ to (xref-elisp-test-descr-to-target xref)." (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-elisp-generic-co-located-default ((this xref-elisp-root-type) arg2))" (xref-make-elisp-location - '(xref-elisp-generic-co-located-default xref-elisp-root-type t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-co-located-default nil + '(xref-elisp-root-type t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) )) @@ -373,11 +447,16 @@ to (xref-elisp-test-descr-to-target xref)." (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-elisp-generic-separate-default (arg1 arg2))" (xref-make-elisp-location - '(xref-elisp-generic-separate-default t t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-separate-default nil '(t t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-elisp-generic-separate-default ((this xref-elisp-root-type) arg2))" (xref-make-elisp-location - '(xref-elisp-generic-separate-default xref-elisp-root-type t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-separate-default nil + '(xref-elisp-root-type t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) )) @@ -386,11 +465,16 @@ to (xref-elisp-test-descr-to-target xref)." (list (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic (arg1 arg2))" (xref-make-elisp-location - '(xref-elisp-generic-implicit-generic t t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-implicit-generic nil '(t t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-elisp-generic-implicit-generic ((this xref-elisp-root-type) arg2))" (xref-make-elisp-location - '(xref-elisp-generic-implicit-generic xref-elisp-root-type t) 'cl-defmethod + (cl--generic-load-hist-format + 'xref-elisp-generic-implicit-generic nil + '(xref-elisp-root-type t)) + 'cl-defmethod (expand-file-name "elisp-mode-tests.el" emacs-test-dir))) )) @@ -406,27 +490,37 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(cl-defgeneric xref-location-marker)" (xref-make-elisp-location 'xref-location-marker 'cl-defgeneric - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-location-marker ((l xref-elisp-location)))" (xref-make-elisp-location - '(xref-location-marker xref-elisp-location) 'cl-defmethod - (expand-file-name "../../lisp/progmodes/elisp-mode.el" emacs-test-dir))) + (cl--generic-load-hist-format + 'xref-location-marker nil '(xref-elisp-location)) + 'cl-defmethod + (expand-file-name "../../../lisp/progmodes/elisp-mode.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-location-marker ((l xref-file-location)))" (xref-make-elisp-location - '(xref-location-marker xref-file-location) 'cl-defmethod - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (cl--generic-load-hist-format + 'xref-location-marker nil '(xref-file-location)) + 'cl-defmethod + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-location-marker ((l xref-buffer-location)))" (xref-make-elisp-location - '(xref-location-marker xref-buffer-location) 'cl-defmethod - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (cl--generic-load-hist-format + 'xref-location-marker nil '(xref-buffer-location)) + 'cl-defmethod + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-location-marker ((l xref-bogus-location)))" (xref-make-elisp-location - '(xref-location-marker xref-bogus-location) 'cl-defmethod - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (cl--generic-load-hist-format + 'xref-location-marker nil '(xref-bogus-location)) + 'cl-defmethod + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) (xref-make "(cl-defmethod xref-location-marker ((l xref-etags-location)))" (xref-make-elisp-location - '(xref-location-marker xref-etags-location) 'cl-defmethod - (expand-file-name "../../lisp/progmodes/etags.el" emacs-test-dir))) + (cl--generic-load-hist-format + 'xref-location-marker nil '(xref-etags-location)) + 'cl-defmethod + (expand-file-name "../../../lisp/progmodes/etags.el" emacs-test-dir))) )) (xref-elisp-deftest find-defs-defgeneric-eval @@ -528,7 +622,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defun xref-find-definitions)" (xref-make-elisp-location 'xref-find-definitions nil - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))))) + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))))) (xref-elisp-deftest find-defs-defun-eval (elisp--xref-find-definitions (eval '(defun stephe-leake-defun ()))) @@ -561,7 +655,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defun abbrev-mode)" (xref-make-elisp-location 'abbrev-mode nil - (expand-file-name "../../lisp/abbrev.el" emacs-test-dir))) + (expand-file-name "../../../lisp/abbrev.el" emacs-test-dir))) "(define-minor-mode abbrev-mode")) ) @@ -582,7 +676,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defun compilation-minor-mode)" (xref-make-elisp-location 'compilation-minor-mode nil - (expand-file-name "../../lisp/progmodes/compile.el" emacs-test-dir))) + (expand-file-name "../../../lisp/progmodes/compile.el" emacs-test-dir))) "(define-minor-mode compilation-minor-mode") )) @@ -592,7 +686,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defvar xref--marker-ring)" (xref-make-elisp-location 'xref--marker-ring 'defvar - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) )) (xref-elisp-deftest find-defs-defvar-c @@ -615,11 +709,11 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(defvar font-lock-keyword-face)" (xref-make-elisp-location 'font-lock-keyword-face 'defvar - (expand-file-name "../../lisp/font-lock.el" emacs-test-dir))) + (expand-file-name "../../../lisp/font-lock.el" emacs-test-dir))) (xref-make "(defface font-lock-keyword-face)" (xref-make-elisp-location 'font-lock-keyword-face 'defface - (expand-file-name "../../lisp/font-lock.el" emacs-test-dir))) + (expand-file-name "../../../lisp/font-lock.el" emacs-test-dir))) )) (xref-elisp-deftest find-defs-face-eval @@ -633,7 +727,7 @@ to (xref-elisp-test-descr-to-target xref)." (xref-make "(feature xref)" (xref-make-elisp-location 'xref 'feature - (expand-file-name "../../lisp/progmodes/xref.el" emacs-test-dir))) + (expand-file-name "../../../lisp/progmodes/xref.el" emacs-test-dir))) ";;; Code:") )) @@ -641,5 +735,11 @@ to (xref-elisp-test-descr-to-target xref)." (elisp--xref-find-definitions (eval '(provide 'stephe-leake-feature))) nil) +(ert-deftest elisp--preceding-sexp--char-name () + (with-temp-buffer + (emacs-lisp-mode) + (insert "?\\N{HEAVY CHECK MARK}") + (should (equal (elisp--preceding-sexp) ?\N{HEAVY CHECK MARK})))) + (provide 'elisp-mode-tests) ;;; elisp-mode-tests.el ends here diff --git a/test/lisp/progmodes/etags-tests.el b/test/lisp/progmodes/etags-tests.el new file mode 100644 index 00000000000..eec8a02f1b1 --- /dev/null +++ b/test/lisp/progmodes/etags-tests.el @@ -0,0 +1,91 @@ +;;; etags-tests.el --- Test suite for etags.el. + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii <eliz@gnu.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'etags) + +(defvar his-masters-voice t) + +(defun y-or-n-p (_prompt) + "Replacement for `y-or-n-p' that returns what we tell it to." + his-masters-voice) + +(ert-deftest etags-bug-158 () + "Test finding tags with local and global tags tables." + (let ((buf-with-global-tags (get-buffer-create "*buf-global*")) + (buf-with-local-tags (get-buffer-create "*buf-local*")) + xref-buf) + (set-buffer buf-with-global-tags) + (setq default-directory (expand-file-name ".")) + (visit-tags-table + (expand-file-name "manual/etags/ETAGS.good_1" + (getenv "EMACS_TEST_DIRECTORY"))) + ;; Check that tags in ETAGS.good_1 are recognized. + (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) + (should (bufferp xref-buf)) + (kill-buffer xref-buf) + (setq xref-buf (xref-find-definitions "PrintAdd")) + (should (bufferp xref-buf)) + (kill-buffer xref-buf) + ;; Check that tags not in ETAGS.good_1, but in ETAGS.good_3, are + ;; NOT recognized. + (should-error (xref-find-definitions "intNumber") :type 'user-error) + (kill-buffer xref-buf) + (set-buffer buf-with-local-tags) + (setq default-directory (expand-file-name ".")) + (let (his-masters-voice) + (visit-tags-table + (expand-file-name "manual/etags/ETAGS.good_3" + (getenv "EMACS_TEST_DIRECTORY")) + t)) + ;; Check that tags in ETAGS.good_1 are recognized. + (setq xref-buf (xref-find-definitions "LL_Task_Procedure_Access/t")) + (should (bufferp xref-buf)) + (kill-buffer xref-buf) + (setq xref-buf (xref-find-definitions "PrintAdd")) + (should (bufferp xref-buf)) + (kill-buffer xref-buf) + ;; Check that tags in ETAGS.good_3 are recognized. This is a test + ;; for bug#158. + (setq xref-buf (xref-find-definitions "intNumber")) + (should (or (null xref-buf) + (bufferp xref-buf))) + ;; Bug #17326 + (should (string= (file-name-nondirectory + (buffer-local-value 'tags-file-name buf-with-local-tags)) + "ETAGS.good_3")) + (should (string= (file-name-nondirectory + (default-value 'tags-file-name)) + "ETAGS.good_1")) + (if (bufferp xref-buf) (kill-buffer xref-buf)))) + +(ert-deftest etags-bug-23164 () + "Test that setting a local value of tags table doesn't signal errors." + (set-buffer (get-buffer-create "*foobar*")) + (fundamental-mode) + (visit-tags-table + (expand-file-name "manual/etags/ETAGS.good_3" + (getenv "EMACS_TEST_DIRECTORY")) + t) + (should (equal (should-error (xref-find-definitions "foobar123")) + '(user-error "No definitions found for: foobar123")))) diff --git a/test/automated/f90.el b/test/lisp/progmodes/f90-tests.el index cda39eda376..533a67149e7 100644 --- a/test/automated/f90.el +++ b/test/lisp/progmodes/f90-tests.el @@ -1,4 +1,4 @@ -;;; f90.el --- tests for progmodes/f90.el +;;; f90-tests.el --- tests for progmodes/f90.el ;; Copyright (C) 2011-2017 Free Software Foundation, Inc. @@ -273,4 +273,4 @@ end program prog") (forward-line -2) (should (= 2 (current-indentation))))) ; class is -;;; f90.el ends here +;;; f90-tests.el ends here diff --git a/test/automated/data/flymake/Makefile b/test/lisp/progmodes/flymake-resources/Makefile index 0f3f39791c8..0f3f39791c8 100644 --- a/test/automated/data/flymake/Makefile +++ b/test/lisp/progmodes/flymake-resources/Makefile diff --git a/test/automated/data/flymake/test.c b/test/lisp/progmodes/flymake-resources/test.c index 3a3926131f5..3a3926131f5 100644 --- a/test/automated/data/flymake/test.c +++ b/test/lisp/progmodes/flymake-resources/test.c diff --git a/test/automated/data/flymake/test.pl b/test/lisp/progmodes/flymake-resources/test.pl index d5abcb47e7f..d5abcb47e7f 100644 --- a/test/automated/data/flymake/test.pl +++ b/test/lisp/progmodes/flymake-resources/test.pl diff --git a/test/automated/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index a5a72f3c30e..9bf6e7aa178 100644 --- a/test/automated/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el @@ -26,7 +26,7 @@ (require 'flymake) (defvar flymake-tests-data-directory - (expand-file-name "data/flymake" (getenv "EMACS_TEST_DIRECTORY")) + (expand-file-name "lisp/progmodes/flymake-resources" (getenv "EMACS_TEST_DIRECTORY")) "Directory containing flymake test data.") diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el new file mode 100644 index 00000000000..8e1bac10cd1 --- /dev/null +++ b/test/lisp/progmodes/js-tests.el @@ -0,0 +1,182 @@ +;;; js-tests.el --- Test suite for js-mode + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) +(require 'js) +(require 'syntax) + +(ert-deftest js-mode-fill-bug-19399 () + (with-temp-buffer + (insert "/") + (save-excursion (insert "/ comment")) + (js-mode) + (fill-paragraph) + (should (equal (buffer-substring (point-min) (point-max)) + "// comment")))) + +(ert-deftest js-mode-fill-bug-22431 () + (with-temp-buffer + (insert "/**\n") + (insert " * Load the inspector's shared head.js for use by tests that ") + (insert "need to open the something or other") + (js-mode) + ;; This fails with auto-fill but not fill-paragraph. + (do-auto-fill) + (should (equal (buffer-substring (point-min) (point-max)) + "/** + * Load the inspector's shared head.js for use by tests that need to + * open the something or other")))) + +(ert-deftest js-mode-fill-bug-22431-fill-paragraph-at-start () + (with-temp-buffer + (insert "/**\n") + (insert " * Load the inspector's shared head.js for use by tests that ") + (insert "need to open the something or other") + (js-mode) + (goto-char (point-min)) + (fill-paragraph) + (should (equal (buffer-substring (point-min) (point-max)) + "/** + * Load the inspector's shared head.js for use by tests that need to + * open the something or other")))) + +(ert-deftest js-mode-regexp-syntax () + (with-temp-buffer + ;; Normally indentation tests are done in manual/indent, but in + ;; this case we are specifically testing a case where the bug + ;; caused the indenter not to do anything, and manual/indent can + ;; only be used for already-correct files. + (insert "function f(start, value) { +if (start - 1 === 0 || /[ (:,='\"]/.test(value)) { +--start; +} +if (start - 1 === 0 && /[ (:,='\"]/.test(value)) { +--start; +} +if (!/[ (:,='\"]/.test(value)) { +--start; +} +} +") + (js-mode) + (indent-region (point-min) (point-max)) + (goto-char (point-min)) + (dolist (x '(0 4 8 4 4 8 4 4 8 4 0)) + (back-to-indentation) + (should (= (current-column) x)) + (forward-line)))) + +(ert-deftest js-mode-auto-fill () + (with-temp-buffer + (js-mode) + (let ((fill-column 10) + (comment-multi-line t)) + (insert "/* test test") + (do-auto-fill) + ;; Filling should continue the multi line comment. + (should (equal (buffer-string) "/* test\n * test")) + (erase-buffer) + (insert "/* test test") + (setq comment-multi-line nil) + (do-auto-fill) + ;; Filling should start a new comment on the next line. + (should (equal (buffer-string) "/* test */\n/* test"))))) + +(ert-deftest js-mode-regexp-syntax-bug-25529 () + (dolist (regexp-contents '("[^[]" + "[/]" + ;; A comment with the regexp on the next + ;; line. + "*comment*/\n/regexp")) + (with-temp-buffer + (js-mode) + (insert "let x = /" regexp-contents "/;\n") + (save-excursion (insert "something();\n")) + ;; The failure mode was that the regexp literal was not + ;; recognized, causing the next line to be given string syntax; + ;; but check for comment syntax as well to prevent an + ;; implementation not recognizing the comment example. + (should-not (syntax-ppss-context (syntax-ppss)))))) + +(ert-deftest js-mode-indentation-error () + (with-temp-buffer + (js-mode) + ;; The bug previously was that requesting re-indentation on the + ;; "{" line here threw an exception. + (insert "const TESTS = [\n{") + (js-indent-line) + ;; Any success is ok here. + (should t))) + +(ert-deftest js-mode-doc-comment-face () + (dolist (test '(("/*" "*/" font-lock-comment-face) + ("//" "\n" font-lock-comment-face) + ("/**" "*/" font-lock-doc-face) + ("\"" "\"" font-lock-string-face))) + (with-temp-buffer + (js-mode) + (insert (car test) " he") + (save-excursion (insert "llo " (cadr test))) + (font-lock-ensure) + (should (eq (get-text-property (point) 'face) (caddr test)))))) + +(ert-deftest js-mode-propertize-bug-1 () + (with-temp-buffer + (js-mode) + (save-excursion (insert "x")) + (insert "/") + ;; The bug was a hang. + (should t))) + +(ert-deftest js-mode-propertize-bug-2 () + (with-temp-buffer + (js-mode) + (insert "function f() { + function g() + { + 1 / 2; + } + + function h() { +") + (save-excursion + (insert " + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00000000000000000000000000000000000000000000000000; + 00; + } +} +")) + (insert "/") + ;; The bug was a hang. + (should t))) + +(provide 'js-tests) + +;;; js-tests.el ends here diff --git a/test/automated/python-tests.el b/test/lisp/progmodes/python-tests.el index 94c356b589e..f76ecbbd3d4 100644 --- a/test/automated/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -654,8 +654,8 @@ async for a in sequencer(): "The most common case." (python-tests-with-temp-buffer " -from foo.bar.baz import something, something_1 \\\\ - something_2 something_3, \\\\ +from foo.bar.baz import something, something_1 \\ + something_2 something_3, \\ something_4, something_5 " (python-tests-look-at "from foo.bar.baz import something, something_1") @@ -675,14 +675,14 @@ from foo.bar.baz import something, something_1 \\\\ "A pretty extreme complicated case." (python-tests-with-temp-buffer " -objects = Thing.objects.all() \\\\ +objects = Thing.objects.all() \\ .filter( type='toy', status='bought' - ) \\\\ + ) \\ .aggregate( Sum('amount') - ) \\\\ + ) \\ .values_list() " (python-tests-look-at "objects = Thing.objects.all()") @@ -698,7 +698,7 @@ objects = Thing.objects.all() \\\\ (python-tests-look-at "status='bought'") (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 27)) - (python-tests-look-at ") \\\\") + (python-tests-look-at ") \\") (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) (should (= (python-indent-calculate-indentation) 23)) (python-tests-look-at ".aggregate(") @@ -708,7 +708,7 @@ objects = Thing.objects.all() \\\\ (python-tests-look-at "Sum('amount')") (should (eq (car (python-indent-context)) :inside-paren-newline-start)) (should (= (python-indent-calculate-indentation) 27)) - (python-tests-look-at ") \\\\") + (python-tests-look-at ") \\") (should (eq (car (python-indent-context)) :inside-paren-at-closing-paren)) (should (= (python-indent-calculate-indentation) 23)) (python-tests-look-at ".values_list()") @@ -723,12 +723,12 @@ objects = Thing.objects.all() \\\\ "Backslash continuation from block start." (python-tests-with-temp-buffer " -with open('/path/to/some/file/you/want/to/read') as file_1, \\\\ +with open('/path/to/some/file/you/want/to/read') as file_1, \\ open('/path/to/some/file/being/written', 'w') as file_2: file_2.write(file_1.read()) " (python-tests-look-at - "with open('/path/to/some/file/you/want/to/read') as file_1, \\\\") + "with open('/path/to/some/file/you/want/to/read') as file_1, \\") (should (eq (car (python-indent-context)) :no-indent)) (should (= (python-indent-calculate-indentation) 0)) (python-tests-look-at @@ -744,35 +744,35 @@ with open('/path/to/some/file/you/want/to/read') as file_1, \\\\ "Backslash continuation from assignment." (python-tests-with-temp-buffer " -super_awful_assignment = some_calculation() and \\\\ - another_calculation() and \\\\ - some_final_calculation() +super_awful_assignment = some_calculation() and \\ + another_calculation() and \\ + some_final_calculation() " (python-tests-look-at - "super_awful_assignment = some_calculation() and \\\\") + "super_awful_assignment = some_calculation() and \\") (should (eq (car (python-indent-context)) :no-indent)) (should (= (python-indent-calculate-indentation) 0)) - (python-tests-look-at "another_calculation() and \\\\") + (python-tests-look-at "another_calculation() and \\") (should (eq (car (python-indent-context)) :after-backslash-assignment-continuation)) - (should (= (python-indent-calculate-indentation) 25)) + (should (= (python-indent-calculate-indentation) python-indent-offset)) (python-tests-look-at "some_final_calculation()") (should (eq (car (python-indent-context)) :after-backslash)) - (should (= (python-indent-calculate-indentation) 25)))) + (should (= (python-indent-calculate-indentation) python-indent-offset)))) (ert-deftest python-indent-after-backslash-5 () "Dotted continuation bizarre example." (python-tests-with-temp-buffer " def delete_all_things(): - Thing \\\\ - .objects.all() \\\\ + Thing \\ + .objects.all() \\ .delete() " - (python-tests-look-at "Thing \\\\") + (python-tests-look-at "Thing \\") (should (eq (car (python-indent-context)) :after-block-start)) (should (= (python-indent-calculate-indentation) 4)) - (python-tests-look-at ".objects.all() \\\\") + (python-tests-look-at ".objects.all() \\") (should (eq (car (python-indent-context)) :after-backslash-first-line)) (should (= (python-indent-calculate-indentation) 8)) (python-tests-look-at ".delete()") @@ -1156,6 +1156,27 @@ if do: (python-tests-look-at "that)") (should (= (current-indentation) 6)))) +(ert-deftest python-indent-electric-colon-4 () + "Test indentation case where there is one more-indented previous open block." + (python-tests-with-temp-buffer + " +def f(): + if True: + a = 5 + + if True: + a = 10 + + b = 3 + +else +" + (python-tests-look-at "else") + (goto-char (line-end-position)) + (python-tests-self-insert ":") + (python-tests-look-at "else" -1) + (should (= (current-indentation) 4)))) + (ert-deftest python-indent-region-1 () "Test indentation case from Bug#18843." (let ((contents " @@ -1296,7 +1317,8 @@ class B: class C: '''docstring''' " - (let ((expected-mark-beginning-position + (let ((transient-mark-mode t) + (expected-mark-beginning-position (progn (python-tests-look-at "class A:") (1- (point)))) @@ -1352,7 +1374,8 @@ class B: class C: '''docstring''' " - (let ((expected-mark-beginning-position + (let ((transient-mark-mode t) + (expected-mark-beginning-position (progn (python-tests-look-at "def __init__(self):") (1- (line-beginning-position)))) @@ -1851,8 +1874,8 @@ class A(object): (ert-deftest python-nav-beginning-of-statement-1 () (python-tests-with-temp-buffer " -v1 = 123 + \ - 456 + \ +v1 = 123 + \\ + 456 + \\ 789 v2 = (value1, value2, @@ -1899,8 +1922,8 @@ string (ert-deftest python-nav-end-of-statement-1 () (python-tests-with-temp-buffer " -v1 = 123 + \ - 456 + \ +v1 = 123 + \\ + 456 + \\ 789 v2 = (value1, value2, @@ -1953,8 +1976,8 @@ string (ert-deftest python-nav-forward-statement-1 () (python-tests-with-temp-buffer " -v1 = 123 + \ - 456 + \ +v1 = 123 + \\ + 456 + \\ 789 v2 = (value1, value2, @@ -1994,8 +2017,8 @@ string (ert-deftest python-nav-backward-statement-1 () (python-tests-with-temp-buffer " -v1 = 123 + \ - 456 + \ +v1 = 123 + \\ + 456 + \\ 789 v2 = (value1, value2, @@ -2036,8 +2059,8 @@ string :expected-result :failed (python-tests-with-temp-buffer " -v1 = 123 + \ - 456 + \ +v1 = 123 + \\ + 456 + \\ 789 v2 = (value1, value2, @@ -2457,7 +2480,7 @@ if x: (python-tests-with-temp-buffer " \"\n" (goto-char (point-min)) - (font-lock-fontify-buffer))) + (call-interactively 'font-lock-fontify-buffer))) ;;; Shell integration @@ -2591,7 +2614,7 @@ Using `python-shell-interpreter' and "Test no side-effects on `process-environment'." (let* ((python-shell-process-environment '("TESTVAR1=value1" "TESTVAR2=value2")) - (python-shell-virtualenv-root "/env") + (python-shell-virtualenv-root (or (getenv "VIRTUAL_ENV") "/env")) (python-shell-unbuffered t) (python-shell-extra-pythonpaths'("/path1" "/path2")) (original-process-environment (copy-sequence process-environment))) @@ -3559,6 +3582,9 @@ class Baz(object): def c(self): pass + + async def d(self): + pass " (goto-char (point-max)) (should (equal @@ -3580,7 +3606,8 @@ class Baz(object): (list "Frob (class)" (cons "*class definition*" (copy-marker 601)) - (cons "c (def)" (copy-marker 626))))) + (cons "c (def)" (copy-marker 626)) + (cons "d (async def)" (copy-marker 665))))) (python-imenu-create-index))))) (ert-deftest python-imenu-create-index-2 () @@ -3702,6 +3729,9 @@ class Baz(object): def c(self): pass + + async def d(self): + pass " (goto-char (point-max)) (should (equal @@ -3714,7 +3744,8 @@ class Baz(object): (cons "Baz.a" (copy-marker 539)) (cons "Baz.b" (copy-marker 570)) (cons "Baz.Frob" (copy-marker 601)) - (cons "Baz.Frob.c" (copy-marker 626))) + (cons "Baz.Frob.c" (copy-marker 626)) + (cons "Baz.Frob.d" (copy-marker 665))) (python-imenu-create-flat-index))))) (ert-deftest python-imenu-create-flat-index-2 () @@ -3923,8 +3954,8 @@ def long_function_name( (ert-deftest python-info-statement-starts-block-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError('sorry, you lose') " @@ -3948,8 +3979,8 @@ def long_function_name( (ert-deftest python-info-statement-ends-block-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -3979,8 +4010,8 @@ def long_function_name( (ert-deftest python-info-beginning-of-statement-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4019,8 +4050,8 @@ def long_function_name( (ert-deftest python-info-end-of-statement-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4060,8 +4091,8 @@ def long_function_name( (ert-deftest python-info-beginning-of-block-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4098,8 +4129,8 @@ def long_function_name( (ert-deftest python-info-end-of-block-p-2 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4606,14 +4637,14 @@ elif b: (ert-deftest python-info-line-ends-backslash-p-1 () (python-tests-with-temp-buffer " -objects = Thing.objects.all() \\\\ +objects = Thing.objects.all() \\ .filter( type='toy', status='bought' - ) \\\\ + ) \\ .aggregate( Sum('amount') - ) \\\\ + ) \\ .values_list() " (should (python-info-line-ends-backslash-p 2)) ; .filter(... @@ -4629,14 +4660,14 @@ objects = Thing.objects.all() \\\\ (ert-deftest python-info-beginning-of-backslash-1 () (python-tests-with-temp-buffer " -objects = Thing.objects.all() \\\\ +objects = Thing.objects.all() \\ .filter( type='toy', status='bought' - ) \\\\ + ) \\ .aggregate( Sum('amount') - ) \\\\ + ) \\ .values_list() " (let ((first 2) @@ -4655,8 +4686,8 @@ objects = Thing.objects.all() \\\\ (ert-deftest python-info-continuation-line-p-1 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4683,8 +4714,8 @@ if width == 0 and height == 0 and \\\\ (ert-deftest python-info-block-continuation-line-p-1 () (python-tests-with-temp-buffer " -if width == 0 and height == 0 and \\\\ - color == 'red' and emphasis == 'strong' or \\\\ +if width == 0 and height == 0 and \\ + color == 'red' and emphasis == 'strong' or \\ highlight > 100: raise ValueError( 'sorry, you lose' @@ -4718,8 +4749,8 @@ def foo(a, (ert-deftest python-info-assignment-statement-p-1 () (python-tests-with-temp-buffer " -data = foo(), bar() \\\\ - baz(), 4 \\\\ +data = foo(), bar() \\ + baz(), 4 \\ 5, 6 " (python-tests-look-at "data = foo(), bar()") @@ -4761,8 +4792,8 @@ data '=' 42 (ert-deftest python-info-assignment-continuation-line-p-1 () (python-tests-with-temp-buffer " -data = foo(), bar() \\\\ - baz(), 4 \\\\ +data = foo(), bar() \\ + baz(), 4 \\ 5, 6 " (python-tests-look-at "data = foo(), bar()") @@ -5285,6 +5316,25 @@ class SomeClass: (or enabled (hs-minor-mode -1))))) +(ert-deftest python-tests--python-nav-end-of-statement--infloop () + "Checks that `python-nav-end-of-statement' doesn't infloop in a +buffer with overlapping strings." + (python-tests-with-temp-buffer "''' '\n''' ' '\n" + (syntax-propertize (point-max)) + ;; Create a situation where strings nominally overlap. This + ;; shouldn't happen in practice, but apparently it can happen when + ;; a package calls `syntax-ppss' in a narrowed buffer during JIT + ;; lock. + (put-text-property 4 5 'syntax-table (string-to-syntax "|")) + (remove-text-properties 8 9 '(syntax-table nil)) + (goto-char 4) + (setq-local syntax-propertize-function nil) + ;; The next form should not infloop. We have to disable + ;; ‘debug-on-error’ so that ‘cl-assert’ doesn’t call the debugger. + (should-error (let ((debug-on-error nil)) + (python-nav-end-of-statement))) + (should (eolp)))) + (provide 'python-tests) diff --git a/test/automated/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index b4b0b024131..f04483f6d7c 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el @@ -716,6 +716,17 @@ VALUES-PLIST is a list with alternating index and value elements." (ruby-backward-sexp) (should (= 2 (line-number-at-pos))))) +(ert-deftest ruby-toggle-string-quotes-quotes-correctly () + (let ((pairs + '(("puts '\"foo\"\\''" . "puts \"\\\"foo\\\"'\"") + ("puts \"'foo'\\\"\"" . "puts '\\'foo\\'\"'")))) + (dolist (pair pairs) + (ruby-with-temp-buffer (car pair) + (beginning-of-line) + (search-forward "foo") + (ruby-toggle-string-quotes) + (should (string= (buffer-string) (cdr pair))))))) + (ert-deftest ruby--insert-coding-comment-ruby-style () (with-temp-buffer (let ((ruby-encoding-magic-comment-style 'ruby)) diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el new file mode 100644 index 00000000000..27a72aa2c23 --- /dev/null +++ b/test/lisp/progmodes/sql-tests.el @@ -0,0 +1,47 @@ +;;; sql-tests.el --- Tests for sql.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl <simenheg@gmail.com> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'cl-lib) +(require 'ert) +(require 'sql) + +(ert-deftest sql-tests-postgres-list-databases () + "Test that output from `psql -ltX' is parsed correctly." + (cl-letf + (((symbol-function 'executable-find) + (lambda (_command) t)) + ((symbol-function 'process-lines) + (lambda (_program &rest _args) + '(" db-name-1 | foo-user | UTF8 | en_US.UTF-8 | en_US.UTF-8 | " + " db_name_2 | foo-user | UTF8 | en_US.UTF-8 | en_US.UTF-8 | " + "")))) + (should (equal (sql-postgres-list-databases) + '("db-name-1" "db_name_2"))))) + +(provide 'sql-tests) +;;; sql-tests.el ends here diff --git a/test/automated/subword-tests.el b/test/lisp/progmodes/subword-tests.el index 39512efdbe1..39512efdbe1 100644 --- a/test/automated/subword-tests.el +++ b/test/lisp/progmodes/subword-tests.el diff --git a/test/automated/xref-tests.el b/test/lisp/progmodes/xref-tests.el index 1ff15e114e4..b7f0f0526c6 100644 --- a/test/automated/xref-tests.el +++ b/test/lisp/progmodes/xref-tests.el @@ -28,7 +28,7 @@ (defvar xref-tests-data-dir (expand-file-name "data/xref/" - (file-name-directory (or load-file-name (buffer-file-name))))) + (getenv "EMACS_TEST_DIRECTORY"))) (ert-deftest xref-collect-matches-finds-none-for-some-regexp () (should (null (xref-collect-matches "zzz" "*" xref-tests-data-dir nil)))) diff --git a/test/automated/replace-tests.el b/test/lisp/ps-print-tests.el index a8a52864508..e1df37b645d 100644 --- a/test/automated/replace-tests.el +++ b/test/lisp/ps-print-tests.el @@ -1,7 +1,9 @@ -;;; replace-tests.el --- tests for replace.el. +;;; ps-print-tests.el --- Test suite for ps-print.el -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2017 Free Software Foundation, Inc. +;; Author: Phillip Lord <phillip.lord@russet.org.uk> + ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify @@ -17,19 +19,18 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. -;;; Code: +;;; Commentary: +;;; Code: +(require 'ps-print) (require 'ert) -(ert-deftest query-replace--split-string-tests () - (let ((sep (propertize "\0" 'separator t))) - (dolist (before '("" "b")) - (dolist (after '("" "a")) - (should (equal - (query-replace--split-string (concat before sep after)) - (cons before after))) - (should (equal - (query-replace--split-string (concat before "\0" after)) - (concat before "\0" after))))))) - -;;; replace-tests.el ends here +;;; Autoload tests +(ert-deftest ps-mule-autoload () + "Tests to see whether ps-mule has been autoloaded" + (should + (fboundp 'ps-mule-initialize)) + (should + (autoloadp + (symbol-function + 'ps-mule-initialize)))) diff --git a/test/automated/occur-tests.el b/test/lisp/replace-tests.el index a250675b31b..adef5a3f3dc 100644 --- a/test/automated/occur-tests.el +++ b/test/lisp/replace-tests.el @@ -1,9 +1,9 @@ -;;; occur-tests.el --- Test suite for occur. +;;; replace-tests.el --- tests for replace.el. ;; Copyright (C) 2010-2017 Free Software Foundation, Inc. +;; Author: Nicolas Richard <youngfrog@members.fsf.org> ;; Author: Juri Linkov <juri@jurta.org> -;; Keywords: matching, internal ;; This file is part of GNU Emacs. @@ -24,7 +24,18 @@ (require 'ert) -(defconst occur-tests +(ert-deftest query-replace--split-string-tests () + (let ((sep (propertize "\0" 'separator t))) + (dolist (before '("" "b")) + (dolist (after '("" "a")) + (should (equal + (query-replace--split-string (concat before sep after)) + (cons before after))) + (should (equal + (query-replace--split-string (concat before "\0" after)) + (concat before "\0" after))))))) + +(defconst replace-occur-tests '( ;; * Test one-line matches (at bob, eob, bol, eol). ("x" 0 "\ @@ -317,7 +328,7 @@ h Each element has the format: \(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).") -(defun occur-test-case (test) +(defun replace-occur-test-case (test) (let ((regexp (nth 0 test)) (nlines (nth 1 test)) (input-buffer-string (nth 2 test)) @@ -333,20 +344,18 @@ Each element has the format: (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) -(defun occur-test-create (n) - "Create a test for element N of the `occur-tests' constant." +(defun replace-occur-test-create (n) + "Create a test for element N of the `replace-occur-tests' constant." (let ((testname (intern (format "occur-test-%.2d" n))) - (testdoc (format "Test element %d of `occur-tests'." n))) + (testdoc (format "Test element %d of `replace-occur-tests'." n))) (eval `(ert-deftest ,testname () ,testdoc - (let (occur-hook) - (should (equal (occur-test-case (nth ,n occur-tests)) - (nth 3 (nth ,n occur-tests))))))))) - -(dotimes (i (length occur-tests)) - (occur-test-create i)) + (let (replace-occur-hook) + (should (equal (replace-occur-test-case (nth ,n replace-occur-tests)) + (nth 3 (nth ,n replace-occur-tests))))))))) -(provide 'occur-tests) +(dotimes (i (length replace-occur-tests)) + (replace-occur-test-create i)) -;;; occur-tests.el ends here +;;; replace-tests.el ends here diff --git a/test/lisp/rot13-tests.el b/test/lisp/rot13-tests.el new file mode 100644 index 00000000000..70fe34510dd --- /dev/null +++ b/test/lisp/rot13-tests.el @@ -0,0 +1,54 @@ +;;; rot13-tests.el --- Tests for rot13.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl <simenheg@gmail.com> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'rot13) + +(ert-deftest rot13-tests-rot13 () + (should (equal (rot13 "Super-secret text") "Fhcre-frperg grkg")) + (with-temp-buffer + (insert "Super-secret text") + (rot13 (current-buffer) (point-min) (point-max)) + (should (equal (buffer-string) "Fhcre-frperg grkg")) + (rot13 (current-buffer) (point-min) (+ (point-min) 5)) + (should (equal (buffer-string) "Super-frperg grkg")))) + +(ert-deftest rot13-tests-rot13-string () + (should (equal (rot13-string "") "")) + (should (equal (rot13-string (rot13-string "foo")) "foo")) + (should (equal (rot13-string "Super-secret text") + "Fhcre-frperg grkg"))) + +(ert-deftest rot13-tests-rot13-region () + (with-temp-buffer + (insert "Super-secret text") + (rot13-region (+ (point-min) 6) (+ (point-min) 12)) + (should (equal (buffer-string) "Super-frperg text")))) + +(provide 'rot13-tests) +;;; rot13-tests.el ends here diff --git a/test/automated/cl-seq-tests.el b/test/lisp/shell-tests.el index d89bad9bfb4..6eb9cdcdd18 100644 --- a/test/automated/cl-seq-tests.el +++ b/test/lisp/shell-tests.el @@ -1,8 +1,6 @@ -;;; cl-seq-tests.el --- Tests for cl-seq.el functionality -*- lexical-binding: t; -*- +;;; shell-tests.el -*- lexical-binding:t -*- -;; Copyright (C) 2015-2017 Free Software Foundation, Inc. - -;; Author: Nicolas Richard <youngfrog@members.fsf.org> +;; Copyright (C) 2010-2017 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -21,22 +19,15 @@ ;;; Commentary: +;; Tests for comint and related modes. + ;;; Code: +(require 'shell) (require 'ert) -(require 'cl-seq) - -(ert-deftest cl-union-test-00 () - (let ((str1 "foo") - (str2 (make-string 3 ?o))) - ;; Emacs may make two string literals eql when reading. - (aset str2 0 ?f) - (should (not (eql str1 str2))) - (should (equal str1 str2)) - (should (equal (cl-union (list str1) (list str2)) - (list str2))) - (should (equal (cl-union (list str1) (list str2) :test 'eql) - (list str1 str2))))) - -(provide 'cl-seq-tests) -;;; cl-seq-tests.el ends here + +(ert-deftest shell-tests-unquote-1 () + "Test problem found by Filipp Gunbin in emacs-devel." + (should (equal (car (shell--unquote&requote-argument "te'st" 2)) "test"))) + +;;; shell-tests.el ends here diff --git a/test/automated/simple-test.el b/test/lisp/simple-tests.el index a3de0b003aa..180dcc0a209 100644 --- a/test/automated/simple-test.el +++ b/test/lisp/simple-tests.el @@ -20,6 +20,7 @@ ;;; Code: (require 'ert) +(eval-when-compile (require 'cl-lib)) (defmacro simple-test--dummy-buffer (&rest body) (declare (indent 0) @@ -30,10 +31,13 @@ (insert "(a b") (save-excursion (insert " c d)")) ,@body - (cons (buffer-substring (point-min) (point)) - (buffer-substring (point) (point-max))))) + (with-no-warnings + (cons (buffer-substring (point-min) (point)) + (buffer-substring (point) (point-max)))))) + +;;; `transpose-sexps' (defmacro simple-test--transpositions (&rest body) (declare (indent 0) (debug t)) @@ -45,6 +49,13 @@ (cons (buffer-substring (point-min) (point)) (buffer-substring (point) (point-max))))) +;;; Transposition with negative args (bug#20698, bug#21885) +(ert-deftest simple-transpose-subr () + (should (equal (simple-test--transpositions (transpose-sexps -1)) + '("(s1) (s2) (s4)" . " (s3) (s5)"))) + (should (equal (simple-test--transpositions (transpose-sexps -2)) + '("(s1) (s4)" . " (s2) (s3) (s5)")))) + ;;; `newline' (ert-deftest newline () @@ -204,7 +215,7 @@ ;;; `delete-trailing-whitespace' -(ert-deftest simple-delete-trailing-whitespace () +(ert-deftest simple-delete-trailing-whitespace--bug-21766 () "Test bug#21766: delete-whitespace sometimes deletes non-whitespace." (defvar python-indent-guess-indent-offset) ; to avoid a warning (let ((python (featurep 'python)) @@ -219,13 +230,27 @@ "\n" "\n")) (delete-trailing-whitespace) - (should (equal (count-lines (point-min) (point-max)) 3))) + (should (string-equal (buffer-string) + (concat "query = \"\"\"WITH filtered AS\n" + "WHERE\n" + "\"\"\".format(fv_)\n")))) ;; Let's clean up if running interactive (unless (or noninteractive python) (unload-feature 'python))))) +(ert-deftest simple-delete-trailing-whitespace--formfeeds () + "Test formfeeds are not deleted but whitespace past them is." + (with-temp-buffer + (with-syntax-table (make-syntax-table) + (modify-syntax-entry ?\f " ") ; Make sure \f is whitespace + (insert " \f \n \f \f \n\nlast\n") + (delete-trailing-whitespace) + (should (string-equal (buffer-string) " \f\n \f \f\n\nlast\n")) + (should (equal ?\s (char-syntax ?\f))) + (should (equal ?\s (char-syntax ?\n)))))) -;;; auto-boundary tests + +;;; undo auto-boundary tests (ert-deftest undo-auto-boundary-timer () (should undo-auto-current-boundary-timer)) @@ -252,17 +277,8 @@ (with-temp-buffer (setq buffer-undo-list nil) (insert "hello") - (car buffer-undo-list) (undo-auto--boundaries 'test)))) -;;; Transposition with negative args (bug#20698, bug#21885) -(ert-deftest simple-transpose-subr () - (should (equal (simple-test--transpositions (transpose-sexps -1)) - '("(s1) (s2) (s4)" . " (s3) (s5)"))) - (should (equal (simple-test--transpositions (transpose-sexps -2)) - '("(s1) (s4)" . " (s2) (s3) (s5)")))) - - ;; Test for a regression introduced by undo-auto--boundaries changes. ;; https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01652.html (defun undo-test-kill-c-a-then-undo () @@ -360,5 +376,77 @@ See Bug#21722." (undo) (point))))) + +;;; `eval-expression' + +(ert-deftest eval-expression-print-format-sym () + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) t))) + (let ((current-prefix-arg '(4))) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "t")))))) + +(ert-deftest eval-expression-print-format-sym-echo () + ;; We can only check the echo area when running interactive. + (skip-unless (not noninteractive)) + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) t))) + (let ((current-prefix-arg nil)) + (message nil) + (call-interactively #'eval-expression) + (should (equal (current-message) "t")))))) + +(ert-deftest eval-expression-print-format-small-int () + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?A))) + (let ((current-prefix-arg '(4))) + (erase-buffer) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "65"))) + (let ((current-prefix-arg 0)) + (erase-buffer) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "65 (#o101, #x41, ?A)")))))) + +(ert-deftest eval-expression-print-format-small-int-echo () + (skip-unless (not noninteractive)) + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?A))) + (let ((current-prefix-arg nil)) + (message nil) + (call-interactively #'eval-expression) + (should (equal (current-message) "65 (#o101, #x41, ?A)")))))) + +(ert-deftest eval-expression-print-format-large-int () + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?B)) + (eval-expression-print-maximum-character ?A)) + (let ((current-prefix-arg '(4))) + (erase-buffer) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "66"))) + (let ((current-prefix-arg 0)) + (erase-buffer) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "66 (#o102, #x42)"))) + (let ((current-prefix-arg -1)) + (erase-buffer) + (call-interactively #'eval-expression) + (should (equal (buffer-string) "66 (#o102, #x42, ?B)")))))) + +(ert-deftest eval-expression-print-format-large-int-echo () + (skip-unless (not noninteractive)) + (with-temp-buffer + (cl-letf (((symbol-function 'read--expression) (lambda (&rest _) ?B)) + (eval-expression-print-maximum-character ?A)) + (let ((current-prefix-arg nil)) + (message nil) + (call-interactively #'eval-expression) + (should (equal (current-message) "66 (#o102, #x42)"))) + (let ((current-prefix-arg '-)) + (message nil) + (call-interactively #'eval-expression) + (should (equal (current-message) "66 (#o102, #x42, ?B)")))))) + (provide 'simple-test) ;;; simple-test.el ends here diff --git a/test/automated/sort-tests.el b/test/lisp/sort-tests.el index f6cbe90d5bf..f6cbe90d5bf 100644 --- a/test/automated/sort-tests.el +++ b/test/lisp/sort-tests.el diff --git a/test/automated/subr-tests.el b/test/lisp/subr-tests.el index cfbfe19b7bb..54f4ab5d1b2 100644 --- a/test/automated/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -28,6 +28,7 @@ ;;; Code: (require 'ert) +(eval-when-compile (require 'cl-lib)) (ert-deftest let-when-compile () ;; good case @@ -224,5 +225,106 @@ (error-message-string (should-error (version-to-list "beta22_8alpha3"))) "Invalid version syntax: `beta22_8alpha3' (must start with a number)")))) +(defun subr-test--backtrace-frames-with-backtrace-frame (base) + "Reference implementation of `backtrace-frames'." + (let ((idx 0) + (frame nil) + (frames nil)) + (while (setq frame (backtrace-frame idx base)) + (push frame frames) + (setq idx (1+ idx))) + (nreverse frames))) + +(defun subr-test--frames-2 (base) + (let ((_dummy nil)) + (progn ;; Add a few frames to top of stack + (unwind-protect + (cons (mapcar (pcase-lambda (`(,evald ,func ,args ,_)) + `(,evald ,func ,@args)) + (backtrace-frames base)) + (subr-test--backtrace-frames-with-backtrace-frame base)))))) + +(defun subr-test--frames-1 (base) + (subr-test--frames-2 base)) + +(ert-deftest subr-test-backtrace-simple-tests () + "Test backtrace-related functions (simple tests). +This exercises `backtrace-frame', and indirectly `mapbacktrace'." + ;; `mapbacktrace' returns nil + (should (equal (mapbacktrace #'ignore) nil)) + ;; Unbound BASE is silently ignored + (let ((unbound (make-symbol "ub"))) + (should (equal (backtrace-frame 0 unbound) nil)) + (should (equal (mapbacktrace #'error unbound) nil))) + ;; First frame is backtrace-related function + (should (equal (backtrace-frame 0) '(t backtrace-frame 0))) + (should (equal (catch 'ret + (mapbacktrace (lambda (&rest args) (throw 'ret args)))) + '(t mapbacktrace ((lambda (&rest args) (throw 'ret args))) nil))) + ;; Past-end NFRAMES is silently ignored + (should (equal (backtrace-frame most-positive-fixnum) nil))) + +(ert-deftest subr-test-backtrace-integration-test () + "Test backtrace-related functions (integration test). +This exercises `backtrace-frame', `backtrace-frames', and +indirectly `mapbacktrace'." + ;; Compare two implementations of backtrace-frames + (let ((frame-lists (subr-test--frames-1 'subr-test--frames-2))) + (should (equal (car frame-lists) (cdr frame-lists))))) + +(ert-deftest subr-tests--string-match-p--blank () + "Test that [:blank:] matches horizontal whitespace, cf. Bug#25366." + (should (equal (string-match-p "\\`[[:blank:]]\\'" " ") 0)) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\t") 0)) + (should-not (string-match-p "\\`[[:blank:]]\\'" "\n")) + (should-not (string-match-p "\\`[[:blank:]]\\'" "a")) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\N{HAIR SPACE}") 0)) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\u3000") 0)) + (should-not (string-match-p "\\`[[:blank:]]\\'" "\N{LINE SEPARATOR}"))) + +(ert-deftest subr-tests--dolist--wrong-number-of-args () + "Test that `dolist' doesn't accept wrong types or length of SPEC, +cf. Bug#25477." + (should-error (eval '(dolist (a))) + :type 'wrong-number-of-arguments) + (should-error (eval '(dolist (a () 'result 'invalid)) t) + :type 'wrong-number-of-arguments) + (should-error (eval '(dolist "foo") t) + :type 'wrong-type-argument)) + +(require 'cl-generic) +(cl-defgeneric subr-tests--generic (x)) +(cl-defmethod subr-tests--generic ((x string)) + (message "%s is a string" x)) +(cl-defmethod subr-tests--generic ((x integer)) + (message "%s is a number" x)) +(cl-defgeneric subr-tests--generic-without-methods (x y)) +(defvar subr-tests--this-file + (file-truename (or load-file-name buffer-file-name))) + +(ert-deftest subr-tests--method-files--finds-methods () + "`method-files' returns a list of files and methods for a generic function." + (let ((retval (method-files 'subr-tests--generic))) + (should (equal (length retval) 2)) + (mapc (lambda (x) + (should (equal (car x) subr-tests--this-file)) + (should (equal (cadr x) 'subr-tests--generic))) + retval) + (should-not (equal (nth 0 retval) (nth 1 retval))))) + +(ert-deftest subr-tests--method-files--nonexistent-methods () + "`method-files' returns nil if asked to find a method which doesn't exist." + (should-not (method-files 'subr-tests--undefined-generic)) + (should-not (method-files 'subr-tests--generic-without-methods))) + +(ert-deftest subr-tests-bug22027 () + "Test for http://debbugs.gnu.org/22027 ." + (let ((default "foo") res) + (cl-letf (((symbol-function 'read-string) + (lambda (_prompt _init _hist def) def))) + (setq res (read-passwd "pass: " 'confirm (mapconcat #'string default ""))) + (should (string= default res))))) + + (provide 'subr-tests) ;;; subr-tests.el ends here diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el new file mode 100644 index 00000000000..b4666ae72d7 --- /dev/null +++ b/test/lisp/textmodes/css-mode-tests.el @@ -0,0 +1,282 @@ +;;; css-mode-tests.el --- Test suite for CSS mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Simen Heggestøyl <simenheg@gmail.com> +;; Keywords: internal + +;; This file is part of GNU Emacs. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'css-mode) +(require 'ert) +(require 'seq) + +(ert-deftest css-test-property-values () + ;; The `float' property has a flat value list. + (should + (equal (seq-sort #'string-lessp (css--property-values "float")) + '("left" "none" "right"))) + + ;; The `list-style' property refers to several other properties. + (should + (equal (seq-sort #'string-lessp (css--property-values "list-style")) + (seq-sort + #'string-lessp + (seq-uniq + (append (css--property-values "list-style-type") + (css--property-values "list-style-position") + (css--property-values "list-style-image")))))) + + ;; The `position' property is tricky because it's also the name of a + ;; value class. + (should + (equal (seq-sort #'string-lessp (css--property-values "position")) + '("absolute" "fixed" "relative" "static"))) + + ;; The `background-position' property should refer to the `position' + ;; value class, not the property of the same name. + (should + (equal (css--property-values "background-position") + (css--value-class-lookup 'position))) + + ;; Check that the `color' property doesn't cause infinite recursion + ;; because it refers to the value class of the same name. + (should (= (length (css--property-values "color")) 152))) + +(ert-deftest css-test-property-value-cache () + "Test that `css--property-value-cache' is in use." + (should-not (gethash "word-wrap" css--property-value-cache)) + (let ((word-wrap-values (css--property-values "word-wrap"))) + (should (equal (gethash "word-wrap" css--property-value-cache) + word-wrap-values)))) + +(ert-deftest css-test-property-values-no-duplicates () + "Test that `css--property-values' returns no duplicates." + ;; The `flex' property is prone to duplicate values; if they aren't + ;; removed, it'll contain at least two instances of `auto'. + (should + (equal (seq-sort #'string-lessp (css--property-values "flex")) + '("auto" "calc()" "content" "none")))) + +(ert-deftest css-test-value-class-lookup () + (should + (equal (seq-sort #'string-lessp (css--value-class-lookup 'position)) + '("bottom" "calc()" "center" "left" "right" "top")))) + +;;; Completion + +(defun css-mode-tests--completions () + (let ((data (css-completion-at-point))) + (all-completions (buffer-substring (nth 0 data) (nth 1 data)) + (nth 2 data)))) + +(ert-deftest css-test-complete-bang-rule () + (with-temp-buffer + (css-mode) + (insert "body { left: 0 !") + (let ((completions (css-mode-tests--completions))) + (should (member "important" completions)) + ;; Don't include SCSS bang-rules + (should-not (member "default" completions))))) + +(ert-deftest scss-test-complete-bang-rule () + (with-temp-buffer + (scss-mode) + (insert "body { left: 0 !") + (let ((completions (css-mode-tests--completions))) + (should (member "important" completions)) + (should (member "default" completions))))) + +(ert-deftest css-test-complete-property-value () + (with-temp-buffer + (css-mode) + (insert "body { position: ") + (let ((completions (css-mode-tests--completions))) + (should + (equal (seq-sort #'string-lessp completions) + '("absolute" "fixed" "inherit" "initial" "relative" + "static" "unset")))))) + +(ert-deftest css-test-complete-pseudo-class () + (with-temp-buffer + (css-mode) + (insert "body:a") + (let ((completions (css-mode-tests--completions))) + (should (member "active" completions)) + (should-not (member "disabled" completions)) + ;; Don't include pseudo-elements + (should-not (member "after" completions))))) + +(ert-deftest css-test-complete-pseudo-element () + (with-temp-buffer + (css-mode) + (insert "body::a") + (let ((completions (css-mode-tests--completions))) + (should (member "after" completions)) + (should-not (member "disabled" completions)) + ;; Don't include pseudo-classes + (should-not (member "active" completions))))) + +(ert-deftest css-test-complete-at-rule () + (with-temp-buffer + (css-mode) + (insert "@m") + (let ((completions (css-mode-tests--completions))) + (should (member "media" completions)) + (should-not (member "keyframes" completions)) + ;; Don't include SCSS at-rules + (should-not (member "mixin" completions))))) + +(ert-deftest scss-test-complete-at-rule () + (with-temp-buffer + (scss-mode) + (insert "@m") + (let ((completions (css-mode-tests--completions))) + (should (member "media" completions)) + (should-not (member "keyframes" completions)) + (should (member "mixin" completions))))) + +(ert-deftest css-test-complete-property () + (with-temp-buffer + (css-mode) + (insert "body { f") + (let ((completions (css-mode-tests--completions))) + (should (member "filter" completions)) + (should-not (member "position" completions))))) + +(ert-deftest css-test-foreign-completions () + (let ((other-buffer-1 (generate-new-buffer "1")) + (other-buffer-2 (generate-new-buffer "2"))) + (with-current-buffer other-buffer-1 + (setq-local css-class-list-function (lambda () '("foo" "bar")))) + (with-current-buffer other-buffer-2 + (setq-local css-class-list-function (lambda () '("bar" "baz")))) + (let ((completions + (css--foreign-completions 'css-class-list-function))) + ;; Completions from `other-buffer-1' and `other-buffer-2' should + ;; be merged. + (should (equal (seq-sort #'string-lessp completions) + '("bar" "baz" "foo")))) + (kill-buffer other-buffer-1) + (kill-buffer other-buffer-2))) + +(ert-deftest css-test-complete-selector-tag () + (with-temp-buffer + (css-mode) + (insert "b") + (let ((completions (css-mode-tests--completions))) + (should (member "body" completions)) + (should-not (member "article" completions))))) + +(ert-deftest css-test-complete-selector-class () + (with-temp-buffer + (setq-local css-class-list-function (lambda () '("foo" "bar"))) + (with-temp-buffer + (css-mode) + (insert ".f") + (let ((completions (css-mode-tests--completions))) + (should (equal completions '("foo"))))))) + +(ert-deftest css-test-complete-selector-id () + (with-temp-buffer + (setq-local css-id-list-function (lambda () '("foo" "bar"))) + (with-temp-buffer + (css-mode) + (insert "#b") + (let ((completions (css-mode-tests--completions))) + (should (equal completions '("bar"))))))) + +(ert-deftest css-test-complete-nested-selector () + (with-temp-buffer + (css-mode) + (insert "body {") + (let ((completions (css-mode-tests--completions))) + (should-not (member "body" completions))))) + +(ert-deftest scss-test-complete-nested-selector () + (with-temp-buffer + (scss-mode) + (insert "body { b") + (let ((completions (css-mode-tests--completions))) + (should (member "body" completions)) + (should-not (member "article" completions))))) + +(ert-deftest css-mdn-symbol-guessing () + (dolist (item '(("@med" "ia" "@media") + ("@keyframes " "{" "@keyframes") + ("p::after" "" "::after") + ("p:before" "" ":before") + ("a:v" "isited" ":visited") + ("border-" "color: red" "border-color") + ("border-color: red" ";" "border-color") + ("border-color: red; color: green" ";" "color") + (" border-collapse " ": collapse;" "border-collapse"))) + (with-temp-buffer + (css-mode) + (insert (nth 0 item)) + (save-excursion (insert (nth 1 item))) + (should (equal (nth 2 item) (css--mdn-find-symbol)))))) + +(ert-deftest css-test-rgb-parser () + (with-temp-buffer + (css-mode) + (dolist (input '("255, 0, 127" + "255, /* comment */ 0, 127" + "255 0 127" + "255, 0, 127, 0.75" + "255 0 127 / 0.75" + "100%, 0%, 50%" + "100%, 0%, 50%, 0.115" + "100% 0% 50%" + "100% 0% 50% / 0.115")) + (erase-buffer) + (save-excursion + (insert input ")")) + (should (equal (css--rgb-color) "#ff007f"))))) + +(ert-deftest css-test-hsl-parser () + (with-temp-buffer + (css-mode) + (dolist (input '("0, 100%, 50%" + "0 100% 50%" + "0 /* two */ /* comments */100% 50%" + "0, 100%, 50%, 0.75" + "0 100% 50% / 0.75" + "0deg 100% 50%" + "360deg 100% 50%" + "0rad, 100%, 50%, 0.115" + "0grad, 100%, 50%, 0.115" + "1turn 100% 50% / 0.115")) + (erase-buffer) + (save-excursion + (insert input ")")) + (should (equal (css--hsl-color) "#ff0000"))))) + +(ert-deftest css-test-named-color () + (dolist (text '("@mixin black" "@include black")) + (with-temp-buffer + (insert text) + (should-not (css--named-color (save-excursion + (backward-word) + (point)) + "black"))))) + +(provide 'css-mode-tests) +;;; css-mode-tests.el ends here diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el new file mode 100644 index 00000000000..34e86201d82 --- /dev/null +++ b/test/lisp/textmodes/dns-mode-tests.el @@ -0,0 +1,58 @@ +;;; dns-mode-tests.el --- Test suite for dns-mode -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Peder O. Klingenberg <peder@klingenberg.no> +;; Keywords: dns zone + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'dns-mode) + +;;; IPv6 reverse zones +(ert-deftest dns-mode-ipv6-conversion () + (let ((address "2001:db8::42")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address) + "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address 32) + "8.b.d.0.1.0.0.2.ip6.arpa. ")) + (should (equal (dns-mode-reverse-and-expand-ipv6 address -112) + "2.4.0.0 ")))) + +(ert-deftest dns-mode-ipv6-text-replacement () + (let ((address "2001:db8::42/32")) + (with-temp-buffer + ;; Conversion with point directly after address + (insert address) + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. ")) + ;; Kill ring contains the expected + (erase-buffer) + (yank) + (should (equal (buffer-string) address)) + ;; Point at beginning of address (and prefix arg to command) + (goto-char (point-min)) + (dns-mode-ipv6-to-nibbles t) + (should (equal (buffer-string) "2.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 ")) + ;; Point separated from address by whitespace + (erase-buffer) + (insert address) + (insert " ") + (dns-mode-ipv6-to-nibbles nil) + (should (equal (buffer-string) "8.b.d.0.1.0.0.2.ip6.arpa. "))))) diff --git a/test/lisp/textmodes/mhtml-mode-tests.el b/test/lisp/textmodes/mhtml-mode-tests.el new file mode 100644 index 00000000000..020ad03c18f --- /dev/null +++ b/test/lisp/textmodes/mhtml-mode-tests.el @@ -0,0 +1,58 @@ +;;; mhtml-mode-tests.el --- Tests for mhtml-mode + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Keywords: tests + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'mhtml-mode) +(require 'ert) + +(defun mhtml-test-syntax (before after what) + (with-temp-buffer + (mhtml-mode) + (insert before) + (save-excursion + (insert after)) + (font-lock-ensure) + (should (eq (syntax-ppss-context (syntax-ppss)) what)))) + +(ert-deftest mhtml-comment-js () + (mhtml-test-syntax "<html><script>\n/* " + " some text */<script></html>" + 'comment)) + +(ert-deftest mhtml-string-js () + (mhtml-test-syntax "<html><script>\n\" " + " some text \"<script></html>" + 'string)) + +(ert-deftest mhtml-comment-css () + (mhtml-test-syntax "<html><style>\n/* " + " some text */<style></html>" + 'comment)) + +(ert-deftest mhtml-string-css () + (mhtml-test-syntax "<html><style>\n\" " + " some text \"<style></html>" + 'string)) + +;;; mhtml-mode-tests.el ends here diff --git a/test/automated/reftex-tests.el b/test/lisp/textmodes/reftex-tests.el index b6f14277b43..55db66c58dc 100644 --- a/test/automated/reftex-tests.el +++ b/test/lisp/textmodes/reftex-tests.el @@ -204,5 +204,20 @@ (should (string= (reftex-format-citation entry "%l:%A:%y:%t %j %P %a") "Foo13:Jane Roe:2013:Some Article Some Journal 1 Jane Roe, John Doe \\& Jane Taxpayer")))) + +;;; Autoload tests + +;; Test to check whether reftex autoloading mechanisms are working +;; correctly. +(ert-deftest reftex-autoload-auc () + "Tests to see whether reftex-auc has been autoloaded" + (should + (fboundp 'reftex-arg-label)) + (should + (autoloadp + (symbol-function + 'reftex-arg-label)))) + + (provide 'reftex-tests) ;;; reftex-tests.el ends here. diff --git a/test/automated/sgml-mode-tests.el b/test/lisp/textmodes/sgml-mode-tests.el index e1aa3e8857e..e1aa3e8857e 100644 --- a/test/automated/sgml-mode-tests.el +++ b/test/lisp/textmodes/sgml-mode-tests.el diff --git a/test/automated/tildify-tests.el b/test/lisp/textmodes/tildify-tests.el index 0a82b2521fb..f958fbc547a 100644 --- a/test/automated/tildify-tests.el +++ b/test/lisp/textmodes/tildify-tests.el @@ -226,7 +226,7 @@ The function must terminate as soon as callback returns nil." (defun tildify-space-undo-test--test - (modes nbsp env-open &optional set-space-string) + (modes nbsp _env-open &optional set-space-string) (with-temp-buffer (setq-local buffer-file-coding-system 'utf-8) (dolist (mode modes) diff --git a/test/automated/thingatpt.el b/test/lisp/thingatpt-tests.el index 46a3b8cf935..d4449eacbf9 100644 --- a/test/automated/thingatpt.el +++ b/test/lisp/thingatpt-tests.el @@ -84,4 +84,40 @@ position to retrieve THING.") (goto-char (nth 1 test)) (should (equal (thing-at-point (nth 2 test)) (nth 3 test)))))) +;; These tests reflect the actual behavior of +;; `thing-at-point-bounds-of-list-at-point'. +(ert-deftest thing-at-point-bug24627 () + "Test for http://debbugs.gnu.org/24627 ." + (let ((string-result '(("(a \"b\" c)" . (a "b" c)) + (";(a \"b\" c)") + ("(a \"b\" c\n)" . (a "b" c)) + ("\"(a b c)\"") + ("(a ;(b c d)\ne)" . (a e)) + ("(foo\n(a ;(b c d)\ne) bar)" . (a e)) + ("(foo\na ;(b c d)\ne bar)" . (foo a e bar)) + ("(foo\n(a \"(b c d)\"\ne) bar)" . (a "(b c d)" e)) + ("(b\n(a ;(foo c d)\ne) bar)" . (a e)) + ("(princ \"(a b c)\")" . (princ "(a b c)")) + ("(defun foo ()\n \"Test function.\"\n ;;(a b)\n nil)" . (defun foo nil "Test function." nil)))) + (file + (expand-file-name "lisp/thingatpt.el" source-directory)) + buf) + ;; Test for `thing-at-point'. + (when (file-exists-p file) + (unwind-protect + (progn + (setq buf (find-file file)) + (goto-char (point-max)) + (forward-line -1) + (should-not (thing-at-point 'list))) + (kill-buffer buf))) + ;; Tests for `list-at-point'. + (dolist (str-res string-result) + (with-temp-buffer + (emacs-lisp-mode) + (insert (car str-res)) + (re-search-backward "\\((a\\|^a\\)") + (should (equal (list-at-point) + (cdr str-res))))))) + ;;; thingatpt.el ends here diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el new file mode 100644 index 00000000000..30636db083c --- /dev/null +++ b/test/lisp/url/url-auth-tests.el @@ -0,0 +1,296 @@ +;;; url-auth-tests.el --- Test suite for url-auth. + +;; Copyright (C) 2015-2017 Free Software Foundation, Inc. + +;; Author: Jarno Malmari <jarno@malmari.fi> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Test HTTP authentication methods. + +;;; Code: + +(require 'ert) +(require 'url-auth) + +(defvar url-auth-test-challenges nil + "List of challenges for testing. +Each challenge is a plist. Values are as presented by the +server's WWW-Authenticate header field.") + +;; Set explicitly for easier modification for re-runs. +(setq url-auth-test-challenges + (list + (list :qop "auth" + :nonce "uBr3+qkQBybTr/dKWkmpUqVO7SaEwWYzyTKO7g==$" + :uri "/random/path" + :method "GET" + :realm "Some test realm" + :cnonce "YWU4NDcxYWMxMDAxMjlkMjAwMDE4MjI5MDAwMGY4NGQ=" + :nc "00000001" + :username "jytky" + :password "xi5Ac2HEfKt1lKKO05DCSqsK0u7hqqtsT" + :expected-ha1 "af521db3a83abd91262fead04fa31892" + :expected-ha2 "e490a6a147c79404b365d1f6059ddda5" + :expected-response "ecb6396e93b9e09e31f19264cfd8f854") + (list :nonce "a1be8a3065e00c5bf190ad499299aea5" + :opaque "d7c2a27230fc8c74bb6e06be8c9cd189" + :realm "The Test Realm" + :username "user" + :password "passwd" + :uri "/digest-auth/auth/user/passwd" + :method "GET" + :expected-ha1 "19c41161a8720edaeb7922ef8531137d" + :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" + :expected-response "46c47a6d8e1fa95a3efcf49724af3fe7") + (list :nonce "servernonce" + :username "user" + :password "passwd" + :realm "The Test Realm 1" + :uri "/digest-auth/auth/user/passwd" + :method "GET" + :expected-ha1 "00f848f943c9a05dd06c932a7334f120" + :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" + :expected-response "b8a48cdc9aa9e514509a5a5c53d4e8cf") + (list :nonce "servernonce" + :username "user" + :password "passwd" + :realm "The Test Realm 2" + :uri "/digest-auth/auth/user/passwd" + :method "GET" + :expected-ha1 "74d6abd3651d6b8260733d8a4c37ec1a" + :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863" + :expected-response "0d84884d967e04440efc77e9e2b5b561"))) + +(ert-deftest url-auth-test-colonjoin () + "Check joining strings with `:'." + (should (string= (url-digest-auth-colonjoin) "")) + (should (string= (url-digest-auth-colonjoin nil) "")) + (should (string= (url-digest-auth-colonjoin nil nil nil) "::")) + (should (string= (url-digest-auth-colonjoin "") "")) + (should (string= (url-digest-auth-colonjoin "" "") ":")) + (should (string= (url-digest-auth-colonjoin "one") "one")) + (should (string= (url-digest-auth-colonjoin "one" "two" "three") "one:two:three"))) + +(ert-deftest url-auth-test-digest-ha1 () + "Check HA1 computation." + (dolist (row url-auth-test-challenges) + (should (string= (url-digest-auth-make-ha1 (plist-get row :username) + (plist-get row :realm) + (plist-get row :password)) + (plist-get row :expected-ha1) + )))) + +(ert-deftest url-auth-test-digest-ha2 () + "Check HA2 computation." + (dolist (row url-auth-test-challenges) + (should (string= (url-digest-auth-make-ha2 (plist-get row :method) + (plist-get row :uri)) + (plist-get row :expected-ha2))))) + +(ert-deftest url-auth-test-digest-request-digest () + "Check digest response value." + (dolist (row url-auth-test-challenges) + (should (string= (plist-get row :expected-response) + (if (plist-member row :qop) + (url-digest-auth-make-request-digest-qop + (plist-get row :qop) + (plist-get row :expected-ha1) + (plist-get row :expected-ha2) + (plist-get row :nonce) + (plist-get row :nc) + (plist-get row :cnonce)) + (url-digest-auth-make-request-digest + (plist-get row :expected-ha1) + (plist-get row :expected-ha2) + (plist-get row :nonce))))))) + +(ert-deftest url-auth-test-digest-create-key () + "Check user credentials in their hashed form." + (dolist (challenge url-auth-test-challenges) + (let ((key (url-digest-auth-create-key (plist-get challenge :username) + (plist-get challenge :password) + (plist-get challenge :realm) + (plist-get challenge :method) + (plist-get challenge :uri)))) + (should (= (length key) 2)) + (should (string= (nth 0 key) (plist-get challenge :expected-ha1))) + (should (string= (nth 1 key) (plist-get challenge :expected-ha2))) + ))) + +(ert-deftest url-auth-test-digest-auth-retrieve-cache () + "Check how the entry point retrieves cached authentication. +Essential is how realms and paths are matched." + + (let* ((url-digest-auth-storage + '(("example.org:80" + ("/path/auth1" "auth1user" "key") + ("/path" "pathuser" "key") + ("/" "rootuser" "key") + ("realm1" "realm1user" "key") + ("realm2" "realm2user" "key") + ("/path/auth2" "auth2user" "key")) + ("example.org:443" + ("realm" "secure_user" "key")) + ("rootless.org:80" ; no "/" entry for this on purpose + ("/path" "pathuser" "key") + ("realm" "realmuser" "key")))) + (attrs (list (cons "nonce" "servernonce"))) + auth) + + (dolist (row (list + ;; If :expected-user is `nil' it indicates + ;; authentication information shouldn't be found. + + ;; non-existent server + (list :url "http://other.com/path" + :realm nil :expected-user nil) + + ;; unmatched port + (list :url "http://example.org:444/path" + :realm nil :expected-user nil) + + ;; root, no realm + (list :url "http://example.org/" + :realm nil :expected-user "rootuser") + + ;; root, no realm, explicit port + (list :url "http://example.org:80/" + :realm nil :expected-user "rootuser") + + (list :url "http://example.org/unknown" + :realm nil :expected-user "rootuser") + + ;; realm specified, overrides any path + (list :url "http://example.org/" + :realm "realm1" :expected-user "realm1user") + + ;; realm specified, overrides any path + (list :url "http://example.org/" + :realm "realm2" :expected-user "realm2user") + + ;; authentication determined by path + (list :url "http://example.org/path/auth1/query" + :realm nil :expected-user "auth1user") + + ;; /path shadows /path/auth2, hence pathuser is expected + (list :url "http://example.org/path/auth2/query" + :realm nil :expected-user "pathuser") + + (list :url "https://example.org/path" + :realm nil :expected-user "secure_user") + + ;; not really secure user but using the same port + (list :url "http://example.org:443/path" + :realm nil :expected-user "secure_user") + + ;; preferring realm user over path, even though no + ;; realm specified (not sure why) + (list :url "http://rootless.org/" + :realm nil :expected-user "realmuser") + ;; second variant for the same case + (list :url "http://rootless.org/unknown/path" + :realm nil :expected-user "realmuser") + + ;; path match + (list :url "http://rootless.org/path/query?q=a" + :realm nil :expected-user "pathuser") + + ;; path match, realm match, prefer realm + (list :url "http://rootless.org/path/query?q=a" + :realm "realm" :expected-user "realmuser") + )) + (setq auth (url-digest-auth (plist-get row :url) + nil nil + (plist-get row :realm) attrs)) + (if (plist-get row :expected-user) + (progn (should auth) + (should (string-match ".*username=\"\\(.*?\\)\".*" auth)) + (should (string= (match-string 1 auth) + (plist-get row :expected-user)))) + (should-not auth))))) + +(ert-deftest url-auth-test-digest-auth () + "Check common authorization string contents. +Challenges with qop are not checked for response since a unique +cnonce is used for generating them which is not mocked by the +test and cannot be passed by arguments to `url-digest-auth'." + (dolist (challenge url-auth-test-challenges) + (let* ((attrs (append + (list (cons "nonce" (plist-get challenge :nonce))) + (if (plist-get challenge :qop) + (list (cons "qop" (plist-get challenge :qop)))))) + (url (concat "http://example.org" (plist-get challenge :uri))) + url-digest-auth-storage + auth) + ;; Add authentication info to cache so `url-digest-auth' can + ;; complete without prompting minibuffer input. + (setq url-digest-auth-storage + (list + (list "example.org:80" + (cons (or (plist-get challenge :realm) "/") + (cons (plist-get challenge :username) + (url-digest-auth-create-key + (plist-get challenge :username) + (plist-get challenge :password) + (plist-get challenge :realm) + (plist-get challenge :method) + (plist-get challenge :uri))))))) + (setq auth (url-digest-auth (url-generic-parse-url url) nil nil + (plist-get challenge :realm) attrs)) + (should auth) + (should (string-prefix-p "Digest " auth)) + (should (string-match ".*username=\"\\(.*?\\)\".*" auth)) + (should (string= (match-string 1 auth) + (plist-get challenge :username))) + (should (string-match ".*realm=\"\\(.*?\\)\".*" auth)) + (should (string= (match-string 1 auth) + (plist-get challenge :realm))) + + (if (plist-member challenge :qop) + (progn + ;; We don't know these, just check that they exists. + (should (string-match-p ".*response=\".*?\".*" auth)) + (should (string-match-p ".*nc=\".*?\".*" auth)) + (should (string-match-p ".*cnonce=\".*?\".*" auth))) + (should (string-match ".*response=\"\\(.*?\\)\".*" auth)) + (should (string= (match-string 1 auth) + (plist-get challenge :expected-response)))) + ))) + +(ert-deftest url-auth-test-digest-auth-opaque () + "Check that `opaque' value is added to result when presented by +the server." + (let* ((url-digest-auth-storage + '(("example.org:80" ("/" "user" "key")))) + (attrs (list (cons "nonce" "anynonce"))) + auth) + ;; Get authentication info from cache without `opaque'. + (setq auth (url-digest-auth "http://example.org/path" nil nil nil attrs)) + (should auth) + (should-not (string-match-p "opaque=" auth)) + + ;; Add `opaque' to attributes. + (push (cons "opaque" "opaque-value") attrs) + (setq auth (url-digest-auth "http://example.org/path" nil nil nil attrs)) + (should auth) + (should (string-match ".*opaque=\"\\(.*?\\)\".*" auth)) + (should (string= (match-string 1 auth) "opaque-value")))) + +(provide 'url-auth-tests) +;;; url-auth-tests.el ends here diff --git a/test/automated/url-expand-tests.el b/test/lisp/url/url-expand-tests.el index 2debbdeb753..2debbdeb753 100644 --- a/test/automated/url-expand-tests.el +++ b/test/lisp/url/url-expand-tests.el diff --git a/test/automated/url-future-tests.el b/test/lisp/url/url-future-tests.el index 64d045219ba..64d045219ba 100644 --- a/test/automated/url-future-tests.el +++ b/test/lisp/url/url-future-tests.el diff --git a/test/automated/url-parse-tests.el b/test/lisp/url/url-parse-tests.el index 05da7280aa2..fd8abb0a5e5 100644 --- a/test/automated/url-parse-tests.el +++ b/test/lisp/url/url-parse-tests.el @@ -162,6 +162,11 @@ (should (equal (url-generic-parse-url "#") (url-parse-make-urlobj nil nil nil nil nil "" "" nil nil))) (should (equal (url-generic-parse-url "#foo") (url-parse-make-urlobj nil nil nil nil nil "" "foo" nil nil)))) +(ert-deftest url-generic-parse-url/multibyte-host-and-path () + (should (equal (url-generic-parse-url "http://банки.рф/фыва/") + (url-parse-make-urlobj "http" nil nil "банки.рф" nil + "/фыва/" nil nil t)))) + (provide 'url-parse-tests) ;;; url-parse-tests.el ends here diff --git a/test/automated/url-util-tests.el b/test/lisp/url/url-util-tests.el index c3375890c01..c3375890c01 100644 --- a/test/automated/url-util-tests.el +++ b/test/lisp/url/url-util-tests.el diff --git a/test/automated/add-log-tests.el b/test/lisp/vc/add-log-tests.el index 3e7bc7fdf0d..3e7bc7fdf0d 100644 --- a/test/automated/add-log-tests.el +++ b/test/lisp/vc/add-log-tests.el diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el new file mode 100644 index 00000000000..807a411fa5d --- /dev/null +++ b/test/lisp/vc/diff-mode-tests.el @@ -0,0 +1,203 @@ +;; Copyright (C) 2017 Free Software Foundation, Inc + +;; Author: Dima Kogan <dima@secretsauce.net> +;; Maintainer: emacs-devel@gnu.org + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'diff-mode) + + +(ert-deftest diff-mode-test-ignore-trailing-dashes () + "Check to make sure we successfully ignore trailing -- made by +'git format-patch'. This is bug #9597" + + ;; I made a test repo, put some files in it, made arbitrary changes + ;; and invoked 'git format-patch' to get a patch out of it. The + ;; patch and the before and after versions of the files appear here. + ;; The test simply tries to apply the patch. The patch contains + ;; trailing --, which confused diff-mode previously + (let ((patch "From 18ed35640be496647e0a02fc155b4ee4a0490eca Mon Sep 17 00:00:00 2001 +From: Dima Kogan <dima@secretsauce.net> +Date: Mon, 30 Jan 2017 22:24:13 -0800 +Subject: [PATCH] test commit + +--- + fil | 3 --- + fil2 | 4 ---- + 2 files changed, 7 deletions(-) + +diff --git a/fil b/fil +index 10344f1..2a56245 100644 +--- a/fil ++++ b/fil +@@ -2,10 +2,8 @@ Afrocentrism + Americanisms + Americanization + Americanizations +-Americanized + Americanizes + Americanizing +-Andrianampoinimerina + Anglicanisms + Antananarivo + Apalachicola +@@ -15,6 +13,5 @@ Aristophanes + Aristotelian + Ashurbanipal + Australopithecus +-Austronesian + Bangladeshis + Barquisimeto +diff --git a/fil2 b/fil2 +index 8858f0d..86e8ea5 100644 +--- a/fil2 ++++ b/fil2 +@@ -1,20 +1,16 @@ + whippoorwills + whitewashing + wholehearted +-wholeheartedly + wholesomeness + wildernesses + windbreakers + wisecracking + withstanding +-woodcarvings + woolgathering + workstations + worthlessness + wretchedness + wristwatches +-wrongfulness + wrongheadedly + wrongheadedness +-xylophonists + youthfulness +-- +2.11.0 + +") + (fil_before "Afrocentrism +Americanisms +Americanization +Americanizations +Americanized +Americanizes +Americanizing +Andrianampoinimerina +Anglicanisms +Antananarivo +Apalachicola +Appalachians +Argentinians +Aristophanes +Aristotelian +Ashurbanipal +Australopithecus +Austronesian +Bangladeshis +Barquisimeto +") + (fil_after "Afrocentrism +Americanisms +Americanization +Americanizations +Americanizes +Americanizing +Anglicanisms +Antananarivo +Apalachicola +Appalachians +Argentinians +Aristophanes +Aristotelian +Ashurbanipal +Australopithecus +Bangladeshis +Barquisimeto +") + (fil2_before "whippoorwills +whitewashing +wholehearted +wholeheartedly +wholesomeness +wildernesses +windbreakers +wisecracking +withstanding +woodcarvings +woolgathering +workstations +worthlessness +wretchedness +wristwatches +wrongfulness +wrongheadedly +wrongheadedness +xylophonists +youthfulness +") + (fil2_after "whippoorwills +whitewashing +wholehearted +wholesomeness +wildernesses +windbreakers +wisecracking +withstanding +woolgathering +workstations +worthlessness +wretchedness +wristwatches +wrongheadedly +wrongheadedness +youthfulness +") + (temp-dir (make-temp-file "diff-mode-test" 'dir))) + + (let ((buf (find-file-noselect (format "%s/%s" temp-dir "fil" ))) + (buf2 (find-file-noselect (format "%s/%s" temp-dir "fil2")))) + (unwind-protect + (progn + (with-current-buffer buf (insert fil_before) (save-buffer)) + (with-current-buffer buf2 (insert fil2_before) (save-buffer)) + + (with-temp-buffer + (cd temp-dir) + (insert patch) + (beginning-of-buffer) + (diff-apply-hunk) + (diff-apply-hunk) + (diff-apply-hunk)) + + (should (equal (with-current-buffer buf (buffer-string)) + fil_after)) + (should (equal (with-current-buffer buf2 (buffer-string)) + fil2_after))) + + (ignore-errors + (with-current-buffer buf (set-buffer-modified-p nil)) + (kill-buffer buf) + (with-current-buffer buf2 (set-buffer-modified-p nil)) + (kill-buffer buf2) + (delete-directory temp-dir 'recursive)))))) + + +(provide 'diff-mode-tests) diff --git a/test/lisp/vc/ediff-diff-tests.el b/test/lisp/vc/ediff-diff-tests.el new file mode 100644 index 00000000000..566f592f84e --- /dev/null +++ b/test/lisp/vc/ediff-diff-tests.el @@ -0,0 +1,55 @@ +;;; ediff-diff-tests.el --- Unit tests for ediff-diff.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for lisp/vc/ediff-diff.el. + +;;; Code: + +(require 'ediff-diff) + +(require 'cl-lib) +(require 'ert) + +(ert-deftest ediff-diff-tests--ediff-exec-process--quoted-file () + "Check that Bug#25950 is fixed." + (cl-letf* ((call-process-args ()) + ((symbol-function #'call-process) + (lambda (&rest args) (push args call-process-args) 0))) + (with-temp-buffer + (ediff-exec-process "diff" (current-buffer) :synchronous "" + "/:/a" "/:/b") + (should (equal call-process-args + `(("diff" nil ,(current-buffer) nil "/a" "/b"))))))) + +(ert-deftest ediff-diff-tests--ediff-exec-process--nil () + "Check that Bug#26378 is fixed." + (cl-letf* ((call-process-args ()) + ((symbol-function #'call-process) + (lambda (&rest args) (push args call-process-args) 0))) + (with-temp-buffer + (ediff-exec-process "diff" (current-buffer) :synchronous "" + "foo" nil "") + (should (equal call-process-args + `(("diff" nil ,(current-buffer) nil "foo"))))))) + +;;; ediff-diff-tests.el ends here diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el new file mode 100644 index 00000000000..387786ced06 --- /dev/null +++ b/test/lisp/vc/ediff-ptch-tests.el @@ -0,0 +1,109 @@ +;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Tino Calancha <tino.calancha@gmail.com> + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Code: + +(require 'ert) +(require 'ediff-ptch) + +(ert-deftest ediff-ptch-test-bug25010 () + "Test for http://debbugs.gnu.org/25010 ." + (with-temp-buffer + (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el +index 6a07f80..6e8e947 100644 +--- a/lisp/vc/ediff-ptch.el ++++ b/lisp/vc/ediff-ptch.el +@@ -120,11 +120,12 @@ ediff-patch-default-directory +") + (goto-char (point-min)) + (let ((filename + (progn + (re-search-forward ediff-context-diff-label-regexp nil t) + (match-string 1)))) + (should-not (string-suffix-p "@@" filename))))) + + +(ert-deftest ediff-ptch-test-bug26084 () + "Test for http://debbugs.gnu.org/26084 ." + (skip-unless (executable-find "git")) + (skip-unless (executable-find ediff-patch-program)) + (let* ((tmpdir (make-temp-file "ediff-ptch-test" t)) + (default-directory (file-name-as-directory tmpdir)) + (patch (make-temp-file "ediff-ptch-test")) + (qux (expand-file-name "qux.txt" tmpdir)) + (bar (expand-file-name "bar.txt" tmpdir)) + (git-program (executable-find "git"))) + ;; Create repository. + (with-temp-buffer + (insert "qux here\n") + (write-region nil nil qux nil 'silent) + (erase-buffer) + (insert "bar here\n") + (write-region nil nil bar nil 'silent)) + (call-process git-program nil nil nil "init") + (call-process git-program nil nil nil "add" ".") + (call-process git-program nil nil nil "commit" "-m" "Test repository.") + ;; Update repo., save the diff and reset to initial state. + (with-temp-buffer + (insert "foo here\n") + (write-region nil nil qux nil 'silent) + (write-region nil nil bar nil 'silent)) + (call-process git-program nil `(:file ,patch) nil "diff") + (call-process git-program nil nil nil "reset" "--hard" "HEAD") + (find-file patch) + (unwind-protect + (let* ((info + (progn (ediff-map-patch-buffer (current-buffer)) ediff-patch-map)) + (patch1 + (buffer-substring-no-properties + (car (nth 3 (car info))) + (car (nth 4 (car info))))) + (patch2 + (buffer-substring-no-properties + (car (nth 3 (cadr info))) + (car (nth 4 (cadr info)))))) + ;; Apply both patches. + (dolist (x (list (cons patch1 bar) (cons patch2 qux))) + (with-temp-buffer + (insert (car x)) + (call-process-region (point-min) + (point-max) + ediff-patch-program + nil nil nil + "-b" (cdr x)))) + ;; Check backup files were saved correctly. + (dolist (x (list qux bar)) + (let ((backup + (car + (directory-files + tmpdir 'full + (concat (file-name-nondirectory x) "."))))) + (should-not + (string= (with-temp-buffer + (insert-file-contents x) + (buffer-string)) + (with-temp-buffer + (insert-file-contents backup) + (buffer-string)))))) + (delete-directory tmpdir 'recursive) + (delete-file patch))))) + + +(provide 'ediff-ptch-tests) +;;; ediff-ptch-tests.el ends here diff --git a/test/automated/vc-bzr.el b/test/lisp/vc/vc-bzr-tests.el index 9b03e246166..fc7d8f8283f 100644 --- a/test/automated/vc-bzr.el +++ b/test/lisp/vc/vc-bzr-tests.el @@ -101,12 +101,8 @@ (while (vc-dir-busy) (sit-for 0.1)) (vc-dir-mark-all-files t) - (let ((f (symbol-function 'y-or-n-p))) - (unwind-protect - (progn - (fset 'y-or-n-p (lambda (prompt) t)) - (vc-next-action nil)) - (fset 'y-or-n-p f))) + (cl-letf (((symbol-function 'y-or-n-p) (lambda (_) t))) + (vc-next-action nil)) (should (get-buffer "*vc-log*"))) (delete-directory homedir t)))) diff --git a/test/automated/vc-hg.el b/test/lisp/vc/vc-hg-tests.el index 8e4c9739e08..284e06a2052 100644 --- a/test/automated/vc-hg.el +++ b/test/lisp/vc/vc-hg-tests.el @@ -1,4 +1,4 @@ -;;; vc-hg.el --- tests for vc/vc-hg.el +;;; vc-hg-tests.el --- tests for vc/vc-hg.el ;; Copyright (C) 2016-2017 Free Software Foundation, Inc. @@ -55,4 +55,4 @@ (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:")) (should (floatp (vc-hg-annotate-time))))) -;;; vc-hg.el ends here +;;; vc-hg-tests.el ends here diff --git a/test/automated/vc-tests.el b/test/lisp/vc/vc-tests.el index b132f7d0821..1104085a2e1 100644 --- a/test/automated/vc-tests.el +++ b/test/lisp/vc/vc-tests.el @@ -109,15 +109,17 @@ (require 'ert) (require 'vc) +(declare-function w32-application-type "w32proc") + ;; The working horses. (defvar vc-test--cleanup-hook nil "Functions for cleanup at the end of an ert test. -Don't set it globally, the functions shall be let-bound.") +Don't set it globally, the functions should be let-bound.") (defun vc-test--revision-granularity-function (backend) "Run the `vc-revision-granularity' backend function." - (funcall (intern (downcase (format "vc-%s-revision-granularity" backend))))) + (vc-call-backend backend 'revision-granularity)) (defun vc-test--create-repo-function (backend) "Run the `vc-create-repo' backend function. @@ -179,7 +181,13 @@ For backends which dont support it, it is emulated." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--create-repo" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -199,29 +207,45 @@ For backends which dont support it, it is emulated." (should (eq (vc-responsible-backend default-directory) backend))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) -;; Why isn't there `vc-unregister'? +;; FIXME: Why isn't there `vc-unregister'? (defun vc-test--unregister-function (backend file) "Run the `vc-unregister' backend function. -For backends which dont support it, `vc-not-supported' is signalled." - - (let ((symbol (intern (downcase (format "vc-%s-unregister" backend))))) - (if (functionp symbol) - (funcall symbol file) - ;; CVS, SVN, SCCS, SRC and Mtn are not supported. - (signal 'vc-not-supported (list 'unregister backend))))) +For backends which don't support it, `vc-not-supported' is signaled." + ;; CVS, SVN, SCCS, SRC and Mtn are not supported, and will signal + ;; `vc-not-supported'. + (prog1 + (vc-call-backend backend 'unregister file) + (vc-file-clearprops file))) + +(defmacro vc-test--run-maybe-unsupported-function (func &rest args) + "Run FUNC with ARGS as arguments. +Catch the `vc-not-supported' error." + `(let (err) + (condition-case err + (funcall ,func ,@args) + (vc-not-supported 'vc-not-supported) + (t (signal (car err) (cdr err)))))) (defun vc-test--register (backend) - "Register and unregister a file." + "Register and unregister a file. +This checks also `vc-backend' and `vc-responsible-backend'." (let ((vc-handled-backends `(,backend)) (default-directory (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) - + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--register" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn ;; Cleanup. @@ -232,37 +256,63 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; Create empty repository. (make-directory default-directory) (vc-test--create-repo-function backend) + ;; For file oriented backends CVS, RCS and SVN the backend is + ;; returned, and the directory is registered already. + (should (if (vc-backend default-directory) + (vc-registered default-directory) + (not (vc-registered default-directory)))) + (should (eq (vc-responsible-backend default-directory) backend)) (let ((tmp-name1 (expand-file-name "foo" default-directory)) (tmp-name2 "bla")) ;; Register files. Check for it. (write-region "foo" nil tmp-name1 nil 'nomessage) (should (file-exists-p tmp-name1)) + (should-not (vc-backend tmp-name1)) + (should (eq (vc-responsible-backend tmp-name1) backend)) (should-not (vc-registered tmp-name1)) + (write-region "bla" nil tmp-name2 nil 'nomessage) (should (file-exists-p tmp-name2)) + (should-not (vc-backend tmp-name2)) + (should (eq (vc-responsible-backend tmp-name2) backend)) (should-not (vc-registered tmp-name2)) + (vc-register (list backend (list tmp-name1 tmp-name2))) (should (file-exists-p tmp-name1)) + (should (eq (vc-backend tmp-name1) backend)) + (should (eq (vc-responsible-backend tmp-name1) backend)) (should (vc-registered tmp-name1)) + (should (file-exists-p tmp-name2)) + (should (eq (vc-backend tmp-name2) backend)) + (should (eq (vc-responsible-backend tmp-name2) backend)) (should (vc-registered tmp-name2)) + ;; `vc-backend' accepts also a list of files, + ;; `vc-responsible-backend' doesn't. + (should (vc-backend (list tmp-name1 tmp-name2))) + ;; Unregister the files. - (condition-case err - (progn - (vc-test--unregister-function backend tmp-name1) - (should-not (vc-registered tmp-name1)) - (vc-test--unregister-function backend tmp-name2) - (should-not (vc-registered tmp-name2))) - ;; CVS, SVN, SCCS, SRC and Mtn are not supported. - (vc-not-supported t)) - ;; The files shall still exist. + (unless (eq (vc-test--run-maybe-unsupported-function + 'vc-test--unregister-function backend tmp-name1) + 'vc-not-supported) + (should-not (vc-backend tmp-name1)) + (should-not (vc-registered tmp-name1))) + (unless (eq (vc-test--run-maybe-unsupported-function + 'vc-test--unregister-function backend tmp-name2) + 'vc-not-supported) + (should-not (vc-backend tmp-name2)) + (should-not (vc-registered tmp-name2))) + + ;; The files should still exist. (should (file-exists-p tmp-name1)) (should (file-exists-p tmp-name2)))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) (defun vc-test--state (backend) "Check the different states of a file." @@ -272,8 +322,13 @@ For backends which dont support it, `vc-not-supported' is signalled." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) - + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--state" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn ;; Cleanup. @@ -281,73 +336,50 @@ For backends which dont support it, `vc-not-supported' is signalled." 'vc-test--cleanup-hook `(lambda () (delete-directory ,default-directory 'recursive))) - ;; Create empty repository. Check repository state. + ;; Create empty repository. (make-directory default-directory) (vc-test--create-repo-function backend) - ;; nil: Hg Mtn RCS - ;; added: Git - ;; unregistered: CVS SCCS SRC - ;; up-to-date: Bzr SVN - (message "vc-state1 %s" (vc-state default-directory)) - ;;(should (eq (vc-state default-directory) - ;;(vc-state default-directory backend))) - (should (memq (vc-state default-directory) - '(nil added unregistered up-to-date))) - (let ((tmp-name (expand-file-name "foo" default-directory))) - ;; Check state of an empty file. + ;; Check state of a nonexistent file. - ;; nil: Hg Mtn SRC SVN - ;; added: Git - ;; unregistered: RCS SCCS - ;; up-to-date: Bzr CVS (message "vc-state2 %s" (vc-state tmp-name)) - ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) - '(nil added unregistered up-to-date))) + (should (null (vc-state tmp-name))) ;; Write a new file. Check state. (write-region "foo" nil tmp-name nil 'nomessage) ;; nil: Mtn - ;; added: Git - ;; unregistered: Hg RCS SCCS SRC SVN - ;; up-to-date: Bzr CVS - (message "vc-state3 %s" (vc-state tmp-name)) - ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) - '(nil added unregistered up-to-date))) + ;; unregistered: Bzr CVS Git Hg SVN RCS + (message "vc-state3 %s %s" backend (vc-state tmp-name backend)) + (should (memq (vc-state tmp-name backend) '(nil unregistered))) ;; Register a file. Check state. (vc-register (list backend (list (file-name-nondirectory tmp-name)))) - ;; added: Git Mtn - ;; unregistered: Hg RCS SCCS SRC SVN - ;; up-to-date: Bzr CVS + ;; FIXME: nil is definitely wrong. + ;; nil: SRC + ;; added: Bzr CVS Git Hg Mtn SVN + ;; up-to-date: RCS SCCS (message "vc-state4 %s" (vc-state tmp-name)) - ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) - '(nil added unregistered up-to-date))) + (should (memq (vc-state tmp-name) '(nil added up-to-date))) ;; Unregister the file. Check state. - (condition-case nil - (progn - (vc-test--unregister-function backend tmp-name) - - ;; added: Git - ;; unregistered: Hg RCS - ;; unsupported: CVS Mtn SCCS SRC SVN - ;; up-to-date: Bzr - (message "vc-state5 %s" (vc-state tmp-name)) - ;;(should (eq (vc-state tmp-name) (vc-state tmp-name backend))) - (should (memq (vc-state tmp-name) - '(nil added unregistered up-to-date)))) - (vc-not-supported (message "vc-state5 unsupported"))))) + (if (eq (vc-test--run-maybe-unsupported-function + 'vc-test--unregister-function backend tmp-name) + 'vc-not-supported) + (message "vc-state5 unsupported") + ;; unregistered: Bzr Git RCS Hg + ;; unsupported: CVS Mtn SCCS SRC SVN + (message "vc-state5 %s %s" backend (vc-state tmp-name backend)) + (should (memq (vc-state tmp-name backend) + '(nil unregistered)))))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) (defun vc-test--working-revision (backend) "Check the working revision of a repository." @@ -357,7 +389,13 @@ For backends which dont support it, `vc-not-supported' is signalled." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--working-revision" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -371,63 +409,56 @@ For backends which dont support it, `vc-not-supported' is signalled." (make-directory default-directory) (vc-test--create-repo-function backend) - ;; nil: CVS Git Mtn RCS SCCS - ;; "0": Bzr Hg SRC SVN + ;; FIXME: Is the value for SVN correct? + ;; nil: Bzr CVS Git Hg Mtn RCS SCCS SRC + ;; "0": SVN (message "vc-working-revision1 %s" (vc-working-revision default-directory)) - ;;(should (eq (vc-working-revision default-directory) - ;;(vc-working-revision default-directory backend))) - (should (member (vc-working-revision default-directory) '(nil "0"))) + (should (member (vc-working-revision default-directory) '(nil "0"))) (let ((tmp-name (expand-file-name "foo" default-directory))) ;; Check initial working revision, should be nil until ;; it's registered. - ;; nil: CVS Git Mtn RCS SCCS SVN - ;; "0": Bzr Hg SRC (message "vc-working-revision2 %s" (vc-working-revision tmp-name)) - ;;(should (eq (vc-working-revision tmp-name) - ;;(vc-working-revision tmp-name backend))) - (should (member (vc-working-revision tmp-name) '(nil "0"))) + (should-not (vc-working-revision tmp-name)) ;; Write a new file. Check working revision. (write-region "foo" nil tmp-name nil 'nomessage) - ;; nil: CVS Git Mtn RCS SCCS SVN - ;; "0": Bzr Hg SRC (message "vc-working-revision3 %s" (vc-working-revision tmp-name)) - ;;(should (eq (vc-working-revision tmp-name) - ;;(vc-working-revision tmp-name backend))) - (should (member (vc-working-revision tmp-name) '(nil "0"))) + (should-not (vc-working-revision tmp-name)) ;; Register a file. Check working revision. (vc-register (list backend (list (file-name-nondirectory tmp-name)))) - ;; nil: Mtn Git RCS SCCS + ;; XXX: nil is fine, at least in Git's case, because + ;; `vc-register' only makes the file `added' in this case. + ;; nil: Git Mtn ;; "0": Bzr CVS Hg SRC SVN + ;; "1.1": RCS SCCS (message "vc-working-revision4 %s" (vc-working-revision tmp-name)) - ;;(should (eq (vc-working-revision tmp-name) - ;;(vc-working-revision tmp-name backend))) - (should (member (vc-working-revision tmp-name) '(nil "0"))) + (should (member (vc-working-revision tmp-name) '(nil "0" "1.1"))) + + ;; TODO: Call `vc-checkin', and check the resulting + ;; working revision. None of the return values should be + ;; nil then. ;; Unregister the file. Check working revision. - (condition-case nil - (progn - (vc-test--unregister-function backend tmp-name) - - ;; nil: Git RCS - ;; "0": Bzr Hg - ;; unsupported: CVS Mtn SCCS SRC SVN - (message - "vc-working-revision5 %s" (vc-working-revision tmp-name)) - ;;(should (eq (vc-working-revision tmp-name) - ;;(vc-working-revision tmp-name backend))) - (should (member (vc-working-revision tmp-name) '(nil "0")))) - (vc-not-supported (message "vc-working-revision5 unsupported"))))) + (if (eq (vc-test--run-maybe-unsupported-function + 'vc-test--unregister-function backend tmp-name) + 'vc-not-supported) + (message "vc-working-revision5 unsupported") + ;; nil: Bzr Git Hg RCS + ;; unsupported: CVS Mtn SCCS SRC SVN + (message "vc-working-revision5 %s" (vc-working-revision tmp-name)) + (should-not (vc-working-revision tmp-name))))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) (defun vc-test--checkout-model (backend) "Check the checkout model of a repository." @@ -437,7 +468,13 @@ For backends which dont support it, `vc-not-supported' is signalled." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--checkout-model" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -451,9 +488,8 @@ For backends which dont support it, `vc-not-supported' is signalled." (vc-test--create-repo-function backend) ;; Surprisingly, none of the backends returns 'announce. - ;; nil: RCS ;; implicit: Bzr CVS Git Hg Mtn SRC SVN - ;; locking: SCCS + ;; locking: RCS SCCS (message "vc-checkout-model1 %s" (vc-checkout-model backend default-directory)) @@ -461,11 +497,10 @@ For backends which dont support it, `vc-not-supported' is signalled." '(announce implicit locking))) (let ((tmp-name (expand-file-name "foo" default-directory))) - ;; Check checkout model of an empty file. + ;; Check checkout model of a nonexistent file. - ;; nil: RCS ;; implicit: Bzr CVS Git Hg Mtn SRC SVN - ;; locking: SCCS + ;; locking: RCS SCCS (message "vc-checkout-model2 %s" (vc-checkout-model backend tmp-name)) (should (memq (vc-checkout-model backend tmp-name) @@ -474,9 +509,8 @@ For backends which dont support it, `vc-not-supported' is signalled." ;; Write a new file. Check checkout model. (write-region "foo" nil tmp-name nil 'nomessage) - ;; nil: RCS ;; implicit: Bzr CVS Git Hg Mtn SRC SVN - ;; locking: SCCS + ;; locking: RCS SCCS (message "vc-checkout-model3 %s" (vc-checkout-model backend tmp-name)) (should (memq (vc-checkout-model backend tmp-name) @@ -486,30 +520,30 @@ For backends which dont support it, `vc-not-supported' is signalled." (vc-register (list backend (list (file-name-nondirectory tmp-name)))) - ;; nil: RCS ;; implicit: Bzr CVS Git Hg Mtn SRC SVN - ;; locking: SCCS + ;; locking: RCS SCCS (message "vc-checkout-model4 %s" (vc-checkout-model backend tmp-name)) (should (memq (vc-checkout-model backend tmp-name) '(announce implicit locking))) ;; Unregister the file. Check checkout model. - (condition-case nil - (progn - (vc-test--unregister-function backend tmp-name) - - ;; nil: RCS - ;; implicit: Bzr Git Hg - ;; unsupported: CVS Mtn SCCS SRC SVN - (message - "vc-checkout-model5 %s" (vc-checkout-model backend tmp-name)) - (should (memq (vc-checkout-model backend tmp-name) - '(announce implicit locking)))) - (vc-not-supported (message "vc-checkout-model5 unsupported"))))) + (if (eq (vc-test--run-maybe-unsupported-function + 'vc-test--unregister-function backend tmp-name) + 'vc-not-supported) + (message "vc-checkout-model5 unsupported") + ;; implicit: Bzr Git Hg + ;; locking: RCS + ;; unsupported: CVS Mtn SCCS SRC SVN + (message + "vc-checkout-model5 %s" (vc-checkout-model backend tmp-name)) + (should (memq (vc-checkout-model backend tmp-name) + '(announce implicit locking)))))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) ;; Create the test cases. @@ -605,8 +639,6 @@ For backends which dont support it, `vc-not-supported' is signalled." ,(intern (format "vc-test-%s04-checkout-model" backend-string)) () ,(format "Check `vc-checkout-model' for the %s backend." backend-string) - ;; FIXME make this pass. - :expected-result ,(if (equal backend 'RCS) :failed :passed) (skip-unless (ert-test-passed-p (ert-test-most-recent-result diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el new file mode 100644 index 00000000000..1e455352f2e --- /dev/null +++ b/test/lisp/whitespace-tests.el @@ -0,0 +1,86 @@ +;;; whitespace-tests.el --- Test suite for whitespace -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(require 'whitespace) + +(defun whitespace-tests--cleanup-string (string) + (with-temp-buffer + (insert string) + (whitespace-cleanup) + (buffer-string))) + +(ert-deftest whitespace-cleanup-eob () + (let ((whitespace-style '(empty))) + (should (equal (whitespace-tests--cleanup-string "a\n") + "a\n")) + (should (equal (whitespace-tests--cleanup-string "a\n\n") + "a\n")) + (should (equal (whitespace-tests--cleanup-string "a\n\t\n") + "a\n")) + (should (equal (whitespace-tests--cleanup-string "a\n\t \n") + "a\n")) + (should (equal (whitespace-tests--cleanup-string "a\n\t \n\n") + "a\n")) + (should (equal (whitespace-tests--cleanup-string "\n\t\n") + "")) + ;; Whitespace at end of non-empty line is not covered by the + ;; `empty' style. + (should (equal (whitespace-tests--cleanup-string "a \n\t \n\n") + "a \n")))) + + +;; We cannot call whitespace-mode because it will do nothing in batch +;; mode. So we call its innards instead. +(defun whitespace-tests-whitespace-mode-on () + "Turn whitespace-mode on even in batch mode." + (whitespace-turn-on) + (whitespace-action-when-on) + (setq whitespace-mode t)) + +(ert-deftest whitespace-tests-display-tables () + "Test whitespace stores and restores the buffer display table - bug26892." + (with-temp-buffer + (whitespace-mode -1) ; turn off in case global ws mode is active + (let ((whitespace-style '(space-mark tab-mark newline-mark)) + (whitespace-display-mappings '((space-mark 32 [183] [46]) + (space-mark 160 [164] [95]) + (newline-mark 10 [36 10]) + (tab-mark 9 [187 9] [92 9]))) + (buffer-display-table nil)) + ;test the display table actually changes + (should-not (equal nil + (progn (whitespace-tests-whitespace-mode-on) + buffer-display-table))) + ;test the display table restores correctly + (should (equal nil + (progn (whitespace-turn-off) + buffer-display-table))) + ;test the stored display table is preserved + (should (equal nil + (progn (whitespace-tests-whitespace-mode-on) + (whitespace-tests-whitespace-mode-on) + (whitespace-turn-off) + buffer-display-table)))))) + +(provide 'whitespace-tests) + +;;; whitespace-tests.el ends here diff --git a/test/automated/xml-parse-tests.el b/test/lisp/xml-tests.el index 0f2182a6a75..16945b0f92d 100644 --- a/test/automated/xml-parse-tests.el +++ b/test/lisp/xml-tests.el @@ -134,6 +134,36 @@ Parser is called with and without 'symbol-qnames argument.") (append xml-default-ns '(("F" . "FOOBAR:")))))))))) +;; Test bug #23440 (proper expansion of default namespace) +; Test data for default namespace +(defvar xml-parse-test--default-namespace-qnames + (cons "<something xmlns=\"myns:\"><whatever></whatever></something>" + '((myns:something + ((("http://www.w3.org/2000/xmlns/" . "") + . "myns:")) + (myns:whatever nil))))) + +(ert-deftest xml-parse-test-default-namespace-qnames () + (with-temp-buffer + (insert (car xml-parse-test--default-namespace-qnames)) + (should (equal (cdr xml-parse-test--default-namespace-qnames) + (xml-parse-region nil nil nil nil 'symbol-qnames))))) + +;; Test bug #26533 (proper expansion in prefixed attributes with 'symbol-qnames) +(defvar xml-parse-test--namespace-attribute-qnames + (cons "<something xmlns:a=\"myns:\"><whatever a:b='c'></whatever></something>" + '((something + ((("http://www.w3.org/2000/xmlns/" . "a") + . "myns:")) + (whatever + ((myns:b . "c"))))))) + +(ert-deftest xml-parse-namespace-attribute-qnames () + (with-temp-buffer + (insert (car xml-parse-test--namespace-attribute-qnames)) + (should (equal (cdr xml-parse-test--namespace-attribute-qnames) + (xml-parse-region nil nil nil nil 'symbol-qnames))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: diff --git a/test/automated/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el index c0e97f57479..c0e97f57479 100644 --- a/test/automated/xt-mouse-tests.el +++ b/test/lisp/xt-mouse-tests.el diff --git a/test/BidiCharacterTest.txt b/test/manual/BidiCharacterTest.txt index 7a460b48afa..7e04d6cb3c0 100644 --- a/test/BidiCharacterTest.txt +++ b/test/manual/BidiCharacterTest.txt @@ -1,13 +1,14 @@ -# BidiCharacterTest-8.0.0.txt -# Date: 2015-02-19, 00:30:00 GMT [LI] +# BidiCharacterTest-9.0.0.txt +# Date: 2016-01-15, 22:30:00 GMT [LI] +# © 2016 Unicode®, Inc. +# For terms of use, see http://www.unicode.org/terms_of_use.html # # Unicode Character Database -# Copyright (c) 1991-2015 Unicode, Inc. -# For terms of use, see http://www.unicode.org/terms_of_use.html +# For documentation, see http://www.unicode.org/reports/tr44/ # # This file provides a conformance test for implementations of the # Unicode Bidirectional Algorithm, specified in UAX #9: Unicode -# Bidirectional Algorithm, at http://www.unicode.org/unicode/reports/tr9/ +# Bidirectional Algorithm, at http://www.unicode.org/reports/tr9/ # # The test data has been generated with a few constraints. Each test case # is a single paragraph, so the test data does not contain any characters @@ -34,6 +35,7 @@ # # Comment lines start with '#'. +################################################################################ # Examples from UAX #9 # Examples from Section 3.3.5 @@ -50,6 +52,48 @@ 0627 0628 062C 0020 0062 006F 006F 006B 0028 0073 0029;0;0;1 1 1 0 0 0 0 0 0 0 0;2 1 0 3 4 5 6 7 8 9 10 0627 0628 062C 0020 0062 006F 006F 006B 0028 0073 0029;1;1;1 1 1 1 2 2 2 2 2 2 2;4 5 6 7 8 9 10 3 2 1 0 +################################################################################ +# Test cases for the algorithm changes and clarifications made in Unicode 8.0 + +# Explicit directional overrides applied to isolates tightly flanked by embeddings +202E 0061 202A 0062 202C 2066 0063 2069 202A 0064 202C 0065 202C;2;0;x 1 x 2 x 1 2 1 x 2 x 1 x;11 9 7 6 5 3 1 +202E 0061 202A 0062 202C 2066 0063 2069 202A 0064 202C 0065 202C;1;1;x 3 x 4 x 3 4 3 x 4 x 3 x;11 9 7 6 5 3 1 +202D 05D0 202B 05D1 202C 2068 05D2 2069 202B 05D3 202C 05D4 202C;2;1;x 2 x 3 x 2 3 2 x 3 x 2 x;1 3 5 6 7 9 11 +202D 0661 202B 0662 202C 2068 0663 2069 202B 0664 202C 0665 202C;0;0;x 2 x 4 x 2 6 2 x 4 x 2 x;1 3 5 6 7 9 11 + +# Explicit directional overrides applied to paired brackets +202A 05D0 0028 05D1 202C 202D 0029;2;1;x 3 3 3 x x 2;3 2 1 6 +202A 05D0 0028 05D1 202C 202D 0029 202C;2;1;x 3 3 3 x x 2 x;3 2 1 6 +202B 0061 0028 0062 202C 202E 0029;2;0;x 2 2 2 x x 1;6 1 2 3 +202B 0061 0028 0062 202C 202E 0029 202C;2;0;x 2 2 2 x x 1 x;6 1 2 3 +202A 202E 0061 202C 0028 05D0 202C 202D 0029 202C;2;0;x x 3 x 3 3 x x 2 x;5 4 2 8 +202B 202D 05D0 202C 0028 0061 202C 202E 0029 202C;2;1;x x 4 x 4 4 x x 3 x;8 2 4 5 +202A 202E 0061 202C 0028 005B 05D0 202C 202D 005D 0029 202C;2;0;x x 3 x 3 3 3 x x 2 2 x;6 5 4 2 9 10 +202B 202D 05D0 202C 0028 005B 0061 202C 202E 005D 0029 202C;2;1;x x 4 x 4 4 4 x x 3 3 x;10 9 2 4 5 6 +202D 0028 202C 202A 05D0 0029 05D1;2;1;x 2 x x 3 3 3;1 6 5 4 +202D 0028 202C 202A 05D0 0029 05D1 202C;2;1;x 2 x x 3 3 3 x;1 6 5 4 +202E 0028 202C 202B 0061 0029 0062;2;0;x 1 x x 2 2 2;4 5 6 1 +202E 0028 202C 202B 0061 0029 0062 202C;2;0;x 1 x x 2 2 2 x;4 5 6 1 +202D 202E 0061 202C 0028 202C 202A 05D0 0029 05D1;2;0;x x 3 x 2 x x 3 3 3;2 4 9 8 7 +202E 202D 05D0 202C 0028 202C 202B 0061 0029 0062;2;1;x x 4 x 3 x x 4 4 4;7 8 9 4 2 +202D 202E 0061 202C 0028 005B 202C 202A 05D0 005D 0029 05D1;2;0;x x 3 x 2 2 x x 3 3 3 3;2 4 5 11 10 9 8 +202E 202D 05D0 202C 0028 005B 202C 202B 0061 005D 0029 0062;2;1;x x 4 x 3 3 x x 4 4 4 4;8 9 10 11 5 4 2 + +# Nonspacing marks applied to paired brackets +0061 0028 0062 0029 0331;1;1;2 2 2 2 2;0 1 2 3 4 +0061 0028 0332 0062 0029 0333;1;1;2 2 2 2 2 2;0 1 2 3 4 5 +05D0 0028 05D1 0029 0331;0;0;1 1 1 1 1;4 3 2 1 0 +05D0 0028 0332 05D1 0029 0333;0;0;1 1 1 1 1 1;5 4 3 2 1 0 +0661 0028 0662 0029 0331;0;0;2 1 2 1 1;4 3 2 1 0 +0661 0028 0332 0662 0029 0333;0;0;2 1 1 2 1 1;5 4 3 2 1 0 + +# Nested bracket pairs that reach and exceed the fixed capacity of the bracket stack +# a ( ( ... ( b ) ) ... ) with 62, 63, and 64 nested bracket pairs +0061 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0062 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029;1;1;2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2;0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 +0061 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0062 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029;1;1;2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2;0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 +0061 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0028 0062 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029 0029;1;1;2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 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 1 1 1 1 1 1;129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 + +################################################################################ # Miscellaneous test cases # Various sequences @@ -246,6 +290,7 @@ 05D0 0020 2329 05D1 002E 0031 3009;0;0;1 1 1 1 1 2 1;6 5 4 3 2 1 0 05D0 0020 3008 05D1 002E 0031 232A;0;0;1 1 1 1 1 2 1;6 5 4 3 2 1 0 +################################################################################ # Permutations of sequences containing paired brackets # The sequences in this section consist of permutation patterns of three diff --git a/test/biditest.el b/test/manual/biditest.el index d98da39d789..c315749e187 100644 --- a/test/biditest.el +++ b/test/manual/biditest.el @@ -46,7 +46,7 @@ The resulting file should be viewed with `inhibit-bidi-mirroring' set to t." (insert-file-contents input-file) (goto-char (point-min)) (while (not (eobp)) - (when (looking-at "^\\([0-9A-F ]+\\);\\([012]\\);\\([01]\\);\\([0-9 ]+\\);\\([0-9 ]+\\)$") + (when (looking-at "^\\([0-9A-F ]+\\);\\([012]\\);\\([01]\\);\\([0-9x ]+\\);\\([0-9 ]+\\)$") (let ((codes (match-string 1)) (default-paragraph (match-string 2)) (resolved-paragraph (match-string 3)) diff --git a/test/cedet/cedet-utests.el b/test/manual/cedet/cedet-utests.el index b8396b822b9..b8396b822b9 100644 --- a/test/cedet/cedet-utests.el +++ b/test/manual/cedet/cedet-utests.el diff --git a/test/cedet/ede-tests.el b/test/manual/cedet/ede-tests.el index fdad01c1ff1..fdad01c1ff1 100644 --- a/test/cedet/ede-tests.el +++ b/test/manual/cedet/ede-tests.el diff --git a/test/cedet/semantic-ia-utest.el b/test/manual/cedet/semantic-ia-utest.el index cf89daf1490..cf89daf1490 100644 --- a/test/cedet/semantic-ia-utest.el +++ b/test/manual/cedet/semantic-ia-utest.el diff --git a/test/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el index bfcba7e6772..bfcba7e6772 100644 --- a/test/cedet/semantic-tests.el +++ b/test/manual/cedet/semantic-tests.el diff --git a/test/cedet/semantic-utest-c.el b/test/manual/cedet/semantic-utest-c.el index 26ce4009277..26ce4009277 100644 --- a/test/cedet/semantic-utest-c.el +++ b/test/manual/cedet/semantic-utest-c.el diff --git a/test/cedet/semantic-utest.el b/test/manual/cedet/semantic-utest.el index f735e552413..f735e552413 100644 --- a/test/cedet/semantic-utest.el +++ b/test/manual/cedet/semantic-utest.el diff --git a/test/cedet/srecode-tests.el b/test/manual/cedet/srecode-tests.el index 36256a70597..36256a70597 100644 --- a/test/cedet/srecode-tests.el +++ b/test/manual/cedet/srecode-tests.el diff --git a/test/cedet/tests/test.c b/test/manual/cedet/tests/test.c index a46486927a7..a46486927a7 100644 --- a/test/cedet/tests/test.c +++ b/test/manual/cedet/tests/test.c diff --git a/test/cedet/tests/test.el b/test/manual/cedet/tests/test.el index 5cd29cc0847..a0efd40acce 100644 --- a/test/cedet/tests/test.el +++ b/test/manual/cedet/tests/test.el @@ -89,7 +89,7 @@ (defconst a-defconst 'a "var doc const") (defcustom a-defcustom nil - "*doc custom" + "doc custom" :group 'a-defgroup :type 'boolean) diff --git a/test/cedet/tests/test.make b/test/manual/cedet/tests/test.make index 46421da54d6..46421da54d6 100644 --- a/test/cedet/tests/test.make +++ b/test/manual/cedet/tests/test.make diff --git a/test/cedet/tests/testdoublens.cpp b/test/manual/cedet/tests/testdoublens.cpp index e9a6ba52673..e9a6ba52673 100644 --- a/test/cedet/tests/testdoublens.cpp +++ b/test/manual/cedet/tests/testdoublens.cpp diff --git a/test/cedet/tests/testdoublens.hpp b/test/manual/cedet/tests/testdoublens.hpp index 556f068d586..556f068d586 100644 --- a/test/cedet/tests/testdoublens.hpp +++ b/test/manual/cedet/tests/testdoublens.hpp diff --git a/test/cedet/tests/testfriends.cpp b/test/manual/cedet/tests/testfriends.cpp index 20425f93afa..20425f93afa 100644 --- a/test/cedet/tests/testfriends.cpp +++ b/test/manual/cedet/tests/testfriends.cpp diff --git a/test/cedet/tests/testjavacomp.java b/test/manual/cedet/tests/testjavacomp.java index c32a17ca248..c32a17ca248 100644 --- a/test/cedet/tests/testjavacomp.java +++ b/test/manual/cedet/tests/testjavacomp.java diff --git a/test/cedet/tests/testnsp.cpp b/test/manual/cedet/tests/testnsp.cpp index 012dc660600..012dc660600 100644 --- a/test/cedet/tests/testnsp.cpp +++ b/test/manual/cedet/tests/testnsp.cpp diff --git a/test/cedet/tests/testpolymorph.cpp b/test/manual/cedet/tests/testpolymorph.cpp index 27aa08b155b..27aa08b155b 100644 --- a/test/cedet/tests/testpolymorph.cpp +++ b/test/manual/cedet/tests/testpolymorph.cpp diff --git a/test/cedet/tests/testspp.c b/test/manual/cedet/tests/testspp.c index 02eab53afb6..02eab53afb6 100644 --- a/test/cedet/tests/testspp.c +++ b/test/manual/cedet/tests/testspp.c diff --git a/test/cedet/tests/testsppcomplete.c b/test/manual/cedet/tests/testsppcomplete.c index d7899942285..d7899942285 100644 --- a/test/cedet/tests/testsppcomplete.c +++ b/test/manual/cedet/tests/testsppcomplete.c diff --git a/test/cedet/tests/testsppreplace.c b/test/manual/cedet/tests/testsppreplace.c index 56ef320f752..56ef320f752 100644 --- a/test/cedet/tests/testsppreplace.c +++ b/test/manual/cedet/tests/testsppreplace.c diff --git a/test/cedet/tests/testsppreplaced.c b/test/manual/cedet/tests/testsppreplaced.c index 3ba90aa4ddb..3ba90aa4ddb 100644 --- a/test/cedet/tests/testsppreplaced.c +++ b/test/manual/cedet/tests/testsppreplaced.c diff --git a/test/cedet/tests/testsubclass.cpp b/test/manual/cedet/tests/testsubclass.cpp index e74ca43124a..e74ca43124a 100644 --- a/test/cedet/tests/testsubclass.cpp +++ b/test/manual/cedet/tests/testsubclass.cpp diff --git a/test/cedet/tests/testsubclass.hh b/test/manual/cedet/tests/testsubclass.hh index 6f199c20bd3..6f199c20bd3 100644 --- a/test/cedet/tests/testsubclass.hh +++ b/test/manual/cedet/tests/testsubclass.hh diff --git a/test/cedet/tests/testtypedefs.cpp b/test/manual/cedet/tests/testtypedefs.cpp index e6c91f736bf..e6c91f736bf 100644 --- a/test/cedet/tests/testtypedefs.cpp +++ b/test/manual/cedet/tests/testtypedefs.cpp diff --git a/test/cedet/tests/testvarnames.c b/test/manual/cedet/tests/testvarnames.c index dbc4afb46ba..dbc4afb46ba 100644 --- a/test/cedet/tests/testvarnames.c +++ b/test/manual/cedet/tests/testvarnames.c diff --git a/test/etags/CTAGS.good b/test/manual/etags/CTAGS.good index d392b691dcb..13bb37c2e6a 100644 --- a/test/etags/CTAGS.good +++ b/test/manual/etags/CTAGS.good @@ -36,7 +36,8 @@ ${CHECKOBJS} make-src/Makefile /^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/ ($prog,$_,@list perl-src/yagrip.pl 39 ($string,$flag,@string,@temp,@last perl-src/yagrip.pl 40 (a-forth-constant forth-src/test-forth.fth /^constant (a-forth-constant$/ -(another-forth-word forth-src/test-forth.fth /^: (another-forth-word) ( -- )$/ +(another-forth-word) forth-src/test-forth.fth /^: (another-forth-word) ( -- )$/ +(foo) forth-src/test-forth.fth /^: (foo) 1 ;$/ + ruby-src/test.rb /^ def +(y)$/ + tex-src/texinfo.tex /^\\def+{{\\tt \\char 43}}$/ .PRECIOUS make-src/Makefile /^.PRECIOUS: ETAGS CTAGS ETAGS16 CTAGS16 ETAGS17 CTA/ @@ -170,6 +171,9 @@ ${CHECKOBJS} make-src/Makefile /^${CHECKOBJS}: CFLAGS=-g3 -DNULLFREECHECK=0$/ /wbytes ps-src/rfc1245.ps /^\/wbytes { $/ /wh ps-src/rfc1245.ps /^\/wh { $/ /yen ps-src/rfc1245.ps /^\/yen \/.notdef \/.notdef \/.notdef \/.notdef \/.notdef / +2const forth-src/test-forth.fth /^3 4 2constant 2const$/ +2val forth-src/test-forth.fth /^2const 2value 2val$/ +2var forth-src/test-forth.fth /^2variable 2var$/ :a-forth-dictionary-entry forth-src/test-forth.fth /^create :a-forth-dictionary-entry$/ < tex-src/texinfo.tex /^\\def<{{\\tt \\less}}$/ << ruby-src/test.rb /^ def <<(y)$/ @@ -336,6 +340,13 @@ CHARTAB_SIZE_BITS_1 c-src/emacs/src/lisp.h 1568 CHARTAB_SIZE_BITS_2 c-src/emacs/src/lisp.h 1569 CHARTAB_SIZE_BITS_3 c-src/emacs/src/lisp.h 1570 CHAR_ALT c-src/emacs/src/lisp.h 2445 +CHAR_BIT c-src/emacs/src/lisp.h 2957 +CHAR_BIT c-src/emacs/src/lisp.h 2959 +CHAR_BIT c-src/emacs/src/lisp.h 2964 +CHAR_BIT c-src/emacs/src/lisp.h 2969 +CHAR_BIT c-src/emacs/src/lisp.h 2974 +CHAR_BIT c-src/emacs/src/lisp.h 2978 +CHAR_BIT c-src/emacs/src/lisp.h 2983 CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 593 CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 597 CHAR_CLASS_MAX_LENGTH c-src/emacs/src/regex.h 605 @@ -351,7 +362,6 @@ CHAR_TABLE_REF c-src/emacs/src/lisp.h /^CHAR_TABLE_REF (Lisp_Object ct, int idx) CHAR_TABLE_REF_ASCII c-src/emacs/src/lisp.h /^CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t id/ CHAR_TABLE_SET c-src/emacs/src/lisp.h /^CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Obje/ CHAR_TABLE_STANDARD_SLOTS c-src/emacs/src/lisp.h 1697 -CHAR_TYPE_SIZE cccp.y 87 CHAR_TYPE_SIZE y-src/cccp.y 87 CHECKFLAGS make-src/Makefile /^CHECKFLAGS=-DDEBUG -Wno-unused-function$/ CHECKOBJS make-src/Makefile /^CHECKOBJS=chkmalloc.o chkxm.o$/ @@ -383,13 +393,9 @@ CHECK_VECTOR c-src/emacs/src/lisp.h /^CHECK_VECTOR (Lisp_Object x)$/ CHECK_VECTOR_OR_STRING c-src/emacs/src/lisp.h /^CHECK_VECTOR_OR_STRING (Lisp_Object x)$/ CHECK_WINDOW c-src/emacs/src/lisp.h /^CHECK_WINDOW (Lisp_Object x)$/ CK_ABS_C y-src/parse.y /^#define CK_ABS_C(x) if((x)<MIN_COL || (x)>MAX_COL)/ -CK_ABS_C parse.y /^#define CK_ABS_C(x) if((x)<MIN_COL || (x)>MAX_COL)/ CK_ABS_R y-src/parse.y /^#define CK_ABS_R(x) if((x)<MIN_ROW || (x)>MAX_ROW)/ -CK_ABS_R parse.y /^#define CK_ABS_R(x) if((x)<MIN_ROW || (x)>MAX_ROW)/ CK_REL_C y-src/parse.y /^#define CK_REL_C(x) if( ((x)>0 && MAX_COL-(x)<cu/ -CK_REL_C parse.y /^#define CK_REL_C(x) if( ((x)>0 && MAX_COL-(x)<cu/ CK_REL_R y-src/parse.y /^#define CK_REL_R(x) if( ((x)>0 && MAX_ROW-(x)<cu/ -CK_REL_R parse.y /^#define CK_REL_R(x) if( ((x)>0 && MAX_ROW-(x)<cu/ CMultiChannelCSC19_3D cp-src/c.C 2 CNL c-src/etags.c /^#define CNL() \\$/ CNL_SAVE_DEFINEDEF c-src/etags.c /^#define CNL_SAVE_DEFINEDEF() \\$/ @@ -533,24 +539,10 @@ EMACS_UINT c-src/emacs/src/lisp.h 104 ENTRY c-src/sysdep.h /^#define ENTRY(name) \\$/ ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) unsigned int$/ ENUM_BF c-src/emacs/src/lisp.h /^#define ENUM_BF(TYPE) enum TYPE$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (symbol_redirect) redirect : 3;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (Lisp_Misc_Type) type : 16; \/* = Lisp_M/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (Lisp_Misc_Type) type : 16; \/* = Lisp_M/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (Lisp_Misc_Type) type : 16; \/* = Lisp_/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (Lisp_Misc_Type) type : 16; \/* = Lisp_/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (Lisp_Misc_Type) type : 16; \/* = Lisp_/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ -ENUM_BF c-src/emacs/src/lisp.h /^ ENUM_BF (specbind_tag) kind : CHAR_BIT;$/ EQ c-src/emacs/src/lisp.h /^# define EQ(x, y) lisp_h_EQ (x, y)$/ EQUAL y-src/cccp.c 12 ERLSRC make-src/Makefile /^ERLSRC=gs_dialog.erl lines.erl lists.erl$/ -ERROR y-src/parse.y 303 -ERROR parse.y 303 +ERROR y-src/parse.y 304 ERROR y-src/cccp.c 9 ETAGS make-src/Makefile /^ETAGS: FRC etags ${infiles}$/ ETAGS% make-src/Makefile /^ETAGS%: FRC etags% ${infiles}$/ @@ -588,15 +580,10 @@ FRC make-src/Makefile /^FRC:;$/ FREEFLOOD c-src/emacs/src/gmalloc.c 1858 FSRC make-src/Makefile /^FSRC=entry.for entry.strange_suffix entry.strange$/ FUN0 y-src/parse.y /^yylex FUN0()$/ -FUN0 parse.y /^yylex FUN0()$/ FUN1 y-src/parse.y /^yyerror FUN1(char *, s)$/ FUN1 y-src/parse.y /^str_to_col FUN1(char **,str)$/ -FUN1 parse.y /^yyerror FUN1(char *, s)$/ -FUN1 parse.y /^str_to_col FUN1(char **,str)$/ FUN2 y-src/parse.y /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/ FUN2 y-src/parse.y /^parse_cell_or_range FUN2(char **,ptr, struct rng */ -FUN2 parse.y /^make_list FUN2(YYSTYPE, car, YYSTYPE, cdr)$/ -FUN2 parse.y /^parse_cell_or_range FUN2(char **,ptr, struct rng */ FUNCTIONP c-src/emacs/src/lisp.h /^FUNCTIONP (Lisp_Object obj)$/ FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 4766 FUNCTION_KEY_OFFSET c-src/emacs/src/keyboard.c 5061 @@ -695,8 +682,6 @@ GC_MARK_STACK_CHECK_GCPROS c-src/emacs/src/lisp.h 3173 GC_USE_GCPROS_AS_BEFORE c-src/emacs/src/lisp.h 3171 GC_USE_GCPROS_CHECK_ZOMBIES c-src/emacs/src/lisp.h 3174 GE y-src/parse.c 8 -GENERIC_PTR cccp.y 56 -GENERIC_PTR cccp.y 58 GENERIC_PTR y-src/cccp.y 56 GENERIC_PTR y-src/cccp.y 58 GEQ y-src/cccp.c 15 @@ -740,7 +725,6 @@ INTERVAL c-src/emacs/src/lisp.h 1149 INTMASK c-src/emacs/src/lisp.h 437 INTTYPEBITS c-src/emacs/src/lisp.h 249 INT_BIT c-src/emacs/src/gmalloc.c 124 -INT_TYPE_SIZE cccp.y 91 INT_TYPE_SIZE y-src/cccp.y 91 ISALNUM c-src/etags.c /^#define ISALNUM(c) isalnum (CHAR (c))$/ ISALPHA c-src/etags.c /^#define ISALPHA(c) isalpha (CHAR (c))$/ @@ -833,7 +817,6 @@ LOCK c-src/emacs/src/gmalloc.c /^#define LOCK() \\$/ LOCK c-src/emacs/src/gmalloc.c /^#define LOCK()$/ LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS() \\$/ LOCK_ALIGNED_BLOCKS c-src/emacs/src/gmalloc.c /^#define LOCK_ALIGNED_BLOCKS()$/ -LONG_TYPE_SIZE cccp.y 95 LONG_TYPE_SIZE y-src/cccp.y 95 LOOKING_AT c-src/etags.c /^#define LOOKING_AT(cp, kw) \/* kw is the keyword, / LOOKING_AT_NOCASE c-src/etags.c /^#define LOOKING_AT_NOCASE(cp, kw) \/* the keyword i/ @@ -945,7 +928,6 @@ MAX_ENCODED_BYTES c-src/emacs/src/keyboard.c 2254 MAX_HASH_VALUE c-src/etags.c 2329 MAX_WORD_LENGTH c-src/etags.c 2327 MAYBEREL y-src/parse.y /^#define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1])/ -MAYBEREL parse.y /^#define MAYBEREL(p) (*(p)=='[' && (isdigit((p)[1])/ MBYTES objc-src/PackInsp.m 59 MCHECK_DISABLED c-src/emacs/src/gmalloc.c 285 MCHECK_FREE c-src/emacs/src/gmalloc.c 287 @@ -988,7 +970,6 @@ Makefile_filenames c-src/etags.c 603 Makefile_help c-src/etags.c 605 Makefile_targets c-src/etags.c /^Makefile_targets (FILE *inf)$/ Mc cp-src/c.C /^int main (void) { my_function0(0); my_function1(1)/ -Mcccp cccp.y /^main ()$/ Mcccp y-src/cccp.y /^main ()$/ Mconway.cpp cp-src/conway.cpp /^void main(void)$/ Metags c-src/etags.c /^main (int argc, char **argv)$/ @@ -1017,9 +998,7 @@ NONPOINTER_BITS c-src/emacs/src/lisp.h 78 NONPOINTER_BITS c-src/emacs/src/lisp.h 80 NONSRCS make-src/Makefile /^NONSRCS=entry.strange lists.erl clheir.hpp.gz$/ NOTEQUAL y-src/cccp.c 13 -NULL cccp.y 51 NULL y-src/cccp.y 51 -NULL_PTR cccp.y 63 NULL_PTR y-src/cccp.y 63 NUMSTATS objc-src/PackInsp.h 36 NUM_MOD_NAMES c-src/emacs/src/keyboard.c 6325 @@ -1303,6 +1282,8 @@ SAVE_OBJECT c-src/emacs/src/lisp.h 2051 SAVE_POINTER c-src/emacs/src/lisp.h 2050 SAVE_SLOT_BITS c-src/emacs/src/lisp.h 2055 SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2062 +SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2114 +SAVE_TYPE_BITS c-src/emacs/src/lisp.h 2123 SAVE_TYPE_FUNCPTR_PTR_OBJ c-src/emacs/src/lisp.h 2076 SAVE_TYPE_INT_INT c-src/emacs/src/lisp.h 2066 SAVE_TYPE_INT_INT_INT c-src/emacs/src/lisp.h 2067 @@ -1338,6 +1319,7 @@ SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c /^#define SINGLE_LETTER_MOD(BIT) SINGLE_LETTER_MOD c-src/emacs/src/keyboard.c 6763 SIZEFORMAT objc-src/PackInsp.m 57 SPECPDL_BACKTRACE c-src/emacs/src/lisp.h 2948 +SPECPDL_INDEX c-src/emacs/src/lisp.h /^SPECPDL_INDEX (void)$/ SPECPDL_LET c-src/emacs/src/lisp.h 2949 SPECPDL_LET_DEFAULT c-src/emacs/src/lisp.h 2952 SPECPDL_LET_LOCAL c-src/emacs/src/lisp.h 2951 @@ -1490,7 +1472,6 @@ USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4652 USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4658 USE_STACK_LISP_OBJECTS c-src/emacs/src/lisp.h 4659 USE_STACK_STRING c-src/emacs/src/lisp.h 4691 -U_CHAR cccp.y 38 U_CHAR y-src/cccp.y 38 Unlock/p ada-src/2ataspri.adb /^ procedure Unlock (L : in out Lock) is$/ Unlock/p ada-src/2ataspri.ads /^ procedure Unlock (L : in out Lock);$/ @@ -1520,7 +1501,6 @@ Vpre_abbrev_expand_hook c-src/abbrev.c 83 WAIT_READING_MAX c-src/emacs/src/lisp.h 4281 WAIT_READING_MAX c-src/emacs/src/lisp.h 4283 WARNINGS make-src/Makefile /^WARNINGS=-pedantic -Wall -Wpointer-arith -Winline / -WCHAR_TYPE_SIZE cccp.y 99 WCHAR_TYPE_SIZE y-src/cccp.y 99 WHITE cp-src/screen.hpp 27 WINDOWP c-src/emacs/src/lisp.h /^WINDOWP (Lisp_Object a)$/ @@ -1622,8 +1602,6 @@ YYBACKUP /usr/share/bison/bison.simple /^#define YYBACKUP(Token, Value) \\$/ YYBACKUP /usr/share/bison/bison.simple /^#define YYBACKUP(Token, Value) \\$/ YYBISON y-src/parse.c 4 YYBISON y-src/cccp.c 4 -YYDEBUG parse.y 88 -YYDEBUG cccp.y 122 YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args) \\$/ YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args)$/ YYDPRINTF /usr/share/bison/bison.simple /^# define YYDPRINTF(Args) \\$/ @@ -1638,16 +1616,10 @@ YYERROR /usr/share/bison/bison.simple 154 YYERROR /usr/share/bison/bison.simple 155 YYFAIL /usr/share/bison/bison.simple 158 YYFAIL /usr/share/bison/bison.simple 159 -YYFINAL parse.y 93 -YYFINAL cccp.y 127 -YYFLAG parse.y 94 -YYFLAG cccp.y 128 YYFPRINTF /usr/share/bison/bison.simple 225 YYFPRINTF /usr/share/bison/bison.simple 226 YYINITDEPTH /usr/share/bison/bison.simple 244 YYINITDEPTH /usr/share/bison/bison.simple 245 -YYLAST parse.y 266 -YYLAST cccp.y 274 YYLEX /usr/share/bison/bison.simple 200 YYLEX /usr/share/bison/bison.simple 202 YYLEX /usr/share/bison/bison.simple 206 @@ -1664,8 +1636,6 @@ YYMAXDEPTH /usr/share/bison/bison.simple 255 YYMAXDEPTH /usr/share/bison/bison.simple 259 YYMAXDEPTH /usr/share/bison/bison.simple 256 YYMAXDEPTH /usr/share/bison/bison.simple 260 -YYNTBASE parse.y 95 -YYNTBASE cccp.y 129 YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 351 YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 354 YYPARSE_PARAM_ARG /usr/share/bison/bison.simple 358 @@ -1728,16 +1698,10 @@ YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) std::x$/ YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) x$/ YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) std::x$/ YYSTD /usr/share/bison/bison.simple /^# define YYSTD(x) x$/ -YYSTYPE y-src/parse.y 71 YYSTYPE y-src/parse.y 72 -YYSTYPE parse.y 71 -YYSTYPE parse.y 72 -YYSTYPE parse.y 85 -YYSTYPE cccp.y 119 +YYSTYPE y-src/parse.y 73 YYTERROR /usr/share/bison/bison.simple 177 YYTERROR /usr/share/bison/bison.simple 178 -YYTRANSLATE parse.y /^#define YYTRANSLATE(x) ((unsigned)(x) <= 278 ? yyt/ -YYTRANSLATE cccp.y /^#define YYTRANSLATE(x) ((unsigned)(x) <= 269 ? yyt/ YY_DECL_NON_LSP_VARIABLES /usr/share/bison/bison.simple 374 YY_DECL_NON_LSP_VARIABLES /usr/share/bison/bison.simple 374 YY_DECL_VARIABLES /usr/share/bison/bison.simple 385 @@ -2512,7 +2476,6 @@ add_node c-src/etags.c /^add_node (node *np, node **cur_node_p)$/ add_regex c-src/etags.c /^add_regex (char *regexp_pattern, language *lang)$/ add_user_signal c-src/emacs/src/keyboard.c /^add_user_signal (int sig, const char *name)$/ addnoise html-src/algrthms.html /^Adding Noise to the$/ -address cccp.y 114 address y-src/cccp.y 113 adjust_point_for_property c-src/emacs/src/keyboard.c /^adjust_point_for_property (ptrdiff_t last_pt, bool/ agent cp-src/clheir.hpp 75 @@ -2550,12 +2513,14 @@ appendix_toc perl-src/htlmify-cystic 16 apply_modifiers c-src/emacs/src/keyboard.c /^apply_modifiers (int modifiers, Lisp_Object base)$/ apply_modifiers_uncached c-src/emacs/src/keyboard.c /^apply_modifiers_uncached (int modifiers, char *bas/ aref_addr c-src/emacs/src/lisp.h /^aref_addr (Lisp_Object array, ptrdiff_t idx)$/ +arg c-src/emacs/src/lisp.h 2961 +arg c-src/emacs/src/lisp.h 2966 +arg c-src/emacs/src/lisp.h 2971 arg c-src/h.h 13 arg_type c-src/etags.c 250 -arglist cccp.y 41 arglist y-src/cccp.y 41 -argno cccp.y 45 argno y-src/cccp.y 45 +args c-src/emacs/src/lisp.h 2986 args c-src/h.h 30 argsindent tex-src/texinfo.tex /^\\newskip\\defargsindent \\defargsindent=50pt$/ argsindent tex-src/texinfo.tex /^\\dimen1=\\hsize \\advance \\dimen1 by -\\defargsindent/ @@ -2651,9 +2616,11 @@ bool_vector_words c-src/emacs/src/lisp.h /^bool_vector_words (EMACS_INT size)$/ boolvar c-src/emacs/src/lisp.h 2287 bracelev c-src/etags.c 2520 bsp_DevId c-src/h.h 25 +bt c-src/emacs/src/lisp.h 2988 btowc c-src/emacs/src/regex.h /^# define btowc(c) c$/ buffer c-src/etags.c 238 buffer c-src/emacs/src/regex.h 341 +buffer c-src/emacs/src/lisp.h 2000 buffer c-src/h.h 119 build prol-src/natded.prolog /^build([],Left,Left).$/ build_pure_c_string c-src/emacs/src/lisp.h /^build_pure_c_string (const char *str)$/ @@ -2667,6 +2634,7 @@ button_down_time c-src/emacs/src/keyboard.c 5218 byte_stack c-src/emacs/src/lisp.h 3049 bytecode_dest c-src/emacs/src/lisp.h 3037 bytecode_top c-src/emacs/src/lisp.h 3036 +bytepos c-src/emacs/src/lisp.h 2016 bytes_free c-src/emacs/src/gmalloc.c 314 bytes_total c-src/emacs/src/gmalloc.c 310 bytes_used c-src/emacs/src/gmalloc.c 312 @@ -2692,12 +2660,14 @@ cat prol-src/natded.prolog /^cat(A, Alpha@Beta, Ass3, Qs3, tree(fe,A:Alpha@Beta/ cat_atoms prol-src/natded.prolog /^cat_atoms(A1,A2,A3):-$/ cccccccccc c-src/h.h 115 cdr c-src/emacs/src/lisp.h 1159 -cell y-src/parse.y 278 +cell y-src/parse.y 279 cgrep html-src/software.html /^cgrep$/ chain c-src/emacs/src/lisp.h 1162 +chain c-src/emacs/src/lisp.h 2206 chain c-src/emacs/src/lisp.h 2396 char_bits c-src/emacs/src/lisp.h 2443 char_table_specials c-src/emacs/src/lisp.h 1692 +charpos c-src/emacs/src/lisp.h 2011 charset_unibyte c-src/emacs/src/regex.h 410 chartonmstr pas-src/common.pas /^function chartonmstr; (*($/ checkQuotation php-src/lce_functions.php /^ function checkQuotation($str)$/ @@ -2749,8 +2719,8 @@ conalgorithm html-src/algrthms.html /^Convolutionally$/ concat c-src/etags.c /^concat (const char *s1, const char *s2, const char/ concatenatenamestrings pas-src/common.pas /^function concatenatenamestrings; (*($/ consider_token c-src/etags.c /^consider_token (char *str, int len, int c, int *c_/ +constant c-src/emacs/src/lisp.h 668 constant c-src/h.h 29 -constant cccp.y 113 constant y-src/cccp.y 112 constant_args c-src/h.h 27 constype c-src/emacs/src/lisp.h 3739 @@ -2766,6 +2736,7 @@ counter cp-src/c.C 36 cow cp-src/c.C 127 cow cp-src/c.C 131 cplpl c-src/etags.c 2935 +create-bar forth-src/test-forth.fth /^: create-bar foo ;$/ createPOEntries php-src/lce_functions.php /^ function createPOEntries()$/ createWidgets pyt-src/server.py /^ def createWidgets(self, host):$/ createWidgets pyt-src/server.py /^ def createWidgets(self):$/ @@ -2790,7 +2761,9 @@ data c-src/emacs/src/lisp.h 2129 data c-src/emacs/src/lisp.h 2395 ddefineseen c-src/etags.c 2462 debian-bug html-src/software.html /^debian-bug.el$/ +debug_on_exit c-src/emacs/src/lisp.h 2984 decimalKey objcpp-src/SimpleCalc.M /^- decimalKey:sender$/ +declared_special c-src/emacs/src/lisp.h 676 decode_timer c-src/emacs/src/keyboard.c /^decode_timer (Lisp_Object timer, struct timespec */ def c-src/h.h 35 def c-src/h.h 38 @@ -2888,6 +2861,7 @@ egetenv c-src/emacs/src/lisp.h /^egetenv (const char *var)$/ emacs_abort c-src/emacs/src/lisp.h /^extern _Noreturn void emacs_abort (void) NO_INLINE/ end c-src/emacs/src/regex.h 432 end c-src/emacs/src/keyboard.c 8753 +end c-src/emacs/src/lisp.h 2039 endtoken c-src/etags.c /^#define endtoken(c) (_etk[CHAR (c)]) \/* c ends tok/ enter_critical_section c-src/h.h 116 entry perl-src/htlmify-cystic 218 @@ -2905,7 +2879,6 @@ erlang_func c-src/etags.c /^erlang_func (char *s, char *last)$/ error c-src/etags.c /^static void error (const char *, ...) ATTRIBUTE_FO/ error c-src/etags.c /^error (const char *format, ...)$/ error c-src/emacs/src/lisp.h /^extern _Noreturn void error (const char *, ...) AT/ -error cccp.y /^error (msg)$/ error y-src/cccp.y /^error (msg)$/ error_signaled c-src/etags.c 264 etags el-src/emacs/lisp/progmodes/etags.el /^(defgroup etags nil "Tags tables."$/ @@ -2939,19 +2912,18 @@ exit c-src/exit.c /^DEFUN(exit, (status), int status)$/ exit c-src/exit.strange_suffix /^DEFUN(exit, (status), int status)$/ exit-recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("exit-recursive-edit", Fexit_recursive_edit/ exit_critical_to_previous c-src/h.h 117 -exp y-src/parse.y 94 +exp y-src/parse.y 95 exp y-src/atest.y 2 exp y-src/cccp.y 156 exp y-src/cccp.y 185 exp1 y-src/cccp.y 148 -exp_list y-src/parse.y 262 +exp_list y-src/parse.y 263 expand-abbrev c-src/abbrev.c /^DEFUN ("expand-abbrev", Fexpand_abbrev, Sexpand_ab/ expandmng prol-src/natded.prolog /^expandmng(var(V),var(V)).$/ expandmng_tree prol-src/natded.prolog /^expandmng_tree(tree(Rule,Syn:Sem,Trees),$/ expandmng_trees prol-src/natded.prolog /^expandmng_trees([],[]).$/ expandsyn prol-src/natded.prolog /^expandsyn(Syn,Syn):-$/ explicitly-quoted-pending-delete-mode el-src/TAGTEST.EL /^(defalias (quote explicitly-quoted-pending-delete-/ -expression_value cccp.y 68 expression_value y-src/cccp.y 68 extras c-src/emacs/src/lisp.h 1603 extvar c-src/h.h 109 @@ -2987,6 +2959,7 @@ fastmap c-src/emacs/src/regex.h 355 fastmap_accurate c-src/emacs/src/regex.h 383 fatal c-src/etags.c /^fatal (const char *s1, const char *s2)$/ fatala c.c /^void fatala () __attribute__ ((noreturn));$/ +fconst forth-src/test-forth.fth /^3.1415e fconstant fconst$/ fdHandler objc-src/Subprocess.m /^- fdHandler:(int)theFd$/ fdHandler objc-src/Subprocess.m /^fdHandler (int theFd, id self)$/ fdefunkey c-src/etags.c 2409 @@ -3040,8 +3013,7 @@ flag2str pyt-src/server.py /^def flag2str(value, string):$/ flistseen c-src/etags.c 2415 fn c-src/exit.c /^ void EXFUN((*fn[1]), (NOARGS));$/ fn c-src/exit.strange_suffix /^ void EXFUN((*fn[1]), (NOARGS));$/ -fnin y-src/parse.y 67 -fnin parse.y 67 +fnin y-src/parse.y 68 focus_set pyt-src/server.py /^ def focus_set(self):$/ follow_key c-src/emacs/src/keyboard.c /^follow_key (Lisp_Object keymap, Lisp_Object key)$/ fonts tex-src/texinfo.tex /^\\obeyspaces \\obeylines \\ninett \\indexfonts \\rawbac/ @@ -3059,6 +3031,7 @@ foo cp-src/x.cc /^XX::foo()$/ foo f-src/entry.for /^ character*(*) function foo()$/ foo f-src/entry.strange_suffix /^ character*(*) function foo()$/ foo f-src/entry.strange /^ character*(*) function foo()$/ +foo forth-src/test-forth.fth /^: foo (foo) ;$/ foo php-src/ptest.php /^foo()$/ foo ruby-src/test1.ru /^ attr_reader :foo$/ foo! ruby-src/test1.ru /^ def foo!$/ @@ -3090,6 +3063,10 @@ free_var prol-src/natded.prolog /^free_var(var(V),var(V)).$/ freehook c-src/emacs/src/gmalloc.c /^freehook (void *ptr)$/ fresh_vars prol-src/natded.prolog /^fresh_vars(var(V),var(V)).$/ fstartlist c-src/etags.c 2413 +func c-src/emacs/src/lisp.h /^ void (*func) (Lisp_Object);$/ +func c-src/emacs/src/lisp.h /^ void (*func) (void *);$/ +func c-src/emacs/src/lisp.h /^ void (*func) (int);$/ +func c-src/emacs/src/lisp.h /^ void (*func) (void);$/ func1 c.c /^int func1$/ func2 c.c /^int func2 (a,b$/ func_key_syms c-src/emacs/src/keyboard.c 4626 @@ -3100,7 +3077,10 @@ function c-src/etags.c 194 function c-src/emacs/src/lisp.h 694 function c-src/emacs/src/lisp.h 1685 function c-src/emacs/src/lisp.h 2197 +function c-src/emacs/src/lisp.h 2985 functionp c-src/emacs/src/lisp.h /^functionp (Lisp_Object object)$/ +fval forth-src/test-forth.fth /^fconst fvalue fval$/ +fvar forth-src/test-forth.fth /^fvariable fvar$/ fvdef c-src/etags.c 2418 fvextern c-src/etags.c 2420 fvnameseen c-src/etags.c 2412 @@ -3113,6 +3093,11 @@ gather pyt-src/server.py /^ def gather(self):$/ gather pyt-src/server.py /^ def gather(self):$/ gc_aset c-src/emacs/src/lisp.h /^gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Ob/ gcmarkbit c-src/emacs/src/lisp.h 656 +gcmarkbit c-src/emacs/src/lisp.h 1974 +gcmarkbit c-src/emacs/src/lisp.h 1981 +gcmarkbit c-src/emacs/src/lisp.h 2035 +gcmarkbit c-src/emacs/src/lisp.h 2113 +gcmarkbit c-src/emacs/src/lisp.h 2204 gcpro c-src/emacs/src/lisp.h 3042 gcpro c-src/emacs/src/lisp.h 3132 gen_help_event c-src/emacs/src/keyboard.c /^gen_help_event (Lisp_Object help, Lisp_Object fram/ @@ -3230,7 +3215,6 @@ inita c.c /^static void inita () {}$/ initb c.c /^static void initb () {}$/ initial_kboard c-src/emacs/src/keyboard.c 84 initialize-new-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun initialize-new-tags-table ()$/ -initialize_random_junk cccp.y /^initialize_random_junk ()$/ initialize_random_junk y-src/cccp.y /^initialize_random_junk ()$/ input-pending-p c-src/emacs/src/keyboard.c /^DEFUN ("input-pending-p", Finput_pending_p, Sinput/ input_available_clear_time c-src/emacs/src/keyboard.c 324 @@ -3238,19 +3222,17 @@ input_pending c-src/emacs/src/keyboard.c 239 input_polling_used c-src/emacs/src/keyboard.c /^input_polling_used (void)$/ input_was_pending c-src/emacs/src/keyboard.c 287 insert-abbrev-table-description c-src/abbrev.c /^DEFUN ("insert-abbrev-table-description", Finsert_/ +insertion_type c-src/emacs/src/lisp.h 1989 insertname pas-src/common.pas /^function insertname;(*($/ instance_method ruby-src/test.rb /^ def instance_method$/ instance_method_equals= ruby-src/test.rb /^ def instance_method_equals=$/ instance_method_exclamation! ruby-src/test.rb /^ def instance_method_exclamation!$/ instance_method_question? ruby-src/test.rb /^ def instance_method_question?$/ -instr y-src/parse.y 80 -instr parse.y 80 +instr y-src/parse.y 81 instruct c-src/etags.c 2527 intNumber go-src/test1.go 13 integer c-src/emacs/src/lisp.h 2127 -integer cccp.y 113 integer y-src/cccp.y 112 -integer_overflow cccp.y /^integer_overflow ()$/ integer_overflow y-src/cccp.y /^integer_overflow ()$/ integertonmstr pas-src/common.pas /^function integertonmstr; (* (TheInteger : integer)/ intensity1 f-src/entry.for /^ & intensity1(efv,fv,svin,svquad,sfpv,maxp,val/ @@ -3260,6 +3242,7 @@ interface_locate c-src/c.c /^interface_locate(void)$/ intern c-src/emacs/src/lisp.h /^intern (const char *str)$/ intern_c_string c-src/emacs/src/lisp.h /^intern_c_string (const char *str)$/ internal_last_event_frame c-src/emacs/src/keyboard.c 228 +interned c-src/emacs/src/lisp.h 672 interpreters c-src/etags.c 197 interrupt_input c-src/emacs/src/keyboard.c 328 interrupt_input_blocked c-src/emacs/src/keyboard.c 76 @@ -3281,11 +3264,8 @@ isLeap cp-src/functions.cpp /^bool isLeap ( int year ){$/ is_curly_brace_form c-src/h.h 54 is_explicit c-src/h.h 49 is_func c-src/etags.c 221 -is_hor_space cccp.y 953 is_hor_space y-src/cccp.y 953 -is_idchar cccp.y 948 is_idchar y-src/cccp.y 948 -is_idstart cccp.y 950 is_idstart y-src/cccp.y 950 is_muldiv_operation cp-src/c.C /^is_muldiv_operation(pc)$/ is_ordset prol-src/ordsets.prolog /^is_ordset(X) :- var(X), !, fail.$/ @@ -3318,9 +3298,7 @@ keyval prol-src/natded.prolog /^keyval(key(Key,Val)) --> [Key,'='], valseq(Val). keyvalcgi prol-src/natded.prolog /^keyvalcgi(Key,Val):-$/ keyvalscgi prol-src/natded.prolog /^keyvalscgi(KeyVals),$/ keyvalseq prol-src/natded.prolog /^keyvalseq([KeyVal|KeyVals]) --> $/ -keyword_parsing cccp.y 73 keyword_parsing y-src/cccp.y 73 -keywords cccp.y 115 keywords y-src/cccp.y 114 keywords y-src/cccp.y 306 kind c-src/emacs/src/keyboard.c 11024 @@ -3369,14 +3347,12 @@ lce_textdomain php-src/lce_functions.php /^ function lce_textdomain($domain lce_textdomain php-src/lce_functions.php /^ function lce_textdomain($domain)$/ leasqr html-src/software.html /^Leasqr$/ left c-src/etags.c 216 -left_shift cccp.y /^left_shift (a, b)$/ left_shift y-src/cccp.y /^left_shift (a, b)$/ len c-src/etags.c 237 length c-src/etags.c 2495 -length cccp.y 44 -length cccp.y 114 length y-src/cccp.y 44 length y-src/cccp.y 113 +let c-src/emacs/src/lisp.h 2981 letter tex-src/texinfo.tex /^\\chapmacro {#1}{Appendix \\appendixletter}%$/ letter tex-src/texinfo.tex /^ {#1}{Appendix \\appendixletter}{\\noexpand\\folio}}/ letter tex-src/texinfo.tex /^\\gdef\\thissection{#1}\\secheading {#1}{\\appendixlet/ @@ -3388,13 +3364,12 @@ letter tex-src/texinfo.tex /^ {\\appendixletter}$/ letter: tex-src/texinfo.tex /^\\xdef\\thischapter{Appendix \\appendixletter: \\noexp/ level c-src/emacs/src/lisp.h 3153 lex prol-src/natded.prolog /^lex(W,SynOut,Sem):-$/ -lexptr cccp.y 332 lexptr y-src/cccp.y 332 licenze html-src/softwarelibero.html /^Licenze d'uso di un programma$/ limit cp-src/Range.h /^ double limit (void) const { return rng_limit; }$/ line c-src/etags.c 2493 line perl-src/htlmify-cystic 37 -line y-src/parse.y 86 +line y-src/parse.y 87 lineCount php-src/lce_functions.php /^ function lineCount($entry)$/ linebuffer c-src/etags.c 239 linebuffer_init c-src/etags.c /^linebuffer_init (linebuffer *lbp)$/ @@ -3462,7 +3437,6 @@ loadPORManager php-src/lce_functions.php /^ function &loadPORManager()$/ local_if_set c-src/emacs/src/lisp.h 2338 location cp-src/clheir.hpp 33 location cp-src/clheir.hpp /^ location() { }$/ -lookup cccp.y /^lookup (name, len, hash)$/ lookup y-src/cccp.y /^lookup (name, len, hash)$/ lowcase c-src/etags.c /^#define lowcase(c) tolower (CHAR (c))$/ lucid_event_type_list_p c-src/emacs/src/keyboard.c /^lucid_event_type_list_p (Lisp_Object object)$/ @@ -3573,6 +3547,7 @@ my_struct c.c 226 my_struct c-src/h.h 91 my_typedef c.c 228 my_typedef c-src/h.h 93 +mypi forth-src/test-forth.fth /^synonym mypi fconst$/ n c-src/exit.c 28 n c-src/exit.strange_suffix 28 name c-src/getopt.h 76 @@ -3582,6 +3557,7 @@ name c-src/etags.c 218 name c-src/etags.c 261 name c-src/etags.c 2271 name c-src/emacs/src/keyboard.c 7241 +name c-src/emacs/src/lisp.h 682 name c-src/emacs/src/lisp.h 1808 name c-src/emacs/src/lisp.h 3144 name perl-src/htlmify-cystic 357 @@ -3601,14 +3577,13 @@ name tex-src/texinfo.tex /^\\begingroup\\defname {#1}{User Option}%$/ name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#1} #2}{Variable}%$/ name tex-src/texinfo.tex /^\\begingroup\\defname {\\code{#2} #3}{#1}$/ name tex-src/texinfo.tex /^\\begingroup\\defname {#2}{#1}\\deftpargs{#3}\\endgrou/ -name cccp.y 43 -name cccp.y 114 -name cccp.y 114 name y-src/cccp.y 43 name y-src/cccp.y 113 name y-src/cccp.y 113 named c-src/etags.c 2505 namestringequal pas-src/common.pas /^function namestringequal;(*(var Name1,Name2 : Name/ +nargs c-src/emacs/src/lisp.h 2987 +need_adjustment c-src/emacs/src/lisp.h 1986 neighbors cp-src/clheir.hpp 59 nelem cp-src/Range.h /^ int nelem (void) const { return rng_nelem; }$/ nestlev c-src/etags.c 2525 @@ -3627,10 +3602,11 @@ next c-src/emacs/src/keyboard.c 861 next c-src/emacs/src/keyboard.c 7246 next c-src/emacs/src/lisp.h 700 next c-src/emacs/src/lisp.h 1848 +next c-src/emacs/src/lisp.h 2009 +next c-src/emacs/src/lisp.h 2037 next c-src/emacs/src/lisp.h 2192 next c-src/emacs/src/lisp.h 3028 next c-src/emacs/src/lisp.h 3134 -next cccp.y 42 next y-src/cccp.y 42 next-file el-src/emacs/lisp/progmodes/etags.el /^(defun next-file (&optional initialize novisit)$/ next-file-list el-src/emacs/lisp/progmodes/etags.el /^(defvar next-file-list nil$/ @@ -3703,10 +3679,8 @@ object c-src/emacs/src/lisp.h 2128 object_registry cp-src/clheir.cpp 10 objtag c-src/etags.c 2453 objvar c-src/emacs/src/lisp.h 2297 -obstack_chunk_alloc y-src/parse.y 46 -obstack_chunk_alloc parse.y 46 -obstack_chunk_free y-src/parse.y 47 -obstack_chunk_free parse.y 47 +obstack_chunk_alloc y-src/parse.y 47 +obstack_chunk_free y-src/parse.y 48 ocatseen c-src/etags.c 2477 octave_MDiagArray2_h cp-src/MDiagArray2.h 29 octave_Range_h cp-src/Range.h 24 @@ -3719,6 +3693,7 @@ oimplementation c-src/etags.c 2474 oinbody c-src/etags.c 2478 ok objc-src/PackInsp.m /^-ok:sender$/ ok_to_echo_at_next_pause c-src/emacs/src/keyboard.c 159 +old_value c-src/emacs/src/lisp.h 2980 omethodcolon c-src/etags.c 2481 omethodparm c-src/etags.c 2482 omethodsign c-src/etags.c 2479 @@ -3729,7 +3704,6 @@ open objc-src/PackInsp.m /^-open:sender$/ open-dribble-file c-src/emacs/src/keyboard.c /^DEFUN ("open-dribble-file", Fopen_dribble_file, So/ openInWorkspace objc-src/PackInsp.m /^static void openInWorkspace(const char *filename)$/ operationKeys objcpp-src/SimpleCalc.M /^- operationKeys:sender$/ -operator cccp.y 438 operator y-src/cccp.y 438 operator ++ cp-src/functions.cpp /^Date & Date::operator ++ ( void ){$/ operator += cp-src/functions.cpp /^Date & Date::operator += ( int days ){$/ @@ -3784,6 +3758,8 @@ outputtable html-src/algrthms.html /^Output$/ outsyn prol-src/natded.prolog /^outsyn(['Any'],_).$/ p c-src/emacs/src/lisp.h 4673 p c-src/emacs/src/lisp.h 4679 +p.x forth-src/test-forth.fth /^ 1 CELLS +FIELD p.x \\ A single cell filed name/ +p.y forth-src/test-forth.fth /^ 1 CELLS +FIELD p.y \\ A single cell field name/ p/f ada-src/etags-test-for.ada /^ function p pragma Import (C,$/ p/f ada-src/etags-test-for.ada /^function p ("p");$/ pD c-src/emacs/src/lisp.h 165 @@ -3803,23 +3779,16 @@ parent c-src/emacs/src/keyboard.c 8745 parent c-src/emacs/src/lisp.h 1590 parse prol-src/natded.prolog /^parse(Ws,Cat):-$/ parseFromVars php-src/lce_functions.php /^ function parseFromVars($prefix)$/ -parse_c_expression cccp.y /^parse_c_expression (string)$/ parse_c_expression y-src/cccp.y /^parse_c_expression (string)$/ parse_cgi prol-src/natded.prolog /^parse_cgi(TokenList,KeyVals):-$/ -parse_error y-src/parse.y 81 -parse_error parse.y 81 -parse_escape cccp.y /^parse_escape (string_ptr)$/ +parse_error y-src/parse.y 82 parse_escape y-src/cccp.y /^parse_escape (string_ptr)$/ -parse_hash y-src/parse.y 63 -parse_hash parse.y 63 +parse_hash y-src/parse.y 64 parse_menu_item c-src/emacs/src/keyboard.c /^parse_menu_item (Lisp_Object item, int inmenubar)$/ parse_modifiers c-src/emacs/src/keyboard.c /^parse_modifiers (Lisp_Object symbol)$/ parse_modifiers_uncached c-src/emacs/src/keyboard.c /^parse_modifiers_uncached (Lisp_Object symbol, ptrd/ -parse_number cccp.y /^parse_number (olen)$/ parse_number y-src/cccp.y /^parse_number (olen)$/ -parse_return y-src/parse.y 73 -parse_return parse.y 73 -parse_return_error cccp.y 70 +parse_return y-src/parse.y 74 parse_return_error y-src/cccp.y 70 parse_solitary_modifier c-src/emacs/src/keyboard.c /^parse_solitary_modifier (Lisp_Object symbol)$/ parse_tool_bar_item c-src/emacs/src/keyboard.c /^parse_tool_bar_item (Lisp_Object key, Lisp_Object / @@ -3832,13 +3801,16 @@ pending_signals c-src/emacs/src/keyboard.c 80 pfatal c-src/etags.c /^pfatal (const char *s1)$/ pfdset c-src/h.h 57 pfnote c-src/etags.c /^pfnote (char *name, bool is_func, char *linestart,/ +pinned c-src/emacs/src/lisp.h 679 plain_C_entries c-src/etags.c /^plain_C_entries (FILE *inf)$/ plain_C_suffixes c-src/etags.c 643 plainc c-src/etags.c 2934 plist c-src/emacs/src/lisp.h 697 +plist c-src/emacs/src/lisp.h 2040 plus cp-src/functions.cpp /^void Date::plus ( int days , int month , int year / plus go-src/test1.go 5 plusvalseq prol-src/natded.prolog /^plusvalseq([]) --> [].$/ +point forth-src/test-forth.fth /^BEGIN-STRUCTURE point \\ create the named structure/ pointer c-src/emacs/src/lisp.h 2125 poll_for_input c-src/emacs/src/keyboard.c /^poll_for_input (struct atimer *timer)$/ poll_for_input_1 c-src/emacs/src/keyboard.c /^poll_for_input_1 (void)$/ @@ -3852,7 +3824,6 @@ position_to_Time c-src/emacs/src/keyboard.c /^position_to_Time (ptrdiff_t pos)$/ posix_memalign c-src/emacs/src/gmalloc.c /^posix_memalign (void **memptr, size_t alignment, s/ posn-at-point c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-point", Fposn_at_point, Sposn_at_p/ posn-at-x-y c-src/emacs/src/keyboard.c /^DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, / -possible_sum_sign cccp.y /^#define possible_sum_sign(a, b, sum) ((((a) ^ (b))/ possible_sum_sign y-src/cccp.y /^#define possible_sum_sign(a, b, sum) ((((a) ^ (b))/ post pyt-src/server.py /^ def post(self):$/ post pyt-src/server.py /^ def post(self):$/ @@ -3926,8 +3897,8 @@ qux= ruby-src/test1.ru /^ def qux=(tee)$/ r0 c-src/sysdep.h 54 r1 c-src/sysdep.h 55 r_alloc c-src/emacs/src/lisp.h /^extern void *r_alloc (void **, size_t) ATTRIBUTE_A/ -range_exp y-src/parse.y 268 -range_exp_list y-src/parse.y 272 +range_exp y-src/parse.y 269 +range_exp_list y-src/parse.y 273 raw_keybuf c-src/emacs/src/keyboard.c 116 raw_keybuf_count c-src/emacs/src/keyboard.c 117 rbtp c.c 240 @@ -3982,6 +3953,7 @@ recursion-depth c-src/emacs/src/keyboard.c /^DEFUN ("recursion-depth", Frecursio recursive-edit c-src/emacs/src/keyboard.c /^DEFUN ("recursive-edit", Frecursive_edit, Srecursi/ recursive_edit_1 c-src/emacs/src/keyboard.c /^recursive_edit_1 (void)$/ recursive_edit_unwind c-src/emacs/src/keyboard.c /^recursive_edit_unwind (Lisp_Object buffer)$/ +redirect c-src/emacs/src/lisp.h 663 reduce prol-src/natded.prolog /^reduce((X^M)@N,L):- % beta reduction$/ reduce_subterm prol-src/natded.prolog /^reduce_subterm(M,M2):-$/ refreshPort pyt-src/server.py /^ def refreshPort(self):$/ @@ -4020,7 +3992,6 @@ return_to_command_loop c-src/emacs/src/keyboard.c 135 reverse prol-src/natded.prolog /^reverse([],Ws,Ws).$/ revert objc-src/PackInsp.m /^-revert:sender$/ right c-src/etags.c 216 -right_shift cccp.y /^right_shift (a, b)$/ right_shift y-src/cccp.y /^right_shift (a, b)$/ ring1 c.c 241 ring2 c.c 242 @@ -4149,6 +4120,10 @@ snone c-src/etags.c 2443 some_mouse_moved c-src/emacs/src/keyboard.c /^some_mouse_moved (void)$/ space tex-src/texinfo.tex /^ {#2\\labelspace #1}\\dotfill\\doshortpageno{#3}}%/ space tex-src/texinfo.tex /^ \\dosubsubsecentry{#2.#3.#4.#5\\labelspace#1}{#6}}/ +spacer c-src/emacs/src/lisp.h 1975 +spacer c-src/emacs/src/lisp.h 1982 +spacer c-src/emacs/src/lisp.h 2036 +spacer c-src/emacs/src/lisp.h 2205 specbind_tag c-src/emacs/src/lisp.h 2943 specbinding c-src/emacs/src/lisp.h 2955 specialsymbol prol-src/natded.prolog /^specialsymbol(C1,C2,S):-$/ @@ -4179,6 +4154,7 @@ stagseen c-src/etags.c 2446 standalone make-src/Makefile /^standalone:$/ start c-src/emacs/src/regex.h 431 start c-src/emacs/src/keyboard.c 8753 +start c-src/emacs/src/lisp.h 2038 start php-src/lce_functions.php /^ function start($line, $class)$/ start y-src/cccp.y 143 start_polling c-src/emacs/src/keyboard.c /^start_polling (void)$/ @@ -4218,12 +4194,12 @@ suffix c-src/etags.c 186 suffixes c-src/etags.c 195 suggest_asking_for_help c-src/etags.c /^suggest_asking_for_help (void)$/ suspend-emacs c-src/emacs/src/keyboard.c /^DEFUN ("suspend-emacs", Fsuspend_emacs, Ssuspend_e/ -sval cccp.y 117 sval y-src/cccp.y 116 swallow_events c-src/emacs/src/keyboard.c /^swallow_events (bool do_display)$/ switch_line_buffers c-src/etags.c /^#define switch_line_buffers() (curndx = 1 - curndx/ sxhash_combine c-src/emacs/src/lisp.h /^sxhash_combine (EMACS_UINT x, EMACS_UINT y)$/ sym_type c-src/etags.c 2204 +symbol c-src/emacs/src/lisp.h 2980 symbol_interned c-src/emacs/src/lisp.h 639 symbol_name c-src/emacs/src/lisp.h 1687 symbol_redirect c-src/emacs/src/lisp.h 646 @@ -4371,13 +4347,10 @@ toc_line perl-src/htlmify-cystic /^sub toc_line ($)$/ toggleDescription objc-src/PackInsp.m /^-toggleDescription$/ tok c-src/etags.c 2491 token c-src/etags.c 2508 -token cccp.y 437 -token cccp.y 439 token y-src/cccp.y 437 token y-src/cccp.y 439 tokenize prol-src/natded.prolog /^tokenize([C1,C2,C3|Cs],Xs-Ys,TsResult):- % spe/ tokenizeatom prol-src/natded.prolog /^tokenizeatom(Atom,Ws):-$/ -tokentab2 cccp.y 442 tokentab2 y-src/cccp.y 442 tool_bar_item_properties c-src/emacs/src/keyboard.c 7970 tool_bar_items c-src/emacs/src/keyboard.c /^tool_bar_items (Lisp_Object reuse, int *nitems)$/ @@ -4404,6 +4377,11 @@ ttypeseen c-src/etags.c 2430 typdef c-src/etags.c 2434 type c-src/etags.c 2271 type c-src/emacs/src/gmalloc.c 145 +type c-src/emacs/src/lisp.h 1973 +type c-src/emacs/src/lisp.h 1980 +type c-src/emacs/src/lisp.h 2034 +type c-src/emacs/src/lisp.h 2112 +type c-src/emacs/src/lisp.h 2203 type c-src/emacs/src/lisp.h 2276 type c-src/emacs/src/lisp.h 2286 type c-src/emacs/src/lisp.h 2296 @@ -4436,8 +4414,11 @@ unblock_input_to c-src/emacs/src/keyboard.c /^unblock_input_to (int level)$/ unchar c-src/h.h 99 unexpand-abbrev c-src/abbrev.c /^DEFUN ("unexpand-abbrev", Funexpand_abbrev, Sunexp/ unread_switch_frame c-src/emacs/src/keyboard.c 204 -unsignedp cccp.y 113 unsignedp y-src/cccp.y 112 +unwind c-src/emacs/src/lisp.h 2962 +unwind_int c-src/emacs/src/lisp.h 2972 +unwind_ptr c-src/emacs/src/lisp.h 2967 +unwind_void c-src/emacs/src/lisp.h 2976 uprintmax_t c-src/emacs/src/lisp.h 149 uprintmax_t c-src/emacs/src/lisp.h 154 usage perl-src/yagrip.pl /^sub usage {$/ @@ -4462,7 +4443,6 @@ validate php-src/lce_functions.php /^ function validate($value)$/ valloc c-src/emacs/src/gmalloc.c /^valloc (size_t size)$/ valseq prol-src/natded.prolog /^valseq([Val|Vals]) --> val(Val), plusvalseq(Vals)./ value c-src/emacs/src/lisp.h 687 -value cccp.y 113 value y-src/cccp.y 112 var c-src/emacs/src/keyboard.c 11023 var c-src/emacs/src/lisp.h 3137 @@ -4480,11 +4460,9 @@ visit-tags-table el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table visit-tags-table-buffer el-src/emacs/lisp/progmodes/etags.el /^(defun visit-tags-table-buffer (&optional cont)$/ void c-src/emacs/src/lisp.h /^INLINE void (check_cons_list) (void) { lisp_h_chec/ voidfuncptr c-src/emacs/src/lisp.h 2108 -voidval cccp.y 116 voidval y-src/cccp.y 115 wait_status_ptr_t c.c 161 waiting_for_input c-src/emacs/src/keyboard.c 150 -warning cccp.y /^warning (msg)$/ warning y-src/cccp.y /^warning (msg)$/ weak c-src/emacs/src/lisp.h 1830 weak_alias c-src/emacs/src/gmalloc.c /^weak_alias (free, cfree)$/ @@ -4492,6 +4470,7 @@ web ftp publish make-src/Makefile /^web ftp publish:$/ what c-src/etags.c 252 wheel_syms c-src/emacs/src/keyboard.c 4628 where c-src/emacs/src/lisp.h 2348 +where c-src/emacs/src/lisp.h 2980 where cp-src/clheir.hpp 77 where_in_registry cp-src/clheir.hpp 15 windowWillClose objcpp-src/SimpleCalc.M /^- windowWillClose:sender$/ @@ -4550,34 +4529,21 @@ y cp-src/clheir.hpp 58 y-get-selection-internal c.c /^ Fy_get_selection_internal, Sy_get_selection_/ yyalloc /usr/share/bison/bison.simple 83 yyalloc /usr/share/bison/bison.simple 84 -yycheck parse.y 330 -yycheck cccp.y 301 yyclearin /usr/share/bison/bison.simple 149 yyclearin /usr/share/bison/bison.simple 150 yydebug /usr/share/bison/bison.simple 237 yydebug /usr/share/bison/bison.simple 238 -yydefact parse.y 219 -yydefact cccp.y 239 -yydefgoto parse.y 237 -yydefgoto cccp.y 251 yyerrhandle /usr/share/bison/bison.simple 848 -yyerrhandle /usr/share/bison/bison.simple 848 -yyerrlab1 /usr/share/bison/bison.simple 823 yyerrlab1 /usr/share/bison/bison.simple 823 yyerrok /usr/share/bison/bison.simple 148 yyerrok /usr/share/bison/bison.simple 149 -yyerror cccp.y /^yyerror (s)$/ yyerror y-src/cccp.y /^yyerror (s)$/ yyerrstatus /usr/share/bison/bison.simple 846 -yyerrstatus /usr/share/bison/bison.simple 846 -yylex cccp.y /^yylex ()$/ yylex y-src/cccp.y /^yylex ()$/ yyls /usr/share/bison/bison.simple 88 yyls /usr/share/bison/bison.simple 89 yylsp /usr/share/bison/bison.simple 748 yylsp /usr/share/bison/bison.simple 921 -yylsp /usr/share/bison/bison.simple 748 -yylsp /usr/share/bison/bison.simple 921 yymemcpy /usr/share/bison/bison.simple 264 yymemcpy /usr/share/bison/bison.simple /^yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T/ yymemcpy /usr/share/bison/bison.simple 265 @@ -4586,50 +4552,21 @@ yyn /usr/share/bison/bison.simple 755 yyn /usr/share/bison/bison.simple 861 yyn /usr/share/bison/bison.simple 895 yyn /usr/share/bison/bison.simple 903 -yyn /usr/share/bison/bison.simple 755 -yyn /usr/share/bison/bison.simple 861 -yyn /usr/share/bison/bison.simple 895 -yyn /usr/share/bison/bison.simple 903 -yynewstate /usr/share/bison/bison.simple 763 -yynewstate /usr/share/bison/bison.simple 925 yynewstate /usr/share/bison/bison.simple 763 yynewstate /usr/share/bison/bison.simple 925 -yypact parse.y 242 -yypact cccp.y 256 yyparse /usr/share/bison/bison.simple /^yyparse (YYPARSE_PARAM_ARG)$/ yyparse /usr/share/bison/bison.simple /^yyparse (YYPARSE_PARAM_ARG)$/ -yypgoto parse.y 260 -yypgoto cccp.y 268 -yyprhs parse.y 134 -yyprhs cccp.y 167 -yyr1 parse.y 197 -yyr1 cccp.y 219 -yyr2 parse.y 207 -yyr2 cccp.y 228 -yyresult /usr/share/bison/bison.simple 932 -yyresult /usr/share/bison/bison.simple 939 -yyresult /usr/share/bison/bison.simple 947 yyresult /usr/share/bison/bison.simple 932 yyresult /usr/share/bison/bison.simple 939 yyresult /usr/share/bison/bison.simple 947 yyreturn /usr/share/bison/bison.simple 933 yyreturn /usr/share/bison/bison.simple 940 -yyreturn /usr/share/bison/bison.simple 933 -yyreturn /usr/share/bison/bison.simple 940 -yyrhs parse.y 142 -yyrhs cccp.y 174 -yyrline parse.y 171 -yyrline cccp.y 195 yyss /usr/share/bison/bison.simple 85 yyss /usr/share/bison/bison.simple 86 yystate /usr/share/bison/bison.simple 757 yystate /usr/share/bison/bison.simple 761 yystate /usr/share/bison/bison.simple 875 yystate /usr/share/bison/bison.simple 924 -yystate /usr/share/bison/bison.simple 757 -yystate /usr/share/bison/bison.simple 761 -yystate /usr/share/bison/bison.simple 875 -yystate /usr/share/bison/bison.simple 924 yystpcpy /usr/share/bison/bison.simple 316 yystpcpy /usr/share/bison/bison.simple /^yystpcpy (char *yydest, const char *yysrc)$/ yystpcpy /usr/share/bison/bison.simple 317 @@ -4638,19 +4575,10 @@ yystrlen /usr/share/bison/bison.simple 293 yystrlen /usr/share/bison/bison.simple /^yystrlen (const char *yystr)$/ yystrlen /usr/share/bison/bison.simple 294 yystrlen /usr/share/bison/bison.simple /^yystrlen (const char *yystr)$/ -yystype cccp.y 118 -yytable parse.y 269 -yytable cccp.y 277 -yytname parse.y 185 -yytname cccp.y 208 -yytranslate parse.y 101 -yytranslate cccp.y 135 yyvs /usr/share/bison/bison.simple 86 yyvs /usr/share/bison/bison.simple 87 yyvsp /usr/share/bison/bison.simple 746 yyvsp /usr/share/bison/bison.simple 919 -yyvsp /usr/share/bison/bison.simple 746 -yyvsp /usr/share/bison/bison.simple 919 z c.c 144 z c.c 164 z cp-src/clheir.hpp 49 diff --git a/test/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1 index 873914474e2..6c4a02ae1c1 100644 --- a/test/etags/ETAGS.good_1 +++ b/test/manual/etags/ETAGS.good_1 @@ -176,43 +176,43 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,2072 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 c-src/torture.c,197 (*tag1 tag118,452 @@ -228,11 +228,11 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,147 -#define _GETOPT_H 19,794 -struct option73,2790 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 +#define _GETOPT_H 19,799 +struct option73,2795 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 c-src/etags.c,10045 char pot_etags_version[pot_etags_version81,3470 @@ -555,32 +555,32 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1189,7 +1189,7 @@ syms_of_keyboard 11045,333577 keys_of_keyboard 11841,367115 mark_kboards 11916,370434 -c-src/emacs/src/lisp.h,20567 +c-src/emacs/src/lisp.h,20276 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1367,7 +1367,6 @@ enum symbol_redirect646,24315 SYMBOL_LOCALIZED 650,24386 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 - ENUM_BF 663,24793 #define EXFUN(707,26252 #define DEFUN_ARGS_MANY 712,26446 #define DEFUN_ARGS_UNEVALLED 713,26498 @@ -1556,11 +1555,8 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -1582,7 +1578,6 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 save_type 2134,70755 XSAVE_POINTER 2143,70985 set_save_pointer 2149,71147 @@ -1592,7 +1587,6 @@ set_save_integer 2170,71711 XSAVE_OBJECT 2179,71932 struct Lisp_Finalizer2186,72109 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 union Lisp_Misc2212,72885 XMISC 2223,73184 XMISCANY 2229,73273 @@ -1710,13 +1704,7 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -2311,19 +2299,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -3151,721 +3152,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -3954,32 +3955,32 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,738 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -VOIDSTAR parse_hash;63,1405 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -char *instr;instr80,1795 -int parse_error 81,1808 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +VOIDSTAR parse_hash;64,1413 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +char *instr;instr81,1803 +int parse_error 82,1816 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -4006,49 +4007,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1181 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -VOIDSTAR parse_hash;63, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -char *instr;instr80, -int parse_error 81, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2110 +/usr/share/bison/bison.simple,1693 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -4115,28 +4074,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -4157,64 +4094,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,1579 -typedef unsigned char U_CHAR;38, -struct arglist 41, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, - struct constant 113, - struct name 114, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2110 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/ETAGS.good_2 b/test/manual/etags/ETAGS.good_2 index 7f24d06432c..fa784d2e7b5 100644 --- a/test/etags/ETAGS.good_2 +++ b/test/manual/etags/ETAGS.good_2 @@ -176,43 +176,43 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,2072 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 c-src/torture.c,197 (*tag1 tag118,452 @@ -228,23 +228,23 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,538 -#define _GETOPT_H 19,794 -extern char *optarg;optarg31,1102 -extern int optind;45,1610 -extern int opterr;50,1736 -struct option73,2790 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 -extern int getopt 98,3433 -extern int getopt 100,3537 -extern int getopt_long 102,3592 -extern int getopt_long_only 104,3724 -extern int _getopt_internal 109,3935 -extern int getopt 114,4133 -extern int getopt_long 115,4155 -extern int getopt_long_only 116,4182 -extern int _getopt_internal 118,4215 +#define _GETOPT_H 19,799 +extern char *optarg;optarg31,1107 +extern int optind;45,1615 +extern int opterr;50,1741 +struct option73,2795 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 +extern int getopt 98,3438 +extern int getopt 100,3542 +extern int getopt_long 102,3597 +extern int getopt_long_only 104,3729 +extern int _getopt_internal 109,3940 +extern int getopt 114,4138 +extern int getopt_long 115,4160 +extern int getopt_long_only 116,4187 +extern int _getopt_internal 118,4220 c-src/etags.c,12175 char pot_etags_version[pot_etags_version81,3470 @@ -622,32 +622,32 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1383,7 +1383,7 @@ syms_of_keyboard 11045,333577 keys_of_keyboard 11841,367115 mark_kboards 11916,370434 -c-src/emacs/src/lisp.h,33973 +c-src/emacs/src/lisp.h,33840 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1600,7 +1600,6 @@ enum symbol_redirect646,24315 SYMBOL_LOCALIZED 650,24386 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 - ENUM_BF 663,24793 #define EXFUN(707,26252 #define DEFUN_ARGS_MANY 712,26446 #define DEFUN_ARGS_UNEVALLED 713,26498 @@ -1792,11 +1791,8 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -1818,7 +1814,6 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 save_type 2134,70755 XSAVE_POINTER 2143,70985 set_save_pointer 2149,71147 @@ -1828,7 +1823,6 @@ set_save_integer 2170,71711 XSAVE_OBJECT 2179,71932 struct Lisp_Finalizer2186,72109 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 union Lisp_Misc2212,72885 XMISC 2223,73184 XMISCANY 2229,73273 @@ -1952,13 +1946,10 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 +extern union specbinding *specpdl;specpdl2991,95265 +extern union specbinding *specpdl_ptr;specpdl_ptr2992,95300 +extern ptrdiff_t specpdl_size;2993,95339 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -2880,19 +2871,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -3721,721 +3725,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -4531,42 +4535,42 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,1061 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -int yylex 57,1322 -void yyerror 59,1352 -void yyerror 61,1381 -VOIDSTAR parse_hash;63,1405 -extern VOIDSTAR hash_find(64,1426 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -YYSTYPE make_list 75,1721 -YYSTYPE make_list 77,1765 -char *instr;instr80,1795 -int parse_error 81,1808 -extern struct obstack tmp_mem;82,1829 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -extern struct node *yylval;yylval305,6238 -unsigned char parse_cell_or_range 308,6283 -unsigned char parse_cell_or_range 310,6347 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +int yylex 58,1330 +void yyerror 60,1360 +void yyerror 62,1389 +VOIDSTAR parse_hash;64,1413 +extern VOIDSTAR hash_find(65,1434 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +YYSTYPE make_list 76,1729 +YYSTYPE make_list 78,1773 +char *instr;instr81,1803 +int parse_error 82,1816 +extern struct obstack tmp_mem;83,1837 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +extern struct node *yylval;yylval306,6246 +unsigned char parse_cell_or_range 309,6291 +unsigned char parse_cell_or_range 311,6355 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -4593,59 +4597,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1464 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -int yylex 57, -void yyerror 59, -void yyerror 61, -VOIDSTAR parse_hash;63, -extern VOIDSTAR hash_find(64, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -YYSTYPE make_list 75, -YYSTYPE make_list 77, -char *instr;instr80, -int parse_error 81, -extern struct obstack tmp_mem;82, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -extern struct node *yylval;yylval305, -unsigned char parse_cell_or_range 308, -unsigned char parse_cell_or_range 310, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2180 +/usr/share/bison/bison.simple,1729 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -4714,30 +4666,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - YYDPRINTF 917, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyerror 946, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -4758,76 +4686,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,2005 -typedef unsigned char U_CHAR;38, -struct arglist 41, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int yylex 66, -void yyerror 67, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -extern unsigned char is_idstart[is_idstart76, -extern unsigned char is_idstart[], is_idchar[is_idchar76, -extern unsigned char is_idstart[], is_idchar[], is_hor_space[is_hor_space76, -extern char *xmalloc xmalloc78, -extern int pedantic;81, -extern int traditional;84, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, -static void integer_overflow 106, -static long left_shift 107, -static long right_shift 108, - struct constant 113, - struct name 114, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -extern int yydebug;919, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2180 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/ETAGS.good_3 b/test/manual/etags/ETAGS.good_3 index f8bd93330e2..547dee2d43c 100644 --- a/test/etags/ETAGS.good_3 +++ b/test/manual/etags/ETAGS.good_3 @@ -176,43 +176,43 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,2072 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 c-src/torture.c,197 (*tag1 tag118,452 @@ -228,16 +228,16 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,275 -#define _GETOPT_H 19,794 -struct option73,2790 - const char *name;name76,2819 - char *name;name78,2845 - int has_arg;82,3002 - int *flag;flag83,3017 - int val;84,3030 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 +#define _GETOPT_H 19,799 +struct option73,2795 + const char *name;name76,2824 + char *name;name78,2850 + int has_arg;82,3007 + int *flag;flag83,3022 + int val;84,3035 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 c-src/etags.c,12045 char pot_etags_version[pot_etags_version81,3470 @@ -620,36 +620,36 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1315,7 +1315,7 @@ syms_of_keyboard 11045,333577 keys_of_keyboard 11841,367115 mark_kboards 11916,370434 -c-src/emacs/src/lisp.h,25767 +c-src/emacs/src/lisp.h,27827 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1495,7 +1495,12 @@ enum symbol_redirect646,24315 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 bool_bf gcmarkbit 656,24458 - ENUM_BF 663,24793 + ENUM_BF (symbol_redirect) redirect 663,24793 + unsigned constant 668,25011 + unsigned interned 672,25131 + bool_bf declared_special 676,25293 + bool_bf pinned 679,25394 + Lisp_Object name;682,25463 Lisp_Object value;687,25631 struct Lisp_Symbol *alias;alias688,25654 struct Lisp_Buffer_Local_Value *blv;blv689,25685 @@ -1746,11 +1751,27 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 + ENUM_BF (Lisp_Misc_Type) type 1973,64866 + bool_bf gcmarkbit 1974,64927 + unsigned spacer 1975,64952 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 + ENUM_BF (Lisp_Misc_Type) type 1980,65001 + bool_bf gcmarkbit 1981,65065 + unsigned spacer 1982,65090 + bool_bf need_adjustment 1986,65282 + bool_bf insertion_type 1989,65423 + struct buffer *buffer;buffer2000,66016 + struct Lisp_Marker *next;next2009,66367 + ptrdiff_t charpos;2011,66455 + ptrdiff_t bytepos;2016,66713 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 + ENUM_BF (Lisp_Misc_Type) type 2034,67349 + bool_bf gcmarkbit 2035,67415 + unsigned spacer 2036,67442 + struct Lisp_Overlay *next;next2037,67468 + Lisp_Object start;2038,67499 + Lisp_Object end;2039,67522 + Lisp_Object plist;2040,67543 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -1772,7 +1793,10 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 + ENUM_BF (Lisp_Misc_Type) type 2112,69903 + bool_bf gcmarkbit 2113,69972 + unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS)2114,69999 + ENUM_BF (Lisp_Save_Type) save_type : SAVE_TYPE_BITS;2123,70489 void *pointer;pointer2125,70558 voidfuncptr funcpointer;2126,70579 ptrdiff_t integer;2127,70610 @@ -1791,7 +1815,10 @@ struct Lisp_Finalizer2186,72109 struct Lisp_Finalizer *next;next2192,72256 Lisp_Object function;2197,72493 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 + ENUM_BF (Lisp_Misc_Type) type 2203,72605 + bool_bf gcmarkbit 2204,72668 + unsigned spacer 2205,72695 + union Lisp_Misc *chain;chain2206,72721 union Lisp_Misc2212,72885 struct Lisp_Misc_Any u_any;2214,72905 struct Lisp_Free u_free;2215,72976 @@ -1941,13 +1968,34 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2957,94386 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2959,94443 + void (*func)func2960,94489 + Lisp_Object arg;2961,94523 + } unwind;2962,94546 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2964,94573 + void (*func)func2965,94619 + void *arg;arg2966,94648 + } unwind_ptr;2967,94665 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2969,94696 + void (*func)func2970,94742 + int arg;2971,94768 + } unwind_int;2972,94783 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2974,94814 + void (*func)func2975,94860 + } unwind_void;2976,94887 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2978,94919 + Lisp_Object symbol,2980,95026 + Lisp_Object symbol, old_value,2980,95026 + Lisp_Object symbol, old_value, where;2980,95026 + } let;2981,95070 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2983,95094 + bool_bf debug_on_exit 2984,95140 + Lisp_Object function;2985,95173 + Lisp_Object *args;args2986,95201 + ptrdiff_t nargs;2987,95226 + } bt;2988,95249 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -2628,19 +2676,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -3498,721 +3559,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -4316,32 +4377,32 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,738 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -VOIDSTAR parse_hash;63,1405 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -char *instr;instr80,1795 -int parse_error 81,1808 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +VOIDSTAR parse_hash;64,1413 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +char *instr;instr81,1803 +int parse_error 82,1816 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -4368,49 +4429,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1181 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -VOIDSTAR parse_hash;63, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -char *instr;instr80, -int parse_error 81, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2168 +/usr/share/bison/bison.simple,1751 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -4480,28 +4499,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -4522,79 +4519,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,2106 -typedef unsigned char U_CHAR;38, -struct arglist 41, - struct arglist *next;next42, - U_CHAR *name;name43, - int length;44, - int argno;45, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, - struct constant 113, - struct constant {long value;113, - struct constant {long value; int unsignedp;113, - struct constant {long value; int unsignedp;} integer;113, - struct name 114, - struct name {U_CHAR *address;address114, - struct name {U_CHAR *address; int length;114, - struct name {U_CHAR *address; int length;} name;114, - struct arglist *keywords;keywords115, - int voidval;116, - char *sval;sval117, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, - char *operator;operator438, - int token;439, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2168 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/ETAGS.good_4 b/test/manual/etags/ETAGS.good_4 index 9db5e3833a2..2c50ec1a742 100644 --- a/test/etags/ETAGS.good_4 +++ b/test/manual/etags/ETAGS.good_4 @@ -176,67 +176,67 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,3274 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 - DEFVAR_LISP ("abbrev-table-name-list"542,16087 - DEFVAR_LISP ("global-abbrev-table"548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16671 - DEFVAR_LISP ("last-abbrev"561,17013 - DEFVAR_LISP ("last-abbrev-text"564,17136 - DEFVAR_INT ("last-abbrev-location"568,17294 - DEFVAR_LISP ("abbrev-start-location"575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer"581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table"586,18034 - DEFVAR_BOOL ("abbrevs-changed"589,18177 - DEFVAR_BOOL ("abbrev-all-caps"594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook"598,18536 - DEFVAR_LISP ("abbrev-table-name-list",\1542,16087 - DEFVAR_LISP ("global-abbrev-table",\1548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16671 - DEFVAR_LISP ("last-abbrev",\1561,17013 - DEFVAR_LISP ("last-abbrev-text",\1564,17136 - DEFVAR_INT ("last-abbrev-location",\1568,17294 - DEFVAR_LISP ("abbrev-start-location",\1575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18034 - DEFVAR_BOOL ("abbrevs-changed",\1589,18177 - DEFVAR_BOOL ("abbrev-all-caps",\1594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18536 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 + DEFVAR_LISP ("abbrev-table-name-list"542,16092 + DEFVAR_LISP ("global-abbrev-table"548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16676 + DEFVAR_LISP ("last-abbrev"561,17018 + DEFVAR_LISP ("last-abbrev-text"564,17141 + DEFVAR_INT ("last-abbrev-location"568,17299 + DEFVAR_LISP ("abbrev-start-location"575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer"581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table"586,18039 + DEFVAR_BOOL ("abbrevs-changed"589,18182 + DEFVAR_BOOL ("abbrev-all-caps"594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook"598,18541 + DEFVAR_LISP ("abbrev-table-name-list",\1542,16092 + DEFVAR_LISP ("global-abbrev-table",\1548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16676 + DEFVAR_LISP ("last-abbrev",\1561,17018 + DEFVAR_LISP ("last-abbrev-text",\1564,17141 + DEFVAR_INT ("last-abbrev-location",\1568,17299 + DEFVAR_LISP ("abbrev-start-location",\1575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18039 + DEFVAR_BOOL ("abbrevs-changed",\1589,18182 + DEFVAR_BOOL ("abbrev-all-caps",\1594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18541 c-src/torture.c,197 (*tag1 tag118,452 @@ -252,11 +252,11 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,147 -#define _GETOPT_H 19,794 -struct option73,2790 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 +#define _GETOPT_H 19,799 +struct option73,2795 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 c-src/etags.c,10045 char pot_etags_version[pot_etags_version81,3470 @@ -579,32 +579,32 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,47 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1353,7 +1353,7 @@ mark_kboards 11916,370434 DEFVAR_LISP ("selection-inhibit-update-commands",\111815,366013 DEFVAR_LISP ("debug-on-event",\111825,366554 -c-src/emacs/src/lisp.h,20567 +c-src/emacs/src/lisp.h,20276 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1531,7 +1531,6 @@ enum symbol_redirect646,24315 SYMBOL_LOCALIZED 650,24386 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 - ENUM_BF 663,24793 #define EXFUN(707,26252 #define DEFUN_ARGS_MANY 712,26446 #define DEFUN_ARGS_UNEVALLED 713,26498 @@ -1720,11 +1719,8 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -1746,7 +1742,6 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 save_type 2134,70755 XSAVE_POINTER 2143,70985 set_save_pointer 2149,71147 @@ -1756,7 +1751,6 @@ set_save_integer 2170,71711 XSAVE_OBJECT 2179,71932 struct Lisp_Finalizer2186,72109 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 union Lisp_Misc2212,72885 XMISC 2223,73184 XMISCANY 2229,73273 @@ -1874,13 +1868,7 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -2475,19 +2463,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -3315,721 +3316,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -4118,32 +4119,32 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,738 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -VOIDSTAR parse_hash;63,1405 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -char *instr;instr80,1795 -int parse_error 81,1808 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +VOIDSTAR parse_hash;64,1413 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +char *instr;instr81,1803 +int parse_error 82,1816 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -4170,49 +4171,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1181 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -VOIDSTAR parse_hash;63, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -char *instr;instr80, -int parse_error 81, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2110 +/usr/share/bison/bison.simple,1693 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -4279,28 +4238,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -4321,64 +4258,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,1579 -typedef unsigned char U_CHAR;38, -struct arglist 41, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, - struct constant 113, - struct name 114, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2110 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/ETAGS.good_5 b/test/manual/etags/ETAGS.good_5 index 982682d0102..2b431034f44 100644 --- a/test/etags/ETAGS.good_5 +++ b/test/manual/etags/ETAGS.good_5 @@ -176,67 +176,67 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,3274 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 - DEFVAR_LISP ("abbrev-table-name-list"542,16087 - DEFVAR_LISP ("global-abbrev-table"548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16671 - DEFVAR_LISP ("last-abbrev"561,17013 - DEFVAR_LISP ("last-abbrev-text"564,17136 - DEFVAR_INT ("last-abbrev-location"568,17294 - DEFVAR_LISP ("abbrev-start-location"575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer"581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table"586,18034 - DEFVAR_BOOL ("abbrevs-changed"589,18177 - DEFVAR_BOOL ("abbrev-all-caps"594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook"598,18536 - DEFVAR_LISP ("abbrev-table-name-list",\1542,16087 - DEFVAR_LISP ("global-abbrev-table",\1548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16671 - DEFVAR_LISP ("last-abbrev",\1561,17013 - DEFVAR_LISP ("last-abbrev-text",\1564,17136 - DEFVAR_INT ("last-abbrev-location",\1568,17294 - DEFVAR_LISP ("abbrev-start-location",\1575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18034 - DEFVAR_BOOL ("abbrevs-changed",\1589,18177 - DEFVAR_BOOL ("abbrev-all-caps",\1594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18536 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 + DEFVAR_LISP ("abbrev-table-name-list"542,16092 + DEFVAR_LISP ("global-abbrev-table"548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16676 + DEFVAR_LISP ("last-abbrev"561,17018 + DEFVAR_LISP ("last-abbrev-text"564,17141 + DEFVAR_INT ("last-abbrev-location"568,17299 + DEFVAR_LISP ("abbrev-start-location"575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer"581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table"586,18039 + DEFVAR_BOOL ("abbrevs-changed"589,18182 + DEFVAR_BOOL ("abbrev-all-caps"594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook"598,18541 + DEFVAR_LISP ("abbrev-table-name-list",\1542,16092 + DEFVAR_LISP ("global-abbrev-table",\1548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16676 + DEFVAR_LISP ("last-abbrev",\1561,17018 + DEFVAR_LISP ("last-abbrev-text",\1564,17141 + DEFVAR_INT ("last-abbrev-location",\1568,17299 + DEFVAR_LISP ("abbrev-start-location",\1575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18039 + DEFVAR_BOOL ("abbrevs-changed",\1589,18182 + DEFVAR_BOOL ("abbrev-all-caps",\1594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18541 c-src/torture.c,197 (*tag1 tag118,452 @@ -252,28 +252,28 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,666 -#define _GETOPT_H 19,794 -extern char *optarg;optarg31,1102 -extern int optind;45,1610 -extern int opterr;50,1736 -struct option73,2790 - const char *name;name76,2819 - char *name;name78,2845 - int has_arg;82,3002 - int *flag;flag83,3017 - int val;84,3030 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 -extern int getopt 98,3433 -extern int getopt 100,3537 -extern int getopt_long 102,3592 -extern int getopt_long_only 104,3724 -extern int _getopt_internal 109,3935 -extern int getopt 114,4133 -extern int getopt_long 115,4155 -extern int getopt_long_only 116,4182 -extern int _getopt_internal 118,4215 +#define _GETOPT_H 19,799 +extern char *optarg;optarg31,1107 +extern int optind;45,1615 +extern int opterr;50,1741 +struct option73,2795 + const char *name;name76,2824 + char *name;name78,2850 + int has_arg;82,3007 + int *flag;flag83,3022 + int val;84,3035 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 +extern int getopt 98,3438 +extern int getopt 100,3542 +extern int getopt_long 102,3597 +extern int getopt_long_only 104,3729 +extern int _getopt_internal 109,3940 +extern int getopt 114,4138 +extern int getopt_long 115,4160 +extern int getopt_long_only 116,4187 +extern int _getopt_internal 118,4220 c-src/etags.c,14175 char pot_etags_version[pot_etags_version81,3470 @@ -711,36 +711,36 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1673,7 +1673,7 @@ mark_kboards 11916,370434 DEFVAR_LISP ("selection-inhibit-update-commands",\111815,366013 DEFVAR_LISP ("debug-on-event",\111825,366554 -c-src/emacs/src/lisp.h,39173 +c-src/emacs/src/lisp.h,41391 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1892,7 +1892,12 @@ enum symbol_redirect646,24315 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 bool_bf gcmarkbit 656,24458 - ENUM_BF 663,24793 + ENUM_BF (symbol_redirect) redirect 663,24793 + unsigned constant 668,25011 + unsigned interned 672,25131 + bool_bf declared_special 676,25293 + bool_bf pinned 679,25394 + Lisp_Object name;682,25463 Lisp_Object value;687,25631 struct Lisp_Symbol *alias;alias688,25654 struct Lisp_Buffer_Local_Value *blv;blv689,25685 @@ -2146,11 +2151,27 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 + ENUM_BF (Lisp_Misc_Type) type 1973,64866 + bool_bf gcmarkbit 1974,64927 + unsigned spacer 1975,64952 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 + ENUM_BF (Lisp_Misc_Type) type 1980,65001 + bool_bf gcmarkbit 1981,65065 + unsigned spacer 1982,65090 + bool_bf need_adjustment 1986,65282 + bool_bf insertion_type 1989,65423 + struct buffer *buffer;buffer2000,66016 + struct Lisp_Marker *next;next2009,66367 + ptrdiff_t charpos;2011,66455 + ptrdiff_t bytepos;2016,66713 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 + ENUM_BF (Lisp_Misc_Type) type 2034,67349 + bool_bf gcmarkbit 2035,67415 + unsigned spacer 2036,67442 + struct Lisp_Overlay *next;next2037,67468 + Lisp_Object start;2038,67499 + Lisp_Object end;2039,67522 + Lisp_Object plist;2040,67543 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -2172,7 +2193,10 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 + ENUM_BF (Lisp_Misc_Type) type 2112,69903 + bool_bf gcmarkbit 2113,69972 + unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS)2114,69999 + ENUM_BF (Lisp_Save_Type) save_type : SAVE_TYPE_BITS;2123,70489 void *pointer;pointer2125,70558 voidfuncptr funcpointer;2126,70579 ptrdiff_t integer;2127,70610 @@ -2191,7 +2215,10 @@ struct Lisp_Finalizer2186,72109 struct Lisp_Finalizer *next;next2192,72256 Lisp_Object function;2197,72493 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 + ENUM_BF (Lisp_Misc_Type) type 2203,72605 + bool_bf gcmarkbit 2204,72668 + unsigned spacer 2205,72695 + union Lisp_Misc *chain;chain2206,72721 union Lisp_Misc2212,72885 struct Lisp_Misc_Any u_any;2214,72905 struct Lisp_Free u_free;2215,72976 @@ -2347,13 +2374,37 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2957,94386 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2959,94443 + void (*func)func2960,94489 + Lisp_Object arg;2961,94523 + } unwind;2962,94546 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2964,94573 + void (*func)func2965,94619 + void *arg;arg2966,94648 + } unwind_ptr;2967,94665 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2969,94696 + void (*func)func2970,94742 + int arg;2971,94768 + } unwind_int;2972,94783 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2974,94814 + void (*func)func2975,94860 + } unwind_void;2976,94887 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2978,94919 + Lisp_Object symbol,2980,95026 + Lisp_Object symbol, old_value,2980,95026 + Lisp_Object symbol, old_value, where;2980,95026 + } let;2981,95070 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2983,95094 + bool_bf debug_on_exit 2984,95140 + Lisp_Object function;2985,95173 + Lisp_Object *args;args2986,95201 + ptrdiff_t nargs;2987,95226 + } bt;2988,95249 +extern union specbinding *specpdl;specpdl2991,95265 +extern union specbinding *specpdl_ptr;specpdl_ptr2992,95300 +extern ptrdiff_t specpdl_size;2993,95339 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -3361,19 +3412,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -4232,721 +4296,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -5057,42 +5121,42 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,1061 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -int yylex 57,1322 -void yyerror 59,1352 -void yyerror 61,1381 -VOIDSTAR parse_hash;63,1405 -extern VOIDSTAR hash_find(64,1426 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -YYSTYPE make_list 75,1721 -YYSTYPE make_list 77,1765 -char *instr;instr80,1795 -int parse_error 81,1808 -extern struct obstack tmp_mem;82,1829 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -extern struct node *yylval;yylval305,6238 -unsigned char parse_cell_or_range 308,6283 -unsigned char parse_cell_or_range 310,6347 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +int yylex 58,1330 +void yyerror 60,1360 +void yyerror 62,1389 +VOIDSTAR parse_hash;64,1413 +extern VOIDSTAR hash_find(65,1434 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +YYSTYPE make_list 76,1729 +YYSTYPE make_list 78,1773 +char *instr;instr81,1803 +int parse_error 82,1816 +extern struct obstack tmp_mem;83,1837 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +extern struct node *yylval;yylval306,6246 +unsigned char parse_cell_or_range 309,6291 +unsigned char parse_cell_or_range 311,6355 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -5119,59 +5183,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1464 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -int yylex 57, -void yyerror 59, -void yyerror 61, -VOIDSTAR parse_hash;63, -extern VOIDSTAR hash_find(64, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -YYSTYPE make_list 75, -YYSTYPE make_list 77, -char *instr;instr80, -int parse_error 81, -extern struct obstack tmp_mem;82, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -extern struct node *yylval;yylval305, -unsigned char parse_cell_or_range 308, -unsigned char parse_cell_or_range 310, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2238 +/usr/share/bison/bison.simple,1787 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -5243,30 +5255,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - YYDPRINTF 917, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyerror 946, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -5287,91 +5275,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,2532 -typedef unsigned char U_CHAR;38, -struct arglist 41, - struct arglist *next;next42, - U_CHAR *name;name43, - int length;44, - int argno;45, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int yylex 66, -void yyerror 67, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -extern unsigned char is_idstart[is_idstart76, -extern unsigned char is_idstart[], is_idchar[is_idchar76, -extern unsigned char is_idstart[], is_idchar[], is_hor_space[is_hor_space76, -extern char *xmalloc xmalloc78, -extern int pedantic;81, -extern int traditional;84, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, -static void integer_overflow 106, -static long left_shift 107, -static long right_shift 108, - struct constant 113, - struct constant {long value;113, - struct constant {long value; int unsignedp;113, - struct constant {long value; int unsignedp;} integer;113, - struct name 114, - struct name {U_CHAR *address;address114, - struct name {U_CHAR *address; int length;114, - struct name {U_CHAR *address; int length;} name;114, - struct arglist *keywords;keywords115, - int voidval;116, - char *sval;sval117, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, - char *operator;operator438, - int token;439, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -extern int yydebug;919, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2238 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/ETAGS.good_6 b/test/manual/etags/ETAGS.good_6 index cf402ae50d7..2cb0d05e72a 100644 --- a/test/etags/ETAGS.good_6 +++ b/test/manual/etags/ETAGS.good_6 @@ -176,67 +176,67 @@ package body Truc.Bidule Truc.Bidule/b138,2153 protected body Machin_T Machin_T/b146,2281 c-src/abbrev.c,3274 -Lisp_Object Vabbrev_table_name_list;43,1424 -Lisp_Object Vglobal_abbrev_table;48,1569 -Lisp_Object Vfundamental_mode_abbrev_table;52,1680 -int abbrevs_changed;56,1781 -int abbrev_all_caps;58,1803 -Lisp_Object Vabbrev_start_location;63,1952 -Lisp_Object Vabbrev_start_location_buffer;66,2041 -Lisp_Object Vlast_abbrev;70,2150 -Lisp_Object Vlast_abbrev_text;75,2319 -int last_abbrev_point;79,2409 -Lisp_Object Vpre_abbrev_expand_hook,83,2482 -Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2482 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2546 -DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2546 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2738 -DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2738 -DEFUN ("define-abbrev", Fdefine_abbrev,107,3119 -DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3119 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4438 -DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4438 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4809 -DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4809 -DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5277 -DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5277 -DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6241 -DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6241 -DEFUN ("expand-abbrev", Fexpand_abbrev,218,6756 -DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6756 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11677 -DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11677 -write_abbrev 426,12884 -describe_abbrev 445,13319 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13834 -DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13834 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14990 -DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14990 -syms_of_abbrev 540,16067 - DEFVAR_LISP ("abbrev-table-name-list"542,16087 - DEFVAR_LISP ("global-abbrev-table"548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16671 - DEFVAR_LISP ("last-abbrev"561,17013 - DEFVAR_LISP ("last-abbrev-text"564,17136 - DEFVAR_INT ("last-abbrev-location"568,17294 - DEFVAR_LISP ("abbrev-start-location"575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer"581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table"586,18034 - DEFVAR_BOOL ("abbrevs-changed"589,18177 - DEFVAR_BOOL ("abbrev-all-caps"594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook"598,18536 - DEFVAR_LISP ("abbrev-table-name-list",\1542,16087 - DEFVAR_LISP ("global-abbrev-table",\1548,16349 - DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16671 - DEFVAR_LISP ("last-abbrev",\1561,17013 - DEFVAR_LISP ("last-abbrev-text",\1564,17136 - DEFVAR_INT ("last-abbrev-location",\1568,17294 - DEFVAR_LISP ("abbrev-start-location",\1575,17493 - DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17770 - DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18034 - DEFVAR_BOOL ("abbrevs-changed",\1589,18177 - DEFVAR_BOOL ("abbrev-all-caps",\1594,18380 - DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18536 +Lisp_Object Vabbrev_table_name_list;43,1429 +Lisp_Object Vglobal_abbrev_table;48,1574 +Lisp_Object Vfundamental_mode_abbrev_table;52,1685 +int abbrevs_changed;56,1786 +int abbrev_all_caps;58,1808 +Lisp_Object Vabbrev_start_location;63,1957 +Lisp_Object Vabbrev_start_location_buffer;66,2046 +Lisp_Object Vlast_abbrev;70,2155 +Lisp_Object Vlast_abbrev_text;75,2324 +int last_abbrev_point;79,2414 +Lisp_Object Vpre_abbrev_expand_hook,83,2487 +Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook;83,2487 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,85,2551 +DEFUN ("make-abbrev-table", Fmake_abbrev_table,make-abbrev-table85,2551 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,92,2743 +DEFUN ("clear-abbrev-table", Fclear_abbrev_table,clear-abbrev-table92,2743 +DEFUN ("define-abbrev", Fdefine_abbrev,107,3124 +DEFUN ("define-abbrev", Fdefine_abbrev,define-abbrev107,3124 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,149,4443 +DEFUN ("define-global-abbrev", Fdefine_global_abbrev,define-global-abbrev149,4443 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,160,4814 +DEFUN ("define-mode-abbrev", Fdefine_mode_abbrev,define-mode-abbrev160,4814 +DEFUN ("abbrev-symbol", Fabbrev_symbol,174,5282 +DEFUN ("abbrev-symbol", Fabbrev_symbol,abbrev-symbol174,5282 +DEFUN ("abbrev-expansion", Fabbrev_expansion,202,6246 +DEFUN ("abbrev-expansion", Fabbrev_expansion,abbrev-expansion202,6246 +DEFUN ("expand-abbrev", Fexpand_abbrev,218,6761 +DEFUN ("expand-abbrev", Fexpand_abbrev,expand-abbrev218,6761 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,389,11682 +DEFUN ("unexpand-abbrev", Funexpand_abbrev,unexpand-abbrev389,11682 +write_abbrev 426,12889 +describe_abbrev 445,13324 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,466,13839 +DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,insert-abbrev-table-description466,13839 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,506,14995 +DEFUN ("define-abbrev-table", Fdefine_abbrev_table,define-abbrev-table506,14995 +syms_of_abbrev 540,16072 + DEFVAR_LISP ("abbrev-table-name-list"542,16092 + DEFVAR_LISP ("global-abbrev-table"548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table"555,16676 + DEFVAR_LISP ("last-abbrev"561,17018 + DEFVAR_LISP ("last-abbrev-text"564,17141 + DEFVAR_INT ("last-abbrev-location"568,17299 + DEFVAR_LISP ("abbrev-start-location"575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer"581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table"586,18039 + DEFVAR_BOOL ("abbrevs-changed"589,18182 + DEFVAR_BOOL ("abbrev-all-caps"594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook"598,18541 + DEFVAR_LISP ("abbrev-table-name-list",\1542,16092 + DEFVAR_LISP ("global-abbrev-table",\1548,16354 + DEFVAR_LISP ("fundamental-mode-abbrev-table",\1555,16676 + DEFVAR_LISP ("last-abbrev",\1561,17018 + DEFVAR_LISP ("last-abbrev-text",\1564,17141 + DEFVAR_INT ("last-abbrev-location",\1568,17299 + DEFVAR_LISP ("abbrev-start-location",\1575,17498 + DEFVAR_LISP ("abbrev-start-location-buffer",\1581,17775 + DEFVAR_PER_BUFFER ("local-abbrev-table",\1586,18039 + DEFVAR_BOOL ("abbrevs-changed",\1589,18182 + DEFVAR_BOOL ("abbrev-all-caps",\1594,18385 + DEFVAR_LISP ("pre-abbrev-expand-hook",\1598,18541 c-src/torture.c,197 (*tag1 tag118,452 @@ -252,28 +252,28 @@ pp287,1419 pp3(100,1518 c-src/getopt.h,666 -#define _GETOPT_H 19,794 -extern char *optarg;optarg31,1102 -extern int optind;45,1610 -extern int opterr;50,1736 -struct option73,2790 - const char *name;name76,2819 - char *name;name78,2845 - int has_arg;82,3002 - int *flag;flag83,3017 - int val;84,3030 -#define no_argument 89,3117 -#define required_argument 90,3140 -#define optional_argument 91,3168 -extern int getopt 98,3433 -extern int getopt 100,3537 -extern int getopt_long 102,3592 -extern int getopt_long_only 104,3724 -extern int _getopt_internal 109,3935 -extern int getopt 114,4133 -extern int getopt_long 115,4155 -extern int getopt_long_only 116,4182 -extern int _getopt_internal 118,4215 +#define _GETOPT_H 19,799 +extern char *optarg;optarg31,1107 +extern int optind;45,1615 +extern int opterr;50,1741 +struct option73,2795 + const char *name;name76,2824 + char *name;name78,2850 + int has_arg;82,3007 + int *flag;flag83,3022 + int val;84,3035 +#define no_argument 89,3122 +#define required_argument 90,3145 +#define optional_argument 91,3173 +extern int getopt 98,3438 +extern int getopt 100,3542 +extern int getopt_long 102,3597 +extern int getopt_long_only 104,3729 +extern int _getopt_internal 109,3940 +extern int getopt 114,4138 +extern int getopt_long 115,4160 +extern int getopt_long_only 116,4187 +extern int _getopt_internal 118,4220 c-src/etags.c,14175 char pot_etags_version[pot_etags_version81,3470 @@ -711,36 +711,36 @@ xmalloc 6536,174148 xrealloc 6545,174314 c-src/exit.c,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/exit.strange_suffix,99 - size_t n;28,967 - void EXFUN((*fn[fn29,981 - } __libc_atexit;30,1017 -DEFUN(exit,38,1258 + size_t n;28,972 + void EXFUN((*fn[fn29,986 + } __libc_atexit;30,1022 +DEFUN(exit,38,1263 c-src/sysdep.h,491 -#define ENTRY(21,870 -#define PSEUDO(26,977 - movl $SYS_##syscall_nam$SYS_##syscall_na31,1137 - movl $SYS_##syscall_name, %eax;eax31,1137 - int $0x80;32,1185 - test %eax,eax33,1215 - test %eax, %eax;eax33,1215 - jl syscall_error;34,1250 -#define XCHG_0 47,1567 -#define XCHG_1 48,1611 -#define XCHG_2 49,1653 -#define XCHG_3 50,1696 -#define XCHG_4 51,1739 -#define XCHG_5 52,1782 -#define r0 54,1826 -#define r1 55,1880 -#define scratch 56,1937 -#define MOVE(57,2006 +#define ENTRY(21,875 +#define PSEUDO(26,982 + movl $SYS_##syscall_nam$SYS_##syscall_na31,1142 + movl $SYS_##syscall_name, %eax;eax31,1142 + int $0x80;32,1190 + test %eax,eax33,1220 + test %eax, %eax;eax33,1220 + jl syscall_error;34,1255 +#define XCHG_0 47,1572 +#define XCHG_1 48,1616 +#define XCHG_2 49,1658 +#define XCHG_3 50,1701 +#define XCHG_4 51,1744 +#define XCHG_5 52,1787 +#define r0 54,1831 +#define r1 55,1885 +#define scratch 56,1942 +#define MOVE(57,2011 c-src/tab.c,196 static int count_words(15,263 @@ -1673,7 +1673,7 @@ mark_kboards 11916,370434 DEFVAR_LISP ("selection-inhibit-update-commands",\111815,366013 DEFVAR_LISP ("debug-on-event",\111825,366554 -c-src/emacs/src/lisp.h,39173 +c-src/emacs/src/lisp.h,41391 #define EMACS_LISP_H22,800 #define DECLARE_GDB_SYM(47,1421 # define DEFINE_GDB_SYMBOL_BEGIN(49,1508 @@ -1892,7 +1892,12 @@ enum symbol_redirect646,24315 SYMBOL_FORWARDED 651,24410 struct Lisp_Symbol654,24437 bool_bf gcmarkbit 656,24458 - ENUM_BF 663,24793 + ENUM_BF (symbol_redirect) redirect 663,24793 + unsigned constant 668,25011 + unsigned interned 672,25131 + bool_bf declared_special 676,25293 + bool_bf pinned 679,25394 + Lisp_Object name;682,25463 Lisp_Object value;687,25631 struct Lisp_Symbol *alias;alias688,25654 struct Lisp_Buffer_Local_Value *blv;blv689,25685 @@ -2146,11 +2151,27 @@ static double const DEFAULT_REHASH_SIZE 1950,64299 sxhash_combine 1956,64465 SXHASH_REDUCE 1964,64648 struct Lisp_Misc_Any 1971,64806 - ENUM_BF 1973,64866 + ENUM_BF (Lisp_Misc_Type) type 1973,64866 + bool_bf gcmarkbit 1974,64927 + unsigned spacer 1975,64952 struct Lisp_Marker1978,64980 - ENUM_BF 1980,65001 + ENUM_BF (Lisp_Misc_Type) type 1980,65001 + bool_bf gcmarkbit 1981,65065 + unsigned spacer 1982,65090 + bool_bf need_adjustment 1986,65282 + bool_bf insertion_type 1989,65423 + struct buffer *buffer;buffer2000,66016 + struct Lisp_Marker *next;next2009,66367 + ptrdiff_t charpos;2011,66455 + ptrdiff_t bytepos;2016,66713 struct Lisp_Overlay2021,66841 - ENUM_BF 2034,67349 + ENUM_BF (Lisp_Misc_Type) type 2034,67349 + bool_bf gcmarkbit 2035,67415 + unsigned spacer 2036,67442 + struct Lisp_Overlay *next;next2037,67468 + Lisp_Object start;2038,67499 + Lisp_Object end;2039,67522 + Lisp_Object plist;2040,67543 SAVE_UNUSED,2047,67644 SAVE_INTEGER,2048,67661 SAVE_FUNCPOINTER,2049,67679 @@ -2172,7 +2193,10 @@ enum Lisp_Save_Type2064,68075 SAVE_TYPE_MEMORY 2080,68885 typedef void (*voidfuncptr)voidfuncptr2108,69839 struct Lisp_Save_Value2110,69876 - ENUM_BF 2112,69903 + ENUM_BF (Lisp_Misc_Type) type 2112,69903 + bool_bf gcmarkbit 2113,69972 + unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS)2114,69999 + ENUM_BF (Lisp_Save_Type) save_type : SAVE_TYPE_BITS;2123,70489 void *pointer;pointer2125,70558 voidfuncptr funcpointer;2126,70579 ptrdiff_t integer;2127,70610 @@ -2191,7 +2215,10 @@ struct Lisp_Finalizer2186,72109 struct Lisp_Finalizer *next;next2192,72256 Lisp_Object function;2197,72493 struct Lisp_Free2201,72584 - ENUM_BF 2203,72605 + ENUM_BF (Lisp_Misc_Type) type 2203,72605 + bool_bf gcmarkbit 2204,72668 + unsigned spacer 2205,72695 + union Lisp_Misc *chain;chain2206,72721 union Lisp_Misc2212,72885 struct Lisp_Misc_Any u_any;2214,72905 struct Lisp_Free u_free;2215,72976 @@ -2347,13 +2374,37 @@ enum specbind_tag 2943,93805 SPECPDL_LET_LOCAL,2951,94235 SPECPDL_LET_DEFAULT 2952,94292 union specbinding2955,94364 - ENUM_BF 2957,94386 - ENUM_BF 2959,94443 - ENUM_BF 2964,94573 - ENUM_BF 2969,94696 - ENUM_BF 2974,94814 - ENUM_BF 2978,94919 - ENUM_BF 2983,95094 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2957,94386 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2959,94443 + void (*func)func2960,94489 + Lisp_Object arg;2961,94523 + } unwind;2962,94546 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2964,94573 + void (*func)func2965,94619 + void *arg;arg2966,94648 + } unwind_ptr;2967,94665 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2969,94696 + void (*func)func2970,94742 + int arg;2971,94768 + } unwind_int;2972,94783 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2974,94814 + void (*func)func2975,94860 + } unwind_void;2976,94887 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2978,94919 + Lisp_Object symbol,2980,95026 + Lisp_Object symbol, old_value,2980,95026 + Lisp_Object symbol, old_value, where;2980,95026 + } let;2981,95070 + ENUM_BF (specbind_tag) kind : CHAR_BIT;2983,95094 + bool_bf debug_on_exit 2984,95140 + Lisp_Object function;2985,95173 + Lisp_Object *args;args2986,95201 + ptrdiff_t nargs;2987,95226 + } bt;2988,95249 +extern union specbinding *specpdl;specpdl2991,95265 +extern union specbinding *specpdl_ptr;specpdl_ptr2992,95300 +extern ptrdiff_t specpdl_size;2993,95339 +SPECPDL_INDEX 2996,95388 enum handlertype 3021,96410 enum handlertype { CATCHER,3021,96410 enum handlertype { CATCHER, CONDITION_CASE 3021,96410 @@ -3361,19 +3412,32 @@ f-src/entry.strange,172 & intensity1(577,12231 character*(*) function foo(579,12307 -forth-src/test-forth.fth,408 -: a-forth-word 20,301 +forth-src/test-forth.fth,733 +: a-forth-word20,301 99 constant a-forth-constant!22,343 55 value a-forth-value?23,373 create :a-forth-dictionary-entry24,397 defer #a-defer-word27,460 -: (another-forth-word)(another-forth-word29,481 +: (another-forth-word)(another-forth-word)29,481 9 field >field136,582 5 field >field237,605 constant (a-forth-constant(a-forth-constant38,628 2000 buffer: #some-storage41,657 -code assemby-code-word 43,685 -: a-forth-word 50,870 +code assemby-code-word43,685 +: a-forth-word50,870 +: (foo)(foo)55,988 +: foo56,1000 +: create-bar58,1015 +3 4 2constant 2const61,1074 +2const 2value 2val62,1095 +2variable 2var63,1114 +3.1415e fconstant fconst65,1130 +fconst fvalue fval66,1155 +fvariable fvar67,1174 +synonym mypi69,1190 +BEGIN-STRUCTURE point71,1211 + 1 CELLS +FIELD p.x72,1262 + 1 CELLS +FIELD p.y73,1318 go-src/test.go,48 package main1,0 @@ -4232,721 +4296,721 @@ tex-src/gzip.texi,303 @node Concept Index,Concept Index473,17287 tex-src/texinfo.tex,30627 -\def\texinfoversion{\texinfoversion26,1027 -\def\tie{\tie49,1518 -\def\gloggingall{\gloggingall72,2268 -\def\loggingall{\loggingall73,2337 -\def\onepageout#1{\onepageout99,3274 -\def\croppageout#1{\croppageout115,4024 -\def\cropmarks{\cropmarks142,5084 -\def\pagebody#1{\pagebody144,5131 -\def\ewtop{\ewtop157,5586 -\def\nstop{\nstop158,5650 -\def\ewbot{\ewbot160,5733 -\def\nsbot{\nsbot161,5797 -\def\parsearg #1{\parsearg170,6096 -\def\parseargx{\parseargx172,6174 -\def\parseargline{\parseargline182,6414 -\def\flushcr{\flushcr186,6535 -\newif\ifENV \ENVfalse \def\inENV{\inENV190,6734 -\def\ENVcheck{\ENVcheck191,6798 -\outer\def\begin{\begin198,7045 -\def\beginxxx #1{\beginxxx200,7083 -\def\end{\end208,7338 -\def\endxxx #1{\endxxx210,7366 -\def\errorE#1{\errorE216,7555 -\def\singlespace{\singlespace222,7749 -\def\@{\@232,7972 -\def\`{\`236,8072 -\def\'{\'237,8084 -\def\mylbrace {\mylbrace241,8132 -\def\myrbrace {\myrbrace242,8165 -\def\:{\:247,8279 -\def\*{\*250,8333 -\def\.{\.253,8409 -\def\w#1{\w258,8640 -\def\group{\group268,9123 - \def\Egroup{\Egroup273,9287 -\def\need{\need289,9729 -\def\needx#1{\needx300,10006 -\def\dots{\dots339,11392 -\def\page{\page343,11456 -\def\exdent{\exdent353,11783 -\def\exdentyyy #1{\exdentyyy354,11816 -\def\nofillexdent{\nofillexdent357,11960 -\def\nofillexdentyyy #1{\nofillexdentyyy358,12005 -\def\include{\include365,12189 -\def\includezzz #1{\includezzz366,12224 -\def\thisfile{\thisfile369,12275 -\def\center{\center373,12338 -\def\centerzzz #1{\centerzzz374,12371 -\def\sp{\sp380,12513 -\def\spxxx #1{\spxxx381,12538 -\def\comment{\comment387,12712 -\def\commentxxx #1{\commentxxx390,12809 -\def\ignoresections{\ignoresections396,12978 -\let\chapter=\relax=\relax397,13000 -\let\section=\relax=\relax406,13245 -\let\subsection=\relax=\relax409,13306 -\let\subsubsection=\relax=\relax410,13329 -\let\appendix=\relax=\relax411,13355 -\let\appendixsec=\relaxsec=\relax412,13376 -\let\appendixsection=\relaxsection=\relax413,13400 -\let\appendixsubsec=\relaxsubsec=\relax414,13428 -\let\appendixsubsection=\relaxsubsection=\relax415,13455 -\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13486 -\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13516 -\def\ignore{\ignore423,13618 -\long\def\ignorexxx #1\end ignore{\ignorexxx427,13758 -\def\direntry{\direntry429,13817 -\long\def\direntryxxx #1\end direntry{\direntryxxx430,13856 -\def\ifset{\ifset434,13966 -\def\ifsetxxx #1{\ifsetxxx436,14024 -\def\Eifset{\Eifset440,14151 -\def\ifsetfail{\ifsetfail441,14165 -\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14221 -\def\ifclear{\ifclear444,14282 -\def\ifclearxxx #1{\ifclearxxx446,14344 -\def\Eifclear{\Eifclear450,14475 -\def\ifclearfail{\ifclearfail451,14491 -\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14551 -\def\set{\set456,14702 -\def\setxxx #1{\setxxx457,14729 -\def\clear{\clear460,14791 -\def\clearxxx #1{\clearxxx461,14822 -\def\iftex{\iftex466,14939 -\def\Eiftex{\Eiftex467,14952 -\def\ifinfo{\ifinfo468,14966 -\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15016 -\long\def\menu #1\end menu{\menu471,15075 -\def\asis#1{\asis472,15104 -\def\math#1{\math485,15647 -\def\node{\node487,15691 -\def\nodezzz#1{\nodezzz488,15729 -\def\nodexxx[#1,#2]{\nodexxx[489,15760 -\def\donoderef{\donoderef492,15822 -\def\unnumbnoderef{\unnumbnoderef496,15943 -\def\appendixnoderef{\appendixnoderef500,16074 -\expandafter\expandafter\expandafter\appendixsetref{setref501,16120 -\let\refill=\relaxill=\relax504,16209 -\def\setfilename{\setfilename509,16423 -\outer\def\bye{\bye518,16669 -\def\inforef #1{\inforef520,16725 -\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16763 -\def\losespace #1{\losespace523,16860 -\def\sf{\sf532,17064 -\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17859 -\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17905 -\def\df{\df560,17941 -\def\resetmathfonts{\resetmathfonts635,20535 -\def\textfonts{\textfonts648,21124 -\def\chapfonts{\chapfonts653,21339 -\def\secfonts{\secfonts658,21555 -\def\subsecfonts{\subsecfonts663,21760 -\def\indexfonts{\indexfonts668,21977 -\def\smartitalicx{\smartitalicx691,22709 -\def\smartitalic#1{\smartitalic692,22785 -\let\cite=\smartitalic=\smartitalic698,22930 -\def\b#1{\b700,22954 -\def\t#1{\t703,22989 -\def\samp #1{\samp706,23141 -\def\key #1{\key707,23174 -\def\ctrl #1{\ctrl708,23235 -\def\tclose#1{\tclose716,23437 -\def\ {\720,23603 -\def\xkey{\xkey728,23872 -\def\kbdfoo#1#2#3\par{\kbdfoo729,23888 -\def\dmn#1{\dmn738,24189 -\def\kbd#1{\kbd740,24216 -\def\l#1{\l742,24273 -\def\r#1{\r744,24302 -\def\sc#1{\sc746,24370 -\def\ii#1{\ii747,24413 -\def\titlefont#1{\titlefont755,24646 -\def\titlepage{\titlepage761,24749 - \def\subtitlefont{\subtitlefont766,24976 - \def\authorfont{\authorfont768,25060 - \def\title{\title774,25270 - \def\titlezzz##1{\titlezzz775,25305 - \def\subtitle{\subtitle783,25620 - \def\subtitlezzz##1{\subtitlezzz784,25661 - \def\author{\author787,25779 - \def\authorzzz##1{\authorzzz788,25816 - \def\page{\page794,26107 -\def\Etitlepage{\Etitlepage804,26276 -\def\finishtitlepage{\finishtitlepage817,26664 -\def\evenheading{\evenheading846,27672 -\def\oddheading{\oddheading847,27715 -\def\everyheading{\everyheading848,27756 -\def\evenfooting{\evenfooting850,27802 -\def\oddfooting{\oddfooting851,27845 -\def\everyfooting{\everyfooting852,27886 -\def\headings #1 {\headings893,29578 -\def\HEADINGSoff{\HEADINGSoff895,29627 -\def\HEADINGSdouble{\HEADINGSdouble904,30054 -\def\HEADINGSsingle{\HEADINGSsingle914,30374 -\def\HEADINGSon{\HEADINGSon922,30595 -\def\HEADINGSafter{\HEADINGSafter924,30629 -\def\HEADINGSdoublex{\HEADINGSdoublex926,30724 -\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30912 -\def\HEADINGSsinglex{\HEADINGSsinglex934,30973 -\def\today{\today943,31248 -\def\thistitle{\thistitle958,31793 -\def\settitle{\settitle959,31818 -\def\settitlezzz #1{\settitlezzz960,31855 -\def\internalBitem{\internalBitem992,32785 -\def\internalBitemx{\internalBitemx993,32835 -\def\internalBxitem "#1"{\internalBxitem995,32880 -\def\internalBxitemx "#1"{\internalBxitemx996,32960 -\def\internalBkitem{\internalBkitem998,33035 -\def\internalBkitemx{\internalBkitemx999,33087 -\def\kitemzzz #1{\kitemzzz1001,33134 -\def\xitemzzz #1{\xitemzzz1004,33236 -\def\itemzzz #1{\itemzzz1007,33339 -\def\item{\item1037,34410 -\def\itemx{\itemx1038,34461 -\def\kitem{\kitem1039,34514 -\def\kitemx{\kitemx1040,34567 -\def\xitem{\xitem1041,34622 -\def\xitemx{\xitemx1042,34675 -\def\description{\description1045,34785 -\def\table{\table1047,34835 -\def\ftable{\ftable1052,34979 -\def\Eftable{\Eftable1056,35125 -\def\vtable{\vtable1059,35194 -\def\Evtable{\Evtable1063,35340 -\def\dontindex #1{\dontindex1066,35409 -\def\fnitemindex #1{\fnitemindex1067,35429 -\def\vritemindex #1{\vritemindex1068,35474 -\def\tablez #1#2#3#4#5#6{\tablez1074,35623 -\def\Edescription{\Edescription1077,35681 -\def\itemfont{\itemfont1082,35883 -\def\Etable{\Etable1090,36109 -\def\itemize{\itemize1103,36433 -\def\itemizezzz #1{\itemizezzz1105,36469 -\def\itemizey #1#2{\itemizey1110,36564 -\def#2{1119,36810 -\def\itemcontents{\itemcontents1120,36851 -\def\bullet{\bullet1123,36899 -\def\minus{\minus1124,36926 -\def\frenchspacing{\frenchspacing1128,37034 -\def\splitoff#1#2\endmark{\splitoff1134,37259 -\def\enumerate{\enumerate1140,37489 -\def\enumeratezzz #1{\enumeratezzz1141,37528 -\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37581 - \def\thearg{\thearg1146,37728 - \ifx\thearg\empty \def\thearg{\thearg1147,37747 -\def\numericenumerate{\numericenumerate1184,39081 -\def\lowercaseenumerate{\lowercaseenumerate1190,39211 -\def\uppercaseenumerate{\uppercaseenumerate1203,39558 -\def\startenumeration#1{\startenumeration1219,40048 -\def\alphaenumerate{\alphaenumerate1227,40230 -\def\capsenumerate{\capsenumerate1228,40265 -\def\Ealphaenumerate{\Ealphaenumerate1229,40299 -\def\Ecapsenumerate{\Ecapsenumerate1230,40333 -\def\itemizeitem{\itemizeitem1234,40413 -\def\newindex #1{\newindex1259,41270 -\def\defindex{\defindex1268,41559 -\def\newcodeindex #1{\newcodeindex1272,41667 -\def\defcodeindex{\defcodeindex1279,41927 -\def\synindex #1 #2 {\synindex1283,42107 -\def\syncodeindex #1 #2 {\syncodeindex1292,42447 -\def\doindex#1{\doindex1309,43126 -\def\singleindexer #1{\singleindexer1310,43185 -\def\docodeindex#1{\docodeindex1313,43297 -\def\singlecodeindexer #1{\singlecodeindexer1314,43364 -\def\indexdummies{\indexdummies1316,43422 -\def\_{\_1317,43442 -\def\w{\w1318,43470 -\def\bf{\bf1319,43497 -\def\rm{\rm1320,43526 -\def\sl{\sl1321,43555 -\def\sf{\sf1322,43584 -\def\tt{\tt1323,43612 -\def\gtr{\gtr1324,43640 -\def\less{\less1325,43670 -\def\hat{\hat1326,43702 -\def\char{\char1327,43732 -\def\TeX{\TeX1328,43764 -\def\dots{\dots1329,43794 -\def\copyright{\copyright1330,43827 -\def\tclose##1{\tclose1331,43870 -\def\code##1{\code1332,43915 -\def\samp##1{\samp1333,43956 -\def\t##1{\t1334,43997 -\def\r##1{\r1335,44032 -\def\i##1{\i1336,44067 -\def\b##1{\b1337,44102 -\def\cite##1{\cite1338,44137 -\def\key##1{\key1339,44178 -\def\file##1{\file1340,44217 -\def\var##1{\var1341,44258 -\def\kbd##1{\kbd1342,44297 -\def\indexdummyfont#1{\indexdummyfont1347,44453 -\def\indexdummytex{\indexdummytex1348,44479 -\def\indexdummydots{\indexdummydots1349,44503 -\def\indexnofonts{\indexnofonts1351,44529 -\let\w=\indexdummyfontdummyfont1352,44549 -\let\t=\indexdummyfontdummyfont1353,44572 -\let\r=\indexdummyfontdummyfont1354,44595 -\let\i=\indexdummyfontdummyfont1355,44618 -\let\b=\indexdummyfontdummyfont1356,44641 -\let\emph=\indexdummyfontdummyfont1357,44664 -\let\strong=\indexdummyfontdummyfont1358,44690 -\let\cite=\indexdummyfont=\indexdummyfont1359,44718 -\let\sc=\indexdummyfontdummyfont1360,44744 -\let\tclose=\indexdummyfontdummyfont1364,44916 -\let\code=\indexdummyfontdummyfont1365,44944 -\let\file=\indexdummyfontdummyfont1366,44970 -\let\samp=\indexdummyfontdummyfont1367,44996 -\let\kbd=\indexdummyfontdummyfont1368,45022 -\let\key=\indexdummyfontdummyfont1369,45047 -\let\var=\indexdummyfontdummyfont1370,45072 -\let\TeX=\indexdummytexdummytex1371,45097 -\let\dots=\indexdummydotsdummydots1372,45121 -\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45373 -\def\doind #1#2{\doind1384,45429 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45472 -\def\rawbackslashxx{\rawbackslashxx1389,45612 -{\indexnofontsnofonts1394,45874 -\def\dosubind #1#2#3{\dosubind1405,46185 -{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46233 -\def\rawbackslashxx{\rawbackslashxx1410,46337 -{\indexnofontsnofonts1414,46491 -\def\findex {\findex1443,47422 -\def\kindex {\kindex1444,47445 -\def\cindex {\cindex1445,47468 -\def\vindex {\vindex1446,47491 -\def\tindex {\tindex1447,47514 -\def\pindex {\pindex1448,47537 -\def\cindexsub {\cindexsub1450,47561 -\def\printindex{\printindex1462,47888 -\def\doprintindex#1{\doprintindex1464,47929 - \def\indexbackslash{\indexbackslash1481,48414 - \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48453 -\def\initial #1{\initial1517,49525 -\def\entry #1#2{\entry1523,49732 - \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50379 -\def\indexdotfill{\indexdotfill1549,50707 -\def\primary #1{\primary1552,50813 -\def\secondary #1#2{\secondary1556,50895 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50977 -\newbox\partialpageialpage1566,51150 -\def\begindoublecolumns{\begindoublecolumns1572,51308 - \output={\global\setbox\partialpage=ialpage=1573,51344 -\def\enddoublecolumns{\enddoublecolumns1577,51532 -\def\doublecolumnout{\doublecolumnout1580,51617 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51686 -\def\pagesofar{\pagesofar1584,51864 -\def\balancecolumns{\balancecolumns1588,52101 - \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52272 - \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52533 -\newcount \appendixno \appendixno = `\@no1627,53438 -\def\appendixletter{\appendixletter1628,53479 -\def\opencontents{\opencontents1632,53582 -\def\thischapter{\thischapter1637,53763 -\def\seccheck#1{\seccheck1638,53801 -\def\chapternofonts{\chapternofonts1643,53905 -\def\result{\result1646,53980 -\def\equiv{\equiv1647,54015 -\def\expansion{\expansion1648,54048 -\def\print{\print1649,54089 -\def\TeX{\TeX1650,54122 -\def\dots{\dots1651,54151 -\def\copyright{\copyright1652,54182 -\def\tt{\tt1653,54223 -\def\bf{\bf1654,54250 -\def\w{\w1655,54278 -\def\less{\less1656,54303 -\def\gtr{\gtr1657,54334 -\def\hat{\hat1658,54363 -\def\char{\char1659,54392 -\def\tclose##1{\tclose1660,54423 -\def\code##1{\code1661,54467 -\def\samp##1{\samp1662,54507 -\def\r##1{\r1663,54547 -\def\b##1{\b1664,54581 -\def\key##1{\key1665,54615 -\def\file##1{\file1666,54653 -\def\kbd##1{\kbd1667,54693 -\def\i##1{\i1669,54801 -\def\cite##1{\cite1670,54835 -\def\var##1{\var1671,54875 -\def\emph##1{\emph1672,54913 -\def\dfn##1{\dfn1673,54953 -\def\thischaptername{\thischaptername1676,54994 -\outer\def\chapter{\chapter1677,55033 -\def\chapterzzz #1{\chapterzzz1678,55074 -{\chapternofonts%nofonts%1687,55470 -\global\let\section = \numberedsec=1692,55623 -\global\let\subsection = \numberedsubsec=1693,55658 -\global\let\subsubsection = \numberedsubsubsec=1694,55699 -\outer\def\appendix{\appendix1697,55750 -\def\appendixzzz #1{\appendixzzz1698,55793 -\global\advance \appendixno by 1 \message{no1700,55870 -\chapmacro {#1}{Appendix \appendixletter}letter1701,55939 -\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56032 -{\chapternofonts%nofonts%1705,56104 - {#1}{Appendix \appendixletter}letter1707,56160 -\appendixnoderef %noderef1710,56260 -\global\let\section = \appendixsec=1711,56279 -\global\let\subsection = \appendixsubsec=1712,56314 -\global\let\subsubsection = \appendixsubsubsec=1713,56355 -\outer\def\top{\top1716,56406 -\outer\def\unnumbered{\unnumbered1717,56446 -\def\unnumberedzzz #1{\unnumberedzzz1718,56493 -{\chapternofonts%nofonts%1722,56656 -\global\let\section = \unnumberedsec=1727,56806 -\global\let\subsection = \unnumberedsubsec=1728,56843 -\global\let\subsubsection = \unnumberedsubsubsec=1729,56886 -\outer\def\numberedsec{\numberedsec1732,56939 -\def\seczzz #1{\seczzz1733,56980 -{\chapternofonts%nofonts%1736,57136 -\outer\def\appendixsection{\appendixsection1745,57322 -\outer\def\appendixsec{\appendixsec1746,57379 -\def\appendixsectionzzz #1{\appendixsectionzzz1747,57432 -\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57544 -{\chapternofonts%nofonts%1750,57612 -{#1}{\appendixletter}letter1752,57668 -\appendixnoderef %noderef1755,57768 -\outer\def\unnumberedsec{\unnumberedsec1759,57808 -\def\unnumberedseczzz #1{\unnumberedseczzz1760,57861 -{\chapternofonts%nofonts%1762,57956 -\outer\def\numberedsubsec{\numberedsubsec1770,58124 -\def\numberedsubseczzz #1{\numberedsubseczzz1771,58179 -{\chapternofonts%nofonts%1774,58358 -\outer\def\appendixsubsec{\appendixsubsec1783,58562 -\def\appendixsubseczzz #1{\appendixsubseczzz1784,58617 -\subsecheading {#1}{\appendixletter}letter1786,58739 -{\chapternofonts%nofonts%1787,58804 -{#1}{\appendixletter}letter1789,58863 -\appendixnoderef %noderef1792,58978 -\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59018 -\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59077 -{\chapternofonts%nofonts%1799,59178 -\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59349 -\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59410 -{\chapternofonts%nofonts%1812,59607 -\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59840 -\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59901 - {\appendixletter}letter1827,60040 -{\chapternofonts%nofonts%1828,60106 - {\appendixletter}letter1830,60171 -\appendixnoderef %noderef1834,60305 -\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60345 -\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60410 -{\chapternofonts%nofonts%1841,60517 -\def\infotop{\infotop1851,60846 -\def\infounnumbered{\infounnumbered1852,60884 -\def\infounnumberedsec{\infounnumberedsec1853,60929 -\def\infounnumberedsubsec{\infounnumberedsubsec1854,60980 -\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61037 -\def\infoappendix{\infoappendix1857,61101 -\def\infoappendixsec{\infoappendixsec1858,61142 -\def\infoappendixsubsec{\infoappendixsubsec1859,61189 -\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61242 -\def\infochapter{\infochapter1862,61302 -\def\infosection{\infosection1863,61341 -\def\infosubsection{\infosubsection1864,61380 -\def\infosubsubsection{\infosubsubsection1865,61425 -\global\let\section = \numberedsec=1870,61662 -\global\let\subsection = \numberedsubsec=1871,61697 -\global\let\subsubsection = \numberedsubsubsec=1872,61738 -\def\majorheading{\majorheading1886,62245 -\def\majorheadingzzz #1{\majorheadingzzz1887,62290 -\def\chapheading{\chapheading1893,62523 -\def\chapheadingzzz #1{\chapheadingzzz1894,62566 -\def\heading{\heading1899,62761 -\def\subheading{\subheading1901,62798 -\def\subsubheading{\subsubheading1903,62841 -\def\dobreak#1#2{\dobreak1910,63118 -\def\setchapterstyle #1 {\setchapterstyle1912,63196 -\def\chapbreak{\chapbreak1919,63451 -\def\chappager{\chappager1920,63501 -\def\chapoddpage{\chapoddpage1921,63539 -\def\setchapternewpage #1 {\setchapternewpage1923,63618 -\def\CHAPPAGoff{\CHAPPAGoff1925,63675 -\def\CHAPPAGon{\CHAPPAGon1929,63769 -\global\def\HEADINGSon{\HEADINGSon1932,63860 -\def\CHAPPAGodd{\CHAPPAGodd1934,63902 -\global\def\HEADINGSon{\HEADINGSon1937,63998 -\def\CHAPFplain{\CHAPFplain1941,64052 -\def\chfplain #1#2{\chfplain1945,64144 -\def\unnchfplain #1{\unnchfplain1956,64367 -\def\unnchfopen #1{\unnchfopen1964,64596 -\def\chfopen #1#2{\chfopen1970,64804 -\def\CHAPFopen{\CHAPFopen1975,64948 -\def\subsecheadingbreak{\subsecheadingbreak1982,65166 -\def\secheadingbreak{\secheadingbreak1985,65295 -\def\secheading #1#2#3{\secheading1993,65577 -\def\plainsecheading #1{\plainsecheading1994,65633 -\def\secheadingi #1{\secheadingi1995,65676 -\def\subsecheading #1#2#3#4{\subsecheading2006,66044 -\def\subsecheadingi #1{\subsecheadingi2007,66111 -\def\subsubsecfonts{\subsubsecfonts2014,66408 -\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66531 -\def\subsubsecheadingi #1{\subsubsecheadingi2018,66609 -\def\startcontents#1{\startcontents2032,67081 - \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67354 -\outer\def\contents{\contents2049,67713 -\outer\def\summarycontents{\summarycontents2057,67857 - \def\secentry ##1##2##3##4{\secentry2067,68228 - \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68263 - \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68298 - \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68339 - \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68377 - \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68424 -\def\chapentry#1#2#3{\chapentry2085,68858 -\def\shortchapentry#1#2#3{\shortchapentry2088,68975 - {#2\labelspace #1}space2091,69085 -\def\unnumbchapentry#1#2{\unnumbchapentry2094,69139 -\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69186 -\def\secentry#1#2#3#4{\secentry2102,69350 -\def\unnumbsecentry#1#2{\unnumbsecentry2103,69409 -\def\subsecentry#1#2#3#4#5{\subsecentry2106,69470 -\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69540 -\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69614 - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69648 -\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69699 -\def\dochapentry#1#2{\dochapentry2123,70073 -\def\dosecentry#1#2{\dosecentry2138,70678 -\def\dosubsecentry#1#2{\dosubsecentry2145,70856 -\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71041 -\def\labelspace{\labelspace2160,71292 -\def\dopageno#1{\dopageno2162,71327 -\def\doshortpageno#1{\doshortpageno2163,71353 -\def\chapentryfonts{\chapentryfonts2165,71385 -\def\secentryfonts{\secentryfonts2166,71420 -\def\point{\point2192,72379 -\def\result{\result2194,72400 -\def\expansion{\expansion2195,72473 -\def\print{\print2196,72544 -\def\equiv{\equiv2198,72611 -\def\error{\error2218,73384 -\def\tex{\tex2224,73613 -\def\@{\@2242,73996 -\gdef\sepspaces{\def {\ }}}\2265,74728 -\def\aboveenvbreak{\aboveenvbreak2268,74810 -\def\afterenvbreak{\afterenvbreak2272,74976 -\def\ctl{\ctl2286,75487 -\def\ctr{\ctr2287,75559 -\def\cbl{\cbl2288,75598 -\def\cbr{\cbr2289,75638 -\def\carttop{\carttop2290,75677 -\def\cartbot{\cartbot2293,75785 -\long\def\cartouche{\cartouche2299,75925 -\def\Ecartouche{\Ecartouche2326,76713 -\def\lisp{\lisp2338,76848 -\def\Elisp{\Elisp2348,77195 -\def\next##1{\next2360,77521 -\def\Eexample{\Eexample2364,77563 -\def\Esmallexample{\Esmallexample2367,77610 -\def\smalllispx{\smalllispx2373,77788 -\def\Esmalllisp{\Esmalllisp2383,78142 -\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78498 -\def\next##1{\next2397,78555 -\def\display{\display2401,78635 -\def\Edisplay{\Edisplay2410,78954 -\def\next##1{\next2422,79265 -\def\format{\format2426,79368 -\def\Eformat{\Eformat2434,79664 -\def\next##1{\next2437,79753 -\def\flushleft{\flushleft2441,79805 -\def\Eflushleft{\Eflushleft2451,80176 -\def\next##1{\next2454,80269 -\def\flushright{\flushright2456,80291 -\def\Eflushright{\Eflushright2466,80663 -\def\next##1{\next2470,80794 -\def\quotation{\quotation2474,80852 -\def\Equotation{\Equotation2480,81044 -\def\setdeffont #1 {\setdeffont2493,81442 -\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81488 -\newskip\defargsindent \defargsindent=50ptargsindent2496,81531 -\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81574 -\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81617 -\def\activeparens{\activeparens2503,81815 -\def\opnr{\opnr2529,83027 -\def\lbrb{\lbrb2530,83092 -\def\defname #1#2{\defname2536,83293 -\advance\dimen2 by -\defbodyindentbodyindent2540,83411 -\advance\dimen3 by -\defbodyindentbodyindent2542,83465 -\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83519 -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83661 -\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83736 -\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84105 -\advance\leftskip by -\defbodyindentbodyindent2557,84239 -\exdentamount=\defbodyindentbodyindent2558,84276 -\def\defparsebody #1#2#3{\defparsebody2568,84635 -\def#1{2572,84819 -\def#2{2573,84855 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84927 -\exdentamount=\defbodyindentbodyindent2576,85001 -\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85105 -\def#1{2585,85266 -\def#2##1 {2586,85302 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85385 -\exdentamount=\defbodyindentbodyindent2589,85459 -\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85544 -\def#1{2596,85705 -\def#2##1 ##2 {2597,85741 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85841 -\exdentamount=\defbodyindentbodyindent2601,85915 -\def\defvarparsebody #1#2#3{\defvarparsebody2608,86186 -\def#1{2612,86373 -\def#2{2613,86409 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86468 -\exdentamount=\defbodyindentbodyindent2616,86542 -\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86633 -\def#1{2625,86792 -\def#2##1 {2626,86828 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86898 -\exdentamount=\defbodyindentbodyindent2629,86972 -\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87044 -\def#1{2636,87208 -\def#2##1 ##2 {2637,87244 -\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87331 -\exdentamount=\defbodyindentbodyindent2641,87405 -\def\defunargs #1{\defunargs2664,88165 -\def\deftypefunargs #1{\deftypefunargs2676,88547 -\def\deffn{\deffn2690,88929 -\def\deffnheader #1#2#3{\deffnheader2692,88986 -\begingroup\defname {name2693,89034 -\def\defun{\defun2699,89179 -\def\defunheader #1#2{\defunheader2701,89232 -\begingroup\defname {name2702,89307 -\defunargs {unargs2703,89343 -\def\deftypefun{\deftypefun2709,89491 -\def\deftypefunheader #1#2{\deftypefunheader2712,89613 -\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89722 -\begingroup\defname {name2716,89814 -\deftypefunargs {typefunargs2717,89860 -\def\deftypefn{\deftypefn2723,90031 -\def\deftypefnheader #1#2#3{\deftypefnheader2726,90180 -\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90316 -\begingroup\defname {name2730,90409 -\deftypefunargs {typefunargs2731,90449 -\def\defmac{\defmac2737,90570 -\def\defmacheader #1#2{\defmacheader2739,90627 -\begingroup\defname {name2740,90703 -\defunargs {unargs2741,90736 -\def\defspec{\defspec2747,90860 -\def\defspecheader #1#2{\defspecheader2749,90921 -\begingroup\defname {name2750,90998 -\defunargs {unargs2751,91038 -\def\deffnx #1 {\deffnx2758,91233 -\def\defunx #1 {\defunx2759,91290 -\def\defmacx #1 {\defmacx2760,91347 -\def\defspecx #1 {\defspecx2761,91406 -\def\deftypefnx #1 {\deftypefnx2762,91467 -\def\deftypeunx #1 {\deftypeunx2763,91532 -\def\defop #1 {\defop2769,91678 -\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91713 -\def\defopheader #1#2#3{\defopheader2772,91767 -\begingroup\defname {name2774,91856 -\defunargs {unargs2775,91902 -\def\defmethod{\defmethod2780,91963 -\def\defmethodheader #1#2#3{\defmethodheader2782,92036 -\begingroup\defname {name2784,92124 -\defunargs {unargs2785,92164 -\def\defcv #1 {\defcv2790,92238 -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92273 -\def\defcvarheader #1#2#3{\defcvarheader2793,92332 -\begingroup\defname {name2795,92418 -\defvarargs {varargs2796,92464 -\def\defivar{\defivar2801,92537 -\def\defivarheader #1#2#3{\defivarheader2803,92600 -\begingroup\defname {name2805,92686 -\defvarargs {varargs2806,92737 -\def\defopx #1 {\defopx2812,92886 -\def\defmethodx #1 {\defmethodx2813,92943 -\def\defcvx #1 {\defcvx2814,93008 -\def\defivarx #1 {\defivarx2815,93065 -\def\defvarargs #1{\defvarargs2822,93336 -\def\defvr{\defvr2828,93480 -\def\defvrheader #1#2#3{\defvrheader2830,93535 -\begingroup\defname {name2831,93583 -\def\defvar{\defvar2835,93668 -\def\defvarheader #1#2{\defvarheader2837,93728 -\begingroup\defname {name2838,93799 -\defvarargs {varargs2839,93835 -\def\defopt{\defopt2844,93901 -\def\defoptheader #1#2{\defoptheader2846,93961 -\begingroup\defname {name2847,94032 -\defvarargs {varargs2848,94071 -\def\deftypevar{\deftypevar2853,94128 -\def\deftypevarheader #1#2{\deftypevarheader2856,94244 -\begingroup\defname {name2858,94327 -\def\deftypevr{\deftypevr2865,94501 -\def\deftypevrheader #1#2#3{\deftypevrheader2867,94572 -\begingroup\defname {name2868,94624 -\def\defvrx #1 {\defvrx2876,94861 -\def\defvarx #1 {\defvarx2877,94918 -\def\defoptx #1 {\defoptx2878,94977 -\def\deftypevarx #1 {\deftypevarx2879,95036 -\def\deftypevrx #1 {\deftypevrx2880,95103 -\def\deftpargs #1{\deftpargs2885,95252 -\def\deftp{\deftp2889,95332 -\def\deftpheader #1#2#3{\deftpheader2891,95387 -\begingroup\defname {name2892,95435 -\def\deftpx #1 {\deftpx2897,95594 -\def\setref#1{\setref2908,95915 -\def\unnumbsetref#1{\unnumbsetref2913,96029 -\def\appendixsetref#1{\appendixsetref2918,96136 -\def\pxref#1{\pxref2929,96547 -\def\xref#1{\xref2930,96583 -\def\ref#1{\ref2931,96618 -\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96648 -\def\printedmanual{\printedmanual2933,96691 -\def\printednodename{\printednodename2934,96729 -\def\printednodename{\printednodename2939,96854 -section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97487 -\refx{x2957,97565 -\def\dosetq #1#2{\dosetq2965,97785 -\def\internalsetq #1#2{\internalsetq2973,98043 -\def\Ypagenumber{\Ypagenumber2977,98144 -\def\Ytitle{\Ytitle2979,98170 -\def\Ynothing{\Ynothing2981,98197 -\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98214 -\def\Yappendixletterandtype{\Yappendixletterandtype2992,98530 -\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98560 -\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98615 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98719 -Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98790 - \def\linenumber{\linenumber3009,99129 -\def\refx#1#2{\refx3015,99313 -\def\xrdef #1#2{\xrdef3037,99939 -\def\readauxfile{\readauxfile3040,100024 -\def\supereject{\supereject3110,101805 -\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102490 -\def\openindices{\openindices3139,102676 -\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102901 -\parindent = \defaultparindentaultparindent3152,102953 -\def\smallbook{\smallbook3175,103677 -\global\def\Esmallexample{\Esmallexample3192,104104 -\def\afourpaper{\afourpaper3196,104195 -\def\finalout{\finalout3224,105003 -\def\normaldoublequote{\normaldoublequote3235,105264 -\def\normaltilde{\normaltilde3236,105290 -\def\normalcaret{\normalcaret3237,105310 -\def\normalunderscore{\normalunderscore3238,105330 -\def\normalverticalbar{\normalverticalbar3239,105355 -\def\normalless{\normalless3240,105381 -\def\normalgreater{\normalgreater3241,105400 -\def\normalplus{\normalplus3242,105422 -\def\ifusingtt#1#2{\ifusingtt3253,105914 -\def\activedoublequote{\activedoublequote3261,106242 -\def~{~3264,106328 -\def^{^3267,106389 -\def_{_3270,106428 -\def\_{\_3272,106502 -\def\lvvmode{\lvvmode3279,106839 -\def|{|3282,106889 -\def<{<3285,106952 -\def>{>3288,107009 -\def+{+3290,107047 -\def\turnoffactive{\turnoffactive3296,107208 -\global\def={=3307,107494 -\def\normalbackslash{\normalbackslash3321,107876 +\def\texinfoversion{\texinfoversion26,1032 +\def\tie{\tie49,1523 +\def\gloggingall{\gloggingall72,2273 +\def\loggingall{\loggingall73,2342 +\def\onepageout#1{\onepageout99,3279 +\def\croppageout#1{\croppageout115,4029 +\def\cropmarks{\cropmarks142,5089 +\def\pagebody#1{\pagebody144,5136 +\def\ewtop{\ewtop157,5591 +\def\nstop{\nstop158,5655 +\def\ewbot{\ewbot160,5738 +\def\nsbot{\nsbot161,5802 +\def\parsearg #1{\parsearg170,6101 +\def\parseargx{\parseargx172,6179 +\def\parseargline{\parseargline182,6419 +\def\flushcr{\flushcr186,6540 +\newif\ifENV \ENVfalse \def\inENV{\inENV190,6739 +\def\ENVcheck{\ENVcheck191,6803 +\outer\def\begin{\begin198,7050 +\def\beginxxx #1{\beginxxx200,7088 +\def\end{\end208,7343 +\def\endxxx #1{\endxxx210,7371 +\def\errorE#1{\errorE216,7560 +\def\singlespace{\singlespace222,7754 +\def\@{\@232,7977 +\def\`{\`236,8077 +\def\'{\'237,8089 +\def\mylbrace {\mylbrace241,8137 +\def\myrbrace {\myrbrace242,8170 +\def\:{\:247,8284 +\def\*{\*250,8338 +\def\.{\.253,8414 +\def\w#1{\w258,8645 +\def\group{\group268,9128 + \def\Egroup{\Egroup273,9292 +\def\need{\need289,9734 +\def\needx#1{\needx300,10011 +\def\dots{\dots339,11397 +\def\page{\page343,11461 +\def\exdent{\exdent353,11788 +\def\exdentyyy #1{\exdentyyy354,11821 +\def\nofillexdent{\nofillexdent357,11965 +\def\nofillexdentyyy #1{\nofillexdentyyy358,12010 +\def\include{\include365,12194 +\def\includezzz #1{\includezzz366,12229 +\def\thisfile{\thisfile369,12280 +\def\center{\center373,12343 +\def\centerzzz #1{\centerzzz374,12376 +\def\sp{\sp380,12518 +\def\spxxx #1{\spxxx381,12543 +\def\comment{\comment387,12717 +\def\commentxxx #1{\commentxxx390,12814 +\def\ignoresections{\ignoresections396,12983 +\let\chapter=\relax=\relax397,13005 +\let\section=\relax=\relax406,13250 +\let\subsection=\relax=\relax409,13311 +\let\subsubsection=\relax=\relax410,13334 +\let\appendix=\relax=\relax411,13360 +\let\appendixsec=\relaxsec=\relax412,13381 +\let\appendixsection=\relaxsection=\relax413,13405 +\let\appendixsubsec=\relaxsubsec=\relax414,13433 +\let\appendixsubsection=\relaxsubsection=\relax415,13460 +\let\appendixsubsubsec=\relaxsubsubsec=\relax416,13491 +\let\appendixsubsubsection=\relaxsubsubsection=\relax417,13521 +\def\ignore{\ignore423,13623 +\long\def\ignorexxx #1\end ignore{\ignorexxx427,13763 +\def\direntry{\direntry429,13822 +\long\def\direntryxxx #1\end direntry{\direntryxxx430,13861 +\def\ifset{\ifset434,13971 +\def\ifsetxxx #1{\ifsetxxx436,14029 +\def\Eifset{\Eifset440,14156 +\def\ifsetfail{\ifsetfail441,14170 +\long\def\ifsetfailxxx #1\end ifset{\ifsetfailxxx442,14226 +\def\ifclear{\ifclear444,14287 +\def\ifclearxxx #1{\ifclearxxx446,14349 +\def\Eifclear{\Eifclear450,14480 +\def\ifclearfail{\ifclearfail451,14496 +\long\def\ifclearfailxxx #1\end ifclear{\ifclearfailxxx452,14556 +\def\set{\set456,14707 +\def\setxxx #1{\setxxx457,14734 +\def\clear{\clear460,14796 +\def\clearxxx #1{\clearxxx461,14827 +\def\iftex{\iftex466,14944 +\def\Eiftex{\Eiftex467,14957 +\def\ifinfo{\ifinfo468,14971 +\long\def\ifinfoxxx #1\end ifinfo{\ifinfoxxx469,15021 +\long\def\menu #1\end menu{\menu471,15080 +\def\asis#1{\asis472,15109 +\def\math#1{\math485,15652 +\def\node{\node487,15696 +\def\nodezzz#1{\nodezzz488,15734 +\def\nodexxx[#1,#2]{\nodexxx[489,15765 +\def\donoderef{\donoderef492,15827 +\def\unnumbnoderef{\unnumbnoderef496,15948 +\def\appendixnoderef{\appendixnoderef500,16079 +\expandafter\expandafter\expandafter\appendixsetref{setref501,16125 +\let\refill=\relaxill=\relax504,16214 +\def\setfilename{\setfilename509,16428 +\outer\def\bye{\bye518,16674 +\def\inforef #1{\inforef520,16730 +\def\inforefzzz #1,#2,#3,#4**{\inforefzzz521,16768 +\def\losespace #1{\losespace523,16865 +\def\sf{\sf532,17069 +\font\defbf=cmbx10 scaled \magstep1 %was 1314bf=cmbx10558,17864 +\font\deftt=cmtt10 scaled \magstep1tt=cmtt10559,17910 +\def\df{\df560,17946 +\def\resetmathfonts{\resetmathfonts635,20540 +\def\textfonts{\textfonts648,21129 +\def\chapfonts{\chapfonts653,21344 +\def\secfonts{\secfonts658,21560 +\def\subsecfonts{\subsecfonts663,21765 +\def\indexfonts{\indexfonts668,21982 +\def\smartitalicx{\smartitalicx691,22714 +\def\smartitalic#1{\smartitalic692,22790 +\let\cite=\smartitalic=\smartitalic698,22935 +\def\b#1{\b700,22959 +\def\t#1{\t703,22994 +\def\samp #1{\samp706,23146 +\def\key #1{\key707,23179 +\def\ctrl #1{\ctrl708,23240 +\def\tclose#1{\tclose716,23442 +\def\ {\720,23608 +\def\xkey{\xkey728,23877 +\def\kbdfoo#1#2#3\par{\kbdfoo729,23893 +\def\dmn#1{\dmn738,24194 +\def\kbd#1{\kbd740,24221 +\def\l#1{\l742,24278 +\def\r#1{\r744,24307 +\def\sc#1{\sc746,24375 +\def\ii#1{\ii747,24418 +\def\titlefont#1{\titlefont755,24651 +\def\titlepage{\titlepage761,24754 + \def\subtitlefont{\subtitlefont766,24981 + \def\authorfont{\authorfont768,25065 + \def\title{\title774,25275 + \def\titlezzz##1{\titlezzz775,25310 + \def\subtitle{\subtitle783,25625 + \def\subtitlezzz##1{\subtitlezzz784,25666 + \def\author{\author787,25784 + \def\authorzzz##1{\authorzzz788,25821 + \def\page{\page794,26112 +\def\Etitlepage{\Etitlepage804,26281 +\def\finishtitlepage{\finishtitlepage817,26669 +\def\evenheading{\evenheading846,27677 +\def\oddheading{\oddheading847,27720 +\def\everyheading{\everyheading848,27761 +\def\evenfooting{\evenfooting850,27807 +\def\oddfooting{\oddfooting851,27850 +\def\everyfooting{\everyfooting852,27891 +\def\headings #1 {\headings893,29583 +\def\HEADINGSoff{\HEADINGSoff895,29632 +\def\HEADINGSdouble{\HEADINGSdouble904,30059 +\def\HEADINGSsingle{\HEADINGSsingle914,30379 +\def\HEADINGSon{\HEADINGSon922,30600 +\def\HEADINGSafter{\HEADINGSafter924,30634 +\def\HEADINGSdoublex{\HEADINGSdoublex926,30729 +\def\HEADINGSsingleafter{\HEADINGSsingleafter933,30917 +\def\HEADINGSsinglex{\HEADINGSsinglex934,30978 +\def\today{\today943,31253 +\def\thistitle{\thistitle958,31798 +\def\settitle{\settitle959,31823 +\def\settitlezzz #1{\settitlezzz960,31860 +\def\internalBitem{\internalBitem992,32790 +\def\internalBitemx{\internalBitemx993,32840 +\def\internalBxitem "#1"{\internalBxitem995,32885 +\def\internalBxitemx "#1"{\internalBxitemx996,32965 +\def\internalBkitem{\internalBkitem998,33040 +\def\internalBkitemx{\internalBkitemx999,33092 +\def\kitemzzz #1{\kitemzzz1001,33139 +\def\xitemzzz #1{\xitemzzz1004,33241 +\def\itemzzz #1{\itemzzz1007,33344 +\def\item{\item1037,34415 +\def\itemx{\itemx1038,34466 +\def\kitem{\kitem1039,34519 +\def\kitemx{\kitemx1040,34572 +\def\xitem{\xitem1041,34627 +\def\xitemx{\xitemx1042,34680 +\def\description{\description1045,34790 +\def\table{\table1047,34840 +\def\ftable{\ftable1052,34984 +\def\Eftable{\Eftable1056,35130 +\def\vtable{\vtable1059,35199 +\def\Evtable{\Evtable1063,35345 +\def\dontindex #1{\dontindex1066,35414 +\def\fnitemindex #1{\fnitemindex1067,35434 +\def\vritemindex #1{\vritemindex1068,35479 +\def\tablez #1#2#3#4#5#6{\tablez1074,35628 +\def\Edescription{\Edescription1077,35686 +\def\itemfont{\itemfont1082,35888 +\def\Etable{\Etable1090,36114 +\def\itemize{\itemize1103,36438 +\def\itemizezzz #1{\itemizezzz1105,36474 +\def\itemizey #1#2{\itemizey1110,36569 +\def#2{1119,36815 +\def\itemcontents{\itemcontents1120,36856 +\def\bullet{\bullet1123,36904 +\def\minus{\minus1124,36931 +\def\frenchspacing{\frenchspacing1128,37039 +\def\splitoff#1#2\endmark{\splitoff1134,37264 +\def\enumerate{\enumerate1140,37494 +\def\enumeratezzz #1{\enumeratezzz1141,37533 +\def\enumeratey #1 #2\endenumeratey{\enumeratey1142,37586 + \def\thearg{\thearg1146,37733 + \ifx\thearg\empty \def\thearg{\thearg1147,37752 +\def\numericenumerate{\numericenumerate1184,39086 +\def\lowercaseenumerate{\lowercaseenumerate1190,39216 +\def\uppercaseenumerate{\uppercaseenumerate1203,39563 +\def\startenumeration#1{\startenumeration1219,40053 +\def\alphaenumerate{\alphaenumerate1227,40235 +\def\capsenumerate{\capsenumerate1228,40270 +\def\Ealphaenumerate{\Ealphaenumerate1229,40304 +\def\Ecapsenumerate{\Ecapsenumerate1230,40338 +\def\itemizeitem{\itemizeitem1234,40418 +\def\newindex #1{\newindex1259,41275 +\def\defindex{\defindex1268,41564 +\def\newcodeindex #1{\newcodeindex1272,41672 +\def\defcodeindex{\defcodeindex1279,41932 +\def\synindex #1 #2 {\synindex1283,42112 +\def\syncodeindex #1 #2 {\syncodeindex1292,42452 +\def\doindex#1{\doindex1309,43131 +\def\singleindexer #1{\singleindexer1310,43190 +\def\docodeindex#1{\docodeindex1313,43302 +\def\singlecodeindexer #1{\singlecodeindexer1314,43369 +\def\indexdummies{\indexdummies1316,43427 +\def\_{\_1317,43447 +\def\w{\w1318,43475 +\def\bf{\bf1319,43502 +\def\rm{\rm1320,43531 +\def\sl{\sl1321,43560 +\def\sf{\sf1322,43589 +\def\tt{\tt1323,43617 +\def\gtr{\gtr1324,43645 +\def\less{\less1325,43675 +\def\hat{\hat1326,43707 +\def\char{\char1327,43737 +\def\TeX{\TeX1328,43769 +\def\dots{\dots1329,43799 +\def\copyright{\copyright1330,43832 +\def\tclose##1{\tclose1331,43875 +\def\code##1{\code1332,43920 +\def\samp##1{\samp1333,43961 +\def\t##1{\t1334,44002 +\def\r##1{\r1335,44037 +\def\i##1{\i1336,44072 +\def\b##1{\b1337,44107 +\def\cite##1{\cite1338,44142 +\def\key##1{\key1339,44183 +\def\file##1{\file1340,44222 +\def\var##1{\var1341,44263 +\def\kbd##1{\kbd1342,44302 +\def\indexdummyfont#1{\indexdummyfont1347,44458 +\def\indexdummytex{\indexdummytex1348,44484 +\def\indexdummydots{\indexdummydots1349,44508 +\def\indexnofonts{\indexnofonts1351,44534 +\let\w=\indexdummyfontdummyfont1352,44554 +\let\t=\indexdummyfontdummyfont1353,44577 +\let\r=\indexdummyfontdummyfont1354,44600 +\let\i=\indexdummyfontdummyfont1355,44623 +\let\b=\indexdummyfontdummyfont1356,44646 +\let\emph=\indexdummyfontdummyfont1357,44669 +\let\strong=\indexdummyfontdummyfont1358,44695 +\let\cite=\indexdummyfont=\indexdummyfont1359,44723 +\let\sc=\indexdummyfontdummyfont1360,44749 +\let\tclose=\indexdummyfontdummyfont1364,44921 +\let\code=\indexdummyfontdummyfont1365,44949 +\let\file=\indexdummyfontdummyfont1366,44975 +\let\samp=\indexdummyfontdummyfont1367,45001 +\let\kbd=\indexdummyfontdummyfont1368,45027 +\let\key=\indexdummyfontdummyfont1369,45052 +\let\var=\indexdummyfontdummyfont1370,45077 +\let\TeX=\indexdummytexdummytex1371,45102 +\let\dots=\indexdummydotsdummydots1372,45126 +\let\indexbackslash=0 %overridden during \printindex.backslash=01382,45378 +\def\doind #1#2{\doind1384,45434 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1386,45477 +\def\rawbackslashxx{\rawbackslashxx1389,45617 +{\indexnofontsnofonts1394,45879 +\def\dosubind #1#2#3{\dosubind1405,46190 +{\indexdummies % Must do this here, since \bf, etc expand at this stagedummies1407,46238 +\def\rawbackslashxx{\rawbackslashxx1410,46342 +{\indexnofontsnofonts1414,46496 +\def\findex {\findex1443,47427 +\def\kindex {\kindex1444,47450 +\def\cindex {\cindex1445,47473 +\def\vindex {\vindex1446,47496 +\def\tindex {\tindex1447,47519 +\def\pindex {\pindex1448,47542 +\def\cindexsub {\cindexsub1450,47566 +\def\printindex{\printindex1462,47893 +\def\doprintindex#1{\doprintindex1464,47934 + \def\indexbackslash{\indexbackslash1481,48419 + \indexfonts\rm \tolerance=9500 \advance\baselineskip -1ptfonts\rm1482,48458 +\def\initial #1{\initial1517,49530 +\def\entry #1#2{\entry1523,49737 + \null\nobreak\indexdotfill % Have leaders before the page number.dotfill1540,50384 +\def\indexdotfill{\indexdotfill1549,50712 +\def\primary #1{\primary1552,50818 +\def\secondary #1#2{\secondary1556,50900 +\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\pardotfill1559,50982 +\newbox\partialpageialpage1566,51155 +\def\begindoublecolumns{\begindoublecolumns1572,51313 + \output={\global\setbox\partialpage=ialpage=1573,51349 +\def\enddoublecolumns{\enddoublecolumns1577,51537 +\def\doublecolumnout{\doublecolumnout1580,51622 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1581,51691 +\def\pagesofar{\pagesofar1584,51869 +\def\balancecolumns{\balancecolumns1588,52106 + \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpageialpage1594,52277 + \dimen@=\pageheight \advance\dimen@ by-\ht\partialpageialpage1600,52538 +\newcount \appendixno \appendixno = `\@no1627,53443 +\def\appendixletter{\appendixletter1628,53484 +\def\opencontents{\opencontents1632,53587 +\def\thischapter{\thischapter1637,53768 +\def\seccheck#1{\seccheck1638,53806 +\def\chapternofonts{\chapternofonts1643,53910 +\def\result{\result1646,53985 +\def\equiv{\equiv1647,54020 +\def\expansion{\expansion1648,54053 +\def\print{\print1649,54094 +\def\TeX{\TeX1650,54127 +\def\dots{\dots1651,54156 +\def\copyright{\copyright1652,54187 +\def\tt{\tt1653,54228 +\def\bf{\bf1654,54255 +\def\w{\w1655,54283 +\def\less{\less1656,54308 +\def\gtr{\gtr1657,54339 +\def\hat{\hat1658,54368 +\def\char{\char1659,54397 +\def\tclose##1{\tclose1660,54428 +\def\code##1{\code1661,54472 +\def\samp##1{\samp1662,54512 +\def\r##1{\r1663,54552 +\def\b##1{\b1664,54586 +\def\key##1{\key1665,54620 +\def\file##1{\file1666,54658 +\def\kbd##1{\kbd1667,54698 +\def\i##1{\i1669,54806 +\def\cite##1{\cite1670,54840 +\def\var##1{\var1671,54880 +\def\emph##1{\emph1672,54918 +\def\dfn##1{\dfn1673,54958 +\def\thischaptername{\thischaptername1676,54999 +\outer\def\chapter{\chapter1677,55038 +\def\chapterzzz #1{\chapterzzz1678,55079 +{\chapternofonts%nofonts%1687,55475 +\global\let\section = \numberedsec=1692,55628 +\global\let\subsection = \numberedsubsec=1693,55663 +\global\let\subsubsection = \numberedsubsubsec=1694,55704 +\outer\def\appendix{\appendix1697,55755 +\def\appendixzzz #1{\appendixzzz1698,55798 +\global\advance \appendixno by 1 \message{no1700,55875 +\chapmacro {#1}{Appendix \appendixletter}letter1701,55944 +\xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}letter:1704,56037 +{\chapternofonts%nofonts%1705,56109 + {#1}{Appendix \appendixletter}letter1707,56165 +\appendixnoderef %noderef1710,56265 +\global\let\section = \appendixsec=1711,56284 +\global\let\subsection = \appendixsubsec=1712,56319 +\global\let\subsubsection = \appendixsubsubsec=1713,56360 +\outer\def\top{\top1716,56411 +\outer\def\unnumbered{\unnumbered1717,56451 +\def\unnumberedzzz #1{\unnumberedzzz1718,56498 +{\chapternofonts%nofonts%1722,56661 +\global\let\section = \unnumberedsec=1727,56811 +\global\let\subsection = \unnumberedsubsec=1728,56848 +\global\let\subsubsection = \unnumberedsubsubsec=1729,56891 +\outer\def\numberedsec{\numberedsec1732,56944 +\def\seczzz #1{\seczzz1733,56985 +{\chapternofonts%nofonts%1736,57141 +\outer\def\appendixsection{\appendixsection1745,57327 +\outer\def\appendixsec{\appendixsec1746,57384 +\def\appendixsectionzzz #1{\appendixsectionzzz1747,57437 +\gdef\thissection{#1}\secheading {#1}{\appendixletter}letter1749,57549 +{\chapternofonts%nofonts%1750,57617 +{#1}{\appendixletter}letter1752,57673 +\appendixnoderef %noderef1755,57773 +\outer\def\unnumberedsec{\unnumberedsec1759,57813 +\def\unnumberedseczzz #1{\unnumberedseczzz1760,57866 +{\chapternofonts%nofonts%1762,57961 +\outer\def\numberedsubsec{\numberedsubsec1770,58129 +\def\numberedsubseczzz #1{\numberedsubseczzz1771,58184 +{\chapternofonts%nofonts%1774,58363 +\outer\def\appendixsubsec{\appendixsubsec1783,58567 +\def\appendixsubseczzz #1{\appendixsubseczzz1784,58622 +\subsecheading {#1}{\appendixletter}letter1786,58744 +{\chapternofonts%nofonts%1787,58809 +{#1}{\appendixletter}letter1789,58868 +\appendixnoderef %noderef1792,58983 +\outer\def\unnumberedsubsec{\unnumberedsubsec1796,59023 +\def\unnumberedsubseczzz #1{\unnumberedsubseczzz1797,59082 +{\chapternofonts%nofonts%1799,59183 +\outer\def\numberedsubsubsec{\numberedsubsubsec1807,59354 +\def\numberedsubsubseczzz #1{\numberedsubsubseczzz1808,59415 +{\chapternofonts%nofonts%1812,59612 +\outer\def\appendixsubsubsec{\appendixsubsubsec1823,59845 +\def\appendixsubsubseczzz #1{\appendixsubsubseczzz1824,59906 + {\appendixletter}letter1827,60045 +{\chapternofonts%nofonts%1828,60111 + {\appendixletter}letter1830,60176 +\appendixnoderef %noderef1834,60310 +\outer\def\unnumberedsubsubsec{\unnumberedsubsubsec1838,60350 +\def\unnumberedsubsubseczzz #1{\unnumberedsubsubseczzz1839,60415 +{\chapternofonts%nofonts%1841,60522 +\def\infotop{\infotop1851,60851 +\def\infounnumbered{\infounnumbered1852,60889 +\def\infounnumberedsec{\infounnumberedsec1853,60934 +\def\infounnumberedsubsec{\infounnumberedsubsec1854,60985 +\def\infounnumberedsubsubsec{\infounnumberedsubsubsec1855,61042 +\def\infoappendix{\infoappendix1857,61106 +\def\infoappendixsec{\infoappendixsec1858,61147 +\def\infoappendixsubsec{\infoappendixsubsec1859,61194 +\def\infoappendixsubsubsec{\infoappendixsubsubsec1860,61247 +\def\infochapter{\infochapter1862,61307 +\def\infosection{\infosection1863,61346 +\def\infosubsection{\infosubsection1864,61385 +\def\infosubsubsection{\infosubsubsection1865,61430 +\global\let\section = \numberedsec=1870,61667 +\global\let\subsection = \numberedsubsec=1871,61702 +\global\let\subsubsection = \numberedsubsubsec=1872,61743 +\def\majorheading{\majorheading1886,62250 +\def\majorheadingzzz #1{\majorheadingzzz1887,62295 +\def\chapheading{\chapheading1893,62528 +\def\chapheadingzzz #1{\chapheadingzzz1894,62571 +\def\heading{\heading1899,62766 +\def\subheading{\subheading1901,62803 +\def\subsubheading{\subsubheading1903,62846 +\def\dobreak#1#2{\dobreak1910,63123 +\def\setchapterstyle #1 {\setchapterstyle1912,63201 +\def\chapbreak{\chapbreak1919,63456 +\def\chappager{\chappager1920,63506 +\def\chapoddpage{\chapoddpage1921,63544 +\def\setchapternewpage #1 {\setchapternewpage1923,63623 +\def\CHAPPAGoff{\CHAPPAGoff1925,63680 +\def\CHAPPAGon{\CHAPPAGon1929,63774 +\global\def\HEADINGSon{\HEADINGSon1932,63865 +\def\CHAPPAGodd{\CHAPPAGodd1934,63907 +\global\def\HEADINGSon{\HEADINGSon1937,64003 +\def\CHAPFplain{\CHAPFplain1941,64057 +\def\chfplain #1#2{\chfplain1945,64149 +\def\unnchfplain #1{\unnchfplain1956,64372 +\def\unnchfopen #1{\unnchfopen1964,64601 +\def\chfopen #1#2{\chfopen1970,64809 +\def\CHAPFopen{\CHAPFopen1975,64953 +\def\subsecheadingbreak{\subsecheadingbreak1982,65171 +\def\secheadingbreak{\secheadingbreak1985,65300 +\def\secheading #1#2#3{\secheading1993,65582 +\def\plainsecheading #1{\plainsecheading1994,65638 +\def\secheadingi #1{\secheadingi1995,65681 +\def\subsecheading #1#2#3#4{\subsecheading2006,66049 +\def\subsecheadingi #1{\subsecheadingi2007,66116 +\def\subsubsecfonts{\subsubsecfonts2014,66413 +\def\subsubsecheading #1#2#3#4#5{\subsubsecheading2017,66536 +\def\subsubsecheadingi #1{\subsubsecheadingi2018,66614 +\def\startcontents#1{\startcontents2032,67086 + \unnumbchapmacro{#1}\def\thischapter{\thischapter2040,67359 +\outer\def\contents{\contents2049,67718 +\outer\def\summarycontents{\summarycontents2057,67862 + \def\secentry ##1##2##3##4{\secentry2067,68233 + \def\unnumbsecentry ##1##2{\unnumbsecentry2068,68268 + \def\subsecentry ##1##2##3##4##5{\subsecentry2069,68303 + \def\unnumbsubsecentry ##1##2{\unnumbsubsecentry2070,68344 + \def\subsubsecentry ##1##2##3##4##5##6{\subsubsecentry2071,68382 + \def\unnumbsubsubsecentry ##1##2{\unnumbsubsubsecentry2072,68429 +\def\chapentry#1#2#3{\chapentry2085,68863 +\def\shortchapentry#1#2#3{\shortchapentry2088,68980 + {#2\labelspace #1}space2091,69090 +\def\unnumbchapentry#1#2{\unnumbchapentry2094,69144 +\def\shortunnumberedentry#1#2{\shortunnumberedentry2095,69191 +\def\secentry#1#2#3#4{\secentry2102,69355 +\def\unnumbsecentry#1#2{\unnumbsecentry2103,69414 +\def\subsecentry#1#2#3#4#5{\subsecentry2106,69475 +\def\unnumbsubsecentry#1#2{\unnumbsubsecentry2107,69545 +\def\subsubsecentry#1#2#3#4#5#6{\subsubsecentry2110,69619 + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}space2111,69653 +\def\unnumbsubsubsecentry#1#2{\unnumbsubsubsecentry2112,69704 +\def\dochapentry#1#2{\dochapentry2123,70078 +\def\dosecentry#1#2{\dosecentry2138,70683 +\def\dosubsecentry#1#2{\dosubsecentry2145,70861 +\def\dosubsubsecentry#1#2{\dosubsubsecentry2152,71046 +\def\labelspace{\labelspace2160,71297 +\def\dopageno#1{\dopageno2162,71332 +\def\doshortpageno#1{\doshortpageno2163,71358 +\def\chapentryfonts{\chapentryfonts2165,71390 +\def\secentryfonts{\secentryfonts2166,71425 +\def\point{\point2192,72384 +\def\result{\result2194,72405 +\def\expansion{\expansion2195,72478 +\def\print{\print2196,72549 +\def\equiv{\equiv2198,72616 +\def\error{\error2218,73389 +\def\tex{\tex2224,73618 +\def\@{\@2242,74001 +\gdef\sepspaces{\def {\ }}}\2265,74733 +\def\aboveenvbreak{\aboveenvbreak2268,74815 +\def\afterenvbreak{\afterenvbreak2272,74981 +\def\ctl{\ctl2286,75492 +\def\ctr{\ctr2287,75564 +\def\cbl{\cbl2288,75603 +\def\cbr{\cbr2289,75643 +\def\carttop{\carttop2290,75682 +\def\cartbot{\cartbot2293,75790 +\long\def\cartouche{\cartouche2299,75930 +\def\Ecartouche{\Ecartouche2326,76718 +\def\lisp{\lisp2338,76853 +\def\Elisp{\Elisp2348,77200 +\def\next##1{\next2360,77526 +\def\Eexample{\Eexample2364,77568 +\def\Esmallexample{\Esmallexample2367,77615 +\def\smalllispx{\smalllispx2373,77793 +\def\Esmalllisp{\Esmalllisp2383,78147 +\obeyspaces \obeylines \ninett \indexfonts \rawbackslashfonts2396,78503 +\def\next##1{\next2397,78560 +\def\display{\display2401,78640 +\def\Edisplay{\Edisplay2410,78959 +\def\next##1{\next2422,79270 +\def\format{\format2426,79373 +\def\Eformat{\Eformat2434,79669 +\def\next##1{\next2437,79758 +\def\flushleft{\flushleft2441,79810 +\def\Eflushleft{\Eflushleft2451,80181 +\def\next##1{\next2454,80274 +\def\flushright{\flushright2456,80296 +\def\Eflushright{\Eflushright2466,80668 +\def\next##1{\next2470,80799 +\def\quotation{\quotation2474,80857 +\def\Equotation{\Equotation2480,81049 +\def\setdeffont #1 {\setdeffont2493,81447 +\newskip\defbodyindent \defbodyindent=.4inbodyindent2495,81493 +\newskip\defargsindent \defargsindent=50ptargsindent2496,81536 +\newskip\deftypemargin \deftypemargin=12pttypemargin2497,81579 +\newskip\deflastargmargin \deflastargmargin=18ptlastargmargin2498,81622 +\def\activeparens{\activeparens2503,81820 +\def\opnr{\opnr2529,83032 +\def\lbrb{\lbrb2530,83097 +\def\defname #1#2{\defname2536,83298 +\advance\dimen2 by -\defbodyindentbodyindent2540,83416 +\advance\dimen3 by -\defbodyindentbodyindent2542,83470 +\setbox0=\hbox{\hskip \deflastargmargin{lastargmargin2544,83524 +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuationsargsindent2546,83666 +\parshape 2 0in \dimen0 \defargsindent \dimen1 %argsindent2547,83741 +\rlap{\rightline{{\rm #2}\hskip \deftypemargin}typemargin2554,84110 +\advance\leftskip by -\defbodyindentbodyindent2557,84244 +\exdentamount=\defbodyindentbodyindent2558,84281 +\def\defparsebody #1#2#3{\defparsebody2568,84640 +\def#1{2572,84824 +\def#2{2573,84860 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2575,84932 +\exdentamount=\defbodyindentbodyindent2576,85006 +\def\defmethparsebody #1#2#3#4 {\defmethparsebody2581,85110 +\def#1{2585,85271 +\def#2##1 {2586,85307 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2588,85390 +\exdentamount=\defbodyindentbodyindent2589,85464 +\def\defopparsebody #1#2#3#4#5 {\defopparsebody2592,85549 +\def#1{2596,85710 +\def#2##1 ##2 {2597,85746 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2600,85846 +\exdentamount=\defbodyindentbodyindent2601,85920 +\def\defvarparsebody #1#2#3{\defvarparsebody2608,86191 +\def#1{2612,86378 +\def#2{2613,86414 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2615,86473 +\exdentamount=\defbodyindentbodyindent2616,86547 +\def\defvrparsebody #1#2#3#4 {\defvrparsebody2621,86638 +\def#1{2625,86797 +\def#2##1 {2626,86833 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2628,86903 +\exdentamount=\defbodyindentbodyindent2629,86977 +\def\defopvarparsebody #1#2#3#4#5 {\defopvarparsebody2632,87049 +\def#1{2636,87213 +\def#2##1 ##2 {2637,87249 +\advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindentbodyindent2640,87336 +\exdentamount=\defbodyindentbodyindent2641,87410 +\def\defunargs #1{\defunargs2664,88170 +\def\deftypefunargs #1{\deftypefunargs2676,88552 +\def\deffn{\deffn2690,88934 +\def\deffnheader #1#2#3{\deffnheader2692,88991 +\begingroup\defname {name2693,89039 +\def\defun{\defun2699,89184 +\def\defunheader #1#2{\defunheader2701,89237 +\begingroup\defname {name2702,89312 +\defunargs {unargs2703,89348 +\def\deftypefun{\deftypefun2709,89496 +\def\deftypefunheader #1#2{\deftypefunheader2712,89618 +\def\deftypefunheaderx #1#2 #3\relax{\deftypefunheaderx2714,89727 +\begingroup\defname {name2716,89819 +\deftypefunargs {typefunargs2717,89865 +\def\deftypefn{\deftypefn2723,90036 +\def\deftypefnheader #1#2#3{\deftypefnheader2726,90185 +\def\deftypefnheaderx #1#2#3 #4\relax{\deftypefnheaderx2728,90321 +\begingroup\defname {name2730,90414 +\deftypefunargs {typefunargs2731,90454 +\def\defmac{\defmac2737,90575 +\def\defmacheader #1#2{\defmacheader2739,90632 +\begingroup\defname {name2740,90708 +\defunargs {unargs2741,90741 +\def\defspec{\defspec2747,90865 +\def\defspecheader #1#2{\defspecheader2749,90926 +\begingroup\defname {name2750,91003 +\defunargs {unargs2751,91043 +\def\deffnx #1 {\deffnx2758,91238 +\def\defunx #1 {\defunx2759,91295 +\def\defmacx #1 {\defmacx2760,91352 +\def\defspecx #1 {\defspecx2761,91411 +\def\deftypefnx #1 {\deftypefnx2762,91472 +\def\deftypeunx #1 {\deftypeunx2763,91537 +\def\defop #1 {\defop2769,91683 +\defopparsebody\Edefop\defopx\defopheader\defoptype}opparsebody\Edefop\defopx\defopheader\defoptype2770,91718 +\def\defopheader #1#2#3{\defopheader2772,91772 +\begingroup\defname {name2774,91861 +\defunargs {unargs2775,91907 +\def\defmethod{\defmethod2780,91968 +\def\defmethodheader #1#2#3{\defmethodheader2782,92041 +\begingroup\defname {name2784,92129 +\defunargs {unargs2785,92169 +\def\defcv #1 {\defcv2790,92243 +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}opvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype2791,92278 +\def\defcvarheader #1#2#3{\defcvarheader2793,92337 +\begingroup\defname {name2795,92423 +\defvarargs {varargs2796,92469 +\def\defivar{\defivar2801,92542 +\def\defivarheader #1#2#3{\defivarheader2803,92605 +\begingroup\defname {name2805,92691 +\defvarargs {varargs2806,92742 +\def\defopx #1 {\defopx2812,92891 +\def\defmethodx #1 {\defmethodx2813,92948 +\def\defcvx #1 {\defcvx2814,93013 +\def\defivarx #1 {\defivarx2815,93070 +\def\defvarargs #1{\defvarargs2822,93341 +\def\defvr{\defvr2828,93485 +\def\defvrheader #1#2#3{\defvrheader2830,93540 +\begingroup\defname {name2831,93588 +\def\defvar{\defvar2835,93673 +\def\defvarheader #1#2{\defvarheader2837,93733 +\begingroup\defname {name2838,93804 +\defvarargs {varargs2839,93840 +\def\defopt{\defopt2844,93906 +\def\defoptheader #1#2{\defoptheader2846,93966 +\begingroup\defname {name2847,94037 +\defvarargs {varargs2848,94076 +\def\deftypevar{\deftypevar2853,94133 +\def\deftypevarheader #1#2{\deftypevarheader2856,94249 +\begingroup\defname {name2858,94332 +\def\deftypevr{\deftypevr2865,94506 +\def\deftypevrheader #1#2#3{\deftypevrheader2867,94577 +\begingroup\defname {name2868,94629 +\def\defvrx #1 {\defvrx2876,94866 +\def\defvarx #1 {\defvarx2877,94923 +\def\defoptx #1 {\defoptx2878,94982 +\def\deftypevarx #1 {\deftypevarx2879,95041 +\def\deftypevrx #1 {\deftypevrx2880,95108 +\def\deftpargs #1{\deftpargs2885,95257 +\def\deftp{\deftp2889,95337 +\def\deftpheader #1#2#3{\deftpheader2891,95392 +\begingroup\defname {name2892,95440 +\def\deftpx #1 {\deftpx2897,95599 +\def\setref#1{\setref2908,95920 +\def\unnumbsetref#1{\unnumbsetref2913,96034 +\def\appendixsetref#1{\appendixsetref2918,96141 +\def\pxref#1{\pxref2929,96552 +\def\xref#1{\xref2930,96588 +\def\ref#1{\ref2931,96623 +\def\xrefX[#1,#2,#3,#4,#5,#6]{\xrefX[2932,96653 +\def\printedmanual{\printedmanual2933,96696 +\def\printednodename{\printednodename2934,96734 +\def\printednodename{\printednodename2939,96859 +section ``\printednodename'' in \cite{\printedmanual}\printedmanual2954,97492 +\refx{x2957,97570 +\def\dosetq #1#2{\dosetq2965,97790 +\def\internalsetq #1#2{\internalsetq2973,98048 +\def\Ypagenumber{\Ypagenumber2977,98149 +\def\Ytitle{\Ytitle2979,98175 +\def\Ynothing{\Ynothing2981,98202 +\def\Ysectionnumberandtype{\Ysectionnumberandtype2983,98219 +\def\Yappendixletterandtype{\Yappendixletterandtype2992,98535 +\ifnum\secno=0 Appendix\xreftie'char\the\appendixno{no2993,98565 +\else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %no.\the\secno2994,98620 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %no.\the\secno.\the\subsecno2996,98724 +Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %no.\the\secno.\the\subsecno.\the\subsubsecno2998,98795 + \def\linenumber{\linenumber3009,99134 +\def\refx#1#2{\refx3015,99318 +\def\xrdef #1#2{\xrdef3037,99944 +\def\readauxfile{\readauxfile3040,100029 +\def\supereject{\supereject3110,101810 +\footstrut\parindent=\defaultparindent\hang\textindent{aultparindent\hang\textindent3131,102495 +\def\openindices{\openindices3139,102681 +\newdimen\defaultparindent \defaultparindent = 15ptaultparindent3151,102906 +\parindent = \defaultparindentaultparindent3152,102958 +\def\smallbook{\smallbook3175,103682 +\global\def\Esmallexample{\Esmallexample3192,104109 +\def\afourpaper{\afourpaper3196,104200 +\def\finalout{\finalout3224,105008 +\def\normaldoublequote{\normaldoublequote3235,105269 +\def\normaltilde{\normaltilde3236,105295 +\def\normalcaret{\normalcaret3237,105315 +\def\normalunderscore{\normalunderscore3238,105335 +\def\normalverticalbar{\normalverticalbar3239,105360 +\def\normalless{\normalless3240,105386 +\def\normalgreater{\normalgreater3241,105405 +\def\normalplus{\normalplus3242,105427 +\def\ifusingtt#1#2{\ifusingtt3253,105919 +\def\activedoublequote{\activedoublequote3261,106247 +\def~{~3264,106333 +\def^{^3267,106394 +\def_{_3270,106433 +\def\_{\_3272,106507 +\def\lvvmode{\lvvmode3279,106844 +\def|{|3282,106894 +\def<{<3285,106957 +\def>{>3288,107014 +\def+{+3290,107052 +\def\turnoffactive{\turnoffactive3296,107213 +\global\def={=3307,107499 +\def\normalbackslash{\normalbackslash3321,107881 c-src/c.c,76 T f(1,0 @@ -5057,42 +5121,42 @@ c-src/a/b/b.c,18 #define questo 34, y-src/parse.y,1061 -#define obstack_chunk_alloc 46,1116 -#define obstack_chunk_free 47,1154 -int yylex 57,1322 -void yyerror 59,1352 -void yyerror 61,1381 -VOIDSTAR parse_hash;63,1405 -extern VOIDSTAR hash_find(64,1426 -unsigned char fnin[fnin67,1524 -#define YYSTYPE 71,1622 -typedef struct node *YYSTYPE;YYSTYPE72,1653 -YYSTYPE parse_return;73,1683 -YYSTYPE make_list 75,1721 -YYSTYPE make_list 77,1765 -char *instr;instr80,1795 -int parse_error 81,1808 -extern struct obstack tmp_mem;82,1829 -line:line86,1867 -exp:exp94,1980 -exp_list:exp_list262,5647 -range_exp:range_exp268,5745 -range_exp_list:range_exp_list272,5775 -cell:cell278,5893 -yyerror FUN1(285,5940 -make_list FUN2(292,6020 -#define ERROR 303,6220 -extern struct node *yylval;yylval305,6238 -unsigned char parse_cell_or_range 308,6283 -unsigned char parse_cell_or_range 310,6347 -yylex FUN0(314,6397 -parse_cell_or_range FUN2(586,11763 -#define CK_ABS_R(670,13205 -#define CK_REL_R(674,13284 -#define CK_ABS_C(679,13413 -#define CK_REL_C(683,13492 -#define MAYBEREL(688,13621 -str_to_col FUN1(846,16822 +#define obstack_chunk_alloc 47,1124 +#define obstack_chunk_free 48,1162 +int yylex 58,1330 +void yyerror 60,1360 +void yyerror 62,1389 +VOIDSTAR parse_hash;64,1413 +extern VOIDSTAR hash_find(65,1434 +unsigned char fnin[fnin68,1532 +#define YYSTYPE 72,1630 +typedef struct node *YYSTYPE;YYSTYPE73,1661 +YYSTYPE parse_return;74,1691 +YYSTYPE make_list 76,1729 +YYSTYPE make_list 78,1773 +char *instr;instr81,1803 +int parse_error 82,1816 +extern struct obstack tmp_mem;83,1837 +line:line87,1875 +exp:exp95,1988 +exp_list:exp_list263,5655 +range_exp:range_exp269,5753 +range_exp_list:range_exp_list273,5783 +cell:cell279,5901 +yyerror FUN1(286,5948 +make_list FUN2(293,6028 +#define ERROR 304,6228 +extern struct node *yylval;yylval306,6246 +unsigned char parse_cell_or_range 309,6291 +unsigned char parse_cell_or_range 311,6355 +yylex FUN0(315,6405 +parse_cell_or_range FUN2(587,11771 +#define CK_ABS_R(671,13213 +#define CK_REL_R(675,13292 +#define CK_ABS_C(680,13421 +#define CK_REL_C(684,13500 +#define MAYBEREL(689,13629 +str_to_col FUN1(847,16830 y-src/parse.c,520 #define YYBISON 4,64 @@ -5119,59 +5183,7 @@ y-src/parse.c,520 # define L_NE 26,492 # define L_GE 27,510 -parse.y,1464 -#define obstack_chunk_alloc 46, -#define obstack_chunk_free 47, -int yylex 57, -void yyerror 59, -void yyerror 61, -VOIDSTAR parse_hash;63, -extern VOIDSTAR hash_find(64, -unsigned char fnin[fnin67, -#define YYSTYPE 71, -typedef struct node *YYSTYPE;YYSTYPE72, -YYSTYPE parse_return;73, -YYSTYPE make_list 75, -YYSTYPE make_list 77, -char *instr;instr80, -int parse_error 81, -extern struct obstack tmp_mem;82, -#define YYSTYPE 85, -# define YYDEBUG 88, -#define YYFINAL 93, -#define YYFLAG 94, -#define YYNTBASE 95, -#define YYTRANSLATE(98, -static const char yytranslate[yytranslate101, -static const short yyprhs[yyprhs134, -static const short yyrhs[yyrhs142, -static const short yyrline[yyrline171, -static const char *const yytname[yytname185, -static const short yyr1[yyr1197, -static const short yyr2[yyr2207, -static const short yydefact[yydefact219, -static const short yydefgoto[yydefgoto237, -static const short yypact[yypact242, -static const short yypgoto[yypgoto260, -#define YYLAST 266, -static const short yytable[yytable269, -static const short yycheck[yycheck330, -yyerror FUN1(285, -make_list FUN2(292, -#define ERROR 303, -extern struct node *yylval;yylval305, -unsigned char parse_cell_or_range 308, -unsigned char parse_cell_or_range 310, -yylex FUN0(314, -parse_cell_or_range FUN2(586, -#define CK_ABS_R(670, -#define CK_REL_R(674, -#define CK_ABS_C(679, -#define CK_REL_C(683, -#define MAYBEREL(688, -str_to_col FUN1(846, - -/usr/share/bison/bison.simple,2238 +/usr/share/bison/bison.simple,1787 # define YYSTD(40, # define YYSTD(42, # define YYSTACK_ALLOC 50, @@ -5243,30 +5255,6 @@ yyparse 403, # define YYPOPSTACK 445, # define YYPOPSTACK 447, # undef YYSTACK_RELOCATE548, - *++yyvsp yyvsp746, - *++yylsp yylsp748, - yyn 755, - yystate 757, - yystate 761, - goto yynewstate;763, - goto yyerrlab1;823, - yyerrstatus 846, - goto yyerrhandle;848, - yyn 861, - yystate 875, - yyn 895, - yyn 903, - YYDPRINTF 917, - *++yyvsp yyvsp919, - *++yylsp yylsp921, - yystate 924, - goto yynewstate;925, - yyresult 932, - goto yyreturn;933, - yyresult 939, - goto yyreturn;940, - yyerror 946, - yyresult 947, y-src/atest.y,9 exp 2,3 @@ -5287,91 +5275,6 @@ y-src/cccp.c,303 # define RSH 17,310 # define UNARY 18,327 -cccp.y,2532 -typedef unsigned char U_CHAR;38, -struct arglist 41, - struct arglist *next;next42, - U_CHAR *name;name43, - int length;44, - int argno;45, -#define NULL 51, -#define GENERIC_PTR 56, -#define GENERIC_PTR 58, -#define NULL_PTR 63, -int yylex 66, -void yyerror 67, -int expression_value;68, -static jmp_buf parse_return_error;70, -static int keyword_parsing 73, -extern unsigned char is_idstart[is_idstart76, -extern unsigned char is_idstart[], is_idchar[is_idchar76, -extern unsigned char is_idstart[], is_idchar[], is_hor_space[is_hor_space76, -extern char *xmalloc xmalloc78, -extern int pedantic;81, -extern int traditional;84, -#define CHAR_TYPE_SIZE 87, -#define INT_TYPE_SIZE 91, -#define LONG_TYPE_SIZE 95, -#define WCHAR_TYPE_SIZE 99, -#define possible_sum_sign(104, -static void integer_overflow 106, -static long left_shift 107, -static long right_shift 108, - struct constant 113, - struct constant {long value;113, - struct constant {long value; int unsignedp;113, - struct constant {long value; int unsignedp;} integer;113, - struct name 114, - struct name {U_CHAR *address;address114, - struct name {U_CHAR *address; int length;114, - struct name {U_CHAR *address; int length;} name;114, - struct arglist *keywords;keywords115, - int voidval;116, - char *sval;sval117, -} yystype;118, -# define YYSTYPE 119, -# define YYDEBUG 122, -#define YYFINAL 127, -#define YYFLAG 128, -#define YYNTBASE 129, -#define YYTRANSLATE(132, -static const char yytranslate[yytranslate135, -static const short yyprhs[yyprhs167, -static const short yyrhs[yyrhs174, -static const short yyrline[yyrline195, -static const char *const yytname[yytname208, -static const short yyr1[yyr1219, -static const short yyr2[yyr2228, -static const short yydefact[yydefact239, -static const short yydefgoto[yydefgoto251, -static const short yypact[yypact256, -static const short yypgoto[yypgoto268, -#define YYLAST 274, -static const short yytable[yytable277, -static const short yycheck[yycheck301, -static char *lexptr;lexptr332, -parse_number 341, -struct token 437, - char *operator;operator438, - int token;439, -static struct token tokentab2[tokentab2442, -yylex 459, -parse_escape 740, -yyerror 836, -integer_overflow 844, -left_shift 851, -right_shift 873, -parse_c_expression 893, -extern int yydebug;919, -main 923, -unsigned char is_idchar[is_idchar948, -unsigned char is_idstart[is_idstart950, -char is_hor_space[is_hor_space953, -initialize_random_junk 958, -error 988, -warning 993, -lookup 999, - /usr/share/bison/bison.simple,2238 # define YYSTD(41, # define YYSTD(43, diff --git a/test/etags/Makefile b/test/manual/etags/Makefile index 6e335711ff2..07ad0f46416 100644 --- a/test/etags/Makefile +++ b/test/manual/etags/Makefile @@ -33,8 +33,8 @@ SRCS=${ADASRC} ${ASRC} ${CSRC} ${CPSRC} ${ELSRC} ${ERLSRC} ${FSRC}\ ${PROLSRC} ${PYTSRC} ${RBSRC} ${TEXSRC} ${YSRC} NONSRCS=./f-src/entry.strange ./erl-src/lists.erl ./cp-src/clheir.hpp.gz -ETAGS_PROG=../../lib-src/etags -CTAGS_PROG=../../lib-src/ctags +ETAGS_PROG=../../../lib-src/etags +CTAGS_PROG=../../../lib-src/ctags REGEX=/[ \t]*DEFVAR_[A-Z_ \t\n(]+"\([^"]+\)"/ xx="this line is here because of a fontlock bug diff --git a/test/etags/a-src/empty.zz b/test/manual/etags/a-src/empty.zz index e69de29bb2d..e69de29bb2d 100644 --- a/test/etags/a-src/empty.zz +++ b/test/manual/etags/a-src/empty.zz diff --git a/test/etags/a-src/empty.zz.gz b/test/manual/etags/a-src/empty.zz.gz index e69de29bb2d..e69de29bb2d 100644 --- a/test/etags/a-src/empty.zz.gz +++ b/test/manual/etags/a-src/empty.zz.gz diff --git a/test/etags/ada-src/2ataspri.adb b/test/manual/etags/ada-src/2ataspri.adb index 43ca983824c..43ca983824c 100644 --- a/test/etags/ada-src/2ataspri.adb +++ b/test/manual/etags/ada-src/2ataspri.adb diff --git a/test/etags/ada-src/2ataspri.ads b/test/manual/etags/ada-src/2ataspri.ads index 01c786028ab..01c786028ab 100644 --- a/test/etags/ada-src/2ataspri.ads +++ b/test/manual/etags/ada-src/2ataspri.ads diff --git a/test/etags/ada-src/etags-test-for.ada b/test/manual/etags/ada-src/etags-test-for.ada index 09e5a1ec9bf..09e5a1ec9bf 100644 --- a/test/etags/ada-src/etags-test-for.ada +++ b/test/manual/etags/ada-src/etags-test-for.ada diff --git a/test/etags/ada-src/waroquiers.ada b/test/manual/etags/ada-src/waroquiers.ada index 316120998f8..316120998f8 100644 --- a/test/etags/ada-src/waroquiers.ada +++ b/test/manual/etags/ada-src/waroquiers.ada diff --git a/test/etags/c-src/a/b/b.c b/test/manual/etags/c-src/a/b/b.c index ee3c97c2456..ee3c97c2456 100644 --- a/test/etags/c-src/a/b/b.c +++ b/test/manual/etags/c-src/a/b/b.c diff --git a/test/etags/c-src/abbrev.c b/test/manual/etags/c-src/abbrev.c index c01eee419ff..c01eee419ff 100644 --- a/test/etags/c-src/abbrev.c +++ b/test/manual/etags/c-src/abbrev.c diff --git a/test/etags/c-src/c.c b/test/manual/etags/c-src/c.c index 77c8929afb2..77c8929afb2 100644 --- a/test/etags/c-src/c.c +++ b/test/manual/etags/c-src/c.c diff --git a/test/etags/c-src/dostorture.c b/test/manual/etags/c-src/dostorture.c index 5190734e0fe..5190734e0fe 100644 --- a/test/etags/c-src/dostorture.c +++ b/test/manual/etags/c-src/dostorture.c diff --git a/test/etags/c-src/emacs/src/gmalloc.c b/test/manual/etags/c-src/emacs/src/gmalloc.c index 79b2040e321..79b2040e321 100644 --- a/test/etags/c-src/emacs/src/gmalloc.c +++ b/test/manual/etags/c-src/emacs/src/gmalloc.c diff --git a/test/etags/c-src/emacs/src/keyboard.c b/test/manual/etags/c-src/emacs/src/keyboard.c index 5a651497d73..5a651497d73 100644 --- a/test/etags/c-src/emacs/src/keyboard.c +++ b/test/manual/etags/c-src/emacs/src/keyboard.c diff --git a/test/etags/c-src/emacs/src/lisp.h b/test/manual/etags/c-src/emacs/src/lisp.h index 688589624fe..688589624fe 100644 --- a/test/etags/c-src/emacs/src/lisp.h +++ b/test/manual/etags/c-src/emacs/src/lisp.h diff --git a/test/etags/c-src/emacs/src/regex.h b/test/manual/etags/c-src/emacs/src/regex.h index 2ed6238730f..2ed6238730f 100644 --- a/test/etags/c-src/emacs/src/regex.h +++ b/test/manual/etags/c-src/emacs/src/regex.h diff --git a/test/etags/c-src/etags.c b/test/manual/etags/c-src/etags.c index e8321f05ff4..e8321f05ff4 100644 --- a/test/etags/c-src/etags.c +++ b/test/manual/etags/c-src/etags.c diff --git a/test/etags/c-src/exit.c b/test/manual/etags/c-src/exit.c index b1952bfddb9..b1952bfddb9 100644 --- a/test/etags/c-src/exit.c +++ b/test/manual/etags/c-src/exit.c diff --git a/test/etags/c-src/exit.strange_suffix b/test/manual/etags/c-src/exit.strange_suffix index b1952bfddb9..b1952bfddb9 100644 --- a/test/etags/c-src/exit.strange_suffix +++ b/test/manual/etags/c-src/exit.strange_suffix diff --git a/test/etags/c-src/fail.c b/test/manual/etags/c-src/fail.c index 32482781b11..32482781b11 100644 --- a/test/etags/c-src/fail.c +++ b/test/manual/etags/c-src/fail.c diff --git a/test/etags/c-src/getopt.h b/test/manual/etags/c-src/getopt.h index aa66fac4ecd..aa66fac4ecd 100644 --- a/test/etags/c-src/getopt.h +++ b/test/manual/etags/c-src/getopt.h diff --git a/test/etags/c-src/h.h b/test/manual/etags/c-src/h.h index f86c00d64ad..f86c00d64ad 100644 --- a/test/etags/c-src/h.h +++ b/test/manual/etags/c-src/h.h diff --git a/test/etags/c-src/machsyscalls.c b/test/manual/etags/c-src/machsyscalls.c index 44930c33cf3..44930c33cf3 100644 --- a/test/etags/c-src/machsyscalls.c +++ b/test/manual/etags/c-src/machsyscalls.c diff --git a/test/etags/c-src/machsyscalls.h b/test/manual/etags/c-src/machsyscalls.h index 8b33dc4e7e5..8b33dc4e7e5 100644 --- a/test/etags/c-src/machsyscalls.h +++ b/test/manual/etags/c-src/machsyscalls.h diff --git a/test/etags/c-src/sysdep.h b/test/manual/etags/c-src/sysdep.h index 2c121cf53a9..2c121cf53a9 100644 --- a/test/etags/c-src/sysdep.h +++ b/test/manual/etags/c-src/sysdep.h diff --git a/test/etags/c-src/tab.c b/test/manual/etags/c-src/tab.c index b25d55cb2e8..b25d55cb2e8 100644 --- a/test/etags/c-src/tab.c +++ b/test/manual/etags/c-src/tab.c diff --git a/test/etags/c-src/torture.c b/test/manual/etags/c-src/torture.c index 77c3763564a..77c3763564a 100644 --- a/test/etags/c-src/torture.c +++ b/test/manual/etags/c-src/torture.c diff --git a/test/etags/cp-src/MDiagArray2.h b/test/manual/etags/cp-src/MDiagArray2.h index 78ee5e1523c..78ee5e1523c 100644 --- a/test/etags/cp-src/MDiagArray2.h +++ b/test/manual/etags/cp-src/MDiagArray2.h diff --git a/test/etags/cp-src/Range.h b/test/manual/etags/cp-src/Range.h index b8cbab47ebf..b8cbab47ebf 100644 --- a/test/etags/cp-src/Range.h +++ b/test/manual/etags/cp-src/Range.h diff --git a/test/etags/cp-src/burton.cpp b/test/manual/etags/cp-src/burton.cpp index d86ad758d81..d86ad758d81 100644 --- a/test/etags/cp-src/burton.cpp +++ b/test/manual/etags/cp-src/burton.cpp diff --git a/test/etags/cp-src/c.C b/test/manual/etags/cp-src/c.C index 2c5f7e01fac..2c5f7e01fac 100644 --- a/test/etags/cp-src/c.C +++ b/test/manual/etags/cp-src/c.C diff --git a/test/etags/cp-src/clheir.cpp.gz b/test/manual/etags/cp-src/clheir.cpp.gz Binary files differindex 38b08a8e7f8..38b08a8e7f8 100644 --- a/test/etags/cp-src/clheir.cpp.gz +++ b/test/manual/etags/cp-src/clheir.cpp.gz diff --git a/test/etags/cp-src/clheir.hpp b/test/manual/etags/cp-src/clheir.hpp index 55d91228fb3..55d91228fb3 100644 --- a/test/etags/cp-src/clheir.hpp +++ b/test/manual/etags/cp-src/clheir.hpp diff --git a/test/etags/cp-src/conway.cpp b/test/manual/etags/cp-src/conway.cpp index 1e600147ed9..1e600147ed9 100644 --- a/test/etags/cp-src/conway.cpp +++ b/test/manual/etags/cp-src/conway.cpp diff --git a/test/etags/cp-src/conway.hpp b/test/manual/etags/cp-src/conway.hpp index 9fbb2517526..9fbb2517526 100644 --- a/test/etags/cp-src/conway.hpp +++ b/test/manual/etags/cp-src/conway.hpp diff --git a/test/etags/cp-src/fail.C b/test/manual/etags/cp-src/fail.C index c602ed26396..c602ed26396 100644 --- a/test/etags/cp-src/fail.C +++ b/test/manual/etags/cp-src/fail.C diff --git a/test/etags/cp-src/functions.cpp b/test/manual/etags/cp-src/functions.cpp index fb546ed4de8..764498d4084 100644 --- a/test/etags/cp-src/functions.cpp +++ b/test/manual/etags/cp-src/functions.cpp @@ -1,7 +1,7 @@ #include "main.hpp" #pragma ident "@(#)functions.cpp 1.0 98/11/12 (c) Rupak Rathore" -// Constructor default argument initialises to today's values +// Constructor default argument initializes to today's values void Date::setDate ( int d , int m , int y ){ time_t t; struct tm * ptm; @@ -9,9 +9,9 @@ void Date::setDate ( int d , int m , int y ){ if ( date != NULL ) delete date; date = NULL; - if ( d == 0 && m == 0 && y == 0 ) // explicity called or default constructor hence leave it. + if ( d == 0 && m == 0 && y == 0 ) //Explicitly called or default constructor hence leave it. return; - if ( d < 0 && m < 0 && d < 0 ) // Special instruction to intialise to today's value + if ( d < 0 && m < 0 && d < 0 ) //Special instruction to initialize to today's value d=m=y=0; date = new tm; ptm=localtime ( &t ) ; diff --git a/test/etags/cp-src/screen.cpp b/test/manual/etags/cp-src/screen.cpp index 1958a19d628..1958a19d628 100644 --- a/test/etags/cp-src/screen.cpp +++ b/test/manual/etags/cp-src/screen.cpp diff --git a/test/etags/cp-src/screen.hpp b/test/manual/etags/cp-src/screen.hpp index a7099a3379d..a7099a3379d 100644 --- a/test/etags/cp-src/screen.hpp +++ b/test/manual/etags/cp-src/screen.hpp diff --git a/test/etags/cp-src/x.cc b/test/manual/etags/cp-src/x.cc index a236060281a..a236060281a 100644 --- a/test/etags/cp-src/x.cc +++ b/test/manual/etags/cp-src/x.cc diff --git a/test/etags/el-src/TAGTEST.EL b/test/manual/etags/el-src/TAGTEST.EL index acf0baf82f0..acf0baf82f0 100644 --- a/test/etags/el-src/TAGTEST.EL +++ b/test/manual/etags/el-src/TAGTEST.EL diff --git a/test/etags/el-src/emacs/lisp/progmodes/etags.el b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el index 955859803df..955859803df 100644 --- a/test/etags/el-src/emacs/lisp/progmodes/etags.el +++ b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el diff --git a/test/etags/erl-src/gs_dialog.erl b/test/manual/etags/erl-src/gs_dialog.erl index c04ee8be0cd..c04ee8be0cd 100644 --- a/test/etags/erl-src/gs_dialog.erl +++ b/test/manual/etags/erl-src/gs_dialog.erl diff --git a/test/etags/f-src/entry.for b/test/manual/etags/f-src/entry.for index 52b8a2487c6..52b8a2487c6 100644 --- a/test/etags/f-src/entry.for +++ b/test/manual/etags/f-src/entry.for diff --git a/test/etags/f-src/entry.strange.gz b/test/manual/etags/f-src/entry.strange.gz Binary files differindex 5f22edc86bb..5f22edc86bb 100644 --- a/test/etags/f-src/entry.strange.gz +++ b/test/manual/etags/f-src/entry.strange.gz diff --git a/test/etags/f-src/entry.strange_suffix b/test/manual/etags/f-src/entry.strange_suffix index 52b8a2487c6..52b8a2487c6 100644 --- a/test/etags/f-src/entry.strange_suffix +++ b/test/manual/etags/f-src/entry.strange_suffix diff --git a/test/etags/forth-src/test-forth.fth b/test/manual/etags/forth-src/test-forth.fth index ce4069dfa8f..4521d32fae4 100644 --- a/test/etags/forth-src/test-forth.fth +++ b/test/manual/etags/forth-src/test-forth.fth @@ -51,3 +51,24 @@ c; a-forth-word dup 200 > abort" Eek. The number is too big" ." Result is " . cr ; + +: (foo) 1 ; +: foo (foo) ; + +: create-bar foo ; +create-bar \ Do NOT create a tag here + +3 4 2constant 2const +2const 2value 2val +2variable 2var + +3.1415e fconstant fconst +fconst fvalue fval +fvariable fvar + +synonym mypi fconst + +BEGIN-STRUCTURE point \ create the named structure + 1 CELLS +FIELD p.x \ A single cell filed named p.x + 1 CELLS +FIELD p.y \ A single cell field named p.y +END-STRUCTURE diff --git a/test/etags/go-src/test.go b/test/manual/etags/go-src/test.go index 6aea26ef210..6aea26ef210 100644 --- a/test/etags/go-src/test.go +++ b/test/manual/etags/go-src/test.go diff --git a/test/etags/go-src/test1.go b/test/manual/etags/go-src/test1.go index 6d1efaaa8a9..6d1efaaa8a9 100644 --- a/test/etags/go-src/test1.go +++ b/test/manual/etags/go-src/test1.go diff --git a/test/etags/html-src/algrthms.html b/test/manual/etags/html-src/algrthms.html index becd93a62d0..becd93a62d0 100644 --- a/test/etags/html-src/algrthms.html +++ b/test/manual/etags/html-src/algrthms.html diff --git a/test/etags/html-src/index.shtml b/test/manual/etags/html-src/index.shtml index 6d8cd858855..6d8cd858855 100644 --- a/test/etags/html-src/index.shtml +++ b/test/manual/etags/html-src/index.shtml diff --git a/test/etags/html-src/software.html b/test/manual/etags/html-src/software.html index b5de1e6d686..f1abba7cb49 100644 --- a/test/etags/html-src/software.html +++ b/test/manual/etags/html-src/software.html @@ -123,7 +123,7 @@ HREF="ftp://fly.cnuce.cnr.it/pub/software/octave/leasqr/">published</A> it. Since then, the original authors Richard I. Shrager, A.Jutan, Ray Muzic, and Sean Brennan agreed to put it under the <A HREF="http://www.gnu.org/licenses/gpl.html">GPL</A>. Matthias Jueschke tested -the program using a non-linear optimisation <A +the program using a non-linear optimization <A HREF="http://www.itl.nist.gov/div898/strd/nls/nls_main.shtml">test suite</A>, and was satisfied with the results. @@ -168,7 +168,7 @@ if that happens so I can update this page. Shows the location of the first read error detected. Can extract a disk Id from the image or the CD itself and build a local database of Ids for future checking of archived CDs. The Id contains the image length, the MD5 - signature and the Volume ID of the disk, so it can automatically recognise + signature and the Volume ID of the disk, so it can automatically recognize the CD to check. Contains a small internal database of <A HREF="http://www.debian.org/">Debian</A> <A HREF="http://cdimage.debian.org/">CD images</A>. diff --git a/test/etags/html-src/softwarelibero.html b/test/manual/etags/html-src/softwarelibero.html index b374273c969..b374273c969 100644 --- a/test/etags/html-src/softwarelibero.html +++ b/test/manual/etags/html-src/softwarelibero.html diff --git a/test/etags/lua-src/allegro.lua b/test/manual/etags/lua-src/allegro.lua index c316b6f26a0..c316b6f26a0 100644 --- a/test/etags/lua-src/allegro.lua +++ b/test/manual/etags/lua-src/allegro.lua diff --git a/test/etags/lua-src/test.lua b/test/manual/etags/lua-src/test.lua index 405eb5f1de0..405eb5f1de0 100644 --- a/test/etags/lua-src/test.lua +++ b/test/manual/etags/lua-src/test.lua diff --git a/test/etags/make-src/Makefile b/test/manual/etags/make-src/Makefile index 016c633d791..016c633d791 100644 --- a/test/etags/make-src/Makefile +++ b/test/manual/etags/make-src/Makefile diff --git a/test/etags/objc-src/PackInsp.h b/test/manual/etags/objc-src/PackInsp.h index 0e3643c8281..0e3643c8281 100644 --- a/test/etags/objc-src/PackInsp.h +++ b/test/manual/etags/objc-src/PackInsp.h diff --git a/test/etags/objc-src/PackInsp.m b/test/manual/etags/objc-src/PackInsp.m index 41cc876850f..41cc876850f 100644 --- a/test/etags/objc-src/PackInsp.m +++ b/test/manual/etags/objc-src/PackInsp.m diff --git a/test/etags/objc-src/Subprocess.h b/test/manual/etags/objc-src/Subprocess.h index 7e586a16a12..7e586a16a12 100644 --- a/test/etags/objc-src/Subprocess.h +++ b/test/manual/etags/objc-src/Subprocess.h diff --git a/test/etags/objc-src/Subprocess.m b/test/manual/etags/objc-src/Subprocess.m index 2d8d586507e..2d8d586507e 100644 --- a/test/etags/objc-src/Subprocess.m +++ b/test/manual/etags/objc-src/Subprocess.m diff --git a/test/etags/objcpp-src/SimpleCalc.H b/test/manual/etags/objcpp-src/SimpleCalc.H index 121ae6bada3..121ae6bada3 100644 --- a/test/etags/objcpp-src/SimpleCalc.H +++ b/test/manual/etags/objcpp-src/SimpleCalc.H diff --git a/test/etags/objcpp-src/SimpleCalc.M b/test/manual/etags/objcpp-src/SimpleCalc.M index 34846a7aceb..34846a7aceb 100644 --- a/test/etags/objcpp-src/SimpleCalc.M +++ b/test/manual/etags/objcpp-src/SimpleCalc.M diff --git a/test/etags/pas-src/common.pas b/test/manual/etags/pas-src/common.pas index ec8e80c4a7a..ec8e80c4a7a 100644 --- a/test/etags/pas-src/common.pas +++ b/test/manual/etags/pas-src/common.pas diff --git a/test/etags/perl-src/htlmify-cystic b/test/manual/etags/perl-src/htlmify-cystic index de150a72b8f..de150a72b8f 100644 --- a/test/etags/perl-src/htlmify-cystic +++ b/test/manual/etags/perl-src/htlmify-cystic diff --git a/test/etags/perl-src/kai-test.pl b/test/manual/etags/perl-src/kai-test.pl index 51b66728f1e..51b66728f1e 100644 --- a/test/etags/perl-src/kai-test.pl +++ b/test/manual/etags/perl-src/kai-test.pl diff --git a/test/etags/perl-src/yagrip.pl b/test/manual/etags/perl-src/yagrip.pl index be9f09c02d4..be9f09c02d4 100644 --- a/test/etags/perl-src/yagrip.pl +++ b/test/manual/etags/perl-src/yagrip.pl diff --git a/test/etags/php-src/lce_functions.php b/test/manual/etags/php-src/lce_functions.php index 65738134593..65738134593 100644 --- a/test/etags/php-src/lce_functions.php +++ b/test/manual/etags/php-src/lce_functions.php diff --git a/test/etags/php-src/ptest.php b/test/manual/etags/php-src/ptest.php index 9893839b493..9893839b493 100644 --- a/test/etags/php-src/ptest.php +++ b/test/manual/etags/php-src/ptest.php diff --git a/test/etags/php-src/sendmail.php b/test/manual/etags/php-src/sendmail.php index 1d15e4ad9f6..1d15e4ad9f6 100644 --- a/test/etags/php-src/sendmail.php +++ b/test/manual/etags/php-src/sendmail.php diff --git a/test/etags/prol-src/natded.prolog b/test/manual/etags/prol-src/natded.prolog index f0ee6b41b12..f0ee6b41b12 100644 --- a/test/etags/prol-src/natded.prolog +++ b/test/manual/etags/prol-src/natded.prolog diff --git a/test/etags/prol-src/ordsets.prolog b/test/manual/etags/prol-src/ordsets.prolog index 7192129fdce..7192129fdce 100644 --- a/test/etags/prol-src/ordsets.prolog +++ b/test/manual/etags/prol-src/ordsets.prolog diff --git a/test/etags/ps-src/rfc1245.ps b/test/manual/etags/ps-src/rfc1245.ps index ad2244f1dc0..ad2244f1dc0 100644 --- a/test/etags/ps-src/rfc1245.ps +++ b/test/manual/etags/ps-src/rfc1245.ps diff --git a/test/etags/pyt-src/server.py b/test/manual/etags/pyt-src/server.py index 68aa29abcfd..68aa29abcfd 100644 --- a/test/etags/pyt-src/server.py +++ b/test/manual/etags/pyt-src/server.py diff --git a/test/etags/ruby-src/test.rb b/test/manual/etags/ruby-src/test.rb index adb2cb1d0bc..adb2cb1d0bc 100644 --- a/test/etags/ruby-src/test.rb +++ b/test/manual/etags/ruby-src/test.rb diff --git a/test/etags/ruby-src/test1.ru b/test/manual/etags/ruby-src/test1.ru index eafaec6248b..eafaec6248b 100644 --- a/test/etags/ruby-src/test1.ru +++ b/test/manual/etags/ruby-src/test1.ru diff --git a/test/etags/tex-src/gzip.texi b/test/manual/etags/tex-src/gzip.texi index 07be37187d7..07be37187d7 100644 --- a/test/etags/tex-src/gzip.texi +++ b/test/manual/etags/tex-src/gzip.texi diff --git a/test/etags/tex-src/nonewline.tex b/test/manual/etags/tex-src/nonewline.tex index 8cc01ce9151..8cc01ce9151 100644 --- a/test/etags/tex-src/nonewline.tex +++ b/test/manual/etags/tex-src/nonewline.tex diff --git a/test/etags/tex-src/testenv.tex b/test/manual/etags/tex-src/testenv.tex index efb83cb834f..efb83cb834f 100644 --- a/test/etags/tex-src/testenv.tex +++ b/test/manual/etags/tex-src/testenv.tex diff --git a/test/etags/tex-src/texinfo.tex b/test/manual/etags/tex-src/texinfo.tex index e98f24cda69..e98f24cda69 100644 --- a/test/etags/tex-src/texinfo.tex +++ b/test/manual/etags/tex-src/texinfo.tex diff --git a/test/etags/y-src/atest.y b/test/manual/etags/y-src/atest.y index 81087b8d86e..81087b8d86e 100644 --- a/test/etags/y-src/atest.y +++ b/test/manual/etags/y-src/atest.y diff --git a/test/etags/y-src/cccp.c b/test/manual/etags/y-src/cccp.c index 338f5a6dad5..380243c6fa4 100644 --- a/test/etags/y-src/cccp.c +++ b/test/manual/etags/y-src/cccp.c @@ -17,7 +17,7 @@ # define RSH 268 # define UNARY 269 -#line 26 "cccp.y" +#line 26 "y-src/cccp.y" #include "config.h" #include <setjmp.h> @@ -102,7 +102,7 @@ static void integer_overflow (); static long left_shift (); static long right_shift (); -#line 111 "cccp.y" +#line 111 "y-src/cccp.y" #ifndef YYSTYPE typedef union { struct constant {long value; int unsignedp;} integer; @@ -1047,59 +1047,59 @@ yyreduce: switch (yyn) { case 1: -#line 144 "cccp.y" +#line 144 "y-src/cccp.y" { expression_value = yyvsp[0].integer.value; } break; case 3: -#line 150 "cccp.y" +#line 150 "y-src/cccp.y" { if (pedantic) pedwarn ("comma operator in operand of `#if'"); yyval.integer = yyvsp[0].integer; } break; case 4: -#line 157 "cccp.y" +#line 157 "y-src/cccp.y" { yyval.integer.value = - yyvsp[0].integer.value; if ((yyval.integer.value & yyvsp[0].integer.value) < 0 && ! yyvsp[0].integer.unsignedp) integer_overflow (); yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; } break; case 5: -#line 162 "cccp.y" +#line 162 "y-src/cccp.y" { yyval.integer.value = ! yyvsp[0].integer.value; yyval.integer.unsignedp = 0; } break; case 6: -#line 165 "cccp.y" +#line 165 "y-src/cccp.y" { yyval.integer = yyvsp[0].integer; } break; case 7: -#line 167 "cccp.y" +#line 167 "y-src/cccp.y" { yyval.integer.value = ~ yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; } break; case 8: -#line 170 "cccp.y" +#line 170 "y-src/cccp.y" { yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length, 0, NULL_PTR); yyval.integer.unsignedp = 0; } break; case 9: -#line 174 "cccp.y" +#line 174 "y-src/cccp.y" { keyword_parsing = 1; } break; case 10: -#line 176 "cccp.y" +#line 176 "y-src/cccp.y" { yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length, 1, yyvsp[-1].keywords); keyword_parsing = 0; yyval.integer.unsignedp = 0; } break; case 11: -#line 181 "cccp.y" +#line 181 "y-src/cccp.y" { yyval.integer = yyvsp[-1].integer; } break; case 12: -#line 186 "cccp.y" +#line 186 "y-src/cccp.y" { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; if (yyval.integer.unsignedp) yyval.integer.value = (unsigned long) yyvsp[-2].integer.value * yyvsp[0].integer.value; @@ -1113,7 +1113,7 @@ case 12: } } break; case 13: -#line 198 "cccp.y" +#line 198 "y-src/cccp.y" { if (yyvsp[0].integer.value == 0) { error ("division by zero in #if"); @@ -1130,7 +1130,7 @@ case 13: } } break; case 14: -#line 213 "cccp.y" +#line 213 "y-src/cccp.y" { if (yyvsp[0].integer.value == 0) { error ("division by zero in #if"); @@ -1143,7 +1143,7 @@ case 14: yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value; } break; case 15: -#line 224 "cccp.y" +#line 224 "y-src/cccp.y" { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; if (! yyval.integer.unsignedp @@ -1152,7 +1152,7 @@ case 15: integer_overflow (); } break; case 16: -#line 231 "cccp.y" +#line 231 "y-src/cccp.y" { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; if (! yyval.integer.unsignedp @@ -1161,7 +1161,7 @@ case 16: integer_overflow (); } break; case 17: -#line 238 "cccp.y" +#line 238 "y-src/cccp.y" { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp; if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp) yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value); @@ -1169,7 +1169,7 @@ case 17: yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); } break; case 18: -#line 244 "cccp.y" +#line 244 "y-src/cccp.y" { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp; if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp) yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value); @@ -1177,17 +1177,17 @@ case 18: yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); } break; case 19: -#line 250 "cccp.y" +#line 250 "y-src/cccp.y" { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value); yyval.integer.unsignedp = 0; } break; case 20: -#line 253 "cccp.y" +#line 253 "y-src/cccp.y" { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value); yyval.integer.unsignedp = 0; } break; case 21: -#line 256 "cccp.y" +#line 256 "y-src/cccp.y" { yyval.integer.unsignedp = 0; if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp) yyval.integer.value = (unsigned long) yyvsp[-2].integer.value <= yyvsp[0].integer.value; @@ -1195,7 +1195,7 @@ case 21: yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value; } break; case 22: -#line 262 "cccp.y" +#line 262 "y-src/cccp.y" { yyval.integer.unsignedp = 0; if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp) yyval.integer.value = (unsigned long) yyvsp[-2].integer.value >= yyvsp[0].integer.value; @@ -1203,7 +1203,7 @@ case 22: yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value; } break; case 23: -#line 268 "cccp.y" +#line 268 "y-src/cccp.y" { yyval.integer.unsignedp = 0; if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp) yyval.integer.value = (unsigned long) yyvsp[-2].integer.value < yyvsp[0].integer.value; @@ -1211,7 +1211,7 @@ case 23: yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value; } break; case 24: -#line 274 "cccp.y" +#line 274 "y-src/cccp.y" { yyval.integer.unsignedp = 0; if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp) yyval.integer.value = (unsigned long) yyvsp[-2].integer.value > yyvsp[0].integer.value; @@ -1219,54 +1219,54 @@ case 24: yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value; } break; case 25: -#line 280 "cccp.y" +#line 280 "y-src/cccp.y" { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; } break; case 26: -#line 283 "cccp.y" +#line 283 "y-src/cccp.y" { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; } break; case 27: -#line 286 "cccp.y" +#line 286 "y-src/cccp.y" { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; } break; case 28: -#line 289 "cccp.y" +#line 289 "y-src/cccp.y" { yyval.integer.value = (yyvsp[-2].integer.value && yyvsp[0].integer.value); yyval.integer.unsignedp = 0; } break; case 29: -#line 292 "cccp.y" +#line 292 "y-src/cccp.y" { yyval.integer.value = (yyvsp[-2].integer.value || yyvsp[0].integer.value); yyval.integer.unsignedp = 0; } break; case 30: -#line 295 "cccp.y" +#line 295 "y-src/cccp.y" { yyval.integer.value = yyvsp[-4].integer.value ? yyvsp[-2].integer.value : yyvsp[0].integer.value; yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; } break; case 31: -#line 298 "cccp.y" +#line 298 "y-src/cccp.y" { yyval.integer = yylval.integer; } break; case 32: -#line 300 "cccp.y" +#line 300 "y-src/cccp.y" { yyval.integer = yylval.integer; } break; case 33: -#line 302 "cccp.y" +#line 302 "y-src/cccp.y" { yyval.integer.value = 0; yyval.integer.unsignedp = 0; } break; case 34: -#line 307 "cccp.y" +#line 307 "y-src/cccp.y" { yyval.keywords = 0; } break; case 35: -#line 309 "cccp.y" +#line 309 "y-src/cccp.y" { struct arglist *temp; yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist)); yyval.keywords->next = yyvsp[-2].keywords; @@ -1281,7 +1281,7 @@ case 35: temp->next->length = 1; } break; case 36: -#line 322 "cccp.y" +#line 322 "y-src/cccp.y" { yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist)); yyval.keywords->name = yyvsp[-1].name.address; yyval.keywords->length = yyvsp[-1].name.length; @@ -1520,7 +1520,7 @@ yyreturn: #endif return yyresult; } -#line 327 "cccp.y" +#line 327 "y-src/cccp.y" /* During parsing of a C expression, the pointer to the next character diff --git a/test/etags/y-src/cccp.y b/test/manual/etags/y-src/cccp.y index 1cd2111464c..1cd2111464c 100644 --- a/test/etags/y-src/cccp.y +++ b/test/manual/etags/y-src/cccp.y diff --git a/test/etags/y-src/parse.c b/test/manual/etags/y-src/parse.c index 1cb71ec895c..f8d836e649d 100644 --- a/test/etags/y-src/parse.c +++ b/test/manual/etags/y-src/parse.c @@ -26,7 +26,7 @@ # define L_NE 277 # define L_GE 278 -#line 1 "parse.y" +#line 1 "y-src/parse.y" /* Copyright (C) 1990, 1992-1993, 2016-2017 Free Software Foundation, * Inc. @@ -46,7 +46,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Oleo; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#line 41 "parse.y" +#line 41 "y-src/parse.y" #include "funcdef.h" @@ -1126,84 +1126,84 @@ yyreduce: switch (yyn) { case 1: -#line 87 "parse.y" +#line 87 "y-src/parse.y" { parse_return=yyvsp[0]; } break; case 2: -#line 88 "parse.y" +#line 88 "y-src/parse.y" { if(!parse_error) parse_error=PARSE_ERR; parse_return=0; } break; case 5: -#line 96 "parse.y" +#line 96 "y-src/parse.y" { yyval=yyvsp[-2]; } break; case 6: -#line 98 "parse.y" +#line 98 "y-src/parse.y" { (yyvsp[-3])->n_x.v_subs[0]=yyvsp[-1]; (yyvsp[-3])->n_x.v_subs[1]=(struct node *)0; yyval=yyvsp[-3]; } break; case 7: -#line 102 "parse.y" +#line 102 "y-src/parse.y" { (yyvsp[-5])->n_x.v_subs[0]=yyvsp[-3]; (yyvsp[-5])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-5]; } break; case 8: -#line 106 "parse.y" +#line 106 "y-src/parse.y" { (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]); (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-7];} break; case 9: -#line 110 "parse.y" +#line 110 "y-src/parse.y" { (yyvsp[-9])->n_x.v_subs[0]=make_list(yyvsp[-7],yyvsp[-5]); (yyvsp[-9])->n_x.v_subs[1]=make_list(yyvsp[-3],yyvsp[-1]); yyval=yyvsp[-9];} break; case 10: -#line 114 "parse.y" +#line 114 "y-src/parse.y" { (yyvsp[-3])->n_x.v_subs[0]=(struct node *)0; (yyvsp[-3])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-3]; } break; case 11: -#line 118 "parse.y" +#line 118 "y-src/parse.y" { yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1]; yyval=yyvsp[-3]; } break; case 12: -#line 121 "parse.y" +#line 121 "y-src/parse.y" { yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1]; yyval=yyvsp[-3]; } break; case 13: -#line 125 "parse.y" +#line 125 "y-src/parse.y" { yyvsp[-5]->n_x.v_subs[0]=yyvsp[-3]; yyvsp[-5]->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-5]; } break; case 14: -#line 129 "parse.y" +#line 129 "y-src/parse.y" { yyvsp[-5]->n_x.v_subs[0]=yyvsp[-3]; yyvsp[-5]->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-5]; } break; case 15: -#line 135 "parse.y" +#line 135 "y-src/parse.y" { if(yyvsp[-7]->comp_value!=F_INDEX) parse_error=PARSE_ERR; @@ -1213,7 +1213,7 @@ case 15: yyval=yyvsp[-7]; } break; case 16: -#line 142 "parse.y" +#line 142 "y-src/parse.y" { if(yyvsp[-7]->comp_value!=F_INDEX) parse_error=PARSE_ERR; @@ -1223,28 +1223,28 @@ case 16: yyval=yyvsp[-7]; } break; case 17: -#line 150 "parse.y" +#line 150 "y-src/parse.y" { (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]); (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-7];} break; case 18: -#line 154 "parse.y" +#line 154 "y-src/parse.y" { (yyvsp[-7])->n_x.v_subs[0]=make_list(yyvsp[-5],yyvsp[-3]); (yyvsp[-7])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-7];} break; case 19: -#line 159 "parse.y" +#line 159 "y-src/parse.y" { (yyvsp[-3])->n_x.v_subs[0]=(struct node *)0; (yyvsp[-3])->n_x.v_subs[1]=yyvsp[-1]; yyval=yyvsp[-3]; } break; case 20: -#line 163 "parse.y" +#line 163 "y-src/parse.y" { yyvsp[-3]->comp_value=IF; yyvsp[-3]->n_x.v_subs[0]=yyvsp[-1]; @@ -1254,98 +1254,98 @@ case 20: yyval=yyvsp[-3]; } break; case 21: -#line 174 "parse.y" +#line 174 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 22: -#line 178 "parse.y" +#line 178 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 23: -#line 182 "parse.y" +#line 182 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 24: -#line 186 "parse.y" +#line 186 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 25: -#line 190 "parse.y" +#line 190 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 26: -#line 194 "parse.y" +#line 194 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 27: -#line 198 "parse.y" +#line 198 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 28: -#line 202 "parse.y" +#line 202 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 29: -#line 206 "parse.y" +#line 206 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 30: -#line 210 "parse.y" +#line 210 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 31: -#line 214 "parse.y" +#line 214 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 32: -#line 218 "parse.y" +#line 218 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 33: -#line 222 "parse.y" +#line 222 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[-2]; yyvsp[-1]->n_x.v_subs[1]=yyvsp[0]; yyval = yyvsp[-1]; } break; case 34: -#line 226 "parse.y" +#line 226 "y-src/parse.y" { if(yyvsp[0]->comp_value==CONST_FLT) { yyvsp[0]->n_x.v_float= -(yyvsp[0]->n_x.v_float); @@ -1363,48 +1363,48 @@ case 34: } } break; case 35: -#line 241 "parse.y" +#line 241 "y-src/parse.y" { yyvsp[-1]->n_x.v_subs[0]=yyvsp[0]; yyvsp[-1]->n_x.v_subs[1]=(struct node *)0; yyval = yyvsp[-1]; } break; case 36: -#line 246 "parse.y" +#line 246 "y-src/parse.y" { yyval = yyvsp[-1]; } break; case 37: -#line 247 "parse.y" +#line 247 "y-src/parse.y" { if(!parse_error) parse_error=NO_CLOSE; } break; case 38: -#line 255 "parse.y" +#line 255 "y-src/parse.y" { if(!parse_error) parse_error=NO_CLOSE; } break; case 39: -#line 263 "parse.y" +#line 263 "y-src/parse.y" { yyval = make_list(yyvsp[0], 0); } break; case 40: -#line 265 "parse.y" +#line 265 "y-src/parse.y" { yyval = make_list(yyvsp[0], yyvsp[-2]); } break; case 43: -#line 273 "parse.y" +#line 273 "y-src/parse.y" { yyval=make_list(yyvsp[0], 0); } break; case 44: -#line 275 "parse.y" +#line 275 "y-src/parse.y" { yyval=make_list(yyvsp[0],yyvsp[-2]); } break; case 45: -#line 279 "parse.y" +#line 279 "y-src/parse.y" { yyval=yyvsp[0]; } break; } @@ -1640,7 +1640,7 @@ yyreturn: #endif return yyresult; } -#line 282 "parse.y" +#line 282 "y-src/parse.y" void diff --git a/test/etags/y-src/parse.y b/test/manual/etags/y-src/parse.y index b40847dd559..b40847dd559 100644 --- a/test/etags/y-src/parse.y +++ b/test/manual/etags/y-src/parse.y diff --git a/test/manual/image-size-tests.el b/test/manual/image-size-tests.el new file mode 100644 index 00000000000..577c7658791 --- /dev/null +++ b/test/manual/image-size-tests.el @@ -0,0 +1,92 @@ +;;; image-size-tests.el -- tests for image scaling + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;; To test: Load the file and eval (image-size-tests). +;; A non-erroring result is a success. + +;;; Code: + +(defmacro im-should (image width height &rest props) + `(let ((im (im-image ,image ,@props))) + (unless (im-compare im ,width ,height) + (error "%s didn't succeed; size is %s" + ',props (image-size im t))))) + +(defun im-image (type &rest props) + (let ((image-scaling-factor 1)) + (apply + #'create-image + (expand-file-name + (if (eq type :w) + "test/data/image/blank-200x100.png" + "test/data/image/blank-100x200.png") + source-directory) + 'imagemagick nil props))) + +(defun im-compare (image width height) + (let ((size (image-size image t))) + (and (= (car size) width) + (= (cdr size) height)))) + +(defun image-size-tests () + (unless (imagemagick-types) + (error "This only makes sense if ImageMagick is installed")) + ;; Test the image that's wider than it is tall. + ;; Default sizes. + (im-should :w 200 100) + ;; Changing one dimension changes the other. + (im-should :w 100 50 :width 100) + (im-should :w 100 50 :height 50) + ;; The same with :max-width etc. + (im-should :w 100 50 :max-width 100) + (im-should :w 100 50 :max-height 50) + ;; :width wins over :max-width etc + (im-should :w 300 150 :width 300 :max-width 100) + (im-should :w 400 200 :height 200 :max-height 100) + ;; Specifying both width and height is fine. + (im-should :w 300 50 :width 300 :height 50) + ;; A too-large :max-width (etc) has no effect. + (im-should :w 200 100 :max-width 300) + (im-should :w 200 100 :max-height 300) + ;; Both max-width/height. + (im-should :w 100 50 :max-width 100 :max-height 75) + (im-should :w 50 25 :max-width 100 :max-height 25) + + ;; Test the image that's taller than it is wide. + (im-should :h 100 200) + ;; Changing one dimension changes the other. + (im-should :h 50 100 :width 50) + (im-should :h 50 100 :height 100) + ;; The same with :max-width etc. + (im-should :h 50 100 :max-width 50) + (im-should :h 50 100 :max-height 100) + ;; :width wins over :max-width etc + (im-should :h 300 600 :width 300 :max-width 100) + (im-should :h 150 300 :height 300 :max-height 100) + ;; Specifying both width and height is fine. + (im-should :h 300 50 :width 300 :height 50) + ;; A too-large :max-width (etc) has no effect. + (im-should :h 100 200 :max-width 300) + (im-should :h 100 200 :max-height 300) + ;; Both max-width/height. + (im-should :h 50 100 :max-width 75 :max-height 100) + (im-should :h 25 50 :max-width 25 :max-height 100) + ) + +;;; image-size-tests.el ends here diff --git a/test/indent/Makefile b/test/manual/indent/Makefile index 83162681d72..09cf4a2b77c 100644 --- a/test/indent/Makefile +++ b/test/manual/indent/Makefile @@ -1,5 +1,5 @@ RM=rm -EMACS=../../src/emacs +EMACS=../../../src/emacs all: clean $(addsuffix .test,$(wildcard *.*)) diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css new file mode 100644 index 00000000000..bf612b53a14 --- /dev/null +++ b/test/manual/indent/css-mode.css @@ -0,0 +1,84 @@ +/* asdfasdf */ + +.xxx +{ +} + +article[role="main"] { + width: 60%; +} + +a, b:hover, c { + color: black !important; +} + +a, b:hover { /* bug:20282 */ + c { + color: black; + } + color: black; +} + +a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */ + background-color: white; +} + +/* asdfasdf */ +@foo x2 { + bla:toto; +} +.x2 +{ + /* foo: bar; */ foo2: bar2; + bar1: url("http://toto/titi"); + bar2: url('http://toto/titi'); + bar3: url(http://toto/titi); +} + +div.x3 +{ +} + +article:hover +{ + color: black; +} + +/* bug:13425 */ +div:first-child, +div:last-child, +div[disabled], +div::before { + font: 15px "Helvetica Neue", + Helvetica, + Arial, + "Nimbus Sans L", + sans-serif; + font: 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + transform: matrix(1.0, 2.0, + 3.0, 4.0, + 5.0, 6.0); + transform: matrix( + 1.0, 2.0, + 3.0, 4.0, + 5.0, 6.0 + ); +} + +@font-face { + src: url("Sans-Regular.eot") format("eot"), + url("Sans-Regular.woff") format("woff"), + url("Sans-Regular.ttf") format("truetype"); +} + +@font-face { + src: + url("Sans-Regular.eot") format("eot"), + url("Sans-Regular.woff") format("woff"); +} + +.foo-bar--baz { + --foo-variable: 5px; + margin: var(--foo-variable); +} diff --git a/test/manual/indent/html-multi-2.html b/test/manual/indent/html-multi-2.html new file mode 100644 index 00000000000..fac5eb1401c --- /dev/null +++ b/test/manual/indent/html-multi-2.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title>test</title> + <!-- + <script> + // No indent in a comment + if (true) { + do not change; + } + </script> + --> + + <style type="text/css"> + h1 { + font-family: 'Spinnaker', sans-serif; + } + </style> + <script> + var a = 4 < 5; + function() { + if (x > 75) + return 25; + return "hello"; + } + </script> + </head> + <body> + </body> + <!-- + Local Variables: + mhtml-tag-relative-indent: nil + End: + --> +</html> diff --git a/test/manual/indent/html-multi-3.html b/test/manual/indent/html-multi-3.html new file mode 100644 index 00000000000..62daf1d715a --- /dev/null +++ b/test/manual/indent/html-multi-3.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title>test</title> + <!-- + <script> + // No indent in a comment + if (true) { + do not change; + } + </script> + --> + + <style type="text/css"> +h1 { + font-family: 'Spinnaker', sans-serif; +} + </style> + <script> +var a = 4 < 5; +function() { + if (x > 75) + return 25; + return "hello"; +} + </script> + </head> + <body> + </body> + <!-- + Local Variables: + mhtml-tag-relative-indent: ignore + End: + --> +</html> diff --git a/test/manual/indent/html-multi-4.html b/test/manual/indent/html-multi-4.html new file mode 100644 index 00000000000..0eb89d17b0d --- /dev/null +++ b/test/manual/indent/html-multi-4.html @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + </head> + <body> + <p>This is a test.</p> + </body> + <script> + if (x) { + y; + } + </script> +</html> diff --git a/test/manual/indent/html-multi.html b/test/manual/indent/html-multi.html new file mode 100644 index 00000000000..a563c5eb244 --- /dev/null +++ b/test/manual/indent/html-multi.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <title>test</title> + <!-- + <script> + // No indent in a comment + if (true) { + do not change; + } + </script> + --> + + <style type="text/css"> + h1 { + font-family: 'Spinnaker', sans-serif; + } + </style> + <script> + var a = 4 < 5; + function() { + if (x > 75) + return 25; + return "hello"; + } + </script> + </head> + <body> + </body> +</html> diff --git a/test/manual/indent/js-chain.js b/test/manual/indent/js-chain.js new file mode 100644 index 00000000000..2a290294026 --- /dev/null +++ b/test/manual/indent/js-chain.js @@ -0,0 +1,29 @@ +// Normal chaining. +let x = svg.mumble() + .zzz; + +// Chaining with an intervening line comment. +let x = svg.mumble() // line comment + .zzz; + +// Chaining with multiple dots. +let x = svg.selectAll().something() + .zzz; + +// Nested chaining. +let x = svg.selectAll(d3.svg.something() + .zzz); + +// Nothing to chain to. +let x = svg() + .zzz; + +// Nothing to chain to. +let x = svg().mumble.x() + 73 + .zzz; + +// Local Variables: +// indent-tabs-mode: nil +// js-chain-indent: t +// js-indent-level: 2 +// End: diff --git a/test/indent/js-indent-init-dynamic.js b/test/manual/indent/js-indent-init-dynamic.js index 536a976e86e..536a976e86e 100644 --- a/test/indent/js-indent-init-dynamic.js +++ b/test/manual/indent/js-indent-init-dynamic.js diff --git a/test/indent/js-indent-init-t.js b/test/manual/indent/js-indent-init-t.js index bb755420ba7..bb755420ba7 100644 --- a/test/indent/js-indent-init-t.js +++ b/test/manual/indent/js-indent-init-t.js diff --git a/test/indent/js-jsx.js b/test/manual/indent/js-jsx.js index 7401939d282..7401939d282 100644 --- a/test/indent/js-jsx.js +++ b/test/manual/indent/js-jsx.js diff --git a/test/indent/js.js b/test/manual/indent/js.js index b40d47b3e5d..1ad76a83e18 100644 --- a/test/indent/js.js +++ b/test/manual/indent/js.js @@ -69,6 +69,9 @@ a++ b += c +var re = /some value/ +str.match(re) + baz(`http://foo.bar/${tee}`) .qux(); @@ -115,6 +118,23 @@ var arr = [ -5 ]; +// Regression test for bug#15582. +if (x > 72 && + y < 85) { // found + do_something(); +} + +// Test that chaining doesn't happen when js-chain-indent is nil. +let x = svg.mumble() + .zzz; + +// https://github.com/mooz/js2-mode/issues/405 +if (1) { + isSet + ? (isEmpty ? 2 : 3) + : 4 +} + // Local Variables: // indent-tabs-mode: nil // js-indent-level: 2 diff --git a/test/indent/latex-mode.tex b/test/manual/indent/latex-mode.tex index 55c8e7033bd..55c8e7033bd 100644 --- a/test/indent/latex-mode.tex +++ b/test/manual/indent/latex-mode.tex diff --git a/test/indent/modula2.mod b/test/manual/indent/modula2.mod index f8fbcb7f4e5..f8fbcb7f4e5 100644 --- a/test/indent/modula2.mod +++ b/test/manual/indent/modula2.mod diff --git a/test/indent/nxml.xml b/test/manual/indent/nxml.xml index 61b84f270b0..61b84f270b0 100644 --- a/test/indent/nxml.xml +++ b/test/manual/indent/nxml.xml diff --git a/test/indent/octave.m b/test/manual/indent/octave.m index 4758f9933cb..4758f9933cb 100644 --- a/test/indent/octave.m +++ b/test/manual/indent/octave.m diff --git a/test/indent/pascal.pas b/test/manual/indent/pascal.pas index fd225fd35d1..fd225fd35d1 100644 --- a/test/indent/pascal.pas +++ b/test/manual/indent/pascal.pas diff --git a/test/indent/perl.perl b/test/manual/indent/perl.perl index f86a09b2733..f86a09b2733 100755 --- a/test/indent/perl.perl +++ b/test/manual/indent/perl.perl diff --git a/test/indent/prolog.prolog b/test/manual/indent/prolog.prolog index 9ac6df1b6c7..9ac6df1b6c7 100644 --- a/test/indent/prolog.prolog +++ b/test/manual/indent/prolog.prolog diff --git a/test/indent/ps-mode.ps b/test/manual/indent/ps-mode.ps index 4b4ee0f10cb..4b4ee0f10cb 100644 --- a/test/indent/ps-mode.ps +++ b/test/manual/indent/ps-mode.ps diff --git a/test/indent/ruby.rb b/test/manual/indent/ruby.rb index b038512b114..b038512b114 100644 --- a/test/indent/ruby.rb +++ b/test/manual/indent/ruby.rb diff --git a/test/indent/scheme.scm b/test/manual/indent/scheme.scm index 84d0f6d8786..84d0f6d8786 100644 --- a/test/indent/scheme.scm +++ b/test/manual/indent/scheme.scm diff --git a/test/manual/indent/scss-mode.scss b/test/manual/indent/scss-mode.scss new file mode 100644 index 00000000000..a3dd41eeb47 --- /dev/null +++ b/test/manual/indent/scss-mode.scss @@ -0,0 +1,108 @@ +// Comment! + +nav { + ul { + margin: 0; /* More comment */ + padding: 0; + list-style: none; + } + + li { display: inline-block; } + + a { + display: block; + padding: 6px 12px; + text-decoration: none; + } +} +nav ul { + margin: 0; + padding: 0; + list-style: none; +} + +nav li { + display: inline-block; +} + +nav a var +{ + display: block; + padding: 6px 12px; + text-decoration: none; +} + +$name: foo; +$attr: border; +p.#{$name} var +{ + x#{$attr}-color: blue; +} +article[role="main"] { + $toto: 500 !global; + $var-with-default: 300 !default; + float: left !important; + width: 600px / 888px * 100%; + height: 100px / 888px * 100%; +} + +%placeholder { + color: #f0f0f0; +} + +button { + @extend %placeholder !optional; +} + +@import 'reset'; + +@mixin border-radius($radius) { + -webkit-border-radius: $radius; + -moz-border-radius: $radius; + -ms-border-radius: $radius; + border-radius: $radius; +} + +.box { @include border-radius(10px); } + +// bug:21230 +$list: ( + ('a', #000000, #fff) + ('b', #000000, #fff) + ('c', #000000, #fff) + ('d', #000000, #fff) + ('e', #000000, #fff) + ('f', #000000, #fff) +); + +// bug:13425 +div:first-child, +div:last-child { + @include foo-mixin( + $foo: 'foo', + $bar: 'bar', + ); + + font: 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + + div:first-child, + div:last-child { + font: 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + } +} + +body { + font: + 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + font-family: + sans-serif; + + article { + font: + 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + } +} diff --git a/test/indent/sgml-mode-attribute.html b/test/manual/indent/sgml-mode-attribute.html index 4cbec0af2c6..4cbec0af2c6 100644 --- a/test/indent/sgml-mode-attribute.html +++ b/test/manual/indent/sgml-mode-attribute.html diff --git a/test/indent/shell.rc b/test/manual/indent/shell.rc index e5c63e335b9..e5c63e335b9 100755 --- a/test/indent/shell.rc +++ b/test/manual/indent/shell.rc diff --git a/test/indent/shell.sh b/test/manual/indent/shell.sh index dc184ea0d77..dc184ea0d77 100755 --- a/test/indent/shell.sh +++ b/test/manual/indent/shell.sh diff --git a/test/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el index 694d55ab1db..defc3fee328 100644 --- a/test/redisplay-testsuite.el +++ b/test/manual/redisplay-testsuite.el @@ -34,7 +34,8 @@ (setq overlay (make-overlay opoint (point))) (while props (overlay-put overlay (car props) (cadr props)) - (setq props (cddr props))))) + (setq props (cddr props))) + overlay)) (defun test-redisplay-1 () (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n") @@ -293,6 +294,44 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff (insert "\n")) +(defvar test-redisplay-5a-expected-overlay nil) +(defvar test-redisplay-5a-result-overlay nil) +(defvar test-redisplay-5b-expected-overlay nil) +(defvar test-redisplay-5b-result-overlay nil) + +(defun test-redisplay-5-toggle (_event) + (interactive "e") + (setq display-raw-bytes-as-hex (not display-raw-bytes-as-hex)) + (let ((label (if display-raw-bytes-as-hex "\\x80" "\\200"))) + (overlay-put test-redisplay-5a-expected-overlay 'display + (propertize label 'face 'escape-glyph))) + (let ((label (if display-raw-bytes-as-hex "\\x3fffc" "\\777774"))) + (overlay-put test-redisplay-5b-expected-overlay 'display + (propertize label 'face 'escape-glyph)))) + +(defun test-redisplay-5 () + (insert "Test 5: Display of raw bytes:\n\n") + (insert " Expected: ") + (setq test-redisplay-5a-expected-overlay + (test-insert-overlay " " 'display + (propertize "\\200" 'face 'escape-glyph))) + (insert "\n Result: ") + (setq test-redisplay-5a-result-overlay + (test-insert-overlay " " 'display "\200")) + (insert "\n\n") + (insert " Expected: ") + ;; This tests a large codepoint, to make sure the internal buffer we + ;; use to produce the representation is large enough. + (aset printable-chars #x3fffc nil) + (setq test-redisplay-5b-expected-overlay + (test-insert-overlay " " 'display + (propertize "\\777774" 'face 'escape-glyph))) + (insert "\n Result: ") + (setq test-redisplay-5b-result-overlay + (test-insert-overlay " " 'display (char-to-string #x3fffc))) + (insert "\n\n") + (insert-button "Toggle between octal and hex display" + 'action 'test-redisplay-5-toggle)) (defun test-redisplay () (interactive) @@ -309,5 +348,6 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff (test-redisplay-2) (test-redisplay-3) (test-redisplay-4) + (test-redisplay-5) (goto-char (point-min)))) diff --git a/test/rmailmm.el b/test/manual/rmailmm.el index fc570fa42b4..fc570fa42b4 100644 --- a/test/rmailmm.el +++ b/test/manual/rmailmm.el diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el new file mode 100644 index 00000000000..95647ce0c40 --- /dev/null +++ b/test/manual/scroll-tests.el @@ -0,0 +1,167 @@ +;;; scroll-tests.el -- tests for scrolling -*- lexical-binding: t -*- + +;; Copyright (C) 2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; These are mostly automated ert tests, but they don't work in batch +;; mode which is why they are under test/manual. + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(defun scroll-tests-up-and-down (margin &optional effective-margin) + (unless effective-margin + (setq effective-margin margin)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (let ((scroll-margin margin) + (wstart (window-start))) + ;; Stopping before `scroll-margin' so we shouldn't have + ;; scrolled. + (let ((current-prefix-arg (- (window-text-height) 1 effective-margin))) + (call-interactively 'next-line)) + (sit-for 0) + (should (= wstart (window-start))) + ;; Passing `scroll-margin' should trigger scrolling. + (call-interactively 'next-line) + (sit-for 0) + (should (/= wstart (window-start))) + ;; Scroll back to top. + (let ((current-prefix-arg (window-start))) + (call-interactively 'scroll-down-command)) + (sit-for 0) + (should (= 1 (window-start))))) + +(defun scroll-tests-display-buffer-with-height (buffer alist) + (let ((height (alist-get 'window-height alist))) + (when height + (let* ((window (or (get-buffer-window buffer) (selected-window))) + (lines (floor height)) + (partial (round (* (- height lines) (default-line-height))))) + (setq window (cond ((window-in-direction 'above window nil +1)) + ((or (window-in-direction 'below window nil -1) + (split-window-below lines)) + window))) + (set-window-buffer window buffer) + (set-window-text-height window lines) + (adjust-window-trailing-edge window partial nil t) + window)))) + +(defmacro scroll-tests-with-buffer-window (&optional height &rest body) + (declare (debug t) (indent defun)) + `(with-temp-buffer + (with-selected-window (display-buffer (current-buffer) + '(scroll-tests-display-buffer-with-height + . ,(if (numberp height) + `((window-height . ,height)) + (push height body) + nil))) + ,@body))) + +(ert-deftest scroll-tests-scroll-margin-0 () + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (scroll-tests-up-and-down 0))) + +(ert-deftest scroll-tests-scroll-margin-negative () + "A negative `scroll-margin' should be the same as 0." + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (scroll-tests-up-and-down -10 0))) + +(ert-deftest scroll-tests-scroll-margin-max () + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window + (let ((max-margin (/ (window-text-height) 4))) + (scroll-tests-up-and-down max-margin)))) + +(ert-deftest scroll-tests-scroll-margin-over-max () + "A `scroll-margin' more than max should be the same as max." + (skip-unless (not noninteractive)) + (scroll-tests-with-buffer-window 7 + (let ((max-margin (/ (window-text-height) 4))) + (scroll-tests-up-and-down (+ max-margin 1) max-margin) + (scroll-tests-up-and-down (+ max-margin 2) max-margin)))) + +(ert-deftest scroll-tests-conservative-show-trailing-whitespace () + "Test for Bug#25792." + ;; Note: requires partial line to trigger problem. + (scroll-tests-with-buffer-window 20.5 + (let ((show-trailing-whitespace t) + (scroll-conservatively 101) + (scroll-margin 5)) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (forward-line 15) + (sit-for 0) + (let ((window-line (count-lines (window-start) (window-point)))) + (dotimes (_ 10) + (call-interactively 'next-line) + (sit-for 0) + (should (= window-line (count-lines (window-start) + (window-point))))))))) + +(defun scroll-tests--point-in-middle-of-window-p () + (= (count-lines (window-start) (window-point)) + (/ (1- (floor (window-screen-lines))) 2))) + +(cl-defun scroll-tests--scroll-margin-whole-window (&key with-line-spacing) + "Test `maximum-scroll-margin' at 0.5. +With a high `scroll-margin', this should keep cursor in the +middle of the window." + (let ((maximum-scroll-margin 0.5) + (scroll-margin 100)) + ;; Choose an odd number of lines, so there is a middle line. + (scroll-tests-with-buffer-window 7 + (setq-local line-spacing with-line-spacing) + ;; `set-window-text-height' doesn't count `line-spacing'. + (when with-line-spacing + (window-resize nil (* line-spacing 8) nil nil 'pixels)) + (erase-buffer) + (insert (mapconcat #'number-to-string + (number-sequence 1 200) "\n")) + (goto-char 1) + (sit-for 0) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-up-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p)) + (call-interactively 'scroll-down-command) + (sit-for 0) + (should (scroll-tests--point-in-middle-of-window-p))))) + +(ert-deftest scroll-tests-scroll-margin-whole-window () + (skip-unless (not noninteractive)) + (scroll-tests--scroll-margin-whole-window)) + +(ert-deftest scroll-tests-scroll-margin-whole-window-line-spacing () + ;; `line-spacing' has no effect on tty displays. + (skip-unless (display-graphic-p)) + (scroll-tests--scroll-margin-whole-window :with-line-spacing 3)) + + +;;; scroll-tests.el ends here diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el new file mode 100644 index 00000000000..1cf1fc3be5c --- /dev/null +++ b/test/src/alloc-tests.el @@ -0,0 +1,53 @@ +;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2017 Free Software Foundation, Inc. + +;; Author: Daniel Colascione <dancol@dancol.org> +;; Keywords: + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) +(require 'cl-lib) + +(ert-deftest finalizer-object-type () + (should (equal (type-of (make-finalizer nil)) 'finalizer))) + +(ert-deftest record-1 () + (let ((x (record 'foo 1 2 3))) + (should (recordp x)) + (should (eq (type-of x) 'foo)) + (should (eq (aref x 0) 'foo)) + (should (eql (aref x 3) 3)) + (should (eql (length x) 4)))) + +(ert-deftest record-2 () + (let ((x (make-record 'bar 1 0))) + (should (eql (length x) 2)) + (should (eql (aref x 1) 0)))) + +(ert-deftest record-3 () + (let* ((x (record 'foo 1 2 3)) + (y (copy-sequence x))) + (should-not (eq x y)) + (dotimes (i 4) + (should (eql (aref x i) (aref y i)))))) diff --git a/test/automated/buffer-tests.el b/test/src/buffer-tests.el index 793dddd8bd4..793dddd8bd4 100644 --- a/test/automated/buffer-tests.el +++ b/test/src/buffer-tests.el diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el new file mode 100644 index 00000000000..853d56e827d --- /dev/null +++ b/test/src/callproc-tests.el @@ -0,0 +1,39 @@ +;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) +(eval-when-compile (require 'cl-lib)) + +(ert-deftest initial-environment-preserved () + "Check that `initial-environment' is not modified by Emacs (Bug #10980)." + (skip-unless (eq system-type 'windows-nt)) + (cl-destructuring-bind (initial-shell shell) + (with-temp-buffer + (let ((process-environment (cons "SHELL" process-environment))) + (call-process (expand-file-name invocation-name invocation-directory) + nil t nil + "--batch" "-Q" "--eval" + (prin1-to-string + '(progn (prin1 (getenv-internal "SHELL" initial-environment)) + (prin1 (getenv-internal "SHELL")))))) + (split-string-and-unquote (buffer-string))) + (should (equal initial-shell "nil")) + (should-not (equal initial-shell shell)))) diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el new file mode 100644 index 00000000000..234d233c71a --- /dev/null +++ b/test/src/casefiddle-tests.el @@ -0,0 +1,263 @@ +;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2016 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'case-table) +(require 'ert) + +(ert-deftest casefiddle-tests-char-properties () + "Sanity check of character Unicode properties." + (let ((props '(uppercase lowercase titlecase + special-uppercase special-lowercase special-titlecase)) + (tests '((?A nil ?a nil nil nil nil) + (?a ?A nil ?A nil nil nil) + (?Ł nil ?ł nil nil nil nil) + (?ł ?Ł nil ?Ł nil nil nil) + + (?DŽ nil ?dž ?Dž nil nil nil) + (?Dž ?DŽ ?dž ?Dž nil nil nil) + (?dž ?DŽ nil ?Dž nil nil nil) + + (?Σ nil ?σ nil nil nil nil) + (?σ ?Σ nil ?Σ nil nil nil) + (?ς ?Σ nil ?Σ nil nil nil) + + (?ⅷ ?Ⅷ nil ?Ⅷ nil nil nil) + (?Ⅷ nil ?ⅷ nil nil nil nil) + + (?fi nil nil nil "FI" nil "Fi") + (?ß nil nil nil "SS" nil "Ss") + (?İ nil ?i nil nil "i\u0307" nil))) + errors) + (dolist (test tests) + (let ((ch (car test)) + (expected (cdr test))) + (dolist (prop props) + (let ((got (get-char-code-property ch prop))) + (unless (equal (car expected) got) + (push (format "\n%c %s; expected: %s but got: %s" + ch prop (car expected) got) + errors))) + (setq expected (cdr expected))))) + (when errors + (ert-fail (mapconcat (lambda (line) line) (nreverse errors) ""))))) + + +(defconst casefiddle-tests--characters + ;; character uppercase lowercase titlecase + '((?A ?A ?a ?A) + (?a ?A ?a ?A) + (?Ł ?Ł ?ł ?Ł) + (?ł ?Ł ?ł ?Ł) + + (?DŽ ?DŽ ?dž ?Dž) + (?Dž ?DŽ ?dž ?Dž) + (?dž ?DŽ ?dž ?Dž) + + (?Σ ?Σ ?σ ?Σ) + (?σ ?Σ ?σ ?Σ) + (?ς ?Σ ?ς ?Σ) + + (?Ⅷ ?Ⅷ ?ⅷ ?Ⅷ) + (?ⅷ ?Ⅷ ?ⅷ ?Ⅷ))) + + +(ert-deftest casefiddle-tests-case-table () + "Sanity check of down and up case tables." + (should-not + (let (errors + (up (case-table-get-table (current-case-table) 'up)) + (down (case-table-get-table (current-case-table) 'down))) + (dolist (test casefiddle-tests--characters) + (let ((ch (car test)) + (expected (cdr test)) + (props '(uppercase lowercase)) + (tabs (list up down))) + (while props + (let ((got (aref (car tabs) ch))) + (unless (equal (car expected) got) + (push (format "\n%c %s; expected: %s but got: %s" + ch (car props) (car expected) got) + errors))) + (setq props (cdr props) tabs (cdr tabs) expected (cdr expected))))) + (when errors + (mapconcat (lambda (line) line) (nreverse errors) ""))))) + + +(ert-deftest casefiddle-tests-casing-character () + (should-not + (let (errors) + (dolist (test casefiddle-tests--characters) + (let ((ch (car test)) + (expected (cdr test)) + (funcs '(upcase downcase capitalize))) + (while funcs + (let ((got (funcall (car funcs) ch))) + (unless (equal (car expected) got) + (push (format "\n%c %s; expected: %s but got: %s" + ch (car funcs) (car expected) got) + errors))) + (setq funcs (cdr funcs) expected (cdr expected))))) + (when errors + (mapconcat (lambda (line) line) (nreverse errors) ""))))) + + +(ert-deftest casefiddle-tests-casing-word () + (with-temp-buffer + (dolist (test '((upcase-word . "FOO Bar") + (downcase-word . "foo Bar") + (capitalize-word . "Foo Bar"))) + (dolist (back '(nil t)) + (delete-region (point-min) (point-max)) + (insert "foO Bar") + (goto-char (+ (if back 4 0) (point-min))) + (funcall (car test) (if back -1 1)) + (should (string-equal (cdr test) (buffer-string))) + (should (equal (+ (if back 4 3) (point-min)) (point))))))) + + +(defun casefiddle-tests--test-casing (tests) + (nreverse + (cl-reduce + (lambda (errors test) + (let* ((input (car test)) + (expected (cdr test)) + (func-pairs '((upcase upcase-region) + (downcase downcase-region) + (capitalize capitalize-region) + (upcase-initials upcase-initials-region))) + (get-string (lambda (func) (funcall func input))) + (get-region (lambda (func) + (delete-region (point-min) (point-max)) + (unwind-protect + (progn + (unless (multibyte-string-p input) + (toggle-enable-multibyte-characters)) + (insert input) + (funcall func (point-min) (point-max)) + (buffer-string)) + (unless (multibyte-string-p input) + (toggle-enable-multibyte-characters))))) + (fmt-str (lambda (str) + (format "%s (%sbyte; %d chars; %d bytes)" + str + (if (multibyte-string-p str) "multi" "uni") + (length str) (string-bytes str)))) + funcs getters) + (while (and func-pairs expected) + (setq funcs (car func-pairs) + getters (list get-string get-region)) + (while (and funcs getters) + (let ((got (funcall (car getters) (car funcs)))) + (unless (string-equal got (car expected)) + (let ((fmt (length (symbol-name (car funcs))))) + (setq fmt (format "\n%%%ds: %%s" (max fmt 8))) + (push (format (concat fmt fmt fmt) + (car funcs) (funcall fmt-str input) + "expected" (funcall fmt-str (car expected)) + "but got" (funcall fmt-str got)) + errors)))) + (setq funcs (cdr funcs) getters (cdr getters))) + (setq func-pairs (cdr func-pairs) expected (cdr expected)))) + errors) + (cons () tests)))) + +(ert-deftest casefiddle-tests-casing () + (should-not + (with-temp-buffer + (casefiddle-tests--test-casing + ;; input upper lower capitalize up-initials + '(("Foo baR" "FOO BAR" "foo bar" "Foo Bar" "Foo BaR") + ("Ⅷ ⅷ" "Ⅷ Ⅷ" "ⅷ ⅷ" "Ⅷ Ⅷ" "Ⅷ Ⅷ") + ;; "DžUNGLA" is an unfortunate result but it’s really best we can + ;; do while still being consistent. Hopefully, users only ever + ;; use upcase-initials on camelCase identifiers not real words. + ("DŽUNGLA" "DŽUNGLA" "džungla" "Džungla" "DžUNGLA") + ("Džungla" "DŽUNGLA" "džungla" "Džungla" "Džungla") + ("džungla" "DŽUNGLA" "džungla" "Džungla" "Džungla") + ("define" "DEFINE" "define" "Define" "Define") + ("fish" "FISH" "fish" "Fish" "Fish") + ("Straße" "STRASSE" "straße" "Straße" "Straße") + + ;; The word repeated twice to test behaviour at the end of a word + ;; inside of an input string as well as at the end of the string. + ("ΌΣΟΣ ΌΣΟΣ" "ΌΣΟΣ ΌΣΟΣ" "όσος όσος" "Όσος Όσος" "ΌΣΟΣ ΌΣΟΣ") + ;; What should be done with sole sigma? It is ‘final’ but on the + ;; other hand it does not form a word. We’re using regular sigma. + ("Σ Σ" "Σ Σ" "σ σ" "Σ Σ" "Σ Σ") + ("όσος" "ΌΣΟΣ" "όσος" "Όσος" "Όσος") + ;; If sigma is already lower case, we don’t want to change it. + ("όσοσ" "ΌΣΟΣ" "όσοσ" "Όσοσ" "Όσοσ")))))) + +(ert-deftest casefiddle-tests-casing-byte8 () + (should-not + (with-temp-buffer + (casefiddle-tests--test-casing + '(("\xff Foo baR \xff" + "\xff FOO BAR \xff" + "\xff foo bar \xff" + "\xff Foo Bar \xff" + "\xff Foo BaR \xff") + ("\xff Zażółć gĘŚlą \xff" + "\xff ZAŻÓŁĆ GĘŚLĄ \xff" + "\xff zażółć gęślą \xff" + "\xff Zażółć Gęślą \xff" + "\xff Zażółć GĘŚlą \xff")))))) + +(ert-deftest casefiddle-tests-casing-byte8-with-changes () + (let ((tab (copy-case-table (standard-case-table))) + (test '("\xff\xff\xef Foo baR \xcf\xcf" + "\xef\xef\xef FOO BAR \xcf\xcf" + "\xff\xff\xff foo bar \xcf\xcf" + "\xef\xff\xff Foo Bar \xcf\xcf" + "\xef\xff\xef Foo BaR \xcf\xcf")) + (byte8 #x3FFF00)) + (should-not + (with-temp-buffer + (set-case-table tab) + (set-case-syntax-pair (+ byte8 #xef) (+ byte8 #xff) tab) + (casefiddle-tests--test-casing + (list test + (mapcar (lambda (str) (decode-coding-string str 'binary)) test) + '("\xff\xff\xef Zażółć gĘŚlą \xcf\xcf" + "\xef\xef\xef ZAŻÓŁĆ GĘŚLĄ \xcf\xcf" + "\xff\xff\xff zażółć gęślą \xcf\xcf" + "\xef\xff\xff Zażółć Gęślą \xcf\xcf" + "\xef\xff\xef Zażółć GĘŚlą \xcf\xcf"))))))) + + +(ert-deftest casefiddle-tests-char-casing () + ;; input upcase downcase [titlecase] + (dolist (test '((?a ?A ?a) (?A ?A ?a) + (?ł ?Ł ?ł) (?Ł ?Ł ?ł) + (?ß ?ß ?ß) (?ẞ ?ẞ ?ß) + (?ⅷ ?Ⅷ ?ⅷ) (?Ⅷ ?Ⅷ ?ⅷ) + (?DŽ ?DŽ ?dž ?Dž) (?Dž ?DŽ ?dž ?Dž) (?dž ?DŽ ?dž ?Dž))) + (let ((ch (car test)) + (up (nth 1 test)) + (lo (nth 2 test)) + (tc (or (nth 3 test) (nth 1 test)))) + (should (eq up (upcase ch))) + (should (eq lo (downcase ch))) + (should (eq tc (capitalize ch))) + (should (eq tc (upcase-initials ch)))))) + + +;;; casefiddle-tests.el ends here diff --git a/test/src/charset-tests.el b/test/src/charset-tests.el new file mode 100644 index 00000000000..515a4eafe14 --- /dev/null +++ b/test/src/charset-tests.el @@ -0,0 +1,26 @@ +;;; charset-tests.el --- Tests for charset.c + +;; Copyright 2017 Free Software Foundation, Inc. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(ert-deftest charset-decode-char () + "Test decode-char." + (should-error (decode-char 'ascii 0.5))) + +(provide 'charset-tests) diff --git a/test/src/chartab-tests.el b/test/src/chartab-tests.el new file mode 100644 index 00000000000..54fcdcffbae --- /dev/null +++ b/test/src/chartab-tests.el @@ -0,0 +1,51 @@ +;;; chartab-tests.el --- Tests for char-tab.c + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii <eliz@gnu.org> + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(defun chartab-set-and-test (rng) + (let ((tbl (make-char-table nil nil)) + (from (car rng)) + (to (cdr rng))) + (set-char-table-range tbl rng t) + (should (eq (aref tbl from) t)) + (should (eq (aref tbl to) t)) + (should (eq (aref tbl (/ (+ from to) 2)) t)) + (when (< to (max-char)) + (should-not (eq (aref tbl (1+ to)) t))) + (when (> from 0) + (should-not (eq (aref tbl (1- from)) t))))) + +(ert-deftest chartab-test-range-setting () + (mapc (lambda (elt) + (chartab-set-and-test elt)) + '((0 . 127) + (128 . 256) + (#x1000 . #x1fff) + (#x1001 . #x2000) + (#x10000 . #x20000) + (#x10001 . #x1ffff) + (#x20000 . #x30000) + (#xe0e00 . #xe0ef6) + ))) + +(provide 'chartab-tests) +;;; chartab-tests.el ends here diff --git a/test/automated/cmds-tests.el b/test/src/cmds-tests.el index 207ae75a21d..207ae75a21d 100644 --- a/test/automated/cmds-tests.el +++ b/test/src/cmds-tests.el diff --git a/test/automated/decoder-tests.el b/test/src/coding-tests.el index 5e9a45b2443..cfcd080281f 100644 --- a/test/automated/decoder-tests.el +++ b/test/src/coding-tests.el @@ -1,7 +1,8 @@ -;;; decoder-tests.el --- test for text decoder +;;; coding-tests.el --- tests for text encoding and decoding ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. +;; Author: Eli Zaretskii <eliz@gnu.org> ;; Author: Kenichi Handa <handa@gnu.org> ;; This file is part of GNU Emacs. @@ -24,16 +25,42 @@ (require 'ert) ;; Directory to hold test data files. -(defvar decoder-tests-workdir - (expand-file-name "decoder-tests" temporary-file-directory)) +(defvar coding-tests-workdir + (expand-file-name "coding-tests" temporary-file-directory)) ;; Remove all generated test files. -(defun decoder-tests-remove-files () - (delete-directory decoder-tests-workdir t)) +(defun coding-tests-remove-files () + (delete-directory coding-tests-workdir t)) + +(ert-deftest ert-test-coding-bogus-coding-systems () + (unwind-protect + (let (test-file) + (or (file-directory-p coding-tests-workdir) + (mkdir coding-tests-workdir t)) + (setq test-file (expand-file-name "nonexistent" coding-tests-workdir)) + (if (file-exists-p test-file) + (delete-file test-file)) + (should-error + (let ((coding-system-for-read 'bogus)) + (insert-file-contents test-file))) + ;; See bug #21602. + (setq test-file (expand-file-name "writing" coding-tests-workdir)) + (should-error + (let ((coding-system-for-write (intern "\"us-ascii\""))) + (write-region "some text" nil test-file)))) + (coding-tests-remove-files))) + +;; See issue #5251. +(ert-deftest ert-test-unibyte-buffer-dos-eol-decode () + (with-temp-buffer + (set-buffer-multibyte nil) + (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n") + (decode-coding-region (point-min) (point-max) 'euc-jp-dos) + (should-not (string-match-p "\^M" (buffer-string))))) ;; Return the contents (specified by CONTENT-TYPE; ascii, latin, or ;; binary) of a test file. -(defun decoder-tests-file-contents (content-type) +(defun coding-tests-file-contents (content-type) (let* ((ascii "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n") (latin (concat ascii "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\n")) (binary (string-to-multibyte @@ -47,10 +74,10 @@ ;; Generate FILE with CONTENTS encoded by CODING-SYSTEM. ;; whose encoding specified by CODING-SYSTEM. -(defun decoder-tests-gen-file (file contents coding-system) - (or (file-directory-p decoder-tests-workdir) - (mkdir decoder-tests-workdir t)) - (setq file (expand-file-name file decoder-tests-workdir)) +(defun coding-tests-gen-file (file contents coding-system) + (or (file-directory-p coding-tests-workdir) + (mkdir coding-tests-workdir t)) + (setq file (expand-file-name file coding-tests-workdir)) (with-temp-file file (set-buffer-file-coding-system coding-system) (insert contents)) @@ -60,7 +87,7 @@ ;;; file. ;; Convert all LFs to CR LF sequences in the string STR. -(defun decoder-tests-lf-to-crlf (str) +(defun coding-tests-lf-to-crlf (str) (with-temp-buffer (insert str) (goto-char (point-min)) @@ -70,14 +97,14 @@ (buffer-string))) ;; Convert all LFs to CRs in the string STR. -(defun decoder-tests-lf-to-cr (str) +(defun coding-tests-lf-to-cr (str) (with-temp-buffer (insert str) (subst-char-in-region (point-min) (point-max) ?\n ?\r) (buffer-string))) ;; Convert all LFs to LF LF sequences in the string STR. -(defun decoder-tests-lf-to-lflf (str) +(defun coding-tests-lf-to-lflf (str) (with-temp-buffer (insert str) (goto-char (point-min)) @@ -86,27 +113,27 @@ (buffer-string))) ;; Prepend the UTF-8 BOM to STR. -(defun decoder-tests-add-bom (str) +(defun coding-tests-add-bom (str) (concat "\xfeff" str)) ;; Return the name of test file whose contents specified by ;; CONTENT-TYPE and whose encoding specified by CODING-SYSTEM. -(defun decoder-tests-filename (content-type coding-system &optional ext) +(defun coding-tests-filename (content-type coding-system &optional ext) (if ext (expand-file-name (format "%s-%s.%s" content-type coding-system ext) - decoder-tests-workdir) + coding-tests-workdir) (expand-file-name (format "%s-%s" content-type coding-system) - decoder-tests-workdir))) + coding-tests-workdir))) ;;; Check ASCII optimizing decoder ;; Generate a test file whose contents specified by CONTENT-TYPE and ;; whose encoding specified by CODING-SYSTEM. -(defun decoder-tests-ao-gen-file (content-type coding-system) - (let ((file (decoder-tests-filename content-type coding-system))) - (decoder-tests-gen-file file - (decoder-tests-file-contents content-type) +(defun coding-tests-ao-gen-file (content-type coding-system) + (let ((file (coding-tests-filename content-type coding-system))) + (coding-tests-gen-file file + (coding-tests-file-contents content-type) coding-system))) ;; Test the decoding of a file whose contents and encoding are @@ -118,13 +145,13 @@ ;; instance, when a file of dos eol-type is read by unix eol-type, ;; `decode-test-lf-to-crlf' must be specified. -(defun decoder-tests (content-type write-coding read-coding detected-coding +(defun coding-tests (content-type write-coding read-coding detected-coding &optional translator) (prefer-coding-system 'utf-8-auto) - (let ((filename (decoder-tests-filename content-type write-coding))) + (let ((filename (coding-tests-filename content-type write-coding))) (with-temp-buffer (let ((coding-system-for-read read-coding) - (contents (decoder-tests-file-contents content-type)) + (contents (coding-tests-file-contents content-type)) (disable-ascii-optimization nil)) (if translator (setq contents (funcall translator contents))) @@ -136,75 +163,75 @@ (string-to-list (buffer-string)) (string-to-list contents))))))) -(ert-deftest ert-test-decoder-ascii () +(ert-deftest ert-test-coding-ascii () (unwind-protect (progn (dolist (eol-type '(unix dos mac)) - (decoder-tests-ao-gen-file 'ascii eol-type)) - (should-not (decoder-tests 'ascii 'unix 'undecided 'unix)) - (should-not (decoder-tests 'ascii 'dos 'undecided 'dos)) - (should-not (decoder-tests 'ascii 'dos 'dos 'dos)) - (should-not (decoder-tests 'ascii 'mac 'undecided 'mac)) - (should-not (decoder-tests 'ascii 'mac 'mac 'mac)) - (should-not (decoder-tests 'ascii 'dos 'utf-8 'utf-8-dos)) - (should-not (decoder-tests 'ascii 'dos 'unix 'unix - 'decoder-tests-lf-to-crlf)) - (should-not (decoder-tests 'ascii 'mac 'dos 'dos - 'decoder-tests-lf-to-cr)) - (should-not (decoder-tests 'ascii 'dos 'mac 'mac - 'decoder-tests-lf-to-lflf))) - (decoder-tests-remove-files))) - -(ert-deftest ert-test-decoder-latin () + (coding-tests-ao-gen-file 'ascii eol-type)) + (should-not (coding-tests 'ascii 'unix 'undecided 'unix)) + (should-not (coding-tests 'ascii 'dos 'undecided 'dos)) + (should-not (coding-tests 'ascii 'dos 'dos 'dos)) + (should-not (coding-tests 'ascii 'mac 'undecided 'mac)) + (should-not (coding-tests 'ascii 'mac 'mac 'mac)) + (should-not (coding-tests 'ascii 'dos 'utf-8 'utf-8-dos)) + (should-not (coding-tests 'ascii 'dos 'unix 'unix + 'coding-tests-lf-to-crlf)) + (should-not (coding-tests 'ascii 'mac 'dos 'dos + 'coding-tests-lf-to-cr)) + (should-not (coding-tests 'ascii 'dos 'mac 'mac + 'coding-tests-lf-to-lflf))) + (coding-tests-remove-files))) + +(ert-deftest ert-test-coding-latin () (unwind-protect (progn (dolist (coding '("utf-8" "utf-8-with-signature")) (dolist (eol-type '("unix" "dos" "mac")) - (decoder-tests-ao-gen-file 'latin + (coding-tests-ao-gen-file 'latin (intern (concat coding "-" eol-type))))) - (should-not (decoder-tests 'latin 'utf-8-unix 'undecided 'utf-8-unix)) - (should-not (decoder-tests 'latin 'utf-8-unix 'utf-8-unix 'utf-8-unix)) - (should-not (decoder-tests 'latin 'utf-8-dos 'undecided 'utf-8-dos)) - (should-not (decoder-tests 'latin 'utf-8-dos 'utf-8-dos 'utf-8-dos)) - (should-not (decoder-tests 'latin 'utf-8-mac 'undecided 'utf-8-mac)) - (should-not (decoder-tests 'latin 'utf-8-mac 'utf-8-mac 'utf-8-mac)) - (should-not (decoder-tests 'latin 'utf-8-dos 'unix 'utf-8-unix - 'decoder-tests-lf-to-crlf)) - (should-not (decoder-tests 'latin 'utf-8-mac 'dos 'utf-8-dos - 'decoder-tests-lf-to-cr)) - (should-not (decoder-tests 'latin 'utf-8-dos 'mac 'utf-8-mac - 'decoder-tests-lf-to-lflf)) - (should-not (decoder-tests 'latin 'utf-8-with-signature-unix 'undecided + (should-not (coding-tests 'latin 'utf-8-unix 'undecided 'utf-8-unix)) + (should-not (coding-tests 'latin 'utf-8-unix 'utf-8-unix 'utf-8-unix)) + (should-not (coding-tests 'latin 'utf-8-dos 'undecided 'utf-8-dos)) + (should-not (coding-tests 'latin 'utf-8-dos 'utf-8-dos 'utf-8-dos)) + (should-not (coding-tests 'latin 'utf-8-mac 'undecided 'utf-8-mac)) + (should-not (coding-tests 'latin 'utf-8-mac 'utf-8-mac 'utf-8-mac)) + (should-not (coding-tests 'latin 'utf-8-dos 'unix 'utf-8-unix + 'coding-tests-lf-to-crlf)) + (should-not (coding-tests 'latin 'utf-8-mac 'dos 'utf-8-dos + 'coding-tests-lf-to-cr)) + (should-not (coding-tests 'latin 'utf-8-dos 'mac 'utf-8-mac + 'coding-tests-lf-to-lflf)) + (should-not (coding-tests 'latin 'utf-8-with-signature-unix 'undecided 'utf-8-with-signature-unix)) - (should-not (decoder-tests 'latin 'utf-8-with-signature-unix 'utf-8-auto + (should-not (coding-tests 'latin 'utf-8-with-signature-unix 'utf-8-auto 'utf-8-with-signature-unix)) - (should-not (decoder-tests 'latin 'utf-8-with-signature-dos 'undecided + (should-not (coding-tests 'latin 'utf-8-with-signature-dos 'undecided 'utf-8-with-signature-dos)) - (should-not (decoder-tests 'latin 'utf-8-with-signature-unix 'utf-8 - 'utf-8-unix 'decoder-tests-add-bom)) - (should-not (decoder-tests 'latin 'utf-8-with-signature-unix 'utf-8 - 'utf-8-unix 'decoder-tests-add-bom))) - (decoder-tests-remove-files))) + (should-not (coding-tests 'latin 'utf-8-with-signature-unix 'utf-8 + 'utf-8-unix 'coding-tests-add-bom)) + (should-not (coding-tests 'latin 'utf-8-with-signature-unix 'utf-8 + 'utf-8-unix 'coding-tests-add-bom))) + (coding-tests-remove-files))) -(ert-deftest ert-test-decoder-binary () +(ert-deftest ert-test-coding-binary () (unwind-protect (progn (dolist (eol-type '("unix" "dos" "mac")) - (decoder-tests-ao-gen-file 'binary + (coding-tests-ao-gen-file 'binary (intern (concat "raw-text" "-" eol-type)))) - (should-not (decoder-tests 'binary 'raw-text-unix 'undecided + (should-not (coding-tests 'binary 'raw-text-unix 'undecided 'raw-text-unix)) - (should-not (decoder-tests 'binary 'raw-text-dos 'undecided + (should-not (coding-tests 'binary 'raw-text-dos 'undecided 'raw-text-dos)) - (should-not (decoder-tests 'binary 'raw-text-mac 'undecided + (should-not (coding-tests 'binary 'raw-text-mac 'undecided 'raw-text-mac)) - (should-not (decoder-tests 'binary 'raw-text-dos 'unix - 'raw-text-unix 'decoder-tests-lf-to-crlf)) - (should-not (decoder-tests 'binary 'raw-text-mac 'dos - 'raw-text-dos 'decoder-tests-lf-to-cr)) - (should-not (decoder-tests 'binary 'raw-text-dos 'mac - 'raw-text-mac 'decoder-tests-lf-to-lflf))) - (decoder-tests-remove-files))) + (should-not (coding-tests 'binary 'raw-text-dos 'unix + 'raw-text-unix 'coding-tests-lf-to-crlf)) + (should-not (coding-tests 'binary 'raw-text-mac 'dos + 'raw-text-dos 'coding-tests-lf-to-cr)) + (should-not (coding-tests 'binary 'raw-text-dos 'mac + 'raw-text-mac 'coding-tests-lf-to-lflf))) + (coding-tests-remove-files))) ;;; Check the coding system `prefer-utf-8'. @@ -212,7 +239,7 @@ ;; Read FILE. Check if the encoding was detected as DETECT. If ;; PREFER is non-nil, prefer that coding system before reading. -(defun decoder-tests-prefer-utf-8-read (file detect prefer) +(defun coding-tests-prefer-utf-8-read (file detect prefer) (with-temp-buffer (with-coding-priority (if prefer (list prefer)) (insert-file-contents file)) @@ -225,7 +252,7 @@ ;; coding tag with it before writing. If STR is non-nil, insert it ;; before writing. -(defun decoder-tests-prefer-utf-8-write (file coding-tag coding +(defun coding-tests-prefer-utf-8-write (file coding-tag coding &optional str) (with-temp-buffer (insert-file-contents file) @@ -235,34 +262,34 @@ (insert ";;\n")) (if str (insert str)) - (write-file (decoder-tests-filename 'test 'test "el")) + (write-file (coding-tests-filename 'test 'test "el")) (if (coding-system-equal buffer-file-coding-system coding) nil (format "Incorrect encoding: %s" last-coding-system-used)))) -(ert-deftest ert-test-decoder-prefer-utf-8 () +(ert-deftest ert-test-coding-prefer-utf-8 () (unwind-protect - (let ((ascii (decoder-tests-gen-file "ascii.el" - (decoder-tests-file-contents 'ascii) + (let ((ascii (coding-tests-gen-file "ascii.el" + (coding-tests-file-contents 'ascii) 'unix)) - (latin (decoder-tests-gen-file "utf-8.el" - (decoder-tests-file-contents 'latin) + (latin (coding-tests-gen-file "utf-8.el" + (coding-tests-file-contents 'latin) 'utf-8-unix))) - (should-not (decoder-tests-prefer-utf-8-read + (should-not (coding-tests-prefer-utf-8-read ascii 'prefer-utf-8-unix nil)) - (should-not (decoder-tests-prefer-utf-8-read + (should-not (coding-tests-prefer-utf-8-read latin 'utf-8-unix nil)) - (should-not (decoder-tests-prefer-utf-8-read + (should-not (coding-tests-prefer-utf-8-read latin 'utf-8-unix 'iso-8859-1)) - (should-not (decoder-tests-prefer-utf-8-read + (should-not (coding-tests-prefer-utf-8-read latin 'utf-8-unix 'sjis)) - (should-not (decoder-tests-prefer-utf-8-write + (should-not (coding-tests-prefer-utf-8-write ascii nil 'prefer-utf-8-unix)) - (should-not (decoder-tests-prefer-utf-8-write + (should-not (coding-tests-prefer-utf-8-write ascii 'iso-8859-1 'iso-8859-1-unix)) - (should-not (decoder-tests-prefer-utf-8-write + (should-not (coding-tests-prefer-utf-8-write ascii nil 'utf-8-unix "À"))) - (decoder-tests-remove-files))) + (coding-tests-remove-files))) ;;; The following is for benchmark testing of the new optimized @@ -347,3 +374,10 @@ (result (benchmark-run 10 (with-temp-buffer (insert-file-contents (car file)))))) (insert (format "%s: %s\n" (car file) result))))))) + +;; Local Variables: +;; byte-compile-warnings: (not obsolete) +;; End: + +(provide 'coding-tests) +;; coding-tests.el ends here diff --git a/test/src/data-tests.el b/test/src/data-tests.el new file mode 100644 index 00000000000..00a30559e32 --- /dev/null +++ b/test/src/data-tests.el @@ -0,0 +1,482 @@ +;;; data-tests.el --- tests for src/data.c + +;; Copyright (C) 2013-2017 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'cl-lib) + +(ert-deftest data-tests-= () + (should-error (=)) + (should (= 1)) + (should (= 2 2)) + (should (= 9 9 9 9 9 9 9 9 9)) + (should (= most-negative-fixnum (float most-negative-fixnum))) + (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum))) + (should-not (apply #'= '(3 8 3))) + (should-error (= 9 9 'foo)) + ;; Short circuits before getting to bad arg + (should-not (= 9 8 'foo))) + +(ert-deftest data-tests-< () + (should-error (<)) + (should (< 1)) + (should (< 2 3)) + (should (< -6 -1 0 2 3 4 8 9 999)) + (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) + (should-not (apply #'< '(3 8 3))) + (should-error (< 9 10 'foo)) + ;; Short circuits before getting to bad arg + (should-not (< 9 8 'foo))) + +(ert-deftest data-tests-> () + (should-error (>)) + (should (> 1)) + (should (> 3 2)) + (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) + (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5)) + (should-not (apply #'> '(3 8 3))) + (should-error (> 9 8 'foo)) + ;; Short circuits before getting to bad arg + (should-not (> 8 9 'foo))) + +(ert-deftest data-tests-<= () + (should-error (<=)) + (should (<= 1)) + (should (<= 2 3)) + (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) + (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) + (should-not (apply #'<= '(3 8 3 3))) + (should-error (<= 9 10 'foo)) + ;; Short circuits before getting to bad arg + (should-not (<= 9 8 'foo))) + +(ert-deftest data-tests->= () + (should-error (>=)) + (should (>= 1)) + (should (>= 3 2)) + (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) + (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum)) + (should-not (apply #'>= '(3 8 3))) + (should-error (>= 9 8 'foo)) + ;; Short circuits before getting to bad arg + (should-not (>= 8 9 'foo))) + +(ert-deftest data-tests-max () + (should-error (max)) + (should (= 1 (max 1))) + (should (= 3 (max 3 2))) + (should (= 666 (max 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) + (should (= (1+ most-negative-fixnum) + (max (float most-negative-fixnum) (1+ most-negative-fixnum)))) + (should (= 8 (apply #'max '(3 8 3)))) + (should-error (max 9 8 'foo)) + (should-error (max (make-marker))) + (should (eql 1 (max (point-min-marker) 1)))) + +(ert-deftest data-tests-min () + (should-error (min)) + (should (= 1 (min 1))) + (should (= 2 (min 3 2))) + (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) + (should (= most-positive-fixnum + (min (+ 1.0 most-positive-fixnum) most-positive-fixnum))) + (should (= 3 (apply #'min '(3 8 3)))) + (should-error (min 9 8 'foo)) + (should-error (min (make-marker))) + (should (eql 1 (min (point-min-marker) 1)))) + +;; Bool vector tests. Compactly represent bool vectors as hex +;; strings. + +(ert-deftest bool-vector-count-population-all-0-nil () + (cl-loop for sz in '(0 45 1 64 9 344) + do (let* ((bv (make-bool-vector sz nil))) + (should + (zerop + (bool-vector-count-population bv)))))) + +(ert-deftest bool-vector-count-population-all-1-t () + (cl-loop for sz in '(0 45 1 64 9 344) + do (let* ((bv (make-bool-vector sz t))) + (should + (eql + (bool-vector-count-population bv) + sz))))) + +(ert-deftest bool-vector-count-population-1-nil () + (let* ((bv (make-bool-vector 45 nil))) + (aset bv 40 t) + (aset bv 0 t) + (should + (eql + (bool-vector-count-population bv) + 2)))) + +(ert-deftest bool-vector-count-population-1-t () + (let* ((bv (make-bool-vector 45 t))) + (aset bv 40 nil) + (aset bv 0 nil) + (should + (eql + (bool-vector-count-population bv) + 43)))) + +(defun mock-bool-vector-count-consecutive (a b i) + (cl-loop for i from i below (length a) + while (eq (aref a i) b) + sum 1)) + +(defun test-bool-vector-bv-from-hex-string (desc) + (let (bv nchars nibbles) + (dolist (c (string-to-list desc)) + (push (string-to-number + (char-to-string c) + 16) + nibbles)) + (setf bv (make-bool-vector (* 4 (length nibbles)) nil)) + (let ((i 0)) + (dolist (n (nreverse nibbles)) + (dotimes (_ 4) + (aset bv i (> (logand 1 n) 0)) + (cl-incf i) + (setf n (lsh n -1))))) + bv)) + +(defun test-bool-vector-to-hex-string (bv) + (let (nibbles (v (cl-coerce bv 'list))) + (while v + (push (logior + (lsh (if (nth 0 v) 1 0) 0) + (lsh (if (nth 1 v) 1 0) 1) + (lsh (if (nth 2 v) 1 0) 2) + (lsh (if (nth 3 v) 1 0) 3)) + nibbles) + (setf v (nthcdr 4 v))) + (mapconcat (lambda (n) (format "%X" n)) + (nreverse nibbles) + ""))) + +(defun test-bool-vector-count-consecutive-tc (desc) + "Run a test case for bool-vector-count-consecutive. +DESC is a string describing the test. It is a sequence of +hexadecimal digits describing the bool vector. We exhaustively +test all counts at all possible positions in the vector by +comparing the subr with a much slower lisp implementation." + (let ((bv (test-bool-vector-bv-from-hex-string desc))) + (cl-loop + for lf in '(nil t) + do (cl-loop + for pos from 0 upto (length bv) + for cnt = (mock-bool-vector-count-consecutive bv lf pos) + for rcnt = (bool-vector-count-consecutive bv lf pos) + unless (eql cnt rcnt) + do (error "FAILED testcase %S %3S %3S %3S" + pos lf cnt rcnt))))) + +(defconst bool-vector-test-vectors +'("" + "0" + "F" + "0F" + "F0" + "00000000000000000000000000000FFFFF0000000" + "44a50234053fba3340000023444a50234053fba33400000234" + "12341234123456123412346001234123412345612341234600" + "44a50234053fba33400000234" + "1234123412345612341234600" + "44a50234053fba33400000234" + "1234123412345612341234600" + "44a502340" + "123412341" + "0000000000000000000000000" + "FFFFFFFFFFFFFFFF1")) + +(ert-deftest bool-vector-count-consecutive () + (mapc #'test-bool-vector-count-consecutive-tc + bool-vector-test-vectors)) + +(defun test-bool-vector-apply-mock-op (mock a b c) + "Compute (slowly) the correct result of a bool-vector set operation." + (let (changed nv) + (cl-assert (eql (length b) (length c))) + (if a (setf nv a) + (setf a (make-bool-vector (length b) nil)) + (setf changed t)) + + (cl-loop for i below (length b) + for mockr = (funcall mock + (if (aref b i) 1 0) + (if (aref c i) 1 0)) + for r = (not (= 0 mockr)) + do (progn + (unless (eq (aref a i) r) + (setf changed t)) + (setf (aref a i) r))) + (if changed a))) + +(defun test-bool-vector-binop (mock real) + "Test a binary set operation." + (cl-loop for s1 in bool-vector-test-vectors + for bv1 = (test-bool-vector-bv-from-hex-string s1) + for vecs2 = (cl-remove-if-not + (lambda (x) (eql (length x) (length s1))) + bool-vector-test-vectors) + do (cl-loop for s2 in vecs2 + for bv2 = (test-bool-vector-bv-from-hex-string s2) + for mock-result = (test-bool-vector-apply-mock-op + mock nil bv1 bv2) + for real-result = (funcall real bv1 bv2) + do (progn + (should (equal mock-result real-result)))))) + +(ert-deftest bool-vector-intersection-op () + (test-bool-vector-binop + #'logand + #'bool-vector-intersection)) + +(ert-deftest bool-vector-union-op () + (test-bool-vector-binop + #'logior + #'bool-vector-union)) + +(ert-deftest bool-vector-xor-op () + (test-bool-vector-binop + #'logxor + #'bool-vector-exclusive-or)) + +(ert-deftest bool-vector-set-difference-op () + (test-bool-vector-binop + (lambda (a b) (logand a (lognot b))) + #'bool-vector-set-difference)) + +(ert-deftest bool-vector-change-detection () + (let* ((vc1 (test-bool-vector-bv-from-hex-string "abcdef")) + (vc2 (test-bool-vector-bv-from-hex-string "012345")) + (vc3 (make-bool-vector (length vc1) nil)) + (c1 (bool-vector-union vc1 vc2 vc3)) + (c2 (bool-vector-union vc1 vc2 vc3))) + (should (equal c1 (test-bool-vector-apply-mock-op + #'logior + nil + vc1 vc2))) + (should (not c2)))) + +(ert-deftest bool-vector-not () + (let* ((v1 (test-bool-vector-bv-from-hex-string "FFFF3")) + (v2 (test-bool-vector-bv-from-hex-string "0000C")) + (v3 (bool-vector-not v1))) + (should (equal v2 v3)))) + +;; Tests for variable bindings + +(defvar binding-test-buffer-A (get-buffer-create "A")) +(defvar binding-test-buffer-B (get-buffer-create "B")) + +(defvar binding-test-always-local 'always) +(make-variable-buffer-local 'binding-test-always-local) + +(defvar binding-test-some-local 'some) +(with-current-buffer binding-test-buffer-A + (set (make-local-variable 'binding-test-some-local) 'local)) + +(ert-deftest binding-test-manual () + "A test case from the elisp manual." + (with-current-buffer binding-test-buffer-A + (let ((binding-test-some-local 'something-else)) + (should (eq binding-test-some-local 'something-else)) + (set-buffer binding-test-buffer-B) + (should (eq binding-test-some-local 'some))) + (should (eq binding-test-some-local 'some)) + (set-buffer binding-test-buffer-A) + (should (eq binding-test-some-local 'local)))) + +(ert-deftest binding-test-setq-default () + "Test that a setq-default has no effect when there is a local binding." + (with-current-buffer binding-test-buffer-B + ;; This variable is not local in this buffer. + (let ((binding-test-some-local 'something-else)) + (setq-default binding-test-some-local 'new-default)) + (should (eq binding-test-some-local 'some)))) + +(ert-deftest binding-test-makunbound () + "Tests of makunbound, from the manual." + (with-current-buffer binding-test-buffer-B + (should (boundp 'binding-test-some-local)) + (let ((binding-test-some-local 'outer)) + (let ((binding-test-some-local 'inner)) + (makunbound 'binding-test-some-local) + (should (not (boundp 'binding-test-some-local)))) + (should (and (boundp 'binding-test-some-local) + (eq binding-test-some-local 'outer)))))) + +(ert-deftest binding-test-defvar-bool () + "Test DEFVAR_BOOL" + (let ((display-hourglass 5)) + (should (eq display-hourglass t)))) + +(ert-deftest binding-test-defvar-int () + "Test DEFVAR_INT" + (should-error (setq gc-cons-threshold 5.0) :type 'wrong-type-argument)) + +(ert-deftest binding-test-set-constant-t () + "Test setting the constant t" + (with-no-warnings (should-error (setq t 'bob) :type 'setting-constant))) + +(ert-deftest binding-test-set-constant-nil () + "Test setting the constant nil" + (with-no-warnings (should-error (setq nil 'bob) :type 'setting-constant))) + +(ert-deftest binding-test-set-constant-keyword () + "Test setting a keyword constant" + (with-no-warnings (should-error (setq :keyword 'bob) :type 'setting-constant))) + +(ert-deftest binding-test-set-constant-nil () + "Test setting a keyword to itself" + (with-no-warnings (should (setq :keyword :keyword)))) + +;; More tests to write - +;; kill-local-variable +;; defconst; can modify +;; defvar and defconst modify the local binding [ doesn't matter for us ] +;; various kinds of special internal forwarding objects +;; a couple examples in manual, not enough +;; variable aliases + +;; Tests for watchpoints + +(ert-deftest data-tests-variable-watchers () + (defvar data-tests-var 0) + (let* ((watch-data nil) + (collect-watch-data + (lambda (&rest args) (push args watch-data)))) + (cl-flet ((should-have-watch-data (data) + (should (equal (pop watch-data) data)) + (should (null watch-data)))) + (add-variable-watcher 'data-tests-var collect-watch-data) + (setq data-tests-var 1) + (should-have-watch-data '(data-tests-var 1 set nil)) + (let ((data-tests-var 2)) + (should-have-watch-data '(data-tests-var 2 let nil)) + (setq data-tests-var 3) + (should-have-watch-data '(data-tests-var 3 set nil))) + (should-have-watch-data '(data-tests-var 1 unlet nil)) + ;; `setq-default' on non-local variable is same as `setq'. + (setq-default data-tests-var 4) + (should-have-watch-data '(data-tests-var 4 set nil)) + (makunbound 'data-tests-var) + (should-have-watch-data '(data-tests-var nil makunbound nil)) + (setq data-tests-var 5) + (should-have-watch-data '(data-tests-var 5 set nil)) + (remove-variable-watcher 'data-tests-var collect-watch-data) + (setq data-tests-var 6) + (should (null watch-data))))) + +(ert-deftest data-tests-varalias-watchers () + (defvar data-tests-var0 0) + (defvar data-tests-var1 0) + (defvar data-tests-var2 0) + (defvar data-tests-var3 0) + (let* ((watch-data nil) + (collect-watch-data + (lambda (&rest args) (push args watch-data)))) + (cl-flet ((should-have-watch-data (data) + (should (equal (pop watch-data) data)) + (should (null watch-data)))) + ;; Watch var0, then alias it. + (add-variable-watcher 'data-tests-var0 collect-watch-data) + (defvar data-tests-var0-alias) + (defvaralias 'data-tests-var0-alias 'data-tests-var0) + (setq data-tests-var0 1) + (should-have-watch-data '(data-tests-var0 1 set nil)) + (setq data-tests-var0-alias 2) + (should-have-watch-data '(data-tests-var0 2 set nil)) + ;; Alias var1, then watch var1-alias. + (defvar data-tests-var1-alias) + (defvaralias 'data-tests-var1-alias 'data-tests-var1) + (add-variable-watcher 'data-tests-var1-alias collect-watch-data) + (setq data-tests-var1 1) + (should-have-watch-data '(data-tests-var1 1 set nil)) + (setq data-tests-var1-alias 2) + (should-have-watch-data '(data-tests-var1 2 set nil)) + ;; Alias var2, then watch it. + (defvar data-tests-var2-alias) + (defvaralias 'data-tests-var2-alias 'data-tests-var2) + (add-variable-watcher 'data-tests-var2 collect-watch-data) + (setq data-tests-var2 1) + (should-have-watch-data '(data-tests-var2 1 set nil)) + (setq data-tests-var2-alias 2) + (should-have-watch-data '(data-tests-var2 2 set nil)) + ;; Watch var3-alias, then make it alias var3 (this removes the + ;; watcher flag). + (defvar data-tests-var3-alias 0) + (add-variable-watcher 'data-tests-var3-alias collect-watch-data) + (defvaralias 'data-tests-var3-alias 'data-tests-var3) + (should-have-watch-data '(data-tests-var3-alias + data-tests-var3 defvaralias nil)) + (setq data-tests-var3 1) + (setq data-tests-var3-alias 2) + (should (null watch-data))))) + +(ert-deftest data-tests-local-variable-watchers () + (with-no-warnings + (defvar-local data-tests-lvar 0)) + (let* ((buf1 (current-buffer)) + (buf2 nil) + (watch-data nil) + (collect-watch-data + (lambda (&rest args) (push args watch-data)))) + (cl-flet ((should-have-watch-data (data) + (should (equal (pop watch-data) data)) + (should (null watch-data)))) + (add-variable-watcher 'data-tests-lvar collect-watch-data) + (setq data-tests-lvar 1) + (should-have-watch-data `(data-tests-lvar 1 set ,buf1)) + (let ((data-tests-lvar 2)) + (should-have-watch-data `(data-tests-lvar 2 let ,buf1)) + (setq data-tests-lvar 3) + (should-have-watch-data `(data-tests-lvar 3 set ,buf1))) + (should-have-watch-data `(data-tests-lvar 1 unlet ,buf1)) + (setq-default data-tests-lvar 4) + (should-have-watch-data `(data-tests-lvar 4 set nil)) + (with-temp-buffer + (setq buf2 (current-buffer)) + (setq data-tests-lvar 1) + (should-have-watch-data `(data-tests-lvar 1 set ,buf2)) + (let ((data-tests-lvar 2)) + (should-have-watch-data `(data-tests-lvar 2 let ,buf2)) + (setq data-tests-lvar 3) + (should-have-watch-data `(data-tests-lvar 3 set ,buf2))) + (should-have-watch-data `(data-tests-lvar 1 unlet ,buf2)) + (kill-local-variable 'data-tests-lvar) + (should-have-watch-data `(data-tests-lvar nil makunbound ,buf2)) + (setq data-tests-lvar 3.5) + (should-have-watch-data `(data-tests-lvar 3.5 set ,buf2)) + (kill-all-local-variables) + (should-have-watch-data `(data-tests-lvar nil makunbound ,buf2))) + (setq-default data-tests-lvar 4) + (should-have-watch-data `(data-tests-lvar 4 set nil)) + (makunbound 'data-tests-lvar) + (should-have-watch-data '(data-tests-lvar nil makunbound nil)) + (setq data-tests-lvar 5) + (should-have-watch-data `(data-tests-lvar 5 set ,buf1)) + (remove-variable-watcher 'data-tests-lvar collect-watch-data) + (setq data-tests-lvar 6) + (should (null watch-data))))) diff --git a/test/automated/zlib-tests.el b/test/src/decompress-tests.el index 6a080389b3a..eaec0d01a7b 100644 --- a/test/automated/zlib-tests.el +++ b/test/src/decompress-tests.el @@ -1,4 +1,4 @@ -;;; zlib-tests.el --- Test suite for zlib. +;;; decompress-tests.el --- Test suite for decompress. ;; Copyright (C) 2013-2017 Free Software Foundation, Inc. @@ -40,6 +40,6 @@ (buffer-string)) "foo\n")))) -(provide 'zlib-tests) +(provide 'decompress-tests) -;;; zlib-tests.el ends here. +;;; decompress-tests.el ends here. diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el new file mode 100644 index 00000000000..8e5446e2a4b --- /dev/null +++ b/test/src/doc-tests.el @@ -0,0 +1,92 @@ +;;; doc-tests.el --- Tests for doc.c + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii <eliz@gnu.org> + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(ert-deftest doc-test-substitute-command-keys () + ;; Bindings. + (should (string= (substitute-command-keys "foo \\[goto-char]") "foo M-g c")) + ;; Cannot use string= here, as that compares unibyte and multibyte + ;; strings not equal. + (should (compare-strings + (substitute-command-keys "\200 \\[goto-char]") nil nil + "\200 M-g c" nil nil)) + ;; Literals. + (should (string= (substitute-command-keys "foo \\=\\[goto-char]") + "foo \\[goto-char]")) + (should (string= (substitute-command-keys "foo \\=\\=") + "foo \\=")) + ;; Keymaps. + (should (string= (substitute-command-keys + "\\{minibuffer-local-must-match-map}") + "\ +key binding +--- ------- + +C-g abort-recursive-edit +TAB minibuffer-complete +C-j minibuffer-complete-and-exit +RET minibuffer-complete-and-exit +ESC Prefix Command +SPC minibuffer-complete-word +? minibuffer-completion-help +<C-tab> file-cache-minibuffer-complete +<XF86Back> previous-history-element +<XF86Forward> next-history-element +<down> next-line-or-history-element +<next> next-history-element +<prior> switch-to-completions +<up> previous-line-or-history-element + +M-v switch-to-completions + +M-n next-history-element +M-p previous-history-element +M-r previous-matching-history-element +M-s next-matching-history-element + +")) + (should (string= + (substitute-command-keys + "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]") + "C-g")) + ;; Allow any style of quotes, since the terminal might not support + ;; UTF-8. + (should (string-match + "\nUses keymap [`‘']foobar-map['’], which is not currently defined.\n" + (substitute-command-keys "\\{foobar-map}"))) + ;; Quotes. + (should (let ((text-quoting-style 'grave)) + (string= (substitute-command-keys "quotes `like this'") + "quotes `like this'"))) + (should (let ((text-quoting-style 'grave)) + (string= (substitute-command-keys "quotes ‘like this’") + "quotes ‘like this’"))) + (should (let ((text-quoting-style 'straight)) + (string= (substitute-command-keys "quotes `like this'") + "quotes 'like this'"))) + ;; Bugs. + (should (string= (substitute-command-keys "\\[foobar") "\\[foobar")) + (should (string= (substitute-command-keys "\\=") "\\=")) + ) + +(provide 'doc-tests) +;;; doc-tests.el ends here diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el new file mode 100644 index 00000000000..3073e371933 --- /dev/null +++ b/test/src/editfns-tests.el @@ -0,0 +1,211 @@ +;;; editfns-tests.el -- tests for editfns.c + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(ert-deftest format-properties () + ;; Bug #23730 + (should (ert-equal-including-properties + (format (propertize "%d" 'face '(:background "red")) 1) + #("1" 0 1 (face (:background "red"))))) + (should (ert-equal-including-properties + (format (propertize "%2d" 'face '(:background "red")) 1) + #(" 1" 0 2 (face (:background "red"))))) + (should (ert-equal-including-properties + (format (propertize "%02d" 'face '(:background "red")) 1) + #("01" 0 2 (face (:background "red"))))) + (should (ert-equal-including-properties + (format (concat (propertize "%2d" 'x 'X) + (propertize "a" 'a 'A) + (propertize "b" 'b 'B)) + 1) + #(" 1ab" 0 2 (x X) 2 3 (a A) 3 4 (b B)))) + + ;; Bug #5306 + (should (ert-equal-including-properties + (format "%.10s" + (concat "1234567890aaaa" + (propertize "12345678901234567890" 'xxx 25))) + "1234567890")) + (should (ert-equal-including-properties + (format "%.10s" + (concat "123456789" + (propertize "12345678901234567890" 'xxx 25))) + #("1234567891" 9 10 (xxx 25)))) + + ;; Bug #23859 + (should (ert-equal-including-properties + (format "%4s" (propertize "hi" 'face 'bold)) + #(" hi" 2 4 (face bold)))) + + ;; Bug #23897 + (should (ert-equal-including-properties + (format "%s" (concat (propertize "01234" 'face 'bold) "56789")) + #("0123456789" 0 5 (face bold)))) + (should (ert-equal-including-properties + (format "%s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #("012345" 0 2 (face bold) 2 4 (face underline)))) + ;; The last property range is extended to include padding on the + ;; right, but the first range is not extended to the left to include + ;; padding on the left! + (should (ert-equal-including-properties + (format "%12s" (concat (propertize "01234" 'face 'bold) "56789")) + #(" 0123456789" 2 7 (face bold)))) + (should (ert-equal-including-properties + (format "%-12s" (concat (propertize "01234" 'face 'bold) "56789")) + #("0123456789 " 0 5 (face bold)))) + (should (ert-equal-including-properties + (format "%10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #(" 012345" 4 6 (face bold) 6 8 (face underline)))) + (should (ert-equal-including-properties + (format "%-10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + "45")) + #("012345 " 0 2 (face bold) 2 4 (face underline)))) + (should (ert-equal-including-properties + (format "%-10s" (concat (propertize "01" 'face 'bold) + (propertize "23" 'face 'underline) + (propertize "45" 'face 'italic))) + #("012345 " 0 2 (face bold) 2 4 (face underline) 4 10 (face italic))))) + +;; Tests for bug#5131. +(defun transpose-test-reverse-word (start end) + "Reverse characters in a word by transposing pairs of characters." + (let ((begm (make-marker)) + (endm (make-marker))) + (set-marker begm start) + (set-marker endm end) + (while (> endm begm) + (progn (transpose-regions begm (1+ begm) endm (1+ endm) t) + (set-marker begm (1+ begm)) + (set-marker endm (1- endm)))))) + +(defun transpose-test-get-byte-positions (len) + "Validate character position to byte position translation." + (let ((bytes '())) + (dotimes (pos len) + (setq bytes (add-to-list 'bytes (position-bytes (1+ pos)) t))) + bytes)) + +(ert-deftest transpose-ascii-regions-test () + (with-temp-buffer + (erase-buffer) + (insert "abcd") + (transpose-test-reverse-word 1 4) + (should (string= (buffer-string) "dcba")) + (should (equal (transpose-test-get-byte-positions 5) '(1 2 3 4 5))))) + +(ert-deftest transpose-nonascii-regions-test-1 () + (with-temp-buffer + (erase-buffer) + (insert "÷bcd") + (transpose-test-reverse-word 1 4) + (should (string= (buffer-string) "dcb÷")) + (should (equal (transpose-test-get-byte-positions 5) '(1 2 3 4 6))))) + +(ert-deftest transpose-nonascii-regions-test-2 () + (with-temp-buffer + (erase-buffer) + (insert "÷ab\"äé") + (transpose-test-reverse-word 1 6) + (should (string= (buffer-string) "éä\"ba÷")) + (should (equal (transpose-test-get-byte-positions 7) '(1 3 5 6 7 8 10))))) + +(ert-deftest format-c-float () + (should-error (format "%c" 0.5))) + +;;; Check format-time-string with various TZ settings. +;;; Use only POSIX-compatible TZ values, since the tests should work +;;; even if tzdb is not in use. +(ert-deftest format-time-string-with-zone () + ;; Don’t use (0 0 0 0) as the test case, as there are too many bugs + ;; in MS-Windows (and presumably other) C libraries when formatting + ;; time stamps near the Epoch of 1970-01-01 00:00:00 UTC, and this + ;; test is for GNU Emacs, not for C runtimes. Instead, look before + ;; you leap: "look" is the timestamp just before the first leap + ;; second on 1972-06-30 23:59:60 UTC, so it should format to the + ;; same string regardless of whether the underlying C library + ;; ignores leap seconds, while avoiding circa-1970 glitches. + ;; + ;; Similarly, stick to the limited set of time zones that are + ;; supported by both POSIX and MS-Windows: exactly 3 ASCII letters + ;; in the abbreviation, and no DST. + (let ((look '(1202 22527 999999 999999)) + (format "%Y-%m-%d %H:%M:%S.%3N %z (%Z)")) + ;; UTC. + (should (string-equal + (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" look t) + "1972-06-30 23:59:59.999 +0000")) + ;; "UTC0". + (should (string-equal + (format-time-string format look "UTC0") + "1972-06-30 23:59:59.999 +0000 (UTC)")) + ;; Negative UTC offset, as a Lisp list. + (should (string-equal + (format-time-string format look '(-28800 "PST")) + "1972-06-30 15:59:59.999 -0800 (PST)")) + ;; Positive UTC offset that is not an hour multiple, as a string. + (should (string-equal + (format-time-string format look "IST-5:30") + "1972-07-01 05:29:59.999 +0530 (IST)")))) + +;;; This should not dump core. +(ert-deftest format-time-string-with-outlandish-zone () + (should (stringp + (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" nil + (concat (make-string 2048 ?X) "0"))))) + +(ert-deftest format-with-field () + (should (equal (format "First argument %2$s, then %3$s, then %1$s" 1 2 3) + "First argument 2, then 3, then 1")) + (should (equal (format "a %2$s %3$d %1$d %2$S %3$d %4$d b" 11 "22" 33 44) + "a 22 33 11 \"22\" 33 44 b")) + (should (equal (format "a %08$s %0000000000000000009$s b" 1 2 3 4 5 6 7 8 9) + "a 8 9 b")) + (should (equal (should-error (format "a %999999$s b" 11)) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %2147483647$s b")) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %9223372036854775807$s b")) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %9223372036854775808$s b")) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %18446744073709551615$s b")) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %18446744073709551616$s b")) + '(error "Not enough arguments for format string"))) + (should (equal (should-error + (format (format "a %%%d$d b" most-positive-fixnum))) + '(error "Not enough arguments for format string"))) + (should (equal (should-error + (format (format "a %%%d$d b" (+ 1.0 most-positive-fixnum)))) + '(error "Not enough arguments for format string"))) + (should (equal (should-error (format "a %$s b" 11)) + '(error "Invalid format operation %$"))) + (should (equal (should-error (format "a %-1$s b" 11)) + '(error "Invalid format operation %$"))) + (should (equal (format "%1$c %1$s" ?±) "± 177"))) + +;;; editfns-tests.el ends here diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el new file mode 100644 index 00000000000..622bbadb3ef --- /dev/null +++ b/test/src/emacs-module-tests.el @@ -0,0 +1,177 @@ +;;; Test GNU Emacs modules. + +;; Copyright 2015-2017 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 <http://www.gnu.org/licenses/>. */ + +(require 'ert) + +(require 'mod-test + (expand-file-name "data/emacs-module/mod-test" + (getenv "EMACS_TEST_DIRECTORY"))) + +;; +;; Basic tests. +;; + +(ert-deftest mod-test-sum-test () + (should (= (mod-test-sum 1 2) 3)) + (let ((descr (should-error (mod-test-sum 1 2 3)))) + (should (eq (car descr) 'wrong-number-of-arguments)) + (should (module-function-p (nth 1 descr))) + (should (eq 0 + (string-match + (concat "#<module function " + "\\(at \\(0x\\)?[0-9a-fA-F]+\\( from .*\\)?" + "\\|Fmod_test_sum from .*\\)>") + (prin1-to-string (nth 1 descr))))) + (should (= (nth 2 descr) 3))) + (should-error (mod-test-sum "1" 2) :type 'wrong-type-argument) + (should-error (mod-test-sum 1 "2") :type 'wrong-type-argument) + ;; The following tests are for 32-bit build --with-wide-int. + (should (= (mod-test-sum -1 most-positive-fixnum) + (1- most-positive-fixnum))) + (should (= (mod-test-sum 1 most-negative-fixnum) + (1+ most-negative-fixnum))) + (when (< #x1fffffff most-positive-fixnum) + (should (= (mod-test-sum 1 #x1fffffff) + (1+ #x1fffffff))) + (should (= (mod-test-sum -1 #x20000000) + #x1fffffff))) + (should-error (mod-test-sum 1 most-positive-fixnum) + :type 'overflow-error) + (should-error (mod-test-sum -1 most-negative-fixnum) + :type 'overflow-error)) + +(ert-deftest mod-test-sum-docstring () + (should (string= (documentation 'mod-test-sum) "Return A + B\n\n(fn a b)"))) + +(ert-deftest module-function-object () + "Extract and test the implementation of a module function. +This test needs to be changed whenever the implementation +changes." + (let ((func (symbol-function #'mod-test-sum))) + (should (module-function-p func)) + (should (equal (type-of func) 'module-function)) + (should (string-match-p + (rx bos "#<module function " + (or "Fmod_test_sum" + (and "at 0x" (+ hex-digit))) + (? " from " (* nonl) "mod-test" (* nonl) ) + ">" eos) + (prin1-to-string func))))) + +;; +;; Non-local exists (throw, signal). +;; + +(ert-deftest mod-test-non-local-exit-signal-test () + (should-error (mod-test-signal)) + (let (debugger-args backtrace) + (should-error + (let ((debugger (lambda (&rest args) + (setq debugger-args args + backtrace (with-output-to-string (backtrace))) + (cl-incf num-nonmacro-input-events))) + (debug-on-signal t)) + (mod-test-signal))) + (should (equal debugger-args '(error (error . 56)))) + (should (string-match-p + (rx bol " mod-test-signal()" eol) + backtrace)))) + +(ert-deftest mod-test-non-local-exit-throw-test () + (should (equal + (catch 'tag + (mod-test-throw) + (ert-fail "expected throw")) + 65))) + +(ert-deftest mod-test-non-local-exit-funcall-normal () + (should (equal (mod-test-non-local-exit-funcall (lambda () 23)) + 23))) + +(ert-deftest mod-test-non-local-exit-funcall-signal () + (should (equal (mod-test-non-local-exit-funcall + (lambda () (signal 'error '(32)))) + '(signal error (32))))) + +(ert-deftest mod-test-non-local-exit-funcall-throw () + (should (equal (mod-test-non-local-exit-funcall (lambda () (throw 'tag 32))) + '(throw tag 32)))) + +;; +;; String tests. +;; + +(defun multiply-string (s n) + (let ((res "")) + (dotimes (i n res) + (setq res (concat res s))))) + +(ert-deftest mod-test-globref-make-test () + (let ((mod-str (mod-test-globref-make)) + (ref-str (multiply-string "abcdefghijklmnopqrstuvwxyz" 100))) + (garbage-collect) ;; XXX: not enough to really test but it's something.. + (should (string= ref-str mod-str)))) + +(ert-deftest mod-test-string-a-to-b-test () + (should (string= (mod-test-string-a-to-b "aaa") "bbb"))) + +;; +;; User-pointer tests. +;; + +(ert-deftest mod-test-userptr-fun-test () + (let* ((n 42) + (v (mod-test-userptr-make n)) + (r (mod-test-userptr-get v))) + + (should (eq (type-of v) 'user-ptr)) + (should (integerp r)) + (should (= r n)))) + +;; TODO: try to test finalizer + +;; +;; Vector tests. +;; + +(ert-deftest mod-test-vector-test () + (dolist (s '(2 10 100 1000)) + (dolist (e '(42 foo "foo")) + (let* ((v-ref (make-vector 2 e)) + (eq-ref (eq (aref v-ref 0) (aref v-ref 1))) + (v-test (make-vector s nil))) + + (should (eq (mod-test-vector-fill v-test e) t)) + (should (eq (mod-test-vector-eq v-test e) eq-ref)))))) + +(ert-deftest module--func-arity () + (should (equal (func-arity #'mod-test-return-t) '(1 . 1))) + (should (equal (func-arity #'mod-test-sum) '(2 . 2)))) + +(ert-deftest module--help-function-arglist () + (should (equal (help-function-arglist #'mod-test-return-t :preserve-names) + '(arg1))) + (should (equal (help-function-arglist #'mod-test-return-t) + '(arg1))) + (should (equal (help-function-arglist #'mod-test-sum :preserve-names) + '(a b))) + (should (equal (help-function-arglist #'mod-test-sum) + '(arg1 arg2)))) + +;;; emacs-module-tests.el ends here diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el new file mode 100644 index 00000000000..03f408716b1 --- /dev/null +++ b/test/src/eval-tests.el @@ -0,0 +1,62 @@ +;;; eval-tests.el --- unit tests for src/eval.c -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for src/eval.c. + +;;; Code: + +(require 'ert) + +(ert-deftest eval-tests--bug24673 () + "Checks that Bug#24673 has been fixed." + ;; This should not crash. + (should-error (funcall '(closure)) :type 'invalid-function)) + +(defvar byte-compile-debug) + +(ert-deftest eval-tests--bugs-24912-and-24913 () + "Checks that Emacs doesn’t accept weird argument lists. +Bug#24912 and Bug#24913." + (dolist (args '((&optional) (&rest) (&optional &rest) (&rest &optional) + (&optional &rest a) (&optional a &rest) + (&rest a &optional) (&rest &optional a) + (&optional &optional) (&optional &optional a) + (&optional a &optional b) + (&rest &rest) (&rest &rest a) + (&rest a &rest b))) + (should-error (eval `(funcall (lambda ,args)) t) :type 'invalid-function) + (should-error (byte-compile-check-lambda-list args)) + (let ((byte-compile-debug t)) + (should-error (eval `(byte-compile (lambda ,args)) t))))) + + +(dolist (form '(let let*)) + (dolist (arg '(1 "a" [a])) + (eval + `(ert-deftest ,(intern (format "eval-tests--%s--%s" form (type-of arg))) () + ,(format "Check that the first argument of `%s' cannot be a %s" + form (type-of arg)) + (should-error (,form ,arg) :type 'wrong-type-argument)) + t))) + +;;; eval-tests.el ends here diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el new file mode 100644 index 00000000000..de3e44314f9 --- /dev/null +++ b/test/src/floatfns-tests.el @@ -0,0 +1,37 @@ +;;; floatfns-tests.el --- tests for floating point operations + +;; Copyright 2017 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 <http://www.gnu.org/licenses/>. + +(require 'ert) + +(ert-deftest divide-extreme-sign () + (should-error (ceiling most-negative-fixnum -1.0)) + (should-error (floor most-negative-fixnum -1.0)) + (should-error (round most-negative-fixnum -1.0)) + (should-error (truncate most-negative-fixnum -1.0))) + +(ert-deftest logb-extreme-fixnum () + (should (= (logb most-negative-fixnum) (1+ (logb most-positive-fixnum))))) + +(ert-deftest fround-fixnum () + (should-error (ffloor 0) :type 'wrong-type-argument) + (should-error (fceiling 0) :type 'wrong-type-argument) + (should-error (ftruncate 0) :type 'wrong-type-argument) + (should-error (fround 0) :type 'wrong-type-argument)) + +(provide 'floatfns-tests) diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el new file mode 100644 index 00000000000..2e463455f0c --- /dev/null +++ b/test/src/fns-tests.el @@ -0,0 +1,544 @@ +;;; fns-tests.el --- tests for src/fns.c + +;; Copyright (C) 2014-2017 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; This program 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. +;; +;; This program 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 this program. If not, see `http://www.gnu.org/licenses/'. + +;;; Commentary: + +;;; Code: + +(require 'cl-lib) + +(ert-deftest fns-tests-reverse () + (should-error (reverse)) + (should-error (reverse 1)) + (should-error (reverse (make-char-table 'foo))) + (should (equal [] (reverse []))) + (should (equal [0] (reverse [0]))) + (should (equal [1 2 3 4] (reverse (reverse [1 2 3 4])))) + (should (equal '(a b c d) (reverse (reverse '(a b c d))))) + (should (equal "xyzzy" (reverse (reverse "xyzzy")))) + (should (equal "こんにちは / コンニチハ" (reverse (reverse "こんにちは / コンニチハ"))))) + +(ert-deftest fns-tests-nreverse () + (should-error (nreverse)) + (should-error (nreverse 1)) + (should-error (nreverse (make-char-table 'foo))) + (should (equal (nreverse "xyzzy") "yzzyx")) + (let ((A [])) + (nreverse A) + (should (equal A []))) + (let ((A [0])) + (nreverse A) + (should (equal A [0]))) + (let ((A [1 2 3 4])) + (nreverse A) + (should (equal A [4 3 2 1]))) + (let ((A [1 2 3 4])) + (nreverse A) + (nreverse A) + (should (equal A [1 2 3 4]))) + (let* ((A [1 2 3 4]) + (B (nreverse (nreverse A)))) + (should (equal A B)))) + +(ert-deftest fns-tests-reverse-bool-vector () + (let ((A (make-bool-vector 10 nil))) + (dotimes (i 5) (aset A i t)) + (should (equal [nil nil nil nil nil t t t t t] (vconcat (reverse A)))) + (should (equal A (reverse (reverse A)))))) + +(ert-deftest fns-tests-nreverse-bool-vector () + (let ((A (make-bool-vector 10 nil))) + (dotimes (i 5) (aset A i t)) + (nreverse A) + (should (equal [nil nil nil nil nil t t t t t] (vconcat A))) + (should (equal [t t t t t nil nil nil nil nil] (vconcat (nreverse A)))))) + +(ert-deftest fns-tests-compare-strings () + (should-error (compare-strings)) + (should-error (compare-strings "xyzzy" "xyzzy")) + (should (= (compare-strings "xyzzy" 0 10 "zyxxy" 0 5) -1)) + (should-error (compare-strings "xyzzy" 0 5 "zyxxy" -1 2)) + (should-error (compare-strings "xyzzy" 'foo nil "zyxxy" 0 1)) + (should-error (compare-strings "xyzzy" 0 'foo "zyxxy" 2 3)) + (should-error (compare-strings "xyzzy" 0 2 "zyxxy" 'foo 3)) + (should-error (compare-strings "xyzzy" nil 3 "zyxxy" 4 'foo)) + (should (eq (compare-strings "" nil nil "" nil nil) t)) + (should (eq (compare-strings "" 0 0 "" 0 0) t)) + (should (eq (compare-strings "test" nil nil "test" nil nil) t)) + (should (eq (compare-strings "test" nil nil "test" nil nil t) t)) + (should (eq (compare-strings "test" nil nil "test" nil nil nil) t)) + (should (eq (compare-strings "Test" nil nil "test" nil nil t) t)) + (should (= (compare-strings "Test" nil nil "test" nil nil) -1)) + (should (= (compare-strings "Test" nil nil "test" nil nil) -1)) + (should (= (compare-strings "test" nil nil "Test" nil nil) 1)) + (should (= (compare-strings "foobaz" nil nil "barbaz" nil nil) 1)) + (should (= (compare-strings "barbaz" nil nil "foobar" nil nil) -1)) + (should (= (compare-strings "foobaz" nil nil "farbaz" nil nil) 2)) + (should (= (compare-strings "farbaz" nil nil "foobar" nil nil) -2)) + (should (eq (compare-strings "abcxyz" 0 2 "abcprq" 0 2) t)) + (should (eq (compare-strings "abcxyz" 0 -3 "abcprq" 0 -3) t)) + (should (= (compare-strings "abcxyz" 0 6 "abcprq" 0 6) 4)) + (should (= (compare-strings "abcprq" 0 6 "abcxyz" 0 6) -4)) + (should (eq (compare-strings "xyzzy" -3 4 "azza" -3 3) t)) + (should (eq (compare-strings "こんにちはコンニチハ" nil nil "こんにちはコンニチハ" nil nil) t)) + (should (= (compare-strings "んにちはコンニチハこ" nil nil "こんにちはコンニチハ" nil nil) 1)) + (should (= (compare-strings "こんにちはコンニチハ" nil nil "んにちはコンニチハこ" nil nil) -1))) + +(defun fns-tests--collate-enabled-p () + "Check whether collation functions are enabled." + (and + ;; When there is no collation library, collation functions fall back + ;; to their lexicographic counterparts. We don't need to test then. + (not (ignore-errors (string-collate-equalp "" "" t))) + ;; We use a locale, which might not be installed. Check it. + (ignore-errors + (string-collate-equalp + "" "" (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) + +(ert-deftest fns-tests-collate-strings () + (skip-unless (fns-tests--collate-enabled-p)) + + (should (string-collate-equalp "xyzzy" "xyzzy")) + (should-not (string-collate-equalp "xyzzy" "XYZZY")) + + ;; In POSIX or C locales, collation order is lexicographic. + (should (string-collate-lessp "XYZZY" "xyzzy" "POSIX")) + ;; In a language specific locale, collation order is different. + (should (string-collate-lessp + "xyzzy" "XYZZY" + (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))) + + ;; Ignore case. + (should (string-collate-equalp "xyzzy" "XYZZY" nil t)) + + ;; Locale must be valid. + (should-error (string-collate-equalp "xyzzy" "xyzzy" "en_DE.UTF-8"))) + +;; There must be a check for valid codepoints. (Check not implemented yet) +; (should-error +; (string-collate-equalp (string ?\x00110000) (string ?\x00110000))) +;; Invalid UTF-8 sequences shall be indicated. How to create such strings? + +(ert-deftest fns-tests-sort () + (should (equal (sort '(9 5 2 -1 5 3 8 7 4) (lambda (x y) (< x y))) + '(-1 2 3 4 5 5 7 8 9))) + (should (equal (sort '(9 5 2 -1 5 3 8 7 4) (lambda (x y) (> x y))) + '(9 8 7 5 5 4 3 2 -1))) + (should (equal (sort '[9 5 2 -1 5 3 8 7 4] (lambda (x y) (< x y))) + [-1 2 3 4 5 5 7 8 9])) + (should (equal (sort '[9 5 2 -1 5 3 8 7 4] (lambda (x y) (> x y))) + [9 8 7 5 5 4 3 2 -1])) + (should (equal + (sort + (vector + '(8 . "xxx") '(9 . "aaa") '(8 . "bbb") '(9 . "zzz") + '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff")) + (lambda (x y) (< (car x) (car y)))) + [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee") + (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))) + +(ert-deftest fns-tests-collate-sort () + ;; See https://lists.gnu.org/archive/html/emacs-devel/2015-10/msg02505.html. + :expected-result (if (eq system-type 'cygwin) :failed :passed) + (skip-unless (fns-tests--collate-enabled-p)) + + ;; Punctuation and whitespace characters are relevant for POSIX. + (should + (equal + (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") + (lambda (a b) (string-collate-lessp a b "POSIX"))) + '("1 1" "1 2" "1.1" "1.2" "11" "12"))) + ;; Punctuation and whitespace characters are not taken into account + ;; for collation in other locales. + (should + (equal + (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") + (lambda (a b) + (let ((w32-collate-ignore-punctuation t)) + (string-collate-lessp + a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) + '("11" "1 1" "1.1" "12" "1 2" "1.2"))) + + ;; Diacritics are different letters for POSIX, they sort lexicographical. + (should + (equal + (sort '("Ævar" "Agustín" "Adrian" "Eli") + (lambda (a b) (string-collate-lessp a b "POSIX"))) + '("Adrian" "Agustín" "Eli" "Ævar"))) + ;; Diacritics are sorted between similar letters for other locales. + (should + (equal + (sort '("Ævar" "Agustín" "Adrian" "Eli") + (lambda (a b) + (let ((w32-collate-ignore-punctuation t)) + (string-collate-lessp + a b (if (eq system-type 'windows-nt) "enu_USA" "en_US.UTF-8"))))) + '("Adrian" "Ævar" "Agustín" "Eli")))) + +(ert-deftest fns-tests-string-version-lessp () + (should (string-version-lessp "foo2.png" "foo12.png")) + (should (not (string-version-lessp "foo12.png" "foo2.png"))) + (should (string-version-lessp "foo12.png" "foo20000.png")) + (should (not (string-version-lessp "foo20000.png" "foo12.png"))) + (should (string-version-lessp "foo.png" "foo2.png")) + (should (not (string-version-lessp "foo2.png" "foo.png"))) + (should (equal (sort '("foo12.png" "foo2.png" "foo1.png") + 'string-version-lessp) + '("foo1.png" "foo2.png" "foo12.png"))) + (should (string-version-lessp "foo2" "foo1234")) + (should (not (string-version-lessp "foo1234" "foo2"))) + (should (string-version-lessp "foo.png" "foo2")) + (should (string-version-lessp "foo1.25.5.png" "foo1.125.5")) + (should (string-version-lessp "2" "1245")) + (should (not (string-version-lessp "1245" "2")))) + +(ert-deftest fns-tests-func-arity () + (should (equal (func-arity 'car) '(1 . 1))) + (should (equal (func-arity 'caar) '(1 . 1))) + (should (equal (func-arity 'format) '(1 . many))) + (require 'info) + (should (equal (func-arity 'Info-goto-node) '(1 . 3))) + (should (equal (func-arity (lambda (&rest x))) '(0 . many))) + (should (equal (func-arity (eval (lambda (x &optional y)) nil)) '(1 . 2))) + (should (equal (func-arity (eval (lambda (x &optional y)) t)) '(1 . 2))) + (should (equal (func-arity 'let) '(1 . unevalled)))) + +(ert-deftest fns-tests-hash-buffer () + (should (equal (sha1 "foo") "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33")) + (should (equal (with-temp-buffer + (insert "foo") + (buffer-hash)) + (sha1 "foo"))) + ;; This tests whether the presence of a gap in the middle of the + ;; buffer is handled correctly. + (should (equal (with-temp-buffer + (insert "foo") + (goto-char 2) + (insert " ") + (backward-delete-char 1) + (buffer-hash)) + (sha1 "foo")))) + +(ert-deftest fns-tests-mapcan () + (should-error (mapcan)) + (should-error (mapcan #'identity)) + (should-error (mapcan #'identity (make-char-table 'foo))) + (should (equal (mapcan #'list '(1 2 3)) '(1 2 3))) + ;; `mapcan' is destructive + (let ((data '((foo) (bar)))) + (should (equal (mapcan #'identity data) '(foo bar))) + (should (equal data '((foo bar) (bar)))))) + +;; Test handling of cyclic and dotted lists. + +(defun cyc1 (a) + (let ((ls (make-list 10 a))) + (nconc ls ls) + ls)) + +(defun cyc2 (a b) + (let ((ls1 (make-list 10 a)) + (ls2 (make-list 1000 b))) + (nconc ls2 ls2) + (nconc ls1 ls2) + ls1)) + +(defun dot1 (a) + (let ((ls (make-list 10 a))) + (nconc ls 'tail) + ls)) + +(defun dot2 (a b) + (let ((ls1 (make-list 10 a)) + (ls2 (make-list 10 b))) + (nconc ls1 ls2) + (nconc ls2 'tail) + ls1)) + +(ert-deftest test-cycle-length () + (should-error (length (cyc1 1)) :type 'circular-list) + (should-error (length (cyc2 1 2)) :type 'circular-list) + (should-error (length (dot1 1)) :type 'wrong-type-argument) + (should-error (length (dot2 1 2)) :type 'wrong-type-argument)) + +(ert-deftest test-cycle-safe-length () + (should (<= 10 (safe-length (cyc1 1)))) + (should (<= 1010 (safe-length (cyc2 1 2)))) + (should (= 10 (safe-length (dot1 1)))) + (should (= 20 (safe-length (dot2 1 2))))) + +(ert-deftest test-cycle-member () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (member 1 c1)) + (should (member 1 c2)) + (should (member 1 d1)) + (should (member 1 d2)) + (should-error (member 2 c1) :type 'circular-list) + (should (member 2 c2)) + (should-error (member 2 d1) :type 'wrong-type-argument) + (should (member 2 d2)) + (should-error (member 3 c1) :type 'circular-list) + (should-error (member 3 c2) :type 'circular-list) + (should-error (member 3 d1) :type 'wrong-type-argument) + (should-error (member 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-memq () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (memq 1 c1)) + (should (memq 1 c2)) + (should (memq 1 d1)) + (should (memq 1 d2)) + (should-error (memq 2 c1) :type 'circular-list) + (should (memq 2 c2)) + (should-error (memq 2 d1) :type 'wrong-type-argument) + (should (memq 2 d2)) + (should-error (memq 3 c1) :type 'circular-list) + (should-error (memq 3 c2) :type 'circular-list) + (should-error (memq 3 d1) :type 'wrong-type-argument) + (should-error (memq 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-memql () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (memql 1 c1)) + (should (memql 1 c2)) + (should (memql 1 d1)) + (should (memql 1 d2)) + (should-error (memql 2 c1) :type 'circular-list) + (should (memql 2 c2)) + (should-error (memql 2 d1) :type 'wrong-type-argument) + (should (memql 2 d2)) + (should-error (memql 3 c1) :type 'circular-list) + (should-error (memql 3 c2) :type 'circular-list) + (should-error (memql 3 d1) :type 'wrong-type-argument) + (should-error (memql 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-assq () + (let ((c1 (cyc1 '(1))) + (c2 (cyc2 '(1) '(2))) + (d1 (dot1 '(1))) + (d2 (dot2 '(1) '(2)))) + (should (assq 1 c1)) + (should (assq 1 c2)) + (should (assq 1 d1)) + (should (assq 1 d2)) + (should-error (assq 2 c1) :type 'circular-list) + (should (assq 2 c2)) + (should-error (assq 2 d1) :type 'wrong-type-argument) + (should (assq 2 d2)) + (should-error (assq 3 c1) :type 'circular-list) + (should-error (assq 3 c2) :type 'circular-list) + (should-error (assq 3 d1) :type 'wrong-type-argument) + (should-error (assq 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-assoc () + (let ((c1 (cyc1 '(1))) + (c2 (cyc2 '(1) '(2))) + (d1 (dot1 '(1))) + (d2 (dot2 '(1) '(2)))) + (should (assoc 1 c1)) + (should (assoc 1 c2)) + (should (assoc 1 d1)) + (should (assoc 1 d2)) + (should-error (assoc 2 c1) :type 'circular-list) + (should (assoc 2 c2)) + (should-error (assoc 2 d1) :type 'wrong-type-argument) + (should (assoc 2 d2)) + (should-error (assoc 3 c1) :type 'circular-list) + (should-error (assoc 3 c2) :type 'circular-list) + (should-error (assoc 3 d1) :type 'wrong-type-argument) + (should-error (assoc 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-rassq () + (let ((c1 (cyc1 '(0 . 1))) + (c2 (cyc2 '(0 . 1) '(0 . 2))) + (d1 (dot1 '(0 . 1))) + (d2 (dot2 '(0 . 1) '(0 . 2)))) + (should (rassq 1 c1)) + (should (rassq 1 c2)) + (should (rassq 1 d1)) + (should (rassq 1 d2)) + (should-error (rassq 2 c1) :type 'circular-list) + (should (rassq 2 c2)) + (should-error (rassq 2 d1) :type 'wrong-type-argument) + (should (rassq 2 d2)) + (should-error (rassq 3 c1) :type 'circular-list) + (should-error (rassq 3 c2) :type 'circular-list) + (should-error (rassq 3 d1) :type 'wrong-type-argument) + (should-error (rassq 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-rassoc () + (let ((c1 (cyc1 '(0 . 1))) + (c2 (cyc2 '(0 . 1) '(0 . 2))) + (d1 (dot1 '(0 . 1))) + (d2 (dot2 '(0 . 1) '(0 . 2)))) + (should (rassoc 1 c1)) + (should (rassoc 1 c2)) + (should (rassoc 1 d1)) + (should (rassoc 1 d2)) + (should-error (rassoc 2 c1) :type 'circular-list) + (should (rassoc 2 c2)) + (should-error (rassoc 2 d1) :type 'wrong-type-argument) + (should (rassoc 2 d2)) + (should-error (rassoc 3 c1) :type 'circular-list) + (should-error (rassoc 3 c2) :type 'circular-list) + (should-error (rassoc 3 d1) :type 'wrong-type-argument) + (should-error (rassoc 3 d2) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-delq () + (should-error (delq 1 (cyc1 1)) :type 'circular-list) + (should-error (delq 1 (cyc2 1 2)) :type 'circular-list) + (should-error (delq 1 (dot1 1)) :type 'wrong-type-argument) + (should-error (delq 1 (dot2 1 2)) :type 'wrong-type-argument) + (should-error (delq 2 (cyc1 1)) :type 'circular-list) + (should-error (delq 2 (cyc2 1 2)) :type 'circular-list) + (should-error (delq 2 (dot1 1)) :type 'wrong-type-argument) + (should-error (delq 2 (dot2 1 2)) :type 'wrong-type-argument) + (should-error (delq 3 (cyc1 1)) :type 'circular-list) + (should-error (delq 3 (cyc2 1 2)) :type 'circular-list) + (should-error (delq 3 (dot1 1)) :type 'wrong-type-argument) + (should-error (delq 3 (dot2 1 2)) :type 'wrong-type-argument)) + +(ert-deftest test-cycle-delete () + (should-error (delete 1 (cyc1 1)) :type 'circular-list) + (should-error (delete 1 (cyc2 1 2)) :type 'circular-list) + (should-error (delete 1 (dot1 1)) :type 'wrong-type-argument) + (should-error (delete 1 (dot2 1 2)) :type 'wrong-type-argument) + (should-error (delete 2 (cyc1 1)) :type 'circular-list) + (should-error (delete 2 (cyc2 1 2)) :type 'circular-list) + (should-error (delete 2 (dot1 1)) :type 'wrong-type-argument) + (should-error (delete 2 (dot2 1 2)) :type 'wrong-type-argument) + (should-error (delete 3 (cyc1 1)) :type 'circular-list) + (should-error (delete 3 (cyc2 1 2)) :type 'circular-list) + (should-error (delete 3 (dot1 1)) :type 'wrong-type-argument) + (should-error (delete 3 (dot2 1 2)) :type 'wrong-type-argument)) + +(ert-deftest test-cycle-reverse () + (should-error (reverse (cyc1 1)) :type 'circular-list) + (should-error (reverse (cyc2 1 2)) :type 'circular-list) + (should-error (reverse (dot1 1)) :type 'wrong-type-argument) + (should-error (reverse (dot2 1 2)) :type 'wrong-type-argument)) + +(ert-deftest test-cycle-plist-get () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (plist-get c1 1)) + (should (plist-get c2 1)) + (should (plist-get d1 1)) + (should (plist-get d2 1)) + (should-not (plist-get c1 2)) + (should (plist-get c2 2)) + (should-not (plist-get d1 2)) + (should (plist-get d2 2)) + (should-not (plist-get c1 3)) + (should-not (plist-get c2 3)) + (should-not (plist-get d1 3)) + (should-not (plist-get d2 3)))) + +(ert-deftest test-cycle-lax-plist-get () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (lax-plist-get c1 1)) + (should (lax-plist-get c2 1)) + (should (lax-plist-get d1 1)) + (should (lax-plist-get d2 1)) + (should-error (lax-plist-get c1 2) :type 'circular-list) + (should (lax-plist-get c2 2)) + (should-error (lax-plist-get d1 2) :type 'wrong-type-argument) + (should (lax-plist-get d2 2)) + (should-error (lax-plist-get c1 3) :type 'circular-list) + (should-error (lax-plist-get c2 3) :type 'circular-list) + (should-error (lax-plist-get d1 3) :type 'wrong-type-argument) + (should-error (lax-plist-get d2 3) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-plist-member () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (plist-member c1 1)) + (should (plist-member c2 1)) + (should (plist-member d1 1)) + (should (plist-member d2 1)) + (should-error (plist-member c1 2) :type 'circular-list) + (should (plist-member c2 2)) + (should-error (plist-member d1 2) :type 'wrong-type-argument) + (should (plist-member d2 2)) + (should-error (plist-member c1 3) :type 'circular-list) + (should-error (plist-member c2 3) :type 'circular-list) + (should-error (plist-member d1 3) :type 'wrong-type-argument) + (should-error (plist-member d2 3) :type 'wrong-type-argument))) + +(ert-deftest test-cycle-plist-put () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (plist-put c1 1 1)) + (should (plist-put c2 1 1)) + (should (plist-put d1 1 1)) + (should (plist-put d2 1 1)) + (should-error (plist-put c1 2 2) :type 'circular-list) + (should (plist-put c2 2 2)) + (should-error (plist-put d1 2 2) :type 'wrong-type-argument) + (should (plist-put d2 2 2)) + (should-error (plist-put c1 3 3) :type 'circular-list) + (should-error (plist-put c2 3 3) :type 'circular-list) + (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-lax-plist-put () + (let ((c1 (cyc1 1)) + (c2 (cyc2 1 2)) + (d1 (dot1 1)) + (d2 (dot2 1 2))) + (should (lax-plist-put c1 1 1)) + (should (lax-plist-put c2 1 1)) + (should (lax-plist-put d1 1 1)) + (should (lax-plist-put d2 1 1)) + (should-error (lax-plist-put c1 2 2) :type 'circular-list) + (should (lax-plist-put c2 2 2)) + (should-error (lax-plist-put d1 2 2) :type 'wrong-type-argument) + (should (lax-plist-put d2 2 2)) + (should-error (lax-plist-put c1 3 3) :type 'circular-list) + (should-error (lax-plist-put c2 3 3) :type 'circular-list) + (should-error (lax-plist-put d1 3 3) :type 'wrong-type-argument) + (should-error (lax-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)) + +(provide 'fns-tests) diff --git a/test/automated/font-parse-tests.el b/test/src/font-tests.el index 30540a9247a..dc48577025c 100644 --- a/test/automated/font-parse-tests.el +++ b/test/src/font-tests.el @@ -1,4 +1,4 @@ -;;; font-parse-tests.el --- Test suite for font parsing. +;;; font-tests.el --- Test suite for font-related functions. ;; Copyright (C) 2011-2017 Free Software Foundation, Inc. @@ -163,4 +163,5 @@ expected font properties from parsing NAME.") ;; no-byte-compile: t ;; End: -;;; font-parse-tests.el ends here. +(provide 'font-tests) +;;; font-tests.el ends here. diff --git a/test/automated/inotify-test.el b/test/src/inotify-tests.el index f30aecc9c4f..987e1fc0777 100644 --- a/test/automated/inotify-test.el +++ b/test/src/inotify-tests.el @@ -28,6 +28,13 @@ (declare-function inotify-add-watch "inotify.c" (file-name aspect callback)) (declare-function inotify-rm-watch "inotify.c" (watch-descriptor)) +(ert-deftest inotify-valid-p-simple () + "Simple tests for `inotify-valid-p'." + (skip-unless (featurep 'inotify)) + (should-not (inotify-valid-p 0)) + (should-not (inotify-valid-p nil)) + (should-not (inotify-valid-p '(0 . 0)))) + ;; (ert-deftest filewatch-file-watch-aspects-check () ;; "Test whether `file-watch' properly checks the aspects." ;; (let ((temp-file (make-temp-file "filewatch-aspects"))) @@ -56,7 +63,9 @@ (insert "Foo\n")) (read-event nil nil 5) (should (> events 0))) + (should (inotify-valid-p wd)) (inotify-rm-watch wd) + (should-not (inotify-valid-p wd)) (delete-file temp-file))))) (provide 'inotify-tests) diff --git a/test/automated/keymap-tests.el b/test/src/keymap-tests.el index f08d5c02aba..c5b9d0cc71c 100644 --- a/test/automated/keymap-tests.el +++ b/test/src/keymap-tests.el @@ -38,6 +38,13 @@ commit 86c19714b097aa477d339ed99ffb5136c755a046." (should (eq (lookup-key Buffer-menu-mode-map [32]) 'undefined))) (define-key Buffer-menu-mode-map [32] def)))) +(ert-deftest keymap-where-is-internal-test () + "Make sure we don't crash when `where-is-preferred-modifier' is not a symbol." + (should + (equal (let ((where-is-preferred-modifier "alt")) + (where-is-internal 'execute-extended-command global-map t)) + [#x8000078]))) + (provide 'keymap-tests) ;;; keymap-tests.el ends here diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el new file mode 100644 index 00000000000..98cbb6a301d --- /dev/null +++ b/test/src/lread-tests.el @@ -0,0 +1,167 @@ +;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*- + +;; Copyright (C) 2016-2017 Free Software Foundation, Inc. + +;; Author: Philipp Stephani <phst@google.com> + +;; This file is part of GNU Emacs. + +;; This program 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. + +;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; Unit tests for code in src/lread.c. + +;;; Code: + +(ert-deftest lread-char-number () + (should (equal (read "?\\N{U+A817}") #xA817))) + +(ert-deftest lread-char-name-1 () + (should (equal (read "?\\N{SYLOTI NAGRI LETTER \n DHO}") + #xA817))) +(ert-deftest lread-char-name-2 () + (should (equal (read "?\\N{BED}") #x1F6CF))) +(ert-deftest lread-char-name-3 () + (should (equal (read "?\\N{U+BED}") #xBED))) +(ert-deftest lread-char-name-4 () + (should (equal (read "?\\N{VARIATION SELECTOR-1}") #xFE00))) +(ert-deftest lread-char-name-5 () + (should (equal (read "?\\N{VARIATION SELECTOR-16}") #xFE0F))) +(ert-deftest lread-char-name-6 () + (should (equal (read "?\\N{VARIATION SELECTOR-17}") #xE0100))) +(ert-deftest lread-char-name-7 () + (should (equal (read "?\\N{VARIATION SELECTOR-256}") #xE01EF))) +(ert-deftest lread-char-name-8 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-F900}") #xF900))) +(ert-deftest lread-char-name-9 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-FAD9}") #xFAD9))) +(ert-deftest lread-char-name-10 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2F800}") #x2F800))) +(ert-deftest lread-char-name-11 () + (should (equal (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2FA1D}") #x2FA1D))) + +(ert-deftest lread-char-invalid-number () + (should-error (read "?\\N{U+110000}") :type 'invalid-read-syntax)) + +(ert-deftest lread-char-invalid-name-1 () + (should-error (read "?\\N{DOES NOT EXIST}")) :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-2 () + (should-error (read "?\\N{VARIATION SELECTOR-0}")) :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-3 () + (should-error (read "?\\N{VARIATION SELECTOR-257}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-4 () + (should-error (read "?\\N{VARIATION SELECTOR--0}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-5 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-F8FF}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-6 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-FADA}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-7 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2F7FF}")) + :type 'invalid-read-syntax) +(ert-deftest lread-char-invalid-name-8 () + (should-error (read "?\\N{CJK COMPATIBILITY IDEOGRAPH-2FA1E}")) + :type 'invalid-read-syntax) + +(ert-deftest lread-char-non-ascii-name () + (should-error (read "?\\N{LATIN CAPITAL LETTER Ø}") + :type 'invalid-read-syntax)) + +(ert-deftest lread-char-empty-name () + (should-error (read "?\\N{}") :type 'invalid-read-syntax)) + +(ert-deftest lread-char-surrogate-1 () + (should-error (read "?\\N{U+D800}") :type 'invalid-read-syntax)) +(ert-deftest lread-char-surrogate-2 () + (should-error (read "?\\N{U+D801}") :type 'invalid-read-syntax)) +(ert-deftest lread-char-surrogate-3 () + (should-error (read "?\\N{U+Dffe}") :type 'invalid-read-syntax)) +(ert-deftest lread-char-surrogate-4 () + (should-error (read "?\\N{U+DFFF}") :type 'invalid-read-syntax)) + +(ert-deftest lread-string-char-number-1 () + (should (equal (read "\"a\\N{U+A817}b\"") "a\uA817b"))) +(ert-deftest lread-string-char-number-2 () + (should-error (read "?\\N{0.5}") :type 'invalid-read-syntax)) +(ert-deftest lread-string-char-number-3 () + (should-error (read "?\\N{U+-0}") :type 'invalid-read-syntax)) + +(ert-deftest lread-string-char-name () + (should (equal (read "\"a\\N{SYLOTI NAGRI LETTER DHO}b\"") "a\uA817b"))) + +(ert-deftest lread-empty-int-literal () + "Check that Bug#25120 is fixed." + (should-error (read "#b") :type 'invalid-read-syntax) + (should-error (read "#o") :type 'invalid-read-syntax) + (should-error (read "#x") :type 'invalid-read-syntax) + (should-error (read "#24r") :type 'invalid-read-syntax) + (should-error (read "#") :type 'invalid-read-syntax)) + +(ert-deftest lread-record-1 () + (should (equal '(#s(foo) #s(foo)) + (read "(#1=#s(foo) #1#)")))) + +(defmacro lread-tests--with-temp-file (file-name-var &rest body) + (declare (indent 1)) + (cl-check-type file-name-var symbol) + `(let ((,file-name-var (make-temp-file "emacs"))) + (unwind-protect + (progn ,@body) + (delete-file ,file-name-var)))) + +(defun lread-tests--last-message () + (with-current-buffer "*Messages*" + (save-excursion + (goto-char (point-max)) + (skip-chars-backward "\n") + (buffer-substring (line-beginning-position) (point))))) + +(ert-deftest lread-tests--unescaped-char-literals () + "Check that loading warns about unescaped character +literals (Bug#20852)." + (lread-tests--with-temp-file file-name + (write-region "?) ?( ?; ?\" ?[ ?]" nil file-name) + (should (equal (load file-name nil :nomessage :nosuffix) t)) + (should (equal (lread-tests--last-message) + (concat (format-message "Loading `%s': " file-name) + "unescaped character literals " + "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"))))) + +(ert-deftest lread-test-bug26837 () + "Test for http://debbugs.gnu.org/26837 ." + (let ((load-path (cons + (file-name-as-directory + (expand-file-name "data" (getenv "EMACS_TEST_DIRECTORY"))) + load-path))) + (load "somelib" nil t) + (should (string-suffix-p "/somelib.el" (caar load-history))) + (load "somelib2" nil t) + (should (string-suffix-p "/somelib2.el" (caar load-history))) + (load "somelib" nil t) + (should (string-suffix-p "/somelib.el" (caar load-history))))) + +(ert-deftest lread-tests--old-style-backquotes () + "Check that loading warns about old-style backquotes." + (lread-tests--with-temp-file file-name + (write-region "(` (a b))" nil file-name) + (should (equal (load file-name nil :nomessage :nosuffix) t)) + (should (equal (lread-tests--last-message) + (concat (format-message "Loading `%s': " file-name) + "old-style backquotes detected!"))))) + +;;; lread-tests.el ends here diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el new file mode 100644 index 00000000000..20ce8f4cc04 --- /dev/null +++ b/test/src/marker-tests.el @@ -0,0 +1,60 @@ +;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +;; The following three tests assert that Emacs survives operations +;; copying a marker whose character position differs from its byte +;; position into a buffer whose character size equals its byte size +;; (Bug#24368). + +(ert-deftest marker-set-window-start-from-other-buffer () + "`set-window-start' from other buffer's marker." + (let ((text-quoting-style 'curve)) + (describe-function 'describe-function)) + (let* ((help (get-buffer "*Help*")) + (marker (with-current-buffer help + (copy-marker (point-max))))) + (should (set-window-start (selected-window) marker)))) + +(ert-deftest marker-set-window-point-from-other-buffer () + "`set-window-point' from another buffer's marker." + (let ((text-quoting-style 'curve)) + (describe-function 'describe-function)) + (let* ((help (get-buffer "*Help*")) + (marker (with-current-buffer help + (copy-marker (point-max))))) + (with-selected-window (get-buffer-window help) + (should (set-window-point (get-buffer-window "*scratch*") marker))))) + +(ert-deftest marker-goto-char-from-other-buffer () + "`goto-char' from another buffer's marker." + (let ((text-quoting-style 'curve)) + (describe-function 'describe-function)) + (let ((marker-1 (make-marker)) + (marker-2 (make-marker))) + (describe-function 'describe-function) + (with-current-buffer "*Help*" + (set-marker marker-1 (point-max))) + (set-marker marker-2 marker-1) + (should (goto-char marker-2)))) + +;;; marker-tests.el ends here. diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el new file mode 100644 index 00000000000..cb14819d349 --- /dev/null +++ b/test/src/minibuf-tests.el @@ -0,0 +1,403 @@ +;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t -*- + +;; Copyright (C) 2016-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + + +;;; Support functions for `try-completion', `all-completion', and +;;; `test-completion' tests. + +(defun minibuf-tests--strings-to-symbol-list (list) + (mapcar #'intern list)) +(defun minibuf-tests--strings-to-symbol-alist (list) + (let ((num 0)) + (mapcar (lambda (str) (cons (intern str) (cl-incf num))) list))) +(defun minibuf-tests--strings-to-string-alist (list) + (let ((num 0)) + (mapcar (lambda (str) (cons str (cl-incf num))) list))) +(defun minibuf-tests--strings-to-obarray (list) + (let ((ob (make-vector 7 0))) + (mapc (lambda (str) (intern str ob)) list) + ob)) +(defun minibuf-tests--strings-to-string-hashtable (list) + (let ((ht (make-hash-table :test #'equal)) + (num 0)) + (mapc (lambda (str) (puthash str (cl-incf num) ht)) list) + ht)) +(defun minibuf-tests--strings-to-symbol-hashtable (list) + (let ((ht (make-hash-table :test #'equal)) + (num 0)) + (mapc (lambda (str) (puthash (intern str) (cl-incf num) ht)) list) + ht)) + +;;; Functions that produce a predicate (for *-completion functions) +;;; which always returns non-nil for a given collection. + +(defun minibuf-tests--memq-of-collection (collection) + (lambda (elt) (memq elt collection))) +(defun minibuf-tests--part-of-obarray (ob) + (lambda (sym) (eq (intern-soft (symbol-name sym) ob) sym))) +(defun minibuf-tests--part-of-hashtable (table) + (lambda (k v) (equal (gethash k table) v))) + + +;;; Testing functions that are agnostic to type of COLLECTION. + +(defun minibuf-tests--try-completion (xform-collection) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (should (equal (try-completion "a" abcdef) "abc")) + (should (equal (try-completion "a" +abba) "ab")) + (should (equal (try-completion "abc" +abba) t)) + (should (equal (try-completion "abcd" +abba) nil)))) + +(defun minibuf-tests--try-completion-pred (xform-collection collection-member) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (abcdef-member (funcall collection-member abcdef)) + (+abba (funcall xform-collection '("abc" "abba" "def"))) + (+abba-member (funcall collection-member +abba))) + (should (equal (try-completion "a" abcdef abcdef-member) "abc")) + (should (equal (try-completion "a" +abba +abba-member) "ab")) + (should (equal (try-completion "abc" +abba +abba-member) t)) + (should (equal (try-completion "abcd" +abba +abba-member) nil)) + (should-not (try-completion "a" abcdef #'ignore)) + (should-not (try-completion "a" +abba #'ignore)) + (should-not (try-completion "abc" +abba #'ignore)) + (should-not (try-completion "abcd" +abba #'ignore)))) + +(defun minibuf-tests--try-completion-regexp (xform-collection) + (let ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (let ((completion-regexp-list '("."))) + (should (equal (try-completion "a" abcdef) "abc")) + (should (equal (try-completion "a" +abba) "ab")) + (should (equal (try-completion "abc" +abba) t)) + (should (equal (try-completion "abcd" +abba) nil))) + (let ((completion-regexp-list '("X"))) + (should-not (try-completion "a" abcdef)) + (should-not (try-completion "a" +abba)) + (should-not (try-completion "abc" +abba)) + (should-not (try-completion "abcd" +abba))))) + +(defun minibuf-tests--all-completions (xform-collection) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (should (equal (all-completions "a" abcdef) '("abc"))) + (should (equal (all-completions "a" +abba) '("abc" "abba"))) + (should (equal (all-completions "abc" +abba) '("abc"))) + (should (equal (all-completions "abcd" +abba) nil)))) + +(defun minibuf-tests--all-completions-pred (xform-collection collection-member) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (abcdef-member (funcall collection-member abcdef)) + (+abba (funcall xform-collection '("abc" "abba" "def"))) + (+abba-member (funcall collection-member +abba))) + (should (equal (all-completions "a" abcdef abcdef-member) '("abc"))) + (should (equal (all-completions "a" +abba +abba-member) '("abc" "abba"))) + (should (equal (all-completions "abc" +abba +abba-member) '("abc"))) + (should (equal (all-completions "abcd" +abba +abba-member) nil)) + (should-not (all-completions "a" abcdef #'ignore)) + (should-not (all-completions "a" +abba #'ignore)) + (should-not (all-completions "abc" +abba #'ignore)) + (should-not (all-completions "abcd" +abba #'ignore)))) + +(defun minibuf-tests--all-completions-regexp (xform-collection) + (let ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (let ((completion-regexp-list '("."))) + (should (equal (all-completions "a" abcdef) '("abc"))) + (should (equal (all-completions "a" +abba) '("abc" "abba"))) + (should (equal (all-completions "abc" +abba) '("abc"))) + (should (equal (all-completions "abcd" +abba) nil))) + (let ((completion-regexp-list '("X"))) + (should-not (all-completions "a" abcdef)) + (should-not (all-completions "a" +abba)) + (should-not (all-completions "abc" +abba)) + (should-not (all-completions "abcd" +abba))))) + +(defun minibuf-tests--test-completion (xform-collection) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (should (test-completion "abc" abcdef)) + (should (test-completion "def" +abba)) + (should (test-completion "abba" +abba)) + (should-not (test-completion "abcd" +abba)))) + +(defun minibuf-tests--test-completion-pred (xform-collection collection-member) + (let* ((abcdef (funcall xform-collection '("abc" "def"))) + (abcdef-member (funcall collection-member abcdef)) + (+abba (funcall xform-collection '("abc" "abba" "def"))) + (+abba-member (funcall collection-member +abba))) + (should (test-completion "abc" abcdef abcdef-member)) + (should (test-completion "def" +abba +abba-member)) + (should (test-completion "abba" +abba +abba-member)) + (should-not (test-completion "abcd" +abba +abba-member)) + (should-not (test-completion "abc" abcdef #'ignore)) + (should-not (test-completion "def" +abba #'ignore)) + (should-not (test-completion "abba" +abba #'ignore)) + (should-not (test-completion "abcd" +abba #'ignore)))) + +(defun minibuf-tests--test-completion-regexp (xform-collection) + (let ((abcdef (funcall xform-collection '("abc" "def"))) + (+abba (funcall xform-collection '("abc" "abba" "def")))) + (let ((completion-regexp-list '("."))) + (should (test-completion "abc" abcdef)) + (should (test-completion "def" +abba)) + (should (test-completion "abba" +abba)) + (should-not (test-completion "abcd" +abba))) + (let ((completion-regexp-list '("X"))) + (should-not (test-completion "abc" abcdef)) + (should-not (test-completion "def" +abba)) + (should-not (test-completion "abba" +abba)) + (should-not (test-completion "abcd" +abba))))) + + +;;; Tests for `try-completion'. +(ert-deftest try-completion-string-list () + (minibuf-tests--try-completion #'identity)) +(ert-deftest try-completion-string-list-predicate () + (minibuf-tests--try-completion-pred + #'identity #'minibuf-tests--memq-of-collection)) +(ert-deftest try-completion-string-list-completion-regexp () + (minibuf-tests--try-completion-regexp #'identity)) + +(ert-deftest try-completion-symbol-list () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-symbol-list)) +(ert-deftest try-completion-symbol-list-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-symbol-list + #'minibuf-tests--memq-of-collection)) +(ert-deftest try-completion-symbol-list-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-symbol-list)) + +(ert-deftest try-completion-symbol-alist () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-symbol-alist)) +(ert-deftest try-completion-symbol-alist-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-symbol-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest try-completion-symbol-alist-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-symbol-alist)) + +(ert-deftest try-completion-string-alist () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-string-alist)) +(ert-deftest try-completion-string-alist-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-string-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest try-completion-string-alist-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-string-alist)) + +(ert-deftest try-completion-obarray () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-obarray)) +(ert-deftest try-completion-obarray-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-obarray + #'minibuf-tests--part-of-obarray)) +(ert-deftest try-completion-obarray-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-obarray)) + +(ert-deftest try-completion-string-hashtable () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-string-hashtable)) +(ert-deftest try-completion-string-hashtable-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-string-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest try-completion-string-hashtable-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-string-hashtable)) + +(ert-deftest try-completion-symbol-hashtable () + (minibuf-tests--try-completion + #'minibuf-tests--strings-to-symbol-hashtable)) +(ert-deftest try-completion-symbol-hashtable-predicate () + (minibuf-tests--try-completion-pred + #'minibuf-tests--strings-to-symbol-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest try-completion-symbol-hashtable-completion-regexp () + (minibuf-tests--try-completion-regexp + #'minibuf-tests--strings-to-symbol-hashtable)) + + +;;; Tests for `all-completions'. + +(ert-deftest all-completions-string-list () + (minibuf-tests--all-completions #'identity)) +(ert-deftest all-completions-string-list-predicate () + (minibuf-tests--all-completions-pred + #'identity #'minibuf-tests--memq-of-collection)) +(ert-deftest all-completions-string-list-completion-regexp () + (minibuf-tests--all-completions-regexp #'identity)) + +(ert-deftest all-completions-symbol-list () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-symbol-list)) +(ert-deftest all-completions-symbol-list-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-symbol-list + #'minibuf-tests--memq-of-collection)) +(ert-deftest all-completions-symbol-list-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-symbol-list)) + +(ert-deftest all-completions-symbol-alist () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-symbol-alist)) +(ert-deftest all-completions-symbol-alist-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-symbol-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest all-completions-symbol-alist-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-symbol-alist)) + +(ert-deftest all-completions-string-alist () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-string-alist)) +(ert-deftest all-completions-string-alist-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-string-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest all-completions-string-alist-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-string-alist)) + +(ert-deftest all-completions-obarray () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-obarray)) +(ert-deftest all-completions-obarray-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-obarray + #'minibuf-tests--part-of-obarray)) +(ert-deftest all-completions-obarray-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-obarray)) + +(ert-deftest all-completions-string-hashtable () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-string-hashtable)) +(ert-deftest all-completions-string-hashtable-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-string-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest all-completions-string-hashtable-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-string-hashtable)) + +(ert-deftest all-completions-symbol-hashtable () + (minibuf-tests--all-completions + #'minibuf-tests--strings-to-symbol-hashtable)) +(ert-deftest all-completions-symbol-hashtable-predicate () + (minibuf-tests--all-completions-pred + #'minibuf-tests--strings-to-symbol-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest all-completions-symbol-hashtable-completion-regexp () + (minibuf-tests--all-completions-regexp + #'minibuf-tests--strings-to-symbol-hashtable)) + + +;;; Tests for `test-completion'. + +(ert-deftest test-completion-string-list () + (minibuf-tests--test-completion #'identity)) +(ert-deftest test-completion-string-list-predicate () + (minibuf-tests--test-completion-pred + #'identity #'minibuf-tests--memq-of-collection)) +(ert-deftest test-completion-string-list-completion-regexp () + (minibuf-tests--test-completion-regexp #'identity)) + +(ert-deftest test-completion-symbol-list () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-symbol-list)) +(ert-deftest test-completion-symbol-list-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-symbol-list + #'minibuf-tests--memq-of-collection)) +(ert-deftest test-completion-symbol-list-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-symbol-list)) + +(ert-deftest test-completion-symbol-alist () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-symbol-alist)) +(ert-deftest test-completion-symbol-alist-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-symbol-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest test-completion-symbol-alist-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-symbol-alist)) + +(ert-deftest test-completion-string-alist () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-string-alist)) +(ert-deftest test-completion-string-alist-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-string-alist + #'minibuf-tests--memq-of-collection)) +(ert-deftest test-completion-string-alist-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-string-alist)) + +(ert-deftest test-completion-obarray () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-obarray)) +(ert-deftest test-completion-obarray-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-obarray + #'minibuf-tests--part-of-obarray)) +(ert-deftest test-completion-obarray-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-obarray)) + +(ert-deftest test-completion-string-hashtable () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-string-hashtable)) +(ert-deftest test-completion-string-hashtable-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-string-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest test-completion-string-hashtable-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-string-hashtable)) + +(ert-deftest test-completion-symbol-hashtable () + (minibuf-tests--test-completion + #'minibuf-tests--strings-to-symbol-hashtable)) +(ert-deftest test-completion-symbol-hashtable-predicate () + (minibuf-tests--test-completion-pred + #'minibuf-tests--strings-to-symbol-hashtable + #'minibuf-tests--part-of-hashtable)) +(ert-deftest test-completion-symbol-hashtable-completion-regexp () + (minibuf-tests--test-completion-regexp + #'minibuf-tests--strings-to-symbol-hashtable)) + + +;;; minibuf-tests.el ends here diff --git a/test/automated/print-tests.el b/test/src/print-tests.el index b3ffc23e120..b3ffc23e120 100644 --- a/test/automated/print-tests.el +++ b/test/src/print-tests.el diff --git a/test/automated/process-tests.el b/test/src/process-tests.el index dd545e90998..04dc903f3a9 100644 --- a/test/automated/process-tests.el +++ b/test/src/process-tests.el @@ -163,3 +163,4 @@ (should (equal path samepath)))) (provide 'process-tests) +;; process-tests.el ends here. diff --git a/test/src/regex-resources/BOOST.tests b/test/src/regex-resources/BOOST.tests new file mode 100644 index 00000000000..98fd3b6abf3 --- /dev/null +++ b/test/src/regex-resources/BOOST.tests @@ -0,0 +1,829 @@ +; +; +; this file contains a script of tests to run through regress.exe +; +; comments start with a semicolon and proceed to the end of the line +; +; changes to regular expression compile flags start with a "-" as the first +; non-whitespace character and consist of a list of the printable names +; of the flags, for example "match_default" +; +; Other lines contain a test to perform using the current flag status +; the first token contains the expression to compile, the second the string +; to match it against. If the second string is "!" then the expression should +; not compile, that is the first string is an invalid regular expression. +; This is then followed by a list of integers that specify what should match, +; each pair represents the starting and ending positions of a subexpression +; starting with the zeroth subexpression (the whole match). +; A value of -1 indicates that the subexpression should not take part in the +; match at all, if the first value is -1 then no part of the expression should +; match the string. +; +; Tests taken from BOOST testsuite and adapted to glibc regex. +; +; Boost Software License - Version 1.0 - August 17th, 2003 +; +; Permission is hereby granted, free of charge, to any person or organization +; obtaining a copy of the software and accompanying documentation covered by +; this license (the "Software") to use, reproduce, display, distribute, +; execute, and transmit the Software, and to prepare derivative works of the +; Software, and to permit third-parties to whom the Software is furnished to +; do so, all subject to the following: +; +; The copyright notices in the Software and this entire statement, including +; the above license grant, this restriction and the following disclaimer, +; must be included in all copies of the Software, in whole or in part, and +; all derivative works of the Software, unless such copies or derivative +; works are solely in the form of machine-executable object code generated by +; a source language processor. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +; FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +; SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +; FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +; ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +; DEALINGS IN THE SOFTWARE. +; + +- match_default normal REG_EXTENDED + +; +; try some really simple literals: +a a 0 1 +Z Z 0 1 +Z aaa -1 -1 +Z xxxxZZxxx 4 5 + +; and some simple brackets: +(a) zzzaazz 3 4 3 4 +() zzz 0 0 0 0 +() "" 0 0 0 0 +( ! +) ) 0 1 +(aa ! +aa) baa)b 1 4 +a b -1 -1 +\(\) () 0 2 +\(a\) (a) 0 3 +\() () 0 2 +(\) ! +p(a)rameter ABCparameterXYZ 3 12 4 5 +[pq](a)rameter ABCparameterXYZ 3 12 4 5 + +; now try escaped brackets: +- match_default bk_parens REG_BASIC +\(a\) zzzaazz 3 4 3 4 +\(\) zzz 0 0 0 0 +\(\) "" 0 0 0 0 +\( ! +\) ! +\(aa ! +aa\) ! +() () 0 2 +(a) (a) 0 3 +(\) ! +\() ! + +; now move on to "." wildcards +- match_default normal REG_EXTENDED REG_STARTEND +. a 0 1 +. \n 0 1 +. \r 0 1 +. \0 0 1 + +; +; now move on to the repetion ops, +; starting with operator * +- match_default normal REG_EXTENDED +a* b 0 0 +ab* a 0 1 +ab* ab 0 2 +ab* sssabbbbbbsss 3 10 +ab*c* a 0 1 +ab*c* abbb 0 4 +ab*c* accc 0 4 +ab*c* abbcc 0 5 +*a ! +\<* ! +\>* ! +\n* \n\n 0 2 +\** ** 0 2 +\* * 0 1 + +; now try operator + +ab+ a -1 -1 +ab+ ab 0 2 +ab+ sssabbbbbbsss 3 10 +ab+c+ a -1 -1 +ab+c+ abbb -1 -1 +ab+c+ accc -1 -1 +ab+c+ abbcc 0 5 ++a ! +\<+ ! +\>+ ! +\n+ \n\n 0 2 +\+ + 0 1 +\+ ++ 0 1 +\++ ++ 0 2 + +; now try operator ? +- match_default normal REG_EXTENDED +a? b 0 0 +ab? a 0 1 +ab? ab 0 2 +ab? sssabbbbbbsss 3 5 +ab?c? a 0 1 +ab?c? abbb 0 2 +ab?c? accc 0 2 +ab?c? abcc 0 3 +?a ! +\<? ! +\>? ! +\n? \n\n 0 1 +\? ? 0 1 +\? ?? 0 1 +\?? ?? 0 1 + +; now try operator {} +- match_default normal REG_EXTENDED +a{2} a -1 -1 +a{2} aa 0 2 +a{2} aaa 0 2 +a{2,} a -1 -1 +a{2,} aa 0 2 +a{2,} aaaaa 0 5 +a{2,4} a -1 -1 +a{2,4} aa 0 2 +a{2,4} aaa 0 3 +a{2,4} aaaa 0 4 +a{2,4} aaaaa 0 4 +a{} ! +a{2 ! +a} a} 0 2 +\{\} {} 0 2 + +- match_default normal REG_BASIC +a\{2\} a -1 -1 +a\{2\} aa 0 2 +a\{2\} aaa 0 2 +a\{2,\} a -1 -1 +a\{2,\} aa 0 2 +a\{2,\} aaaaa 0 5 +a\{2,4\} a -1 -1 +a\{2,4\} aa 0 2 +a\{2,4\} aaa 0 3 +a\{2,4\} aaaa 0 4 +a\{2,4\} aaaaa 0 4 +{} {} 0 2 + +; now test the alternation operator | +- match_default normal REG_EXTENDED +a|b a 0 1 +a|b b 0 1 +a(b|c) ab 0 2 1 2 +a(b|c) ac 0 2 1 2 +a(b|c) ad -1 -1 -1 -1 +a\| a| 0 2 + +; now test the set operator [] +- match_default normal REG_EXTENDED +; try some literals first +[abc] a 0 1 +[abc] b 0 1 +[abc] c 0 1 +[abc] d -1 -1 +[^bcd] a 0 1 +[^bcd] b -1 -1 +[^bcd] d -1 -1 +[^bcd] e 0 1 +a[b]c abc 0 3 +a[ab]c abc 0 3 +a[^ab]c adc 0 3 +a[]b]c a]c 0 3 +a[[b]c a[c 0 3 +a[-b]c a-c 0 3 +a[^]b]c adc 0 3 +a[^-b]c adc 0 3 +a[b-]c a-c 0 3 +a[b ! +a[] ! + +; then some ranges +[b-e] a -1 -1 +[b-e] b 0 1 +[b-e] e 0 1 +[b-e] f -1 -1 +[^b-e] a 0 1 +[^b-e] b -1 -1 +[^b-e] e -1 -1 +[^b-e] f 0 1 +a[1-3]c a2c 0 3 +a[3-1]c ! +a[1-3-5]c ! +a[1- ! + +; and some classes +a[[:alpha:]]c abc 0 3 +a[[:unknown:]]c ! +a[[: ! +a[[:alpha ! +a[[:alpha:] ! +a[[:alpha,:] ! +a[[:]:]]b ! +a[[:-:]]b ! +a[[:alph:]] ! +a[[:alphabet:]] ! +[[:alnum:]]+ -%@a0X_- 3 6 +[[:alpha:]]+ -%@aX_0- 3 5 +[[:blank:]]+ "a \tb" 1 4 +[[:cntrl:]]+ a\n\tb 1 3 +[[:digit:]]+ a019b 1 4 +[[:graph:]]+ " a%b " 1 4 +[[:lower:]]+ AabC 1 3 +; This test fails with STLPort, disable for now as this is a corner case anyway... +;[[:print:]]+ "\na b\n" 1 4 +[[:punct:]]+ " %-&\t" 1 4 +[[:space:]]+ "a \n\t\rb" 1 5 +[[:upper:]]+ aBCd 1 3 +[[:xdigit:]]+ p0f3Cx 1 5 + +; now test flag settings: +- escape_in_lists REG_NO_POSIX_TEST +[\n] \n 0 1 +- REG_NO_POSIX_TEST + +; line anchors +- match_default normal REG_EXTENDED +^ab ab 0 2 +^ab xxabxx -1 -1 +ab$ ab 0 2 +ab$ abxx -1 -1 +- match_default match_not_bol match_not_eol normal REG_EXTENDED REG_NOTBOL REG_NOTEOL +^ab ab -1 -1 +^ab xxabxx -1 -1 +ab$ ab -1 -1 +ab$ abxx -1 -1 + +; back references +- match_default normal REG_PERL +a(b)\2c ! +a(b\1)c ! +a(b*)c\1d abbcbbd 0 7 1 3 +a(b*)c\1d abbcbd -1 -1 +a(b*)c\1d abbcbbbd -1 -1 +^(.)\1 abc -1 -1 +a([bc])\1d abcdabbd 4 8 5 6 +; strictly speaking this is at best ambiguous, at worst wrong, this is what most +; re implimentations will match though. +a(([bc])\2)*d abbccd 0 6 3 5 3 4 + +a(([bc])\2)*d abbcbd -1 -1 +a((b)*\2)*d abbbd 0 5 1 4 2 3 +; perl only: +(ab*)[ab]*\1 ababaaa 0 7 0 1 +(a)\1bcd aabcd 0 5 0 1 +(a)\1bc*d aabcd 0 5 0 1 +(a)\1bc*d aabd 0 4 0 1 +(a)\1bc*d aabcccd 0 7 0 1 +(a)\1bc*[ce]d aabcccd 0 7 0 1 +^(a)\1b(c)*cd$ aabcccd 0 7 0 1 4 5 + +; posix only: +- match_default extended REG_EXTENDED +(ab*)[ab]*\1 ababaaa 0 7 0 1 + +; +; word operators: +\w a 0 1 +\w z 0 1 +\w A 0 1 +\w Z 0 1 +\w _ 0 1 +\w } -1 -1 +\w ` -1 -1 +\w [ -1 -1 +\w @ -1 -1 +; non-word: +\W a -1 -1 +\W z -1 -1 +\W A -1 -1 +\W Z -1 -1 +\W _ -1 -1 +\W } 0 1 +\W ` 0 1 +\W [ 0 1 +\W @ 0 1 +; word start: +\<abcd " abcd" 2 6 +\<ab cab -1 -1 +\<ab "\nab" 1 3 +\<tag ::tag 2 5 +;word end: +abc\> abc 0 3 +abc\> abcd -1 -1 +abc\> abc\n 0 3 +abc\> abc:: 0 3 +; word boundary: +\babcd " abcd" 2 6 +\bab cab -1 -1 +\bab "\nab" 1 3 +\btag ::tag 2 5 +abc\b abc 0 3 +abc\b abcd -1 -1 +abc\b abc\n 0 3 +abc\b abc:: 0 3 +; within word: +\B ab 1 1 +a\Bb ab 0 2 +a\B ab 0 1 +a\B a -1 -1 +a\B "a " -1 -1 + +; +; buffer operators: +\`abc abc 0 3 +\`abc \nabc -1 -1 +\`abc " abc" -1 -1 +abc\' abc 0 3 +abc\' abc\n -1 -1 +abc\' "abc " -1 -1 + +; +; now follows various complex expressions designed to try and bust the matcher: +a(((b)))c abc 0 3 1 2 1 2 1 2 +a(b|(c))d abd 0 3 1 2 -1 -1 +a(b|(c))d acd 0 3 1 2 1 2 +a(b*|c)d abbd 0 4 1 3 +; just gotta have one DFA-buster, of course +a[ab]{20} aaaaabaaaabaaaabaaaab 0 21 +; and an inline expansion in case somebody gets tricky +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] aaaaabaaaabaaaabaaaab 0 21 +; and in case somebody just slips in an NFA... +a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) aaaaabaaaabaaaabaaaabweeknights 0 31 21 24 24 31 +; one really big one +1234567890123456789012345678901234567890123456789012345678901234567890 a1234567890123456789012345678901234567890123456789012345678901234567890b 1 71 +; fish for problems as brackets go past 8 +[ab][cd][ef][gh][ij][kl][mn] xacegikmoq 1 8 +[ab][cd][ef][gh][ij][kl][mn][op] xacegikmoq 1 9 +[ab][cd][ef][gh][ij][kl][mn][op][qr] xacegikmoqy 1 10 +[ab][cd][ef][gh][ij][kl][mn][op][q] xacegikmoqy 1 10 +; and as parenthesis go past 9: +(a)(b)(c)(d)(e)(f)(g)(h) zabcdefghi 1 9 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 +(a)(b)(c)(d)(e)(f)(g)(h)(i) zabcdefghij 1 10 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 +(a)(b)(c)(d)(e)(f)(g)(h)(i)(j) zabcdefghijk 1 11 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 +(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k) zabcdefghijkl 1 12 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 +(a)d|(b)c abc 1 3 -1 -1 1 2 +_+((www)|(ftp)|(mailto)):_* "_wwwnocolon _mailto:" 12 20 13 19 -1 -1 -1 -1 13 19 + +; subtleties of matching +;a(b)?c\1d acd 0 3 -1 -1 +; POSIX is about the following test: +a(b)?c\1d acd -1 -1 -1 -1 +a(b?c)+d accd 0 4 2 3 +(wee|week)(knights|night) weeknights 0 10 0 3 3 10 +.* abc 0 3 +a(b|(c))d abd 0 3 1 2 -1 -1 +a(b|(c))d acd 0 3 1 2 1 2 +a(b*|c|e)d abbd 0 4 1 3 +a(b*|c|e)d acd 0 3 1 2 +a(b*|c|e)d ad 0 2 1 1 +a(b?)c abc 0 3 1 2 +a(b?)c ac 0 2 1 1 +a(b+)c abc 0 3 1 2 +a(b+)c abbbc 0 5 1 4 +a(b*)c ac 0 2 1 1 +(a|ab)(bc([de]+)f|cde) abcdef 0 6 0 1 1 6 3 5 +a([bc]?)c abc 0 3 1 2 +a([bc]?)c ac 0 2 1 1 +a([bc]+)c abc 0 3 1 2 +a([bc]+)c abcc 0 4 1 3 +a([bc]+)bc abcbc 0 5 1 3 +a(bb+|b)b abb 0 3 1 2 +a(bbb+|bb+|b)b abb 0 3 1 2 +a(bbb+|bb+|b)b abbb 0 4 1 3 +a(bbb+|bb+|b)bb abbb 0 4 1 2 +(.*).* abcdef 0 6 0 6 +(a*)* bc 0 0 0 0 +xyx*xz xyxxxxyxxxz 5 11 + +; do we get the right subexpression when it is used more than once? +a(b|c)*d ad 0 2 -1 -1 +a(b|c)*d abcd 0 4 2 3 +a(b|c)+d abd 0 3 1 2 +a(b|c)+d abcd 0 4 2 3 +a(b|c?)+d ad 0 2 1 1 +a(b|c){0,0}d ad 0 2 -1 -1 +a(b|c){0,1}d ad 0 2 -1 -1 +a(b|c){0,1}d abd 0 3 1 2 +a(b|c){0,2}d ad 0 2 -1 -1 +a(b|c){0,2}d abcd 0 4 2 3 +a(b|c){0,}d ad 0 2 -1 -1 +a(b|c){0,}d abcd 0 4 2 3 +a(b|c){1,1}d abd 0 3 1 2 +a(b|c){1,2}d abd 0 3 1 2 +a(b|c){1,2}d abcd 0 4 2 3 +a(b|c){1,}d abd 0 3 1 2 +a(b|c){1,}d abcd 0 4 2 3 +a(b|c){2,2}d acbd 0 4 2 3 +a(b|c){2,2}d abcd 0 4 2 3 +a(b|c){2,4}d abcd 0 4 2 3 +a(b|c){2,4}d abcbd 0 5 3 4 +a(b|c){2,4}d abcbcd 0 6 4 5 +a(b|c){2,}d abcd 0 4 2 3 +a(b|c){2,}d abcbd 0 5 3 4 +; perl only: these conflict with the POSIX test below +;a(b|c?)+d abcd 0 4 3 3 +;a(b+|((c)*))+d abd 0 3 2 2 2 2 -1 -1 +;a(b+|((c)*))+d abcd 0 4 3 3 3 3 2 3 + +; posix only: +- match_default extended REG_EXTENDED REG_STARTEND + +a(b|c?)+d abcd 0 4 2 3 +a(b|((c)*))+d abcd 0 4 2 3 2 3 2 3 +a(b+|((c)*))+d abd 0 3 1 2 -1 -1 -1 -1 +a(b+|((c)*))+d abcd 0 4 2 3 2 3 2 3 +a(b|((c)*))+d ad 0 2 1 1 1 1 -1 -1 +a(b|((c)*))*d abcd 0 4 2 3 2 3 2 3 +a(b+|((c)*))*d abd 0 3 1 2 -1 -1 -1 -1 +a(b+|((c)*))*d abcd 0 4 2 3 2 3 2 3 +a(b|((c)*))*d ad 0 2 1 1 1 1 -1 -1 + +- match_default normal REG_PERL +; try to match C++ syntax elements: +; line comment: +//[^\n]* "++i //here is a line comment\n" 4 28 +; block comment: +/\*([^*]|\*+[^*/])*\*+/ "/* here is a block comment */" 0 29 26 27 +/\*([^*]|\*+[^*/])*\*+/ "/**/" 0 4 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/***/" 0 5 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/****/" 0 6 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/*****/" 0 7 -1 -1 +/\*([^*]|\*+[^*/])*\*+/ "/*****/*/" 0 7 -1 -1 +; preprossor directives: +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol" 0 19 -1 -1 +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) #x" 0 25 -1 -1 +; perl only: +^[[:blank:]]*#([^\n]*\\[[:space:]]+)*[^\n]* "#define some_symbol(x) \\ \r\n foo();\\\r\n printf(#x);" 0 53 30 42 +; literals: +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFF 0 4 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 35 0 2 0 2 -1 -1 0 2 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFu 0 5 0 4 0 4 -1 -1 -1 -1 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFL 0 5 0 4 0 4 -1 -1 4 5 -1 -1 -1 -1 +((0x[[:xdigit:]]+)|([[:digit:]]+))u?((int(8|16|32|64))|L)? 0xFFFFFFFFFFFFFFFFuint64 0 24 0 18 0 18 -1 -1 19 24 19 24 22 24 +; strings: +'([^\\']|\\.)*' '\\x3A' 0 6 4 5 +'([^\\']|\\.)*' '\\'' 0 4 1 3 +'([^\\']|\\.)*' '\\n' 0 4 1 3 + +; finally try some case insensitive matches: +- match_default normal REG_EXTENDED REG_ICASE +; upper and lower have no meaning here so they fail, however these +; may compile with other libraries... +;[[:lower:]] ! +;[[:upper:]] ! +0123456789@abcdefghijklmnopqrstuvwxyz\[\\\]\^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ\{\|\} 0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\} 0 72 + +; known and suspected bugs: +- match_default normal REG_EXTENDED +\( ( 0 1 +\) ) 0 1 +\$ $ 0 1 +\^ ^ 0 1 +\. . 0 1 +\* * 0 1 +\+ + 0 1 +\? ? 0 1 +\[ [ 0 1 +\] ] 0 1 +\| | 0 1 +\\ \\ 0 1 +# # 0 1 +\# # 0 1 +a- a- 0 2 +\- - 0 1 +\{ { 0 1 +\} } 0 1 +0 0 0 1 +1 1 0 1 +9 9 0 1 +b b 0 1 +B B 0 1 +< < 0 1 +> > 0 1 +w w 0 1 +W W 0 1 +` ` 0 1 +' ' 0 1 +\n \n 0 1 +, , 0 1 +a a 0 1 +f f 0 1 +n n 0 1 +r r 0 1 +t t 0 1 +v v 0 1 +c c 0 1 +x x 0 1 +: : 0 1 +(\.[[:alnum:]]+){2} "w.a.b " 1 5 3 5 + +- match_default normal REG_EXTENDED REG_ICASE +a A 0 1 +A a 0 1 +[abc]+ abcABC 0 6 +[ABC]+ abcABC 0 6 +[a-z]+ abcABC 0 6 +[A-Z]+ abzANZ 0 6 +[a-Z]+ abzABZ 0 6 +[A-z]+ abzABZ 0 6 +[[:lower:]]+ abyzABYZ 0 8 +[[:upper:]]+ abzABZ 0 6 +[[:alpha:]]+ abyzABYZ 0 8 +[[:alnum:]]+ 09abyzABYZ 0 10 + +; word start: +\<abcd " abcd" 2 6 +\<ab cab -1 -1 +\<ab "\nab" 1 3 +\<tag ::tag 2 5 +;word end: +abc\> abc 0 3 +abc\> abcd -1 -1 +abc\> abc\n 0 3 +abc\> abc:: 0 3 + +; collating elements and rewritten set code: +- match_default normal REG_EXTENDED REG_STARTEND +;[[.zero.]] 0 0 1 +;[[.one.]] 1 0 1 +;[[.two.]] 2 0 1 +;[[.three.]] 3 0 1 +[[.a.]] baa 1 2 +;[[.right-curly-bracket.]] } 0 1 +;[[.NUL.]] \0 0 1 +[[:<:]z] ! +[a[:>:]] ! +[[=a=]] a 0 1 +;[[=right-curly-bracket=]] } 0 1 +- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE +[[.A.]] A 0 1 +[[.A.]] a 0 1 +[[.A.]-b]+ AaBb 0 4 +[A-[.b.]]+ AaBb 0 4 +[[.a.]-B]+ AaBb 0 4 +[a-[.B.]]+ AaBb 0 4 +- match_default normal REG_EXTENDED REG_STARTEND +[[.a.]-c]+ abcd 0 3 +[a-[.c.]]+ abcd 0 3 +[[:alpha:]-a] ! +[a-[:alpha:]] ! + +; try mutli-character ligatures: +;[[.ae.]] ae 0 2 +;[[.ae.]] aE -1 -1 +;[[.AE.]] AE 0 2 +;[[.Ae.]] Ae 0 2 +;[[.ae.]-b] a -1 -1 +;[[.ae.]-b] b 0 1 +;[[.ae.]-b] ae 0 2 +;[a-[.ae.]] a 0 1 +;[a-[.ae.]] b -1 -1 +;[a-[.ae.]] ae 0 2 +- match_default normal REG_EXTENDED REG_STARTEND REG_ICASE +;[[.ae.]] AE 0 2 +;[[.ae.]] Ae 0 2 +;[[.AE.]] Ae 0 2 +;[[.Ae.]] aE 0 2 +;[[.AE.]-B] a -1 -1 +;[[.Ae.]-b] b 0 1 +;[[.Ae.]-b] B 0 1 +;[[.ae.]-b] AE 0 2 + +- match_default normal REG_EXTENDED REG_STARTEND REG_NO_POSIX_TEST +\s+ "ab ab" 2 5 +\S+ " abc " 2 5 + +- match_default normal REG_EXTENDED REG_STARTEND +\`abc abc 0 3 +\`abc aabc -1 -1 +abc\' abc 0 3 +abc\' abcd -1 -1 +abc\' abc\n\n -1 -1 +abc\' abc 0 3 + +; extended repeat checking to exercise new algorithms: +ab.*xy abxy_ 0 4 +ab.*xy ab_xy_ 0 5 +ab.*xy abxy 0 4 +ab.*xy ab_xy 0 5 +ab.* ab 0 2 +ab.* ab__ 0 4 + +ab.{2,5}xy ab__xy_ 0 6 +ab.{2,5}xy ab____xy_ 0 8 +ab.{2,5}xy ab_____xy_ 0 9 +ab.{2,5}xy ab__xy 0 6 +ab.{2,5}xy ab_____xy 0 9 +ab.{2,5} ab__ 0 4 +ab.{2,5} ab_______ 0 7 +ab.{2,5}xy ab______xy -1 -1 +ab.{2,5}xy ab_xy -1 -1 + +ab.*?xy abxy_ 0 4 +ab.*?xy ab_xy_ 0 5 +ab.*?xy abxy 0 4 +ab.*?xy ab_xy 0 5 +ab.*? ab 0 2 +ab.*? ab__ 0 4 + +ab.{2,5}?xy ab__xy_ 0 6 +ab.{2,5}?xy ab____xy_ 0 8 +ab.{2,5}?xy ab_____xy_ 0 9 +ab.{2,5}?xy ab__xy 0 6 +ab.{2,5}?xy ab_____xy 0 9 +ab.{2,5}? ab__ 0 4 +ab.{2,5}? ab_______ 0 7 +ab.{2,5}?xy ab______xy -1 -1 +ab.{2,5}xy ab_xy -1 -1 + +; again but with slower algorithm variant: +- match_default REG_EXTENDED +; now again for single character repeats: + +ab_*xy abxy_ 0 4 +ab_*xy ab_xy_ 0 5 +ab_*xy abxy 0 4 +ab_*xy ab_xy 0 5 +ab_* ab 0 2 +ab_* ab__ 0 4 + +ab_{2,5}xy ab__xy_ 0 6 +ab_{2,5}xy ab____xy_ 0 8 +ab_{2,5}xy ab_____xy_ 0 9 +ab_{2,5}xy ab__xy 0 6 +ab_{2,5}xy ab_____xy 0 9 +ab_{2,5} ab__ 0 4 +ab_{2,5} ab_______ 0 7 +ab_{2,5}xy ab______xy -1 -1 +ab_{2,5}xy ab_xy -1 -1 + +ab_*?xy abxy_ 0 4 +ab_*?xy ab_xy_ 0 5 +ab_*?xy abxy 0 4 +ab_*?xy ab_xy 0 5 +ab_*? ab 0 2 +ab_*? ab__ 0 4 + +ab_{2,5}?xy ab__xy_ 0 6 +ab_{2,5}?xy ab____xy_ 0 8 +ab_{2,5}?xy ab_____xy_ 0 9 +ab_{2,5}?xy ab__xy 0 6 +ab_{2,5}?xy ab_____xy 0 9 +ab_{2,5}? ab__ 0 4 +ab_{2,5}? ab_______ 0 7 +ab_{2,5}?xy ab______xy -1 -1 +ab_{2,5}xy ab_xy -1 -1 + +; and again for sets: +ab[_,;]*xy abxy_ 0 4 +ab[_,;]*xy ab_xy_ 0 5 +ab[_,;]*xy abxy 0 4 +ab[_,;]*xy ab_xy 0 5 +ab[_,;]* ab 0 2 +ab[_,;]* ab__ 0 4 + +ab[_,;]{2,5}xy ab__xy_ 0 6 +ab[_,;]{2,5}xy ab____xy_ 0 8 +ab[_,;]{2,5}xy ab_____xy_ 0 9 +ab[_,;]{2,5}xy ab__xy 0 6 +ab[_,;]{2,5}xy ab_____xy 0 9 +ab[_,;]{2,5} ab__ 0 4 +ab[_,;]{2,5} ab_______ 0 7 +ab[_,;]{2,5}xy ab______xy -1 -1 +ab[_,;]{2,5}xy ab_xy -1 -1 + +ab[_,;]*?xy abxy_ 0 4 +ab[_,;]*?xy ab_xy_ 0 5 +ab[_,;]*?xy abxy 0 4 +ab[_,;]*?xy ab_xy 0 5 +ab[_,;]*? ab 0 2 +ab[_,;]*? ab__ 0 4 + +ab[_,;]{2,5}?xy ab__xy_ 0 6 +ab[_,;]{2,5}?xy ab____xy_ 0 8 +ab[_,;]{2,5}?xy ab_____xy_ 0 9 +ab[_,;]{2,5}?xy ab__xy 0 6 +ab[_,;]{2,5}?xy ab_____xy 0 9 +ab[_,;]{2,5}? ab__ 0 4 +ab[_,;]{2,5}? ab_______ 0 7 +ab[_,;]{2,5}?xy ab______xy -1 -1 +ab[_,;]{2,5}xy ab_xy -1 -1 + +; and again for tricky sets with digraphs: +;ab[_[.ae.]]*xy abxy_ 0 4 +;ab[_[.ae.]]*xy ab_xy_ 0 5 +;ab[_[.ae.]]*xy abxy 0 4 +;ab[_[.ae.]]*xy ab_xy 0 5 +;ab[_[.ae.]]* ab 0 2 +;ab[_[.ae.]]* ab__ 0 4 + +;ab[_[.ae.]]{2,5}xy ab__xy_ 0 6 +;ab[_[.ae.]]{2,5}xy ab____xy_ 0 8 +;ab[_[.ae.]]{2,5}xy ab_____xy_ 0 9 +;ab[_[.ae.]]{2,5}xy ab__xy 0 6 +;ab[_[.ae.]]{2,5}xy ab_____xy 0 9 +;ab[_[.ae.]]{2,5} ab__ 0 4 +;ab[_[.ae.]]{2,5} ab_______ 0 7 +;ab[_[.ae.]]{2,5}xy ab______xy -1 -1 +;ab[_[.ae.]]{2,5}xy ab_xy -1 -1 + +;ab[_[.ae.]]*?xy abxy_ 0 4 +;ab[_[.ae.]]*?xy ab_xy_ 0 5 +;ab[_[.ae.]]*?xy abxy 0 4 +;ab[_[.ae.]]*?xy ab_xy 0 5 +;ab[_[.ae.]]*? ab 0 2 +;ab[_[.ae.]]*? ab__ 0 2 + +;ab[_[.ae.]]{2,5}?xy ab__xy_ 0 6 +;ab[_[.ae.]]{2,5}?xy ab____xy_ 0 8 +;ab[_[.ae.]]{2,5}?xy ab_____xy_ 0 9 +;ab[_[.ae.]]{2,5}?xy ab__xy 0 6 +;ab[_[.ae.]]{2,5}?xy ab_____xy 0 9 +;ab[_[.ae.]]{2,5}? ab__ 0 4 +;ab[_[.ae.]]{2,5}? ab_______ 0 4 +;ab[_[.ae.]]{2,5}?xy ab______xy -1 -1 +;ab[_[.ae.]]{2,5}xy ab_xy -1 -1 + +; new bugs detected in spring 2003: +- normal match_continuous REG_NO_POSIX_TEST +b abc 1 2 + +() abc 0 0 0 0 +^() abc 0 0 0 0 +^()+ abc 0 0 0 0 +^(){1} abc 0 0 0 0 +^(){2} abc 0 0 0 0 +^((){2}) abc 0 0 0 0 0 0 +() "" 0 0 0 0 +()\1 "" 0 0 0 0 +()\1 a 0 0 0 0 +a()\1b ab 0 2 1 1 +a()b\1 ab 0 2 1 1 + +; subtleties of matching with no sub-expressions marked +- normal match_nosubs REG_NO_POSIX_TEST +a(b?c)+d accd 0 4 +(wee|week)(knights|night) weeknights 0 10 +.* abc 0 3 +a(b|(c))d abd 0 3 +a(b|(c))d acd 0 3 +a(b*|c|e)d abbd 0 4 +a(b*|c|e)d acd 0 3 +a(b*|c|e)d ad 0 2 +a(b?)c abc 0 3 +a(b?)c ac 0 2 +a(b+)c abc 0 3 +a(b+)c abbbc 0 5 +a(b*)c ac 0 2 +(a|ab)(bc([de]+)f|cde) abcdef 0 6 +a([bc]?)c abc 0 3 +a([bc]?)c ac 0 2 +a([bc]+)c abc 0 3 +a([bc]+)c abcc 0 4 +a([bc]+)bc abcbc 0 5 +a(bb+|b)b abb 0 3 +a(bbb+|bb+|b)b abb 0 3 +a(bbb+|bb+|b)b abbb 0 4 +a(bbb+|bb+|b)bb abbb 0 4 +(.*).* abcdef 0 6 +(a*)* bc 0 0 + +- normal nosubs REG_NO_POSIX_TEST +a(b?c)+d accd 0 4 +(wee|week)(knights|night) weeknights 0 10 +.* abc 0 3 +a(b|(c))d abd 0 3 +a(b|(c))d acd 0 3 +a(b*|c|e)d abbd 0 4 +a(b*|c|e)d acd 0 3 +a(b*|c|e)d ad 0 2 +a(b?)c abc 0 3 +a(b?)c ac 0 2 +a(b+)c abc 0 3 +a(b+)c abbbc 0 5 +a(b*)c ac 0 2 +(a|ab)(bc([de]+)f|cde) abcdef 0 6 +a([bc]?)c abc 0 3 +a([bc]?)c ac 0 2 +a([bc]+)c abc 0 3 +a([bc]+)c abcc 0 4 +a([bc]+)bc abcbc 0 5 +a(bb+|b)b abb 0 3 +a(bbb+|bb+|b)b abb 0 3 +a(bbb+|bb+|b)b abbb 0 4 +a(bbb+|bb+|b)bb abbb 0 4 +(.*).* abcdef 0 6 +(a*)* bc 0 0 + diff --git a/test/src/regex-resources/PCRE.tests b/test/src/regex-resources/PCRE.tests new file mode 100644 index 00000000000..0fb9cadafc9 --- /dev/null +++ b/test/src/regex-resources/PCRE.tests @@ -0,0 +1,2386 @@ +# PCRE version 4.4 21-August-2003 + +# Tests taken from PCRE and modified to suit glibc regex. +# +# PCRE LICENCE +# ------------ +# +# PCRE is a library of functions to support regular expressions whose syntax +# and semantics are as close as possible to those of the Perl 5 language. +# +# Written by: Philip Hazel <ph10@cam.ac.uk> +# +# University of Cambridge Computing Service, +# Cambridge, England. Phone: +44 1223 334714. +# +# Copyright (c) 1997-2003 University of Cambridge +# +# Permission is granted to anyone to use this software for any purpose on any +# computer system, and to redistribute it freely, subject to the following +# restrictions: +# +# 1. This software 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. +# +# 2. The origin of this software must not be misrepresented, either by +# explicit claim or by omission. In practice, this means that if you use +# PCRE in software that you distribute to others, commercially or +# otherwise, you must put a sentence like this +# +# Regular expression support is provided by the PCRE library package, +# which is open source software, written by Philip Hazel, and copyright +# by the University of Cambridge, England. +# +# somewhere reasonably visible in your documentation and in any relevant +# files or online help data or similar. A reference to the ftp site for +# the source, that is, to +# +# ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ +# +# should also be given in the documentation. However, this condition is not +# intended to apply to whole chains of software. If package A includes PCRE, +# it must acknowledge it, but if package B is software that includes package +# A, the condition is not imposed on package B (unless it uses PCRE +# independently). +# +# 3. Altered versions must be plainly marked as such, and must not be +# misrepresented as being the original software. +# +# 4. If PCRE is embedded in any software that is released under the GNU +# General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL), +# then the terms of that licence shall supersede any condition above with +# which it is incompatible. +# +# The documentation for PCRE, supplied in the "doc" directory, is distributed +# under the same terms as the software itself. +# +# End +# + +/the quick brown fox/ + the quick brown fox + 0: the quick brown fox + The quick brown FOX +No match + What do you know about the quick brown fox? + 0: the quick brown fox + What do you know about THE QUICK BROWN FOX? +No match + +/The quick brown fox/i + the quick brown fox + 0: the quick brown fox + The quick brown FOX + 0: The quick brown FOX + What do you know about the quick brown fox? + 0: the quick brown fox + What do you know about THE QUICK BROWN FOX? + 0: THE QUICK BROWN FOX + +/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/ + abxyzpqrrrabbxyyyypqAzz + 0: abxyzpqrrrabbxyyyypqAzz + abxyzpqrrrabbxyyyypqAzz + 0: abxyzpqrrrabbxyyyypqAzz + aabxyzpqrrrabbxyyyypqAzz + 0: aabxyzpqrrrabbxyyyypqAzz + aaabxyzpqrrrabbxyyyypqAzz + 0: aaabxyzpqrrrabbxyyyypqAzz + aaaabxyzpqrrrabbxyyyypqAzz + 0: aaaabxyzpqrrrabbxyyyypqAzz + abcxyzpqrrrabbxyyyypqAzz + 0: abcxyzpqrrrabbxyyyypqAzz + aabcxyzpqrrrabbxyyyypqAzz + 0: aabcxyzpqrrrabbxyyyypqAzz + aaabcxyzpqrrrabbxyyyypAzz + 0: aaabcxyzpqrrrabbxyyyypAzz + aaabcxyzpqrrrabbxyyyypqAzz + 0: aaabcxyzpqrrrabbxyyyypqAzz + aaabcxyzpqrrrabbxyyyypqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqAzz + aaabcxyzpqrrrabbxyyyypqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqqAzz + aaabcxyzpqrrrabbxyyyypqqqqqqAzz + 0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz + aaaabcxyzpqrrrabbxyyyypqAzz + 0: aaaabcxyzpqrrrabbxyyyypqAzz + abxyzzpqrrrabbxyyyypqAzz + 0: abxyzzpqrrrabbxyyyypqAzz + aabxyzzzpqrrrabbxyyyypqAzz + 0: aabxyzzzpqrrrabbxyyyypqAzz + aaabxyzzzzpqrrrabbxyyyypqAzz + 0: aaabxyzzzzpqrrrabbxyyyypqAzz + aaaabxyzzzzpqrrrabbxyyyypqAzz + 0: aaaabxyzzzzpqrrrabbxyyyypqAzz + abcxyzzpqrrrabbxyyyypqAzz + 0: abcxyzzpqrrrabbxyyyypqAzz + aabcxyzzzpqrrrabbxyyyypqAzz + 0: aabcxyzzzpqrrrabbxyyyypqAzz + aaabcxyzzzzpqrrrabbxyyyypqAzz + 0: aaabcxyzzzzpqrrrabbxyyyypqAzz + aaaabcxyzzzzpqrrrabbxyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbxyyyypqAzz + aaaabcxyzzzzpqrrrabbbxyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz + aaaabcxyzzzzpqrrrabbbxyyyyypqAzz + 0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz + aaabcxyzpqrrrabbxyyyypABzz + 0: aaabcxyzpqrrrabbxyyyypABzz + aaabcxyzpqrrrabbxyyyypABBzz + 0: aaabcxyzpqrrrabbxyyyypABBzz + >>>aaabxyzpqrrrabbxyyyypqAzz + 0: aaabxyzpqrrrabbxyyyypqAzz + >aaaabxyzpqrrrabbxyyyypqAzz + 0: aaaabxyzpqrrrabbxyyyypqAzz + >>>>abcxyzpqrrrabbxyyyypqAzz + 0: abcxyzpqrrrabbxyyyypqAzz + *** Failers +No match + abxyzpqrrabbxyyyypqAzz +No match + abxyzpqrrrrabbxyyyypqAzz +No match + abxyzpqrrrabxyyyypqAzz +No match + aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz +No match + aaaabcxyzzzzpqrrrabbbxyyypqAzz +No match + aaabcxyzpqrrrabbxyyyypqqqqqqqAzz +No match + +/^(abc){1,2}zz/ + abczz + 0: abczz + 1: abc + abcabczz + 0: abcabczz + 1: abc + *** Failers +No match + zz +No match + abcabcabczz +No match + >>abczz +No match + +/^(b+|a){1,2}c/ + bc + 0: bc + 1: b + bbc + 0: bbc + 1: bb + bbbc + 0: bbbc + 1: bbb + bac + 0: bac + 1: a + bbac + 0: bbac + 1: a + aac + 0: aac + 1: a + abbbbbbbbbbbc + 0: abbbbbbbbbbbc + 1: bbbbbbbbbbb + bbbbbbbbbbbac + 0: bbbbbbbbbbbac + 1: a + *** Failers +No match + aaac +No match + abbbbbbbbbbbac +No match + +/^[]cde]/ + ]thing + 0: ] + cthing + 0: c + dthing + 0: d + ething + 0: e + *** Failers +No match + athing +No match + fthing +No match + +/^[^]cde]/ + athing + 0: a + fthing + 0: f + *** Failers + 0: * + ]thing +No match + cthing +No match + dthing +No match + ething +No match + +/^[0-9]+$/ + 0 + 0: 0 + 1 + 0: 1 + 2 + 0: 2 + 3 + 0: 3 + 4 + 0: 4 + 5 + 0: 5 + 6 + 0: 6 + 7 + 0: 7 + 8 + 0: 8 + 9 + 0: 9 + 10 + 0: 10 + 100 + 0: 100 + *** Failers +No match + abc +No match + +/^.*nter/ + enter + 0: enter + inter + 0: inter + uponter + 0: uponter + +/^xxx[0-9]+$/ + xxx0 + 0: xxx0 + xxx1234 + 0: xxx1234 + *** Failers +No match + xxx +No match + +/^.+[0-9][0-9][0-9]$/ + x123 + 0: x123 + xx123 + 0: xx123 + 123456 + 0: 123456 + *** Failers +No match + 123 +No match + x1234 + 0: x1234 + +/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/ + abc!pqr=apquxz.ixr.zzz.ac.uk + 0: abc!pqr=apquxz.ixr.zzz.ac.uk + 1: abc + 2: pqr + *** Failers +No match + !pqr=apquxz.ixr.zzz.ac.uk +No match + abc!=apquxz.ixr.zzz.ac.uk +No match + abc!pqr=apquxz:ixr.zzz.ac.uk +No match + abc!pqr=apquxz.ixr.zzz.ac.ukk +No match + +/:/ + Well, we need a colon: somewhere + 0: : + *** Fail if we don't +No match + +/([0-9a-f:]+)$/i + 0abc + 0: 0abc + 1: 0abc + abc + 0: abc + 1: abc + fed + 0: fed + 1: fed + E + 0: E + 1: E + :: + 0: :: + 1: :: + 5f03:12C0::932e + 0: 5f03:12C0::932e + 1: 5f03:12C0::932e + fed def + 0: def + 1: def + Any old stuff + 0: ff + 1: ff + *** Failers +No match + 0zzz +No match + gzzz +No match + Any old rubbish +No match + +/^.*\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/ + .1.2.3 + 0: .1.2.3 + 1: 1 + 2: 2 + 3: 3 + A.12.123.0 + 0: A.12.123.0 + 1: 12 + 2: 123 + 3: 0 + *** Failers +No match + .1.2.3333 +No match + 1.2.3 +No match + 1234.2.3 +No match + +/^([0-9]+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/ + 1 IN SOA non-sp1 non-sp2( + 0: 1 IN SOA non-sp1 non-sp2( + 1: 1 + 2: non-sp1 + 3: non-sp2 + 1 IN SOA non-sp1 non-sp2 ( + 0: 1 IN SOA non-sp1 non-sp2 ( + 1: 1 + 2: non-sp1 + 3: non-sp2 + *** Failers +No match + 1IN SOA non-sp1 non-sp2( +No match + +/^[a-zA-Z0-9][a-zA-Z0-9-]*(\.[a-zA-Z0-9][a-zA-z0-9-]*)*\.$/ + a. + 0: a. + Z. + 0: Z. + 2. + 0: 2. + ab-c.pq-r. + 0: ab-c.pq-r. + 1: .pq-r + sxk.zzz.ac.uk. + 0: sxk.zzz.ac.uk. + 1: .uk + x-.y-. + 0: x-.y-. + 1: .y- + *** Failers +No match + -abc.peq. +No match + +/^\*\.[a-z]([a-z0-9-]*[a-z0-9]+)?(\.[a-z]([a-z0-9-]*[a-z0-9]+)?)*$/ + *.a + 0: *.a + *.b0-a + 0: *.b0-a + 1: 0-a + *.c3-b.c + 0: *.c3-b.c + 1: 3-b + 2: .c + *.c-a.b-c + 0: *.c-a.b-c + 1: -a + 2: .b-c + 3: -c + *** Failers +No match + *.0 +No match + *.a- +No match + *.a-b.c- +No match + *.c-a.0-c +No match + +/^[0-9a-f](\.[0-9a-f])*$/i + a.b.c.d + 0: a.b.c.d + 1: .d + A.B.C.D + 0: A.B.C.D + 1: .D + a.b.c.1.2.3.C + 0: a.b.c.1.2.3.C + 1: .C + +/^".*"\s*(;.*)?$/ + "1234" + 0: "1234" + "abcd" ; + 0: "abcd" ; + 1: ; + "" ; rhubarb + 0: "" ; rhubarb + 1: ; rhubarb + *** Failers +No match + "1234" : things +No match + +/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/ + abcdefhijklm + 0: abcdefhijklm + 1: abc + 2: bc + 3: c + 4: def + 5: ef + 6: f + 7: hij + 8: ij + 9: j +10: klm +11: lm +12: m + +/^a*\w/ + z + 0: z + az + 0: az + aaaz + 0: aaaz + a + 0: a + aa + 0: aa + aaaa + 0: aaaa + a+ + 0: a + aa+ + 0: aa + +/^a+\w/ + az + 0: az + aaaz + 0: aaaz + aa + 0: aa + aaaa + 0: aaaa + aa+ + 0: aa + +/^[0-9]{8}\w{2,}/ + 1234567890 + 0: 1234567890 + 12345678ab + 0: 12345678ab + 12345678__ + 0: 12345678__ + *** Failers +No match + 1234567 +No match + +/^[aeiou0-9]{4,5}$/ + uoie + 0: uoie + 1234 + 0: 1234 + 12345 + 0: 12345 + aaaaa + 0: aaaaa + *** Failers +No match + 123456 +No match + +/\`(abc|def)=(\1){2,3}\'/ + abc=abcabc + 0: abc=abcabc + 1: abc + 2: abc + def=defdefdef + 0: def=defdefdef + 1: def + 2: def + *** Failers +No match + abc=defdef +No match + +/(cat(a(ract|tonic)|erpillar)) \1()2(3)/ + cataract cataract23 + 0: cataract cataract23 + 1: cataract + 2: aract + 3: ract + 4: + 5: 3 + catatonic catatonic23 + 0: catatonic catatonic23 + 1: catatonic + 2: atonic + 3: tonic + 4: + 5: 3 + caterpillar caterpillar23 + 0: caterpillar caterpillar23 + 1: caterpillar + 2: erpillar + 3: <unset> + 4: + 5: 3 + + +/^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/ + From abcd Mon Sep 01 12:33:02 1997 + 0: From abcd Mon Sep 01 12:33 + 1: abcd + +/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}[0-9]{1,2}\s+[0-9][0-9]:[0-9][0-9]/ + From abcd Mon Sep 01 12:33:02 1997 + 0: From abcd Mon Sep 01 12:33 + 1: Sep + From abcd Mon Sep 1 12:33:02 1997 + 0: From abcd Mon Sep 1 12:33 + 1: Sep + *** Failers +No match + From abcd Sep 01 12:33:02 1997 +No match + +/^(a)\1{2,3}(.)/ + aaab + 0: aaab + 1: a + 2: b + aaaab + 0: aaaab + 1: a + 2: b + aaaaab + 0: aaaaa + 1: a + 2: a + aaaaaab + 0: aaaaa + 1: a + 2: a + +/^[ab]{1,3}(ab*|b)/ + aabbbbb + 0: aabbbbb + 1: abbbbb + +/^(cow|)\1(bell)/ + cowcowbell + 0: cowcowbell + 1: cow + 2: bell + bell + 0: bell + 1: + 2: bell + *** Failers +No match + cowbell +No match + +/^(a|)\1+b/ + aab + 0: aab + 1: a + aaaab + 0: aaaab + 1: a + b + 0: b + 1: + *** Failers +No match + ab +No match + +/^(a|)\1{2}b/ + aaab + 0: aaab + 1: a + b + 0: b + 1: + *** Failers +No match + ab +No match + aab +No match + aaaab +No match + +/^(a|)\1{2,3}b/ + aaab + 0: aaab + 1: a + aaaab + 0: aaaab + 1: a + b + 0: b + 1: + *** Failers +No match + ab +No match + aab +No match + aaaaab +No match + +/ab{1,3}bc/ + abbbbc + 0: abbbbc + abbbc + 0: abbbc + abbc + 0: abbc + *** Failers +No match + abc +No match + abbbbbc +No match + +/([^.]*)\.([^:]*):[T ]+(.*)/ + track1.title:TBlah blah blah + 0: track1.title:TBlah blah blah + 1: track1 + 2: title + 3: Blah blah blah + +/([^.]*)\.([^:]*):[T ]+(.*)/i + track1.title:TBlah blah blah + 0: track1.title:TBlah blah blah + 1: track1 + 2: title + 3: Blah blah blah + +/([^.]*)\.([^:]*):[t ]+(.*)/i + track1.title:TBlah blah blah + 0: track1.title:TBlah blah blah + 1: track1 + 2: title + 3: Blah blah blah + +/^abc$/ + abc + 0: abc + *** Failers +No match + +/[-az]+/ + az- + 0: az- + *** Failers + 0: a + b +No match + +/[az-]+/ + za- + 0: za- + *** Failers + 0: a + b +No match + +/[a-z]+/ + abcdxyz + 0: abcdxyz + +/[0-9-]+/ + 12-34 + 0: 12-34 + *** Failers +No match + aaa +No match + +/(abc)\1/i + abcabc + 0: abcabc + 1: abc + ABCabc + 0: ABCabc + 1: ABC + abcABC + 0: abcABC + 1: abc + +/a{0}bc/ + bc + 0: bc + +/^([^a])([^b])([^c]*)([^d]{3,4})/ + baNOTccccd + 0: baNOTcccc + 1: b + 2: a + 3: NOT + 4: cccc + baNOTcccd + 0: baNOTccc + 1: b + 2: a + 3: NOT + 4: ccc + baNOTccd + 0: baNOTcc + 1: b + 2: a + 3: NO + 4: Tcc + bacccd + 0: baccc + 1: b + 2: a + 3: + 4: ccc + *** Failers + 0: *** Failers + 1: * + 2: * + 3: * Fail + 4: ers + anything +No match + baccd +No match + +/[^a]/ + Abc + 0: A + +/[^a]/i + Abc + 0: b + +/[^a]+/ + AAAaAbc + 0: AAA + +/[^a]+/i + AAAaAbc + 0: bc + +/[^k]$/ + abc + 0: c + *** Failers + 0: s + abk +No match + +/[^k]{2,3}$/ + abc + 0: abc + kbc + 0: bc + kabc + 0: abc + *** Failers + 0: ers + abk +No match + akb +No match + akk +No match + +/^[0-9]{8,}@.+[^k]$/ + 12345678@a.b.c.d + 0: 12345678@a.b.c.d + 123456789@x.y.z + 0: 123456789@x.y.z + *** Failers +No match + 12345678@x.y.uk +No match + 1234567@a.b.c.d +No match + +/(a)\1{8,}/ + aaaaaaaaa + 0: aaaaaaaaa + 1: a + aaaaaaaaaa + 0: aaaaaaaaaa + 1: a + *** Failers +No match + aaaaaaa +No match + +/[^a]/ + aaaabcd + 0: b + aaAabcd + 0: A + +/[^a]/i + aaaabcd + 0: b + aaAabcd + 0: b + +/[^az]/ + aaaabcd + 0: b + aaAabcd + 0: A + +/[^az]/i + aaaabcd + 0: b + aaAabcd + 0: b + +/P[^*]TAIRE[^*]{1,6}LL/ + xxxxxxxxxxxPSTAIREISLLxxxxxxxxx + 0: PSTAIREISLL + +/P[^*]TAIRE[^*]{1,}LL/ + xxxxxxxxxxxPSTAIREISLLxxxxxxxxx + 0: PSTAIREISLL + +/(\.[0-9][0-9][1-9]?)[0-9]+/ + 1.230003938 + 0: .230003938 + 1: .23 + 1.875000282 + 0: .875000282 + 1: .875 + 1.235 + 0: .235 + 1: .23 + +/\b(foo)\s+(\w+)/i + Food is on the foo table + 0: foo table + 1: foo + 2: table + +/foo(.*)bar/ + The food is under the bar in the barn. + 0: food is under the bar in the bar + 1: d is under the bar in the + +/(.*)([0-9]*)/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 53147 + 2: + +/(.*)([0-9]+)/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 5314 + 2: 7 + +/(.*)([0-9]+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: 5314 + 2: 7 + +/(.*)\b([0-9]+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: + 2: 53147 + +/(.*[^0-9])([0-9]+)$/ + I have 2 numbers: 53147 + 0: I have 2 numbers: 53147 + 1: I have 2 numbers: + 2: 53147 + +/[[:digit:]][[:digit:]]\/[[:digit:]][[:digit:]]\/[[:digit:]][[:digit:]][[:digit:]][[:digit:]]/ + 01/01/2000 + 0: 01/01/2000 + +/^(a){0,0}/ + bcd + 0: + abc + 0: + aab + 0: + +/^(a){0,1}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: a + 1: a + +/^(a){0,2}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + +/^(a){0,3}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + +/^(a){0,}/ + bcd + 0: + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + aaaaaaaa + 0: aaaaaaaa + 1: a + +/^(a){1,1}/ + bcd +No match + abc + 0: a + 1: a + aab + 0: a + 1: a + +/^(a){1,2}/ + bcd +No match + abc + 0: a + 1: a + aab + 0: aa + 1: a + +/^(a){1,3}/ + bcd +No match + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + +/^(a){1,}/ + bcd +No match + abc + 0: a + 1: a + aab + 0: aa + 1: a + aaa + 0: aaa + 1: a + aaaaaaaa + 0: aaaaaaaa + 1: a + +/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/ + 123456654321 + 0: 123456654321 + +/^[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]/ + 123456654321 + 0: 123456654321 + +/^[abc]{12}/ + abcabcabcabc + 0: abcabcabcabc + +/^[a-c]{12}/ + abcabcabcabc + 0: abcabcabcabc + +/^(a|b|c){12}/ + abcabcabcabc + 0: abcabcabcabc + 1: c + +/^[abcdefghijklmnopqrstuvwxy0123456789]/ + n + 0: n + *** Failers +No match + z +No match + +/abcde{0,0}/ + abcd + 0: abcd + *** Failers +No match + abce +No match + +/ab[cd]{0,0}e/ + abe + 0: abe + *** Failers +No match + abcde +No match + +/ab(c){0,0}d/ + abd + 0: abd + *** Failers +No match + abcd +No match + +/a(b*)/ + a + 0: a + 1: + ab + 0: ab + 1: b + abbbb + 0: abbbb + 1: bbbb + *** Failers + 0: a + 1: + bbbbb +No match + +/ab[0-9]{0}e/ + abe + 0: abe + *** Failers +No match + ab1e +No match + +/(A|B)*CD/ + CD + 0: CD + +/(AB)*\1/ + ABABAB + 0: ABABAB + 1: AB + +/([0-9]+)(\w)/ + 12345a + 0: 12345a + 1: 12345 + 2: a + 12345+ + 0: 12345 + 1: 1234 + 2: 5 + +/(abc|)+/ + abc + 0: abc + 1: abc + abcabc + 0: abcabc + 1: abc + abcabcabc + 0: abcabcabc + 1: abc + xyz + 0: + 1: + +/([a]*)*/ + a + 0: a + 1: a + aaaaa + 0: aaaaa + 1: aaaaa + +/([ab]*)*/ + a + 0: a + 1: a + b + 0: b + 1: b + ababab + 0: ababab + 1: ababab + aaaabcde + 0: aaaab + 1: aaaab + bbbb + 0: bbbb + 1: bbbb + +/([^a]*)*/ + b + 0: b + 1: b + bbbb + 0: bbbb + 1: bbbb + aaa + 0: + +/([^ab]*)*/ + cccc + 0: cccc + 1: cccc + abab + 0: + +/abc/ + abc + 0: abc + xabcy + 0: abc + ababc + 0: abc + *** Failers +No match + xbc +No match + axc +No match + abx +No match + +/ab*c/ + abc + 0: abc + +/ab*bc/ + abc + 0: abc + abbc + 0: abbc + abbbbc + 0: abbbbc + +/.{1}/ + abbbbc + 0: a + +/.{3,4}/ + abbbbc + 0: abbb + +/ab{0,}bc/ + abbbbc + 0: abbbbc + +/ab+bc/ + abbc + 0: abbc + *** Failers +No match + abc +No match + abq +No match + +/ab+bc/ + abbbbc + 0: abbbbc + +/ab{1,}bc/ + abbbbc + 0: abbbbc + +/ab{1,3}bc/ + abbbbc + 0: abbbbc + +/ab{3,4}bc/ + abbbbc + 0: abbbbc + +/ab{4,5}bc/ + *** Failers +No match + abq +No match + abbbbc +No match + +/ab?bc/ + abbc + 0: abbc + abc + 0: abc + +/ab{0,1}bc/ + abc + 0: abc + +/ab?c/ + abc + 0: abc + +/ab{0,1}c/ + abc + 0: abc + +/^abc$/ + abc + 0: abc + *** Failers +No match + abbbbc +No match + abcc +No match + +/^abc/ + abcc + 0: abc + +/abc$/ + aabc + 0: abc + *** Failers +No match + aabc + 0: abc + aabcd +No match + +/^/ + abc + 0: + +/$/ + abc + 0: + +/a.c/ + abc + 0: abc + axc + 0: axc + +/a.*c/ + axyzc + 0: axyzc + +/a[bc]d/ + abd + 0: abd + *** Failers +No match + axyzd +No match + abc +No match + +/a[b-d]e/ + ace + 0: ace + +/a[b-d]/ + aac + 0: ac + +/a[-b]/ + a- + 0: a- + +/a[b-]/ + a- + 0: a- + +/a[]]b/ + a]b + 0: a]b + +/a[^bc]d/ + aed + 0: aed + *** Failers +No match + abd +No match + abd +No match + +/a[^-b]c/ + adc + 0: adc + +/a[^]b]c/ + adc + 0: adc + *** Failers +No match + a-c + 0: a-c + a]c +No match + +/\ba\b/ + a- + 0: a + -a + 0: a + -a- + 0: a + +/\by\b/ + *** Failers +No match + xy +No match + yz +No match + xyz +No match + +/\Ba\B/ + *** Failers + 0: a + a- +No match + -a +No match + -a- +No match + +/\By\b/ + xy + 0: y + +/\by\B/ + yz + 0: y + +/\By\B/ + xyz + 0: y + +/\w/ + a + 0: a + +/\W/ + - + 0: - + *** Failers + 0: * + - + 0: - + a +No match + +/a\sb/ + a b + 0: a b + +/a\Sb/ + a-b + 0: a-b + *** Failers +No match + a-b + 0: a-b + a b +No match + +/[0-9]/ + 1 + 0: 1 + +/[^0-9]/ + - + 0: - + *** Failers + 0: * + - + 0: - + 1 +No match + +/ab|cd/ + abc + 0: ab + abcd + 0: ab + +/()ef/ + def + 0: ef + 1: + +/a\(b/ + a(b + 0: a(b + +/a\(*b/ + ab + 0: ab + a((b + 0: a((b + +/((a))/ + abc + 0: a + 1: a + 2: a + +/(a)b(c)/ + abc + 0: abc + 1: a + 2: c + +/a+b+c/ + aabbabc + 0: abc + +/a{1,}b{1,}c/ + aabbabc + 0: abc + +/(a+|b)*/ + ab + 0: ab + 1: b + +/(a+|b){0,}/ + ab + 0: ab + 1: b + +/(a+|b)+/ + ab + 0: ab + 1: b + +/(a+|b){1,}/ + ab + 0: ab + 1: b + +/(a+|b)?/ + ab + 0: a + 1: a + +/(a+|b){0,1}/ + ab + 0: a + 1: a + +/[^ab]*/ + cde + 0: cde + +/abc/ + *** Failers +No match + b +No match + + +/a*/ + + +/([abc])*d/ + abbbcd + 0: abbbcd + 1: c + +/([abc])*bcd/ + abcd + 0: abcd + 1: a + +/a|b|c|d|e/ + e + 0: e + +/(a|b|c|d|e)f/ + ef + 0: ef + 1: e + +/abcd*efg/ + abcdefg + 0: abcdefg + +/ab*/ + xabyabbbz + 0: ab + xayabbbz + 0: a + +/(ab|cd)e/ + abcde + 0: cde + 1: cd + +/[abhgefdc]ij/ + hij + 0: hij + +/(abc|)ef/ + abcdef + 0: ef + 1: + +/(a|b)c*d/ + abcd + 0: bcd + 1: b + +/(ab|ab*)bc/ + abc + 0: abc + 1: a + +/a([bc]*)c*/ + abc + 0: abc + 1: bc + +/a([bc]*)(c*d)/ + abcd + 0: abcd + 1: bc + 2: d + +/a([bc]+)(c*d)/ + abcd + 0: abcd + 1: bc + 2: d + +/a([bc]*)(c+d)/ + abcd + 0: abcd + 1: b + 2: cd + +/a[bcd]*dcdcde/ + adcdcde + 0: adcdcde + +/a[bcd]+dcdcde/ + *** Failers +No match + abcde +No match + adcdcde +No match + +/(ab|a)b*c/ + abc + 0: abc + 1: ab + +/((a)(b)c)(d)/ + abcd + 0: abcd + 1: abc + 2: a + 3: b + 4: d + +/[a-zA-Z_][a-zA-Z0-9_]*/ + alpha + 0: alpha + +/^a(bc+|b[eh])g|.h$/ + abh + 0: bh + +/(bc+d$|ef*g.|h?i(j|k))/ + effgz + 0: effgz + 1: effgz + ij + 0: ij + 1: ij + 2: j + reffgz + 0: effgz + 1: effgz + *** Failers +No match + effg +No match + bcdd +No match + +/((((((((((a))))))))))/ + a + 0: a + 1: a + 2: a + 3: a + 4: a + 5: a + 6: a + 7: a + 8: a + 9: a +10: a + +/((((((((((a))))))))))\9/ + aa + 0: aa + 1: a + 2: a + 3: a + 4: a + 5: a + 6: a + 7: a + 8: a + 9: a +10: a + +/(((((((((a)))))))))/ + a + 0: a + 1: a + 2: a + 3: a + 4: a + 5: a + 6: a + 7: a + 8: a + 9: a + +/multiple words of text/ + *** Failers +No match + aa +No match + uh-uh +No match + +/multiple words/ + multiple words, yeah + 0: multiple words + +/(.*)c(.*)/ + abcde + 0: abcde + 1: ab + 2: de + +/\((.*), (.*)\)/ + (a, b) + 0: (a, b) + 1: a + 2: b + +/abcd/ + abcd + 0: abcd + +/a(bc)d/ + abcd + 0: abcd + 1: bc + +/a[-]?c/ + ac + 0: ac + +/(abc)\1/ + abcabc + 0: abcabc + 1: abc + +/([a-c]*)\1/ + abcabc + 0: abcabc + 1: abc + +/(a)|\1/ + a + 0: a + 1: a + *** Failers + 0: a + 1: a + ab + 0: a + 1: a + x +No match + +/abc/i + ABC + 0: ABC + XABCY + 0: ABC + ABABC + 0: ABC + *** Failers +No match + aaxabxbaxbbx +No match + XBC +No match + AXC +No match + ABX +No match + +/ab*c/i + ABC + 0: ABC + +/ab*bc/i + ABC + 0: ABC + ABBC + 0: ABBC + +/ab+bc/i + *** Failers +No match + ABC +No match + ABQ +No match + +/ab+bc/i + ABBBBC + 0: ABBBBC + +/^abc$/i + ABC + 0: ABC + *** Failers +No match + ABBBBC +No match + ABCC +No match + +/^abc/i + ABCC + 0: ABC + +/abc$/i + AABC + 0: ABC + +/^/i + ABC + 0: + +/$/i + ABC + 0: + +/a.c/i + ABC + 0: ABC + AXC + 0: AXC + +/a.*c/i + *** Failers +No match + AABC + 0: AABC + AXYZD +No match + +/a[bc]d/i + ABD + 0: ABD + +/a[b-d]e/i + ACE + 0: ACE + *** Failers +No match + ABC +No match + ABD +No match + +/a[b-d]/i + AAC + 0: AC + +/a[-b]/i + A- + 0: A- + +/a[b-]/i + A- + 0: A- + +/a[]]b/i + A]B + 0: A]B + +/a[^bc]d/i + AED + 0: AED + +/a[^-b]c/i + ADC + 0: ADC + *** Failers +No match + ABD +No match + A-C +No match + +/a[^]b]c/i + ADC + 0: ADC + +/ab|cd/i + ABC + 0: AB + ABCD + 0: AB + +/()ef/i + DEF + 0: EF + 1: + +/$b/i + *** Failers +No match + A]C +No match + B +No match + +/a\(b/i + A(B + 0: A(B + +/a\(*b/i + AB + 0: AB + A((B + 0: A((B + +/((a))/i + ABC + 0: A + 1: A + 2: A + +/(a)b(c)/i + ABC + 0: ABC + 1: A + 2: C + +/a+b+c/i + AABBABC + 0: ABC + +/a{1,}b{1,}c/i + AABBABC + 0: ABC + +/(a+|b)*/i + AB + 0: AB + 1: B + +/(a+|b){0,}/i + AB + 0: AB + 1: B + +/(a+|b)+/i + AB + 0: AB + 1: B + +/(a+|b){1,}/i + AB + 0: AB + 1: B + +/(a+|b)?/i + AB + 0: A + 1: A + +/(a+|b){0,1}/i + AB + 0: A + 1: A + +/[^ab]*/i + CDE + 0: CDE + +/([abc])*d/i + ABBBCD + 0: ABBBCD + 1: C + +/([abc])*bcd/i + ABCD + 0: ABCD + 1: A + +/a|b|c|d|e/i + E + 0: E + +/(a|b|c|d|e)f/i + EF + 0: EF + 1: E + +/abcd*efg/i + ABCDEFG + 0: ABCDEFG + +/ab*/i + XABYABBBZ + 0: AB + XAYABBBZ + 0: A + +/(ab|cd)e/i + ABCDE + 0: CDE + 1: CD + +/[abhgefdc]ij/i + HIJ + 0: HIJ + +/^(ab|cd)e/i + ABCDE +No match + +/(abc|)ef/i + ABCDEF + 0: EF + 1: + +/(a|b)c*d/i + ABCD + 0: BCD + 1: B + +/(ab|ab*)bc/i + ABC + 0: ABC + 1: A + +/a([bc]*)c*/i + ABC + 0: ABC + 1: BC + +/a([bc]*)(c*d)/i + ABCD + 0: ABCD + 1: BC + 2: D + +/a([bc]+)(c*d)/i + ABCD + 0: ABCD + 1: BC + 2: D + +/a([bc]*)(c+d)/i + ABCD + 0: ABCD + 1: B + 2: CD + +/a[bcd]*dcdcde/i + ADCDCDE + 0: ADCDCDE + +/a[bcd]+dcdcde/i + +/(ab|a)b*c/i + ABC + 0: ABC + 1: AB + +/((a)(b)c)(d)/i + ABCD + 0: ABCD + 1: ABC + 2: A + 3: B + 4: D + +/[a-zA-Z_][a-zA-Z0-9_]*/i + ALPHA + 0: ALPHA + +/^a(bc+|b[eh])g|.h$/i + ABH + 0: BH + +/(bc+d$|ef*g.|h?i(j|k))/i + EFFGZ + 0: EFFGZ + 1: EFFGZ + IJ + 0: IJ + 1: IJ + 2: J + REFFGZ + 0: EFFGZ + 1: EFFGZ + *** Failers +No match + ADCDCDE +No match + EFFG +No match + BCDD +No match + +/((((((((((a))))))))))/i + A + 0: A + 1: A + 2: A + 3: A + 4: A + 5: A + 6: A + 7: A + 8: A + 9: A +10: A + +/((((((((((a))))))))))\9/i + AA + 0: AA + 1: A + 2: A + 3: A + 4: A + 5: A + 6: A + 7: A + 8: A + 9: A +10: A + +/(((((((((a)))))))))/i + A + 0: A + 1: A + 2: A + 3: A + 4: A + 5: A + 6: A + 7: A + 8: A + 9: A + +/multiple words of text/i + *** Failers +No match + AA +No match + UH-UH +No match + +/multiple words/i + MULTIPLE WORDS, YEAH + 0: MULTIPLE WORDS + +/(.*)c(.*)/i + ABCDE + 0: ABCDE + 1: AB + 2: DE + +/\((.*), (.*)\)/i + (A, B) + 0: (A, B) + 1: A + 2: B + +/abcd/i + ABCD + 0: ABCD + +/a(bc)d/i + ABCD + 0: ABCD + 1: BC + +/a[-]?c/i + AC + 0: AC + +/(abc)\1/i + ABCABC + 0: ABCABC + 1: ABC + +/([a-c]*)\1/i + ABCABC + 0: ABCABC + 1: ABC + +/((foo)|(bar))*/ + foobar + 0: foobar + 1: bar + 2: foo + 3: bar + +/^(.+)?B/ + AB + 0: AB + 1: A + +/^([^a-z])|(\^)$/ + . + 0: . + 1: . + +/^[<>]&/ + <&OUT + 0: <& + +/^(){3,5}/ + abc + 0: + 1: + +/^(a+)*ax/ + aax + 0: aax + 1: a + +/^((a|b)+)*ax/ + aax + 0: aax + 1: a + 2: a + +/^((a|bc)+)*ax/ + aax + 0: aax + 1: a + 2: a + +/(a|x)*ab/ + cab + 0: ab + +/(a)*ab/ + cab + 0: ab + +/(ab)[0-9]\1/i + Ab4ab + 0: Ab4ab + 1: Ab + ab4Ab + 0: ab4Ab + 1: ab + +/foo\w*[0-9]{4}baz/ + foobar1234baz + 0: foobar1234baz + +/(\w+:)+/ + one: + 0: one: + 1: one: + +/((\w|:)+::)?(\w+)$/ + abcd + 0: abcd + 1: <unset> + 2: <unset> + 3: abcd + xy:z:::abcd + 0: xy:z:::abcd + 1: xy:z::: + 2: : + 3: abcd + +/^[^bcd]*(c+)/ + aexycd + 0: aexyc + 1: c + +/(a*)b+/ + caab + 0: aab + 1: aa + +/((\w|:)+::)?(\w+)$/ + abcd + 0: abcd + 1: <unset> + 2: <unset> + 3: abcd + xy:z:::abcd + 0: xy:z:::abcd + 1: xy:z::: + 2: : + 3: abcd + *** Failers + 0: Failers + 1: <unset> + 2: <unset> + 3: Failers + abcd: +No match + abcd: +No match + +/^[^bcd]*(c+)/ + aexycd + 0: aexyc + 1: c + +/((Z)+|A)*/ + ZABCDEFG + 0: ZA + 1: A + 2: Z + +/(Z()|A)*/ + ZABCDEFG + 0: ZA + 1: A + 2: + +/(Z(())|A)*/ + ZABCDEFG + 0: ZA + 1: A + 2: + 3: + +/(.*)[0-9]+\1/ + abc123abc + 0: abc123abc + 1: abc + abc123bc + 0: bc123bc + 1: bc + +/((.*))[0-9]+\1/ + abc123abc + 0: abc123abc + 1: abc + 2: abc + abc123bc + 0: bc123bc + 1: bc + 2: bc + +/^a{2,5}$/ + aa + 0: aa + aaa + 0: aaa + aaaa + 0: aaaa + aaaaa + 0: aaaaa + *** Failers +No match + a +No match + b +No match + aaaaab +No match + aaaaaa diff --git a/test/src/regex-resources/PTESTS b/test/src/regex-resources/PTESTS new file mode 100644 index 00000000000..68acc314d37 --- /dev/null +++ b/test/src/regex-resources/PTESTS @@ -0,0 +1,341 @@ +# 2.8.2 Regular Expression General Requirement +2¦4¦bb*¦abbbc¦ +2¦2¦bb*¦ababbbc¦ +7¦9¦A#*::¦A:A#:qA::qA#::qA##::q¦ +1¦5¦A#*::¦A##::A#::qA::qA#:q¦ +# 2.8.3.1.2 BRE Special Characters +# GA108 +2¦2¦\.¦a.c¦ +2¦2¦\[¦a[c¦ +2¦2¦\\¦a\c¦ +2¦2¦\*¦a*c¦ +2¦2¦\^¦a^c¦ +2¦2¦\$¦a$c¦ +7¦11¦X\*Y\*8¦Y*8X*8X*Y*8¦ +# GA109 +2¦2¦[.]¦a.c¦ +2¦2¦[[]¦a[c¦ +-1¦-1¦[[]¦ac¦ +2¦2¦[\]¦a\c¦ +1¦1¦[\a]¦abc¦ +2¦2¦[\.]¦a\.c¦ +2¦2¦[\.]¦a.\c¦ +2¦2¦[*]¦a*c¦ +2¦2¦[$]¦a$c¦ +2¦2¦[X*Y8]¦7*8YX¦ +# GA110 +2¦2¦*¦a*c¦ +3¦4¦*a¦*b*a*c¦ +1¦5¦**9=¦***9=9¦ +# GA111 +1¦1¦^*¦*bc¦ +-1¦-1¦^*¦a*c¦ +-1¦-1¦^*¦^*ab¦ +1¦5¦^**9=¦***9=¦ +-1¦-1¦^*5<*9¦5<9*5<*9¦ +# GA112 +2¦3¦\(*b\)¦a*b¦ +-1¦-1¦\(*b\)¦ac¦ +1¦6¦A\(**9\)=¦A***9=79¦ +# GA113(1) +1¦3¦\(^*ab\)¦*ab¦ +-1¦-1¦\(^*ab\)¦^*ab¦ +-1¦-1¦\(^*b\)¦a*b¦ +-1¦-1¦\(^*b\)¦^*b¦ +### GA113(2) GNU regex implements GA113(1) +##-1¦-1¦\(^*ab\)¦*ab¦ +##-1¦-1¦\(^*ab\)¦^*ab¦ +##1¦1¦\(^*b\)¦b¦ +##1¦3¦\(^*b\)¦^^b¦ +# GA114 +1¦3¦a^b¦a^b¦ +1¦3¦a\^b¦a^b¦ +1¦1¦^^¦^bc¦ +2¦2¦\^¦a^c¦ +1¦1¦[c^b]¦^abc¦ +1¦1¦[\^ab]¦^ab¦ +2¦2¦[\^ab]¦c\d¦ +-1¦-1¦[^^]¦^¦ +1¦3¦\(a^b\)¦a^b¦ +1¦3¦\(a\^b\)¦a^b¦ +2¦2¦\(\^\)¦a^b¦ +# GA115 +3¦3¦$$¦ab$¦ +-1¦-1¦$$¦$ab¦ +2¦3¦$c¦a$c¦ +2¦2¦[$]¦a$c¦ +1¦2¦\$a¦$a¦ +3¦3¦\$$¦ab$¦ +2¦6¦A\([34]$[34]\)B¦XA4$3BY¦ +# 2.8.3.1.3 Periods in BREs +# GA116 +1¦1¦.¦abc¦ +-1¦-1¦.ab¦abc¦ +1¦3¦ab.¦abc¦ +1¦3¦a.b¦a,b¦ +-1¦-1¦.......¦PqRs6¦ +1¦7¦.......¦PqRs6T8¦ +# 2.8.3.2 RE Bracket Expression +# GA118 +2¦2¦[abc]¦xbyz¦ +-1¦-1¦[abc]¦xyz¦ +2¦2¦[abc]¦xbay¦ +# GA119 +2¦2¦[^a]¦abc¦ +4¦4¦[^]cd]¦cd]ef¦ +2¦2¦[^abc]¦axyz¦ +-1¦-1¦[^abc]¦abc¦ +3¦3¦[^[.a.]b]¦abc¦ +3¦3¦[^[=a=]b]¦abc¦ +2¦2¦[^-ac]¦abcde-¦ +2¦2¦[^ac-]¦abcde-¦ +3¦3¦[^a-b]¦abcde¦ +3¦3¦[^a-bd-e]¦dec¦ +2¦2¦[^---]¦-ab¦ +16¦16¦[^a-zA-Z0-9]¦pqrstVWXYZ23579#¦ +# GA120(1) +3¦3¦[]a]¦cd]ef¦ +1¦1¦[]-a]¦a_b¦ +3¦3¦[][.-.]-0]¦ab0-]¦ +1¦1¦[]^a-z]¦string¦ +# GA120(2) +4¦4¦[^]cd]¦cd]ef¦ +0¦0¦[^]]*¦]]]]]]]]X¦ +0¦0¦[^]]*¦]]]]]]]]¦ +9¦9¦[^]]\{1,\}¦]]]]]]]]X¦ +-1¦-1¦[^]]\{1,\}¦]]]]]]]]¦ +# GA120(3) +3¦3¦[c[.].]d]¦ab]cd¦ +2¦8¦[a-z]*[[.].]][A-Z]*¦Abcd]DEFg¦ +# GA121 +2¦2¦[[.a.]b]¦Abc¦ +1¦1¦[[.a.]b]¦aBc¦ +-1¦-1¦[[.a.]b]¦ABc¦ +3¦3¦[^[.a.]b]¦abc¦ +3¦3¦[][.-.]-0]¦ab0-]¦ +3¦3¦[A-[.].]c]¦ab]!¦ +# GA122 +-2¦-2¦[[.ch.]]¦abc¦ +-2¦-2¦[[.ab.][.CD.][.EF.]]¦yZabCDEFQ9¦ +# GA125 +2¦2¦[[=a=]b]¦Abc¦ +1¦1¦[[=a=]b]¦aBc¦ +-1¦-1¦[[=a=]b]¦ABc¦ +3¦3¦[^[=a=]b]¦abc¦ +# GA126 +#W the expected result for [[:alnum:]]* is 2-7 which is wrong +0¦0¦[[:alnum:]]*¦ aB28gH¦ +2¦7¦[[:alnum:]][[:alnum:]]*¦ aB28gH¦ +#W the expected result for [^[:alnum:]]* is 2-5 which is wrong +0¦0¦[^[:alnum:]]*¦2 ,a¦ +2¦5¦[^[:alnum:]][^[:alnum:]]*¦2 ,a¦ +#W the expected result for [[:alpha:]]* is 2-5 which is wrong +0¦0¦[[:alpha:]]*¦ aBgH2¦ +2¦5¦[[:alpha:]][[:alpha:]]*¦ aBgH2¦ +1¦6¦[^[:alpha:]]*¦2 8,a¦ +1¦2¦[[:blank:]]*¦
¦ +1¦8¦[^[:blank:]]*¦aB28gH, ¦ +1¦2¦[[:cntrl:]]*¦ ¦ +1¦8¦[^[:cntrl:]]*¦aB2 8gh,¦ +#W the expected result for [[:digit:]]* is 2-3 which is wrong +0¦0¦[[:digit:]]*¦a28¦ +2¦3¦[[:digit:]][[:digit:]]*¦a28¦ +1¦8¦[^[:digit:]]*¦aB gH,¦ +1¦7¦[[:graph:]]*¦aB28gH, ¦ +1¦3¦[^[:graph:]]*¦ ,¦ +1¦2¦[[:lower:]]*¦agB¦ +1¦8¦[^[:lower:]]*¦B2 8H,a¦ +1¦8¦[[:print:]]*¦aB2 8gH, ¦ +1¦2¦[^[:print:]]*¦ ¦ +#W the expected result for [[:punct:]]* is 2-2 which is wrong +0¦0¦[[:punct:]]*¦a,2¦ +2¦3¦[[:punct:]][[:punct:]]*¦a,,2¦ +1¦9¦[^[:punct:]]*¦aB2 8gH¦ +1¦3¦[[:space:]]*¦
¦ +#W the expected result for [^[:space:]]* is 2-9 which is wrong +0¦0¦[^[:space:]]*¦ aB28gH, ¦ +2¦9¦[^[:space:]][^[:space:]]*¦ aB28gH, ¦ +#W the expected result for [[:upper:]]* is 2-3 which is wrong +0¦0¦[[:upper:]]*¦aBH2¦ +2¦3¦[[:upper:]][[:upper:]]*¦aBH2¦ +1¦8¦[^[:upper:]]*¦a2 8g,B¦ +#W the expected result for [[:xdigit:]]* is 2-5 which is wrong +0¦0¦[[:xdigit:]]*¦gaB28h¦ +2¦5¦[[:xdigit:]][[:xdigit:]]*¦gaB28h¦ +#W the expected result for [^[:xdigit:]]* is 2-7 which is wrong +2¦7¦[^[:xdigit:]][^[:xdigit:]]*¦a gH,2¦ +# GA127 +-2¦-2¦[b-a]¦abc¦ +1¦1¦[a-c]¦bbccde¦ +2¦2¦[a-b]¦-bc¦ +3¦3¦[a-z0-9]¦AB0¦ +3¦3¦[^a-b]¦abcde¦ +3¦3¦[^a-bd-e]¦dec¦ +1¦1¦[]-a]¦a_b¦ +2¦2¦[+--]¦a,b¦ +2¦2¦[--/]¦a.b¦ +2¦2¦[^---]¦-ab¦ +3¦3¦[][.-.]-0]¦ab0-]¦ +3¦3¦[A-[.].]c]¦ab]!¦ +2¦6¦bc[d-w]xy¦abchxyz¦ +# GA129 +1¦1¦[a-cd-f]¦dbccde¦ +-1¦-1¦[a-ce-f]¦dBCCdE¦ +2¦4¦b[n-zA-M]Y¦absY9Z¦ +2¦4¦b[n-zA-M]Y¦abGY9Z¦ +# GA130 +3¦3¦[-xy]¦ac-¦ +2¦4¦c[-xy]D¦ac-D+¦ +2¦2¦[--/]¦a.b¦ +2¦4¦c[--/]D¦ac.D+b¦ +2¦2¦[^-ac]¦abcde-¦ +1¦3¦a[^-ac]c¦abcde-¦ +3¦3¦[xy-]¦zc-¦ +2¦4¦c[xy-]7¦zc-786¦ +2¦2¦[^ac-]¦abcde-¦ +2¦4¦a[^ac-]c¦5abcde-¦ +2¦2¦[+--]¦a,b¦ +2¦4¦a[+--]B¦Xa,By¦ +2¦2¦[^---]¦-ab¦ +4¦6¦X[^---]Y¦X-YXaYXbY¦ +# 2.8.3.3 BREs Matching Multiple Characters +# GA131 +3¦4¦cd¦abcdeabcde¦ +1¦2¦ag*b¦abcde¦ +-1¦-1¦[a-c][e-f]¦abcdef¦ +3¦4¦[a-c][e-f]¦acbedf¦ +4¦8¦abc*XYZ¦890abXYZ#*¦ +4¦9¦abc*XYZ¦890abcXYZ#*¦ +4¦15¦abc*XYZ¦890abcccccccXYZ#*¦ +-1¦-1¦abc*XYZ¦890abc*XYZ#*¦ +# GA132 +2¦4¦\(*bc\)¦a*bc¦ +1¦2¦\(ab\)¦abcde¦ +1¦10¦\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)¦abcdefghijk¦ +3¦8¦43\(2\(6\)*0\)AB¦654320ABCD¦ +3¦9¦43\(2\(7\)*0\)AB¦6543270ABCD¦ +3¦12¦43\(2\(7\)*0\)AB¦6543277770ABCD¦ +# GA133 +1¦10¦\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)¦abcdefghijk¦ +-1¦-1¦\(a\(b\(c\(d\(e\(f\(g\)h\(i\(k\)\)\)\)\)\)\)\)¦abcdefghijk¦ +# GA134 +2¦4¦\(bb*\)¦abbbc¦ +2¦2¦\(bb*\)¦ababbbc¦ +1¦6¦a\(.*b\)¦ababbbc¦ +1¦2¦a\(b*\)¦ababbbc¦ +1¦20¦a\(.*b\)c¦axcaxbbbcsxbbbbbbbbc¦ +# GA135 +1¦7¦\(a\(b\(c\(d\(e\)\)\)\)\)\4¦abcdededede¦ +#W POSIX does not really specify whether a\(b\)*c\1 matches acb. +#W back references are supposed to expand to the last match, but what +#W if there never was a match as in this case? +-1¦-1¦a\(b\)*c\1¦acb¦ +1¦11¦\(a\(b\(c\(d\(e\(f\(g\)h\(i\(j\)\)\)\)\)\)\)\)\9¦abcdefghijjk¦ +# GA136 +#W These two tests have the same problem as the test in GA135. No match +#W of a subexpression, why should the back reference be usable? +#W 1 2 a\(b\)*c\1 acb +#W 4 7 a\(b\(c\(d\(f\)*\)\)\)\4¦xYzabcdePQRST +-1¦-1¦a\(b\)*c\1¦acb¦ +-1¦-1¦a\(b\(c\(d\(f\)*\)\)\)\4¦xYzabcdePQRST¦ +# GA137 +-2¦-2¦\(a\(b\)\)\3¦foo¦ +-2¦-2¦\(a\(b\)\)\(a\(b\)\)\5¦foo¦ +# GA138 +1¦2¦ag*b¦abcde¦ +1¦10¦a.*b¦abababvbabc¦ +2¦5¦b*c¦abbbcdeabbbbbbcde¦ +2¦5¦bbb*c¦abbbcdeabbbbbbcde¦ +1¦5¦a\(b\)*c\1¦abbcbbb¦ +-1¦-1¦a\(b\)*c\1¦abbdbd¦ +0¦0¦\([a-c]*\)\1¦abcacdef¦ +1¦6¦\([a-c]*\)\1¦abcabcabcd¦ +1¦2¦a^*b¦ab¦ +1¦5¦a^*b¦a^^^b¦ +# GA139 +1¦2¦a\{2\}¦aaaa¦ +1¦7¦\([a-c]*\)\{0,\}¦aabcaab¦ +1¦2¦\(a\)\1\{1,2\}¦aabc¦ +1¦3¦\(a\)\1\{1,2\}¦aaaabc¦ +#W the expression \(\(a\)\1\)\{1,2\} is ill-formed, using \2 +1¦4¦\(\(a\)\2\)\{1,2\}¦aaaabc¦ +# GA140 +1¦2¦a\{2\}¦aaaa¦ +-1¦-1¦a\{2\}¦abcd¦ +0¦0¦a\{0\}¦aaaa¦ +1¦64¦a\{64\}¦aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa¦ +# GA141 +1¦7¦\([a-c]*\)\{0,\}¦aabcaab¦ +#W the expected result for \([a-c]*\)\{2,\} is failure which isn't correct +1¦3¦\([a-c]*\)\{2,\}¦abcdefg¦ +1¦3¦\([a-c]*\)\{1,\}¦abcdefg¦ +-1¦-1¦a\{64,\}¦aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa¦ +# GA142 +1¦3¦a\{2,3\}¦aaaa¦ +-1¦-1¦a\{2,3\}¦abcd¦ +0¦0¦\([a-c]*\)\{0,0\}¦foo¦ +1¦63¦a\{1,63\}¦aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa¦ +# 2.8.3.4 BRE Precedence +# GA143 +#W There are numerous bugs in the original version. +2¦19¦\^\[[[.].]]\\(\\1\\)\*\\{1,2\\}\$¦a^[]\(\1\)*\{1,2\}$b¦ +1¦6¦[[=*=]][[=\=]][[=]=]][[===]][[...]][[:punct:]]¦*\]=.;¦ +1¦6¦[$\(*\)^]*¦$\()*^¦ +1¦1¦[\1]¦1¦ +1¦1¦[\{1,2\}]¦{¦ +#W the expected result for \(*\)*\1* is 2-2 which isn't correct +0¦0¦\(*\)*\1*¦a*b*11¦ +2¦3¦\(*\)*\1*b¦a*b*11¦ +#W the expected result for \(a\(b\{1,2\}\)\{1,2\}\) is 1-5 which isn't correct +1¦3¦\(a\(b\{1,2\}\)\{1,2\}\)¦abbab¦ +1¦5¦\(a\(b\{1,2\}\)\)\{1,2\}¦abbab¦ +1¦1¦^\(^\(^a$\)$\)$¦a¦ +1¦2¦\(a\)\1$¦aa¦ +1¦3¦ab*¦abb¦ +1¦4¦ab\{2,4\}¦abbbc¦ +# 2.8.3.5 BRE Expression Anchoring +# GA144 +1¦1¦^a¦abc¦ +-1¦-1¦^b¦abc¦ +-1¦-1¦^[a-zA-Z]¦99Nine¦ +1¦4¦^[a-zA-Z]*¦Nine99¦ +# GA145(1) +1¦2¦\(^a\)\1¦aabc¦ +-1¦-1¦\(^a\)\1¦^a^abc¦ +1¦2¦\(^^a\)¦^a¦ +1¦1¦\(^^\)¦^^¦ +1¦3¦\(^abc\)¦abcdef¦ +-1¦-1¦\(^def\)¦abcdef¦ +### GA145(2) GNU regex implements GA145(1) +##-1¦-1¦\(^a\)\1¦aabc¦ +##1¦4¦\(^a\)\1¦^a^abc¦ +##-1¦-1¦\(^^a\)¦^a¦ +##1¦2¦\(^^\)¦^^¦ +# GA146 +3¦3¦a$¦cba¦ +-1¦-1¦a$¦abc¦ +5¦7¦[a-z]*$¦99ZZxyz¦ +#W the expected result for [a-z]*$ is failure which isn't correct +10¦9¦[a-z]*$¦99ZZxyz99¦ +3¦3¦$$¦ab$¦ +-1¦-1¦$$¦$ab¦ +3¦3¦\$$¦ab$¦ +# GA147(1) +-1¦-1¦\(a$\)\1¦bcaa¦ +-1¦-1¦\(a$\)\1¦ba$¦ +-1¦-1¦\(ab$\)¦ab$¦ +1¦2¦\(ab$\)¦ab¦ +4¦6¦\(def$\)¦abcdef¦ +-1¦-1¦\(abc$\)¦abcdef¦ +### GA147(2) GNU regex implements GA147(1) +##-1¦-1¦\(a$\)\1¦bcaa¦ +##2¦5¦\(a$\)\1¦ba$a$¦ +##-1¦-1¦\(ab$\)¦ab¦ +##1¦3¦\(ab$\)¦ab$¦ +# GA148 +0¦0¦^$¦¦ +1¦3¦^abc$¦abc¦ +-1¦-1¦^xyz$¦^xyz^¦ +-1¦-1¦^234$¦^234$¦ +1¦9¦^[a-zA-Z0-9]*$¦2aA3bB9zZ¦ +-1¦-1¦^[a-z0-9]*$¦2aA3b#B9zZ¦ diff --git a/test/src/regex-resources/TESTS b/test/src/regex-resources/TESTS new file mode 100644 index 00000000000..f2c98864058 --- /dev/null +++ b/test/src/regex-resources/TESTS @@ -0,0 +1,167 @@ +0:(.*)*\1:xx +0:^: +0:$: +0:^$: +0:^a$:a +0:abc:abc +1:abc:xbc +1:abc:axc +1:abc:abx +0:abc:xabcy +0:abc:ababc +0:ab*c:abc +0:ab*bc:abc +0:ab*bc:abbc +0:ab*bc:abbbbc +0:ab+bc:abbc +1:ab+bc:abc +1:ab+bc:abq +0:ab+bc:abbbbc +0:ab?bc:abbc +0:ab?bc:abc +1:ab?bc:abbbbc +0:ab?c:abc +0:^abc$:abc +1:^abc$:abcc +0:^abc:abcc +1:^abc$:aabc +0:abc$:aabc +0:^:abc +0:$:abc +0:a.c:abc +0:a.c:axc +0:a.*c:axyzc +1:a.*c:axyzd +1:a[bc]d:abc +0:a[bc]d:abd +1:a[b-d]e:abd +0:a[b-d]e:ace +0:a[b-d]:aac +0:a[-b]:a- +0:a[b-]:a- +2:a[b-a]:- +2:a[]b:- +2:a[:- +0:a]:a] +0:a[]]b:a]b +0:a[^bc]d:aed +1:a[^bc]d:abd +0:a[^-b]c:adc +1:a[^-b]c:a-c +1:a[^]b]c:a]c +0:a[^]b]c:adc +0:ab|cd:abc +0:ab|cd:abcd +0:()ef:def +0:()*:- +2:*a:- +2:^*:- +2:$*:- +2:(*)b:- +1:$b:b +2:a\:- +0:a\(b:a(b +0:a\(*b:ab +0:a\(*b:a((b +1:a\x:a\x +1:abc):- +2:(abc:- +0:((a)):abc +0:(a)b(c):abc +0:a+b+c:aabbabc +0:a**:- +0:a*?:- +0:(a*)*:- +0:(a*)+:- +0:(a|)*:- +0:(a*|b)*:- +0:(a+|b)*:ab +0:(a+|b)+:ab +0:(a+|b)?:ab +0:[^ab]*:cde +0:(^)*:- +0:(ab|)*:- +2:)(:- +1:abc: +1:abc: +0:a*: +0:([abc])*d:abbbcd +0:([abc])*bcd:abcd +0:a|b|c|d|e:e +0:(a|b|c|d|e)f:ef +0:((a*|b))*:- +0:abcd*efg:abcdefg +0:ab*:xabyabbbz +0:ab*:xayabbbz +0:(ab|cd)e:abcde +0:[abhgefdc]ij:hij +1:^(ab|cd)e:abcde +0:(abc|)ef:abcdef +0:(a|b)c*d:abcd +0:(ab|ab*)bc:abc +0:a([bc]*)c*:abc +0:a([bc]*)(c*d):abcd +0:a([bc]+)(c*d):abcd +0:a([bc]*)(c+d):abcd +0:a[bcd]*dcdcde:adcdcde +1:a[bcd]+dcdcde:adcdcde +0:(ab|a)b*c:abc +0:((a)(b)c)(d):abcd +0:[A-Za-z_][A-Za-z0-9_]*:alpha +0:^a(bc+|b[eh])g|.h$:abh +0:(bc+d$|ef*g.|h?i(j|k)):effgz +0:(bc+d$|ef*g.|h?i(j|k)):ij +1:(bc+d$|ef*g.|h?i(j|k)):effg +1:(bc+d$|ef*g.|h?i(j|k)):bcdd +0:(bc+d$|ef*g.|h?i(j|k)):reffgz +1:((((((((((a)))))))))):- +0:(((((((((a))))))))):a +1:multiple words of text:uh-uh +0:multiple words:multiple words, yeah +0:(.*)c(.*):abcde +1:\((.*),:(.*)\) +1:[k]:ab +0:abcd:abcd +0:a(bc)d:abcd +0:a[-]?c:ac +0:(....).*\1:beriberi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Qaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mo'ammar Gadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Kaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Qadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar El Kadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Gadafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qadafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamer El Kazzafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar al-Gaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Al Qathafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Al Qathafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mo'ammar el-Gadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar El Kadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar al-Qadhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qadhdhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Qadafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar Gaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Qadhdhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Khaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar al-Khaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'amar al-Kadafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghaddafy +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghadafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muamar Kaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Quathafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Gheddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muamar Al-Kaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar Khadafy +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar Qudhafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qaddafi +0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi +0:[[:digit:]]+:01234 +1:[[:alpha:]]+:01234 +0:^[[:digit:]]*$:01234 +1:^[[:digit:]]*$:01234a +0:^[[:alnum:]]*$:01234a +0:^[[:xdigit:]]*$:01234a +1:^[[:xdigit:]]*$:01234g +0:^[[:alnum:][:space:]]*$:Hello world diff --git a/test/src/regex-tests.el b/test/src/regex-tests.el new file mode 100644 index 00000000000..1364bf6848a --- /dev/null +++ b/test/src/regex-tests.el @@ -0,0 +1,680 @@ +;;; regex-tests.el --- tests for regex.c functions -*- lexical-binding: t -*- + +;; Copyright (C) 2015-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(defvar regex-tests--resources-dir + (concat (concat (file-name-directory (or load-file-name buffer-file-name)) + "/regex-resources/")) + "Path to regex-resources directory next to the \"regex-tests.el\" file.") + +(ert-deftest regex-word-cc-fallback-test () + "Test that ‘[[:cc:]]*x’ matches ‘x’ (bug#24020). + +Test that a regex of the form \"[[:cc:]]*x\" where CC is +a character class which matches a multibyte character X, matches +string \"x\". + +For example, ‘[[:word:]]*\u2620’ regex (note: \u2620 is a word +character) must match a string \"\u2420\"." + (dolist (class '("[[:word:]]" "\\sw")) + (dolist (repeat '("*" "+")) + (dolist (suffix '("" "b" "bar" "\u2620")) + (dolist (string '("" "foo")) + (when (not (and (string-equal repeat "+") + (string-equal string ""))) + (should (string-match (concat "^" class repeat suffix "$") + (concat string suffix))))))))) + +(defun regex--test-cc (name matching not-matching) + (let (case-fold-search) + (should (string-match-p (concat "^[[:" name ":]]*$") matching)) + (should (string-match-p (concat "^[[:" name ":]]*?\u2622$") + (concat matching "\u2622"))) + (should (string-match-p (concat "^[^[:" name ":]]*$") not-matching)) + (should (string-match-p (concat "^[^[:" name ":]]*\u2622$") + (concat not-matching "\u2622"))) + (with-temp-buffer + (insert matching) + (let ((p (point))) + (insert not-matching) + (goto-char (point-min)) + (skip-chars-forward (concat "[:" name ":]")) + (should (equal (point) p)) + (skip-chars-forward (concat "^[:" name ":]")) + (should (equal (point) (point-max))) + (goto-char (point-min)) + (skip-chars-forward (concat "[:" name ":]\u2622")) + (should (or (equal (point) p) (equal (point) (1+ p)))))))) + +(dolist (test '(("alnum" "abcABC012łąka" "-, \t\n") + ("alpha" "abcABCłąka" "-,012 \t\n") + ("digit" "012" "abcABCłąka-, \t\n") + ("xdigit" "0123aBc" "łąk-, \t\n") + ("upper" "ABCŁĄKA" "abc012-, \t\n") + ("lower" "abcłąka" "ABC012-, \t\n") + + ("word" "abcABC012\u2620" "-, \t\n") + + ("punct" ".,-" "abcABC012\u2620 \t\n") + ("cntrl" "\1\2\t\n" ".,-abcABC012\u2620 ") + ("graph" "abcłąka\u2620-," " \t\n\1") + ("print" "abcłąka\u2620-, " "\t\n\1") + + ("space" " \t\n\u2001" "abcABCł0123") + ("blank" " \t\u2001" "\n") + + ("ascii" "abcABC012 \t\n\1" "łą\u2620") + ("nonascii" "łą\u2622" "abcABC012 \t\n\1") + ("unibyte" "abcABC012 \t\n\1" "łą\u2622") + ("multibyte" "łą\u2622" "abcABC012 \t\n\1"))) + (let ((name (intern (concat "regex-tests-" (car test) "-character-class"))) + (doc (concat "Perform sanity test of regexes using " (car test) + " character class. + +Go over all the supported character classes and test whether the +classes and their inversions match what they are supposed to +match. The test is done using `string-match-p' as well as +`skip-chars-forward'."))) + (eval `(ert-deftest ,name () ,doc ,(cons 'regex--test-cc test)) t))) + + +(defmacro regex-tests-generic-line (comment-char test-file whitelist &rest body) + "Reads a line of the test file TEST-FILE, skipping +comments (defined by COMMENT-CHAR), and evaluates the tests in +this line as defined in the BODY. Line numbers in the WHITELIST +are known failures, and are skipped." + + `(with-temp-buffer + (modify-syntax-entry ?_ "w;; ") ; tests expect _ to be a word + (insert-file-contents (concat regex-tests--resources-dir ,test-file)) + (let ((case-fold-search nil) + (line-number 1) + (whitelist-idx 0)) + + (goto-char (point-min)) + + (while (not (eobp)) + (let ((start (point))) + (end-of-line) + (narrow-to-region start (point)) + + (goto-char (point-min)) + + (when + (and + ;; ignore comments + (save-excursion + (re-search-forward ,(concat "^[^" (string comment-char) "]") nil t)) + + ;; skip lines in the whitelist + (let ((whitelist-next + (condition-case nil + (aref ,whitelist whitelist-idx) (args-out-of-range nil)))) + (cond + ;; whitelist exhausted. do process this line + ((null whitelist-next) t) + + ;; we're not yet at the next whitelist element. do + ;; process this line + ((< line-number whitelist-next) t) + + ;; we're past the next whitelist element. This + ;; shouldn't happen + ((> line-number whitelist-next) + (error + (format + "We somehow skipped the next whitelist element: line %d" whitelist-next))) + + ;; we're at the next whitelist element. Skip this + ;; line, and advance the whitelist index + (t + (setq whitelist-idx (1+ whitelist-idx)) nil)))) + ,@body) + + (widen) + (forward-line) + (beginning-of-line) + (setq line-number (1+ line-number))))))) + +(defun regex-tests-compare (string what-failed bounds-ref &optional substring-ref) + "I just ran a search, looking at STRING. WHAT-FAILED describes +what failed, if anything; valid values are 'search-failed, +'compilation-failed and nil. I compare the beginning/end of each +group with their expected values. This is done with either +BOUNDS-REF or SUBSTRING-REF; one of those should be non-nil. +BOUNDS-REF is a sequence \[start-ref0 end-ref0 start-ref1 +end-ref1 ....] while SUBSTRING-REF is the expected substring +obtained by indexing the input string by start/end-ref. + +If the search was supposed to fail then start-ref0/substring-ref0 +is 'search-failed. If the search wasn't even supposed to compile +successfully, then start-ref0/substring-ref0 is +'compilation-failed. If I only care about a match succeeding, +this can be set to t. + +This function returns a string that describes the failure, or nil +on success" + + (when (or + (and bounds-ref substring-ref) + (not (or bounds-ref substring-ref))) + (error "Exactly one of bounds-ref and bounds-ref should be non-nil")) + + (let ((what-failed-ref (car (or bounds-ref substring-ref)))) + + (cond + ((eq what-failed 'search-failed) + (cond + ((eq what-failed-ref 'search-failed) + nil) + ((eq what-failed-ref 'compilation-failed) + "Expected pattern failure; but no match") + (t + "Expected match; but no match"))) + + ((eq what-failed 'compilation-failed) + (cond + ((eq what-failed-ref 'search-failed) + "Expected no match; but pattern failure") + ((eq what-failed-ref 'compilation-failed) + nil) + (t + "Expected match; but pattern failure"))) + + ;; The regex match succeeded + ((eq what-failed-ref 'search-failed) + "Expected no match; but match") + ((eq what-failed-ref 'compilation-failed) + "Expected pattern failure; but match") + + ;; The regex match succeeded, as expected. I now check all the + ;; bounds + (t + (let ((idx 0) + msg + ref next-ref-function compare-ref-function mismatched-ref-function) + + (if bounds-ref + (setq ref bounds-ref + next-ref-function (lambda (x) (cddr x)) + compare-ref-function (lambda (ref start-pos end-pos) + (or (eq (car ref) t) + (and (eq start-pos (car ref)) + (eq end-pos (cadr ref))))) + mismatched-ref-function (lambda (ref start-pos end-pos) + (format + "beginning/end positions: %d/%s and %d/%s" + start-pos (car ref) end-pos (cadr ref)))) + (setq ref substring-ref + next-ref-function (lambda (x) (cdr x)) + compare-ref-function (lambda (ref start-pos end-pos) + (or (eq (car ref) t) + (string= (substring string start-pos end-pos) (car ref)))) + mismatched-ref-function (lambda (ref start-pos end-pos) + (format + "beginning/end positions: %d/%s and %d/%s" + start-pos (car ref) end-pos (cadr ref))))) + + (while (not (or (null ref) msg)) + + (let ((start (match-beginning idx)) + (end (match-end idx))) + + (when (not (funcall compare-ref-function ref start end)) + (setq msg + (format + "Have expected match, but mismatch in group %d: %s" idx (funcall mismatched-ref-function ref start end)))) + + (setq ref (funcall next-ref-function ref) + idx (1+ idx)))) + + (or msg + nil)))))) + + + +(defun regex-tests-match (pattern string bounds-ref &optional substring-ref) + "I match the given STRING against PATTERN. I compare the +beginning/end of each group with their expected values. +BOUNDS-REF is a sequence [start-ref0 end-ref0 start-ref1 end-ref1 +....]. + +If the search was supposed to fail then start-ref0 is +'search-failed. If the search wasn't even supposed to compile +successfully, then start-ref0 is 'compilation-failed. + +This function returns a string that describes the failure, or nil +on success" + + (if (string-match "\\[\\([\\.=]\\)..?\\1\\]" pattern) + ;; Skipping test: [.x.] and [=x=] forms not supported by emacs + nil + + (regex-tests-compare + string + (condition-case nil + (if (string-match pattern string) nil 'search-failed) + ('invalid-regexp 'compilation-failed)) + bounds-ref substring-ref))) + + +(defconst regex-tests-re-even-escapes + "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*" + "Regex that matches an even number of \\ characters") + +(defconst regex-tests-re-odd-escapes + (concat regex-tests-re-even-escapes "\\\\") + "Regex that matches an odd number of \\ characters") + + +(defun regex-tests-unextend (pattern) + "Basic conversion from extended regexes to emacs ones. This is +mostly a hack that adds \\ to () and | and {}, and removes it if +it already exists. We also change \\S (and \\s) to \\S- (and +\\s-) because extended regexes see the former as whitespace, but +emacs requires an extra symbol character" + + (with-temp-buffer + (insert pattern) + (goto-char (point-min)) + + (while (re-search-forward "[()|{}]" nil t) + ;; point is past special character. If it is escaped, unescape + ;; it + + (if (save-excursion + (re-search-backward (concat regex-tests-re-odd-escapes ".\\=") nil t)) + + ;; This special character is preceded by an odd number of \, + ;; so I unescape it by removing the last one + (progn + (forward-char -2) + (delete-char 1) + (forward-char 1)) + + ;; This special character is preceded by an even (possibly 0) + ;; number of \. I add an escape + (forward-char -1) + (insert "\\") + (forward-char 1))) + + ;; convert \s to \s- + (goto-char (point-min)) + (while (re-search-forward (concat regex-tests-re-odd-escapes "[Ss]") nil t) + (insert "-")) + + (buffer-string))) + +(defun regex-tests-BOOST-frob-escapes (s ispattern) + "Mangle \\ the way it is done in frob_escapes() in +regex-tests-BOOST.c in glibc: \\t, \\n, \\r are interpreted; +\\\\, \\^, \{, \\|, \} are unescaped for the string (not +pattern)" + + ;; this is all similar to (regex-tests-unextend) + (with-temp-buffer + (insert s) + + (let ((interpret-list (list "t" "n" "r"))) + (while interpret-list + (goto-char (point-min)) + (while (re-search-forward + (concat "\\(" regex-tests-re-even-escapes "\\)" + "\\\\" (car interpret-list)) + nil t) + (replace-match (concat "\\1" (car (read-from-string + (concat "\"\\" (car interpret-list) "\"")))))) + + (setq interpret-list (cdr interpret-list)))) + + (when (not ispattern) + ;; unescape \\, \^, \{, \|, \} + (let ((unescape-list (list "\\\\" "^" "{" "|" "}"))) + (while unescape-list + (goto-char (point-min)) + (while (re-search-forward + (concat "\\(" regex-tests-re-even-escapes "\\)" + "\\\\" (car unescape-list)) + nil t) + (replace-match (concat "\\1" (car unescape-list)))) + + (setq unescape-list (cdr unescape-list)))) + ) + (buffer-string))) + + + + +(defconst regex-tests-BOOST-whitelist + [ + ;; emacs is more stringent with regexes involving unbalanced ) + 63 65 69 + + ;; in emacs, regex . doesn't match \n + 91 + + ;; emacs is more forgiving with * and ? that don't apply to + ;; characters + 107 108 109 122 123 124 140 141 142 + + ;; emacs accepts regexes with {} + 161 + + ;; emacs doesn't fail on bogus ranges such as [3-1] or [1-3-5] + 222 223 + + ;; emacs doesn't match (ab*)[ab]*\1 greedily: only 4 chars of + ;; ababaaa match + 284 294 + + ;; ambiguous groupings are ambiguous + 443 444 445 446 448 449 450 + + ;; emacs doesn't know how to handle weird ranges such as [a-Z] and + ;; [[:alpha:]-a] + 539 580 581 + + ;; emacs matches non-greedy regex ab.*? non-greedily + 639 677 712 + ] + "Line numbers in the boost test that should be skipped. These +are false-positive test failures that represent known/benign +differences in behavior.") + +;; - Format +;; - Comments are lines starting with ; +;; - Lines starting with - set options passed to regcomp() and regexec(): +;; - if no "REG_BASIC" is found, with have an extended regex +;; - These set a flag: +;; - REG_ICASE +;; - REG_NEWLINE (ignored by this function) +;; - REG_NOTBOL +;; - REG_NOTEOL +;; +;; - Test lines are +;; pattern string start0 end0 start1 end1 ... +;; +;; - pattern, string can have escapes +;; - string can have whitespace if enclosed in "" +;; - if string is "!", then the pattern is supposed to fail compilation +;; - start/end are of group0, group1, etc. group 0 is the full match +;; - start<0 indicates "no match" +;; - start is the 0-based index of the first character +;; - end is the 0-based index of the first character past the group +(defun regex-tests-BOOST () + (let (failures + basic icase notbol noteol) + (regex-tests-generic-line + ?\; "BOOST.tests" regex-tests-BOOST-whitelist + (if (save-excursion (re-search-forward "^-" nil t)) + (setq basic (save-excursion (re-search-forward "REG_BASIC" nil t)) + icase (save-excursion (re-search-forward "REG_ICASE" nil t)) + notbol (save-excursion (re-search-forward "REG_NOTBOL" nil t)) + noteol (save-excursion (re-search-forward "REG_NOTEOL" nil t))) + + (save-excursion + (or (re-search-forward "\\(\\S-+\\)\\s-+\"\\(.*\\)\"\\s-+?\\(.+\\)" nil t) + (re-search-forward "\\(\\S-+\\)\\s-+\\(\\S-+\\)\\s-+?\\(.+\\)" nil t) + (re-search-forward "\\(\\S-+\\)\\s-+\\(!\\)" nil t))) + + (let* ((pattern-raw (match-string 1)) + (string-raw (match-string 2)) + (positions-raw (match-string 3)) + (pattern (regex-tests-BOOST-frob-escapes pattern-raw t)) + (string (regex-tests-BOOST-frob-escapes string-raw nil)) + (positions + (if (string= string "!") + (list 'compilation-failed 0) + (mapcar + (lambda (x) + (let ((x (string-to-number x))) + (if (< x 0) nil x))) + (split-string positions-raw))))) + + (when (null (car positions)) + (setcar positions 'search-failed)) + + (when (not basic) + (setq pattern (regex-tests-unextend pattern))) + + ;; great. I now have all the data parsed. Let's use it to do + ;; stuff + (let* ((case-fold-search icase) + (msg (regex-tests-match pattern string positions))) + + (if (and + ;; Skipping test: notbol/noteol not supported + (not notbol) (not noteol) + + msg) + + ;; store failure + (setq failures + (cons (format "line number %d: Regex '%s': %s" + line-number pattern msg) + failures))))))) + + failures)) + +(defconst regex-tests-PCRE-whitelist + [ + ;; ambiguous groupings are ambiguous + 610 611 1154 1157 1160 1168 1171 1176 1179 1182 1185 1188 1193 1196 1203 + ] + "Line numbers in the PCRE test that should be skipped. These +are false-positive test failures that represent known/benign +differences in behavior.") + +;; - Format +;; +;; regex +;; input_string +;; group_num: group_match | "No match" +;; input_string +;; group_num: group_match | "No match" +;; input_string +;; group_num: group_match | "No match" +;; input_string +;; group_num: group_match | "No match" +;; ... +(defun regex-tests-PCRE () + (let (failures + pattern icase string what-failed matches-observed) + (regex-tests-generic-line + ?# "PCRE.tests" regex-tests-PCRE-whitelist + + (cond + + ;; pattern + ((save-excursion (re-search-forward "^/\\(.*\\)/\\(.*i?\\)$" nil t)) + (setq icase (string= "i" (match-string 2)) + pattern (regex-tests-unextend (match-string 1)))) + + ;; string. read it in, match against pattern, and save all the results + ((save-excursion (re-search-forward "^ \\(.*\\)" nil t)) + (let ((case-fold-search icase)) + (setq string (match-string 1) + + ;; the regex match under test + what-failed + (condition-case nil + (if (string-match pattern string) nil 'search-failed) + ('invalid-regexp 'compilation-failed)) + + matches-observed + (cl-loop for x from 0 to 20 + collect (and (not what-failed) + (or (match-string x string) "<unset>"))))) + nil) + + ;; verification line: failed match + ((save-excursion (re-search-forward "^No match" nil t)) + (unless what-failed + (setq failures + (cons (format "line number %d: Regex '%s': Expected no match; but match" + line-number pattern) + failures)))) + + ;; verification line: succeeded match + ((save-excursion (re-search-forward "^ *\\([0-9]+\\): \\(.*\\)" nil t)) + (let* ((match-ref (match-string 2)) + (idx (string-to-number (match-string 1)))) + + (if what-failed + "Expected match; but no match" + (unless (string= match-ref (elt matches-observed idx)) + (setq failures + (cons (format "line number %d: Regex '%s': Have expected match, but group %d is wrong: '%s'/'%s'" + line-number pattern + idx match-ref (elt matches-observed idx)) + failures)))))) + + ;; reset + (t (setq pattern nil) nil))) + + failures)) + +(defconst regex-tests-PTESTS-whitelist + [ + ;; emacs doesn't barf on weird ranges such as [b-a], but simply + ;; fails to match + 138 + + ;; emacs doesn't see DEL (0x78) as a [:cntrl:] character + 168 + ] + "Line numbers in the PTESTS test that should be skipped. These +are false-positive test failures that represent known/benign +differences in behavior.") + +;; - Format +;; - fields separated by ¦ (note: this is not a |) +;; - start¦end¦pattern¦string +;; - start is the 1-based index of the first character +;; - end is the 1-based index of the last character +(defun regex-tests-PTESTS () + (let (failures) + (regex-tests-generic-line + ?# "PTESTS" regex-tests-PTESTS-whitelist + (let* ((fields (split-string (buffer-string) "¦")) + + ;; string has 1-based index of first char in the + ;; match. -1 means "no match". -2 means "invalid + ;; regex". + ;; + ;; start-ref is 0-based index of first char in the + ;; match + ;; + ;; string==0 is a special case, and I have to treat + ;; it as start-ref = 0 + (start-ref (let ((raw (string-to-number (elt fields 0)))) + (cond + ((= raw -2) 'compilation-failed) + ((= raw -1) 'search-failed) + ((= raw 0) 0) + (t (1- raw))))) + + ;; string has 1-based index of last char in the + ;; match. end-ref is 0-based index of first char past + ;; the match + (end-ref (string-to-number (elt fields 1))) + (pattern (elt fields 2)) + (string (elt fields 3))) + + (let ((msg (regex-tests-match pattern string (list start-ref end-ref)))) + (when msg + (setq failures + (cons (format "line number %d: Regex '%s': %s" + line-number pattern msg) + failures)))))) + failures)) + +(defconst regex-tests-TESTS-whitelist + [ + ;; emacs doesn't barf on weird ranges such as [b-a], but simply + ;; fails to match + 42 + + ;; emacs is more forgiving with * and ? that don't apply to + ;; characters + 57 58 59 60 + + ;; emacs is more stringent with regexes involving unbalanced ) + 67 + ] + "Line numbers in the TESTS test that should be skipped. These +are false-positive test failures that represent known/benign +differences in behavior.") + +;; - Format +;; - fields separated by :. Watch for [\[:xxx:]] +;; - expected:pattern:string +;; +;; expected: +;; | 0 | successful match | +;; | 1 | failed match | +;; | 2 | regcomp() should fail | +(defun regex-tests-TESTS () + (let (failures) + (regex-tests-generic-line + ?# "TESTS" regex-tests-TESTS-whitelist + (if (save-excursion (re-search-forward "^\\([^:]+\\):\\(.*\\):\\([^:]*\\)$" nil t)) + (let* ((what-failed + (let ((raw (string-to-number (match-string 1)))) + (cond + ((= raw 2) 'compilation-failed) + ((= raw 1) 'search-failed) + (t t)))) + (string (match-string 3)) + (pattern (regex-tests-unextend (match-string 2)))) + + (let ((msg (regex-tests-match pattern string nil (list what-failed)))) + (when msg + (setq failures + (cons (format "line number %d: Regex '%s': %s" + line-number pattern msg) + failures))))) + + (error "Error parsing TESTS file line: '%s'" (buffer-string)))) + failures)) + +(ert-deftest regex-tests-BOOST () + "Tests of the regular expression engine. +This evaluates the BOOST test cases from glibc." + (should-not (regex-tests-BOOST))) + +(ert-deftest regex-tests-PCRE () + "Tests of the regular expression engine. +This evaluates the PCRE test cases from glibc." + (should-not (regex-tests-PCRE))) + +(ert-deftest regex-tests-PTESTS () + "Tests of the regular expression engine. +This evaluates the PTESTS test cases from glibc." + (should-not (regex-tests-PTESTS))) + +(ert-deftest regex-tests-TESTS () + "Tests of the regular expression engine. +This evaluates the TESTS test cases from glibc." + (should-not (regex-tests-TESTS))) + +;;; regex-tests.el ends here diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el new file mode 100644 index 00000000000..6edde0b137b --- /dev/null +++ b/test/src/syntax-tests.el @@ -0,0 +1,85 @@ +;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*- + +;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +(ert-deftest parse-partial-sexp-continue-over-comment-marker () + "Continue a parse that stopped in the middle of a comment marker." + (with-temp-buffer + (let ((table (make-syntax-table))) + (modify-syntax-entry ?/ ". 124") + (modify-syntax-entry ?* ". 23b") + (set-syntax-table table)) + (insert "/*C*/\nX") + (goto-char (point-min)) + (let* ((pointC (progn (search-forward "C") (1- (point)))) + (preC (1- pointC)) + (pointX (progn (search-forward "X") (1- (point)))) + (aftC (+ 2 pointC)) + (ppsC (parse-partial-sexp (point-min) pointC)) + (pps-preC (parse-partial-sexp (point-min) preC)) + (pps-aftC (parse-partial-sexp (point-min) aftC)) + (ppsX (parse-partial-sexp (point-min) pointX))) + ;; C should be inside comment. + (should (= (nth 0 ppsC) 0)) + (should (eq (nth 4 ppsC) t)) + (should (= (nth 8 ppsC) (- pointC 2))) + ;; X should not be in comment or list. + (should (= (nth 0 ppsX) 0)) + (should-not (nth 4 ppsX)) + ;; Try using OLDSTATE. + (should (equal (parse-partial-sexp preC pointC nil nil pps-preC) + ppsC)) + (should (equal (parse-partial-sexp pointC aftC nil nil ppsC) + pps-aftC)) + (should (equal (parse-partial-sexp preC aftC nil nil pps-preC) + pps-aftC)) + (should (equal (parse-partial-sexp aftC pointX nil nil pps-aftC) + ppsX))))) + +(ert-deftest parse-partial-sexp-paren-comments () + "Test syntax parsing with paren comment markers. +Specifically, where the first character of the comment marker is +also has open paren syntax (see Bug#24870)." + (with-temp-buffer + (let ((table (make-syntax-table))) + (modify-syntax-entry ?\{ "(}1nb" table) + (modify-syntax-entry ?\} "){4nb" table) + (modify-syntax-entry ?- ". 123" table) + (set-syntax-table table)) + (insert "{-C-}\nX") + (goto-char (point-min)) + (let* ((pointC (progn (search-forward "C") (1- (point)))) + (pointX (progn (search-forward "X") (1- (point)))) + (ppsC (parse-partial-sexp (point-min) pointC)) + (ppsX (parse-partial-sexp (point-min) pointX))) + ;; C should be inside nestable comment, not list. + (should (= (nth 0 ppsC) 0)) + (should (= (nth 4 ppsC) 1)) + (should (= (nth 8 ppsC) (- pointC 2))) + ;; X should not be in comment or list. + (should (= (nth 0 ppsX) 0)) + (should-not (nth 4 ppsX)) + ;; Try using OLDSTATE. + (should (equal (parse-partial-sexp pointC pointX nil nil ppsC) + ppsX))))) + +;;; syntax-tests.el ends here diff --git a/test/automated/textprop-tests.el b/test/src/textprop-tests.el index 386acdd77e0..d4c8925b5db 100644 --- a/test/automated/textprop-tests.el +++ b/test/src/textprop-tests.el @@ -67,3 +67,6 @@ ;; (message "%S" (car stack)) (should (and (equal-including-properties (pop stack) string) (null stack))))) + +(provide 'textprop-tests) +;; textprop-tests.el ends here. diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el new file mode 100644 index 00000000000..849b2e3dd1b --- /dev/null +++ b/test/src/thread-tests.el @@ -0,0 +1,301 @@ +;;; threads.el --- tests for threads. + +;; Copyright (C) 2012-2017 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(ert-deftest threads-is-one () + "test for existence of a thread" + (should (current-thread))) + +(ert-deftest threads-threadp () + "test of threadp" + (should (threadp (current-thread)))) + +(ert-deftest threads-type () + "test of thread type" + (should (eq (type-of (current-thread)) 'thread))) + +(ert-deftest threads-name () + "test for name of a thread" + (should + (string= "hi bob" (thread-name (make-thread #'ignore "hi bob"))))) + +(ert-deftest threads-alive () + "test for thread liveness" + (should + (thread-alive-p (make-thread #'ignore)))) + +(ert-deftest threads-all-threads () + "simple test for all-threads" + (should (listp (all-threads)))) + +(defvar threads-test-global nil) + +(defun threads-test-thread1 () + (setq threads-test-global 23)) + +(ert-deftest threads-basic () + "basic thread test" + (should + (progn + (setq threads-test-global nil) + (make-thread #'threads-test-thread1) + (while (not threads-test-global) + (thread-yield)) + threads-test-global))) + +(ert-deftest threads-join () + "test of thread-join" + (should + (progn + (setq threads-test-global nil) + (let ((thread (make-thread #'threads-test-thread1))) + (thread-join thread) + (and threads-test-global + (not (thread-alive-p thread))))))) + +(ert-deftest threads-join-self () + "cannot thread-join the current thread" + (should-error (thread-join (current-thread)))) + +(defvar threads-test-binding nil) + +(defun threads-test-thread2 () + (let ((threads-test-binding 23)) + (thread-yield)) + (setq threads-test-global 23)) + +(ert-deftest threads-let-binding () + "simple test of threads and let bindings" + (should + (progn + (setq threads-test-global nil) + (make-thread #'threads-test-thread2) + (while (not threads-test-global) + (thread-yield)) + (and (not threads-test-binding) + threads-test-global)))) + +(ert-deftest threads-mutexp () + "simple test of mutexp" + (should-not (mutexp 'hi))) + +(ert-deftest threads-mutexp-2 () + "another simple test of mutexp" + (should (mutexp (make-mutex)))) + +(ert-deftest threads-mutex-type () + "type-of mutex" + (should (eq (type-of (make-mutex)) 'mutex))) + +(ert-deftest threads-mutex-lock-unlock () + "test mutex-lock and unlock" + (should + (let ((mx (make-mutex))) + (mutex-lock mx) + (mutex-unlock mx) + t))) + +(ert-deftest threads-mutex-recursive () + "test mutex-lock and unlock" + (should + (let ((mx (make-mutex))) + (mutex-lock mx) + (mutex-lock mx) + (mutex-unlock mx) + (mutex-unlock mx) + t))) + +(defvar threads-mutex nil) +(defvar threads-mutex-key nil) + +(defun threads-test-mlock () + (mutex-lock threads-mutex) + (setq threads-mutex-key 23) + (while threads-mutex-key + (thread-yield)) + (mutex-unlock threads-mutex)) + +(ert-deftest threads-mutex-contention () + "test of mutex contention" + (should + (progn + (setq threads-mutex (make-mutex)) + (setq threads-mutex-key nil) + (make-thread #'threads-test-mlock) + ;; Wait for other thread to get the lock. + (while (not threads-mutex-key) + (thread-yield)) + ;; Try now. + (setq threads-mutex-key nil) + (mutex-lock threads-mutex) + (mutex-unlock threads-mutex) + t))) + +(defun threads-test-mlock2 () + (setq threads-mutex-key 23) + (mutex-lock threads-mutex)) + +(ert-deftest threads-mutex-signal () + "test signaling a blocked thread" + (should + (progn + (setq threads-mutex (make-mutex)) + (setq threads-mutex-key nil) + (mutex-lock threads-mutex) + (let ((thr (make-thread #'threads-test-mlock2))) + (while (not threads-mutex-key) + (thread-yield)) + (thread-signal thr 'quit nil) + (thread-join thr)) + t))) + +(defun threads-test-io-switch () + (setq threads-test-global 23)) + +(ert-deftest threads-io-switch () + "test that accept-process-output causes thread switch" + (should + (progn + (setq threads-test-global nil) + (make-thread #'threads-test-io-switch) + (while (not threads-test-global) + (accept-process-output nil 1)) + threads-test-global))) + +(ert-deftest threads-condvarp () + "simple test of condition-variable-p" + (should-not (condition-variable-p 'hi))) + +(ert-deftest threads-condvarp-2 () + "another simple test of condition-variable-p" + (should (condition-variable-p (make-condition-variable (make-mutex))))) + +(ert-deftest threads-condvar-type () + "type-of condvar" + (should (eq (type-of (make-condition-variable (make-mutex))) + 'condition-variable))) + +(ert-deftest threads-condvar-mutex () + "simple test of condition-mutex" + (should + (let ((m (make-mutex))) + (eq m (condition-mutex (make-condition-variable m)))))) + +(ert-deftest threads-condvar-name () + "simple test of condition-name" + (should + (eq nil (condition-name (make-condition-variable (make-mutex)))))) + +(ert-deftest threads-condvar-name-2 () + "another simple test of condition-name" + (should + (string= "hi bob" + (condition-name (make-condition-variable (make-mutex) + "hi bob"))))) +(defun call-error () + "Call `error'." + (error "Error is called")) + +;; This signals an error internally; the error should be caught. +(defun thread-custom () + (defcustom thread-custom-face 'highlight + "Face used for thread customizations." + :type 'face + :group 'widget-faces)) + +(ert-deftest thread-errors () + "Test what happens when a thread signals an error." + (let (th1 th2) + (setq th1 (make-thread #'call-error "call-error")) + (should (threadp th1)) + (while (thread-alive-p th1) + (thread-yield)) + (should (equal (thread-last-error) + '(error "Error is called"))) + (setq th2 (make-thread #'thread-custom "thread-custom")) + (should (threadp th2)))) + +(ert-deftest thread-sticky-point () + "Test bug #25165 with point movement in cloned buffer." + (with-temp-buffer + (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit.") + (goto-char (point-min)) + (clone-indirect-buffer nil nil) + (forward-char 20) + (sit-for 1) + (should (= (point) 21)))) + +(ert-deftest thread-signal-early () + "Test signaling a thread as soon as it is started by the OS." + (let ((thread + (make-thread #'(lambda () + (while t (thread-yield)))))) + (thread-signal thread 'error nil) + (sit-for 1) + (should-not (thread-alive-p thread)) + (should (equal (thread-last-error) '(error))))) + +(defvar threads-condvar nil) + +(defun threads-test-condvar-wait () + ;; Wait for condvar to be notified. + (with-mutex (condition-mutex threads-condvar) + (condition-wait threads-condvar)) + ;; Wait again, it will be signaled. + (with-mutex (condition-mutex threads-condvar) + (condition-wait threads-condvar))) + +(ert-deftest threads-condvar-wait () + "test waiting on conditional variable" + (let ((cv-mutex (make-mutex)) + new-thread) + ;; We could have spurious threads from the previous tests still + ;; running; wait for them to die. + (while (> (length (all-threads)) 1) + (thread-yield)) + (setq threads-condvar (make-condition-variable cv-mutex)) + (setq new-thread (make-thread #'threads-test-condvar-wait)) + + ;; Make sure new-thread is alive. + (should (thread-alive-p new-thread)) + (should (= (length (all-threads)) 2)) + ;; Wait for new-thread to become blocked on the condvar. + (while (not (eq (thread--blocker new-thread) threads-condvar)) + (thread-yield)) + + ;; Notify the waiting thread. + (with-mutex cv-mutex + (condition-notify threads-condvar t)) + ;; Allow new-thread to process the notification. + (sleep-for 0.1) + ;; Make sure the thread is still there. This used to fail due to + ;; a bug in thread.c:condition_wait_callback. + (should (thread-alive-p new-thread)) + (should (= (length (all-threads)) 2)) + (should (eq (thread--blocker new-thread) threads-condvar)) + + ;; Signal the thread. + (thread-signal new-thread 'error '("Die, die, die!")) + (sleep-for 0.1) + ;; Make sure the thread died. + (should (= (length (all-threads)) 1)) + (should (equal (thread-last-error) '(error "Die, die, die!"))))) + +;;; threads.el ends here diff --git a/test/automated/undo-tests.el b/test/src/undo-tests.el index fbd3bf84a42..fbd3bf84a42 100644 --- a/test/automated/undo-tests.el +++ b/test/src/undo-tests.el diff --git a/test/automated/libxml-tests.el b/test/src/xml-tests.el index 1550887f77d..1550887f77d 100644 --- a/test/automated/libxml-tests.el +++ b/test/src/xml-tests.el |