summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in (renamed from test/automated/Makefile.in)77
-rw-r--r--test/README3
-rw-r--r--test/automated/abbrev-tests.el98
-rw-r--r--test/automated/help-fns.el70
-rw-r--r--test/data/decompress/foo.gz (renamed from test/automated/data/decompress/foo.gz)bin30 -> 30 bytes
-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)bin77 -> 77 bytes
-rw-r--r--test/data/net/cert.pem25
-rw-r--r--test/data/net/key.pem28
-rw-r--r--test/data/shr/div-div.html1
-rw-r--r--test/data/shr/div-div.txt2
-rw-r--r--test/data/shr/div-p.html1
-rw-r--r--test/data/shr/div-p.txt3
-rw-r--r--test/data/shr/li-div.html10
-rw-r--r--test/data/shr/li-div.txt6
-rw-r--r--test/data/shr/li-empty.html1
-rw-r--r--test/data/shr/li-empty.txt3
-rw-r--r--test/data/shr/nonbr.html1
-rw-r--r--test/data/shr/nonbr.txt12
-rw-r--r--test/data/shr/ul-empty.html4
-rw-r--r--test/data/shr/ul-empty.txt3
-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.org54
-rw-r--r--test/lisp/abbrev-tests.el255
-rw-r--r--test/lisp/auth-source-tests.el (renamed from test/automated/auth-source-tests.el)0
-rw-r--r--test/lisp/autorevert-tests.el (renamed from test/automated/auto-revert-tests.el)73
-rw-r--r--test/lisp/calc/calc-tests.el (renamed from test/automated/calc-tests.el)0
-rw-r--r--test/lisp/calendar/icalendar-tests.el (renamed from test/automated/icalendar-tests.el)19
-rw-r--r--test/lisp/calendar/parse-time-tests.el49
-rw-r--r--test/lisp/char-fold-tests.el (renamed from test/automated/char-fold-tests.el)0
-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.el56
-rw-r--r--test/lisp/electric-tests.el (renamed from test/automated/electric-tests.el)0
-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)0
-rw-r--r--test/lisp/emacs-lisp/cl-seq-tests.el (renamed from test/automated/cl-seq-tests.el)0
-rw-r--r--test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el (renamed from test/automated/eieio-test-methodinvoke.el)0
-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)6
-rw-r--r--test/lisp/emacs-lisp/ert-tests.el (renamed from test/automated/ert-tests.el)0
-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)0
-rw-r--r--test/lisp/emacs-lisp/lisp-tests.el211
-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)bin20480 -> 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)2
-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)bin287 -> 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)bin287 -> 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)bin287 -> 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)63
-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/regexp-opt-tests.el (renamed from test/automated/regexp-tests.el)0
-rw-r--r--test/lisp/emacs-lisp/seq-tests.el (renamed from test/automated/seq-tests.el)34
-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/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)42
-rw-r--r--test/lisp/erc/erc-track-tests.el122
-rw-r--r--test/lisp/eshell/eshell.el (renamed from test/automated/eshell.el)0
-rw-r--r--test/lisp/faces-tests.el (renamed from test/automated/faces-tests.el)0
-rw-r--r--test/lisp/filenotify-tests.el (renamed from test/automated/file-notify-tests.el)563
-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.el121
-rw-r--r--test/lisp/htmlfontify-tests.el34
-rw-r--r--test/lisp/ibuffer-tests.el34
-rw-r--r--test/lisp/imenu-tests.el (renamed from test/automated/imenu-test.el)0
-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.el277
-rw-r--r--test/lisp/isearch-tests.el (renamed from test/automated/isearch-tests.el)0
-rw-r--r--test/lisp/jit-lock-tests.el60
-rw-r--r--test/lisp/json-tests.el (renamed from test/automated/json-tests.el)0
-rw-r--r--test/lisp/legacy/bytecomp-tests.el (renamed from test/automated/bytecomp-tests.el)0
-rw-r--r--test/lisp/legacy/coding-tests.el (renamed from test/automated/coding-tests.el)8
-rw-r--r--test/lisp/legacy/core-elisp-tests.el (renamed from test/automated/core-elisp-tests.el)0
-rw-r--r--test/lisp/legacy/decoder-tests.el (renamed from test/automated/decoder-tests.el)0
-rw-r--r--test/lisp/legacy/files-tests.el (renamed from test/automated/files.el)0
-rw-r--r--test/lisp/legacy/font-parse-tests.el (renamed from test/automated/font-parse-tests.el)1
-rw-r--r--test/lisp/legacy/lexbind-tests.el (renamed from test/automated/lexbind-tests.el)0
-rw-r--r--test/lisp/legacy/occur-tests.el (renamed from test/automated/occur-tests.el)0
-rw-r--r--test/lisp/legacy/process-tests.el (renamed from test/automated/process-tests.el)0
-rw-r--r--test/lisp/legacy/syntax-tests.el (renamed from test/automated/syntax-tests.el)0
-rw-r--r--test/lisp/legacy/textprop-tests.el (renamed from test/automated/textprop-tests.el)0
-rw-r--r--test/lisp/legacy/undo-tests.el (renamed from test/automated/undo-tests.el)0
-rw-r--r--test/lisp/mail/rmail-tests.el35
-rw-r--r--test/lisp/man-tests.el (renamed from test/automated/man-tests.el)0
-rw-r--r--test/lisp/minibuffer-tests.el (renamed from test/automated/completion-tests.el)0
-rw-r--r--test/lisp/mouse-tests.el50
-rw-r--r--test/lisp/net/dbus-tests.el (renamed from test/automated/dbus-tests.el)0
-rw-r--r--test/lisp/net/network-stream-tests.el294
-rw-r--r--test/lisp/net/newsticker-tests.el (renamed from test/automated/newsticker-tests.el)0
-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.el58
-rw-r--r--test/lisp/net/tramp-tests.el (renamed from test/automated/tramp-tests.el)196
-rw-r--r--test/lisp/obarray-tests.el (renamed from test/automated/obarray-tests.el)0
-rw-r--r--test/lisp/progmodes/cc-mode.el65
-rw-r--r--test/lisp/progmodes/compile-tests.el (renamed from test/automated/compile-tests.el)7
-rw-r--r--test/lisp/progmodes/elisp-mode-tests.el (renamed from test/automated/elisp-mode-tests.el)85
-rw-r--r--test/lisp/progmodes/f90.el (renamed from test/automated/f90.el)0
-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/python-tests.el (renamed from test/automated/python-tests.el)0
-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/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.el36
-rw-r--r--test/lisp/replace-tests.el (renamed from test/automated/replace-tests.el)0
-rw-r--r--test/lisp/simple-tests.el (renamed from test/automated/simple-test.el)18
-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)0
-rw-r--r--test/lisp/textmodes/css-mode-tests.el188
-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)0
-rw-r--r--test/lisp/thingatpt-tests.el (renamed from test/automated/thingatpt.el)0
-rw-r--r--test/lisp/url/url-auth-tests.el255
-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)0
-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/vc-bzr-tests.el (renamed from test/automated/vc-bzr.el)8
-rw-r--r--test/lisp/vc/vc-hg.el (renamed from test/automated/vc-hg.el)0
-rw-r--r--test/lisp/vc/vc-tests.el (renamed from test/automated/vc-tests.el)229
-rw-r--r--test/lisp/xml-tests.el (renamed from test/automated/xml-parse-tests.el)0
-rw-r--r--test/lisp/xt-mouse-tests.el (renamed from test/automated/xt-mouse-tests.el)0
-rw-r--r--test/make-test-deps.emacs-lisp98
-rw-r--r--test/manual/BidiCharacterTest.txt (renamed from test/BidiCharacterTest.txt)0
-rw-r--r--test/manual/biditest.el (renamed from test/biditest.el)0
-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)0
-rw-r--r--test/manual/etags/ETAGS.good_1 (renamed from test/etags/ETAGS.good_1)0
-rw-r--r--test/manual/etags/ETAGS.good_2 (renamed from test/etags/ETAGS.good_2)0
-rw-r--r--test/manual/etags/ETAGS.good_3 (renamed from test/etags/ETAGS.good_3)0
-rw-r--r--test/manual/etags/ETAGS.good_4 (renamed from test/etags/ETAGS.good_4)0
-rw-r--r--test/manual/etags/ETAGS.good_5 (renamed from test/etags/ETAGS.good_5)0
-rw-r--r--test/manual/etags/ETAGS.good_6 (renamed from test/etags/ETAGS.good_6)0
-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)bin408 -> 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)bin3265 -> 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)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)2
-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.ruby29
-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)0
-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)0
-rw-r--r--test/manual/etags/y-src/parse.y (renamed from test/etags/y-src/parse.y)0
-rw-r--r--test/manual/indent/Makefile (renamed from test/indent/Makefile)0
-rw-r--r--test/manual/indent/css-mode.css (renamed from test/indent/css-mode.css)0
-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)0
-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-xtest/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 (renamed from test/indent/scss-mode.scss)0
-rw-r--r--test/manual/indent/sgml-mode-attribute.html (renamed from test/indent/sgml-mode-attribute.html)0
-rwxr-xr-xtest/manual/indent/shell.rc (renamed from test/indent/shell.rc)0
-rwxr-xr-xtest/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)0
-rw-r--r--test/manual/rmailmm.el (renamed from test/rmailmm.el)0
-rw-r--r--test/src/alloc-tests.el (renamed from test/automated/finalizer-tests.el)2
-rw-r--r--test/src/buffer-tests.el (renamed from test/automated/buffer-tests.el)0
-rw-r--r--test/src/callproc-tests.el39
-rw-r--r--test/src/chartab-tests.el51
-rw-r--r--test/src/cmds-tests.el (renamed from test/automated/cmds-tests.el)0
-rw-r--r--test/src/data-tests.el (renamed from test/automated/data-tests.el)0
-rw-r--r--test/src/decompress-tests.el (renamed from test/automated/zlib-tests.el)6
-rw-r--r--test/src/editfns-tests.el136
-rw-r--r--test/src/fns-tests.el (renamed from test/automated/fns-tests.el)54
-rw-r--r--test/src/inotify-tests.el (renamed from test/automated/inotify-test.el)0
-rw-r--r--test/src/keymap-tests.el (renamed from test/automated/keymap-tests.el)0
-rw-r--r--test/src/lread-tests.el107
-rw-r--r--test/src/print-tests.el (renamed from test/automated/print-tests.el)0
-rw-r--r--test/src/regex-resources/BOOST.tests829
-rw-r--r--test/src/regex-resources/PCRE.tests2386
-rw-r--r--test/src/regex-resources/PTESTS341
-rw-r--r--test/src/regex-resources/TESTS167
-rw-r--r--test/src/regex-tests.el678
-rw-r--r--test/src/xml-tests.el (renamed from test/automated/libxml-tests.el)0
311 files changed, 8290 insertions, 690 deletions
diff --git a/test/automated/Makefile.in b/test/Makefile.in
index 9c9b3be1e0b..33e625fc996 100644
--- a/test/automated/Makefile.in
+++ b/test/Makefile.in
@@ -21,7 +21,8 @@
## Some targets:
## check: re-run all tests, writing to .log files.
-## check-maybe: run all tests whose .log file needs updating
+## 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
@@ -32,12 +33,14 @@ SHELL = @SHELL@
srcdir = @srcdir@
VPATH = $(srcdir)
+MKDIR_P = @MKDIR_P@
+
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 = ../src/emacs
EMACS_EXTRAOPT=
@@ -103,22 +106,31 @@ else
SELECTOR_ACTUAL=$(SELECTOR_EXPENSIVE)
endif
+## Byte-compile all test files to test for errors (unless explicitly
+## told not to), but then evaluate the un-byte-compiled files, because
+## they give cleaner stacktraces.
-%.log: ${srcdir}/%.el
- @if grep '^;.*no-byte-compile: t' $< > /dev/null; then \
- loadfile=$<; \
- else \
- loadfile=$<c; \
- ${MAKE} $$loadfile; \
+## Beware: it approximates 'no-byte-compile', so watch out for false-positives!
+%.log: %.el
+ elc=$<c; \
+ if ! grep '^;.*no-byte-compile: t' $< > /dev/null; then \
+ ${MAKE} $$elc; \
fi; \
+ loadfile=$<; \
echo Testing $$loadfile; \
stat=OK ; \
+ ${MKDIR_P} $(dir $@) ; \
$(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=}
+ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
+ -path "*resources" -prune -o -name "*el" -print)
+## .elc files may be in a different directory for out of source builds
+ELCFILES = $(patsubst %.el,%.elc, \
+ $(patsubst $(srcdir)%,.%,$(ELFILES)))
+LOGFILES = $(patsubst %.elc,%.log,${ELCFILES})
+LOGSAVEFILES = $(patsubst %.elc,%.log~,${ELCFILES})
+TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
## If we have to interrupt a hanging test, preserve the log so we can
## see what the problem was.
@@ -127,26 +139,46 @@ TESTS = ${LOGFILES:.log=}
.PHONY: ${TESTS}
## The short aliases that always re-run the tests, with no logging.
+## Define an alias both with and without the directory name for ease
+## of use.
define test_template
$(1):
- @test ! -f $(1).log || mv $(1).log $(1).log~
- @${MAKE} $(1).log WRITE_LOG=
+ @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})))
+## 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
+
+## Include dependencies between test files and the files they test.
+## We could do this without the file and eval directly, but then we
+## would have to run Emacs for every make invocation, and it might not
+## be available during clean.
+-include make-test-deps.mk
## Rerun all default tests.
-check: mostlyclean
+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-expensive: mostlyclean check-no-automated-subdir
@${MAKE} check-doit SELECTOR="${SELECTOR_EXPENSIVE}"
-## Only re-run default tests whose .log is older than the test.
+## 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. The source file dependencies are
+## determined by a heuristic and does not identify the full dependency
+## graph. See make-test-deps.emacs-lisp for details.
.PHONY: check-maybe
-check-maybe:
+check-maybe: check-no-automated-subdir
@${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
## Run the tests.
@@ -157,17 +189,22 @@ check-doit: ${LOGFILES}
.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
mostlyclean:
- -@for f in *.log; do test ! -f $$f || mv $$f $$f~; done
+ -@for f in ${LOGFILES}; do test ! -f $$f || mv $$f $$f~; done
clean:
- -rm -f *.log *.log~
+ -rm -f ${LOGFILES} ${LOGSAVEFILES}
+ -rm make-test-deps.mk
bootstrap-clean: clean
- -rm -f ${srcdir}/*.elc
+ -rm -f ${ELCFILES}
distclean: clean
rm -f Makefile
maintainer-clean: distclean bootstrap-clean
+make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
+ $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
+ --eval "(make-test-deps \"$(srcdir)\")" \
+ 2> $@
# Makefile ends here.
diff --git a/test/README b/test/README
index d2aee9bf57b..2994fca6c85 100644
--- a/test/README
+++ b/test/README
@@ -8,8 +8,7 @@ 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/abbrev-tests.el b/test/automated/abbrev-tests.el
deleted file mode 100644
index 66413c5a590..00000000000
--- a/test/automated/abbrev-tests.el
+++ /dev/null
@@ -1,98 +0,0 @@
-;;; abbrev-tests.el --- Test suite for abbrevs.
-
-;; Copyright (C) 2015-2016 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/help-fns.el b/test/automated/help-fns.el
deleted file mode 100644
index babba1a68fc..00000000000
--- a/test/automated/help-fns.el
+++ /dev/null
@@ -1,70 +0,0 @@
-;;; help-fns.el --- tests for help-fns.el
-
-;; Copyright (C) 2014-2016 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/data/decompress/foo.gz b/test/data/decompress/foo.gz
index a68653fcbb9..a68653fcbb9 100644
--- a/test/automated/data/decompress/foo.gz
+++ b/test/data/decompress/foo.gz
Binary files differ
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
index 53d463e85b5..53d463e85b5 100644
--- a/test/automated/data/files-bug18141.el.gz
+++ b/test/data/files-bug18141.el.gz
Binary files differ
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 &#39;(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">    &quot;Turns on cursor-intangible-mode.&quot;</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/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..226e12d5330
--- /dev/null
+++ b/test/file-organization.org
@@ -0,0 +1,54 @@
+#+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/automated/lisp~ directory. Tests
+should reflect the directory structure of the source tree; so tests for files
+in the ~emacs-lisp~ source directory should reside in the
+~test/lisp/emacs-lisp~ directory.
+
+Tests should normally reside in a file with ~-tests~ added to the name of
+the tested source file; hence ~ert.el~ is tested in ~ert-tests.el~, or
+~pcase.el~ is tested in ~pcase-tests.el~. Exceptionally, 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~
+
+Where features of the C source are tested using Emacs-Lisp test files, these
+should reside in ~/test/src~ and be named after the C file.
+
+A few test suites which predate this scheme and do not fit cleanly
+into it are placed in ~/test/lisp/legacy~.
+
+There are also some test materials that cannot be run automatically
+(i.e. via ert). These should be placed in ~/test/manual~
+
+** 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 ~flymake.el~ should have test
+files in ~/test/automated/lisp/progmodes/flymake-tests.el~ should reside in a
+directory called ~/test/automated/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/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
new file mode 100644
index 00000000000..c747e19db88
--- /dev/null
+++ b/test/lisp/abbrev-tests.el
@@ -0,0 +1,255 @@
+;;; abbrev-tests.el --- Test suite for abbrevs -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2015-2016 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)))
+ (let* ((table (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/automated/auth-source-tests.el b/test/lisp/auth-source-tests.el
index 5faa1fe20bf..5faa1fe20bf 100644
--- a/test/automated/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
diff --git a/test/automated/auto-revert-tests.el b/test/lisp/autorevert-tests.el
index a6f8cb29563..2f951c0c9aa 100644
--- a/test/automated/auto-revert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -156,7 +156,76 @@
(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
+ (with-current-buffer (get-buffer-create "*Messages*")
+ (narrow-to-region (point-max) (point-max)))
+ (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)
+ (with-current-buffer (get-buffer-create "*Messages*")
+ (narrow-to-region (point-max) (point-max)))
+ (sleep-for 1)
+ (write-region "another text" nil tmpfile nil 'no-message)
+
+ ;; Check, that the buffer hasn't been reverted. File
+ ;; notification should be disabled, falling back to
+ ;; polling.
+ (auto-revert--wait-for-revert buf)
+ (should (string-match "any text" (buffer-string)))
+ (should-not auto-revert-use-notify)
+
+ ;; Once the file has been recreated, the buffer shall be
+ ;; reverted.
+ (kill-local-variable 'before-revert-hook)
+ (with-current-buffer (get-buffer-create "*Messages*")
+ (narrow-to-region (point-max) (point-max)))
+ (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)
+ (should (string-match "another text" (buffer-string)))
+
+ ;; An empty file shall still be reverted.
+ (with-current-buffer (get-buffer-create "*Messages*")
+ (narrow-to-region (point-max) (point-max)))
+ (sleep-for 1)
+ (write-region "" nil tmpfile nil 'no-message)
+
+ ;; Check, that the buffer has been reverted.
+ (auto-revert--wait-for-revert buf)
+ (should (string-equal "" (buffer-string)))))
+
+ ;; Exit.
+ (with-current-buffer "*Messages*" (widen))
+ (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.
@@ -194,7 +263,7 @@
(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.
diff --git a/test/automated/calc-tests.el b/test/lisp/calc/calc-tests.el
index c1fb1695c78..c1fb1695c78 100644
--- a/test/automated/calc-tests.el
+++ b/test/lisp/calc/calc-tests.el
diff --git a/test/automated/icalendar-tests.el b/test/lisp/calendar/icalendar-tests.el
index 2c13a363213..6db4222697e 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")
diff --git a/test/lisp/calendar/parse-time-tests.el b/test/lisp/calendar/parse-time-tests.el
new file mode 100644
index 00000000000..9bcf2b4a53c
--- /dev/null
+++ b/test/lisp/calendar/parse-time-tests.el
@@ -0,0 +1,49 @@
+;; parse-time-tests.el --- Test suite for parse-time.el
+
+;; Copyright (C) 2016 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))))
+
+(provide 'parse-time-tests)
+
+;;; parse-time-tests.el ends here
diff --git a/test/automated/char-fold-tests.el b/test/lisp/char-fold-tests.el
index 485254aa6cf..485254aa6cf 100644
--- a/test/automated/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
diff --git a/test/automated/comint-testsuite.el b/test/lisp/comint-tests.el
index 576be238408..576be238408 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 9c7a8385535..9c7a8385535 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 9e851c3a119..9e851c3a119 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..6dd4bb91bc2
--- /dev/null
+++ b/test/lisp/dired-tests.el
@@ -0,0 +1,56 @@
+;;; dired-tests.el --- Test suite. -*- 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 'ert)
+(require 'dired)
+
+
+(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))))
+
+(provide 'dired-tests)
+;; dired-tests.el ends here
diff --git a/test/automated/electric-tests.el b/test/lisp/electric-tests.el
index afd707667b8..afd707667b8 100644
--- a/test/automated/electric-tests.el
+++ b/test/lisp/electric-tests.el
diff --git a/test/automated/cl-generic-tests.el b/test/lisp/emacs-lisp/cl-generic-tests.el
index dee10fe285e..dee10fe285e 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 cbaf70fc4bb..cbaf70fc4bb 100644
--- a/test/automated/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
diff --git a/test/automated/cl-seq-tests.el b/test/lisp/emacs-lisp/cl-seq-tests.el
index d2eb412eee3..d2eb412eee3 100644
--- a/test/automated/cl-seq-tests.el
+++ b/test/lisp/emacs-lisp/cl-seq-tests.el
diff --git a/test/automated/eieio-test-methodinvoke.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
index eb26047da2f..eb26047da2f 100644
--- a/test/automated/eieio-test-methodinvoke.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
diff --git a/test/automated/eieio-test-persist.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
index 2f8d65e512e..2f8d65e512e 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 bdf66c946f0..9665beb490e 100644
--- a/test/automated/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -895,6 +895,12 @@ Subclasses to override slot attributes.")
(ert-deftest eieio-test-37-obsolete-name-in-constructor ()
(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 5d3675553d7..5d3675553d7 100644
--- a/test/automated/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
diff --git a/test/automated/ert-x-tests.el b/test/lisp/emacs-lisp/ert-x-tests.el
index ef8642aebfb..ef8642aebfb 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 8ed0f2a240d..8ed0f2a240d 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 80d418cabbe..80d418cabbe 100644
--- a/test/automated/let-alist.el
+++ b/test/lisp/emacs-lisp/let-alist-tests.el
diff --git a/test/lisp/emacs-lisp/lisp-tests.el b/test/lisp/emacs-lisp/lisp-tests.el
new file mode 100644
index 00000000000..4fe20f06e9d
--- /dev/null
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -0,0 +1,211 @@
+;;; lisp-tests.el --- Test Lisp editing commands -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
+
+;; Author: Aaron S. Hawley <aaron.s.hawley@gmail.com>
+;; 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)
+
+(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.
+
+(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 20cb0f6b399..0af1c656e09 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 cd51599b86a..cd51599b86a 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
index 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
Binary files differ
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..1acd9f744b9 100644
--- a/test/automated/data/package/package-test-server.py
+++ b/test/lisp/emacs-lisp/package-resources/package-test-server.py
@@ -10,7 +10,7 @@ Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
- port = 8000
+ port = 0
server_address = ('127.0.0.1', port)
HandlerClass.protocol_version = Protocol
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
index 658edd3f60e..658edd3f60e 100644
--- a/test/automated/data/package/signed/archive-contents.sig
+++ b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig
Binary files differ
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
index 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
Binary files differ
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
index 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
Binary files differ
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 c4c856f3031..3d2801e3d70 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
@@ -190,18 +190,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 +244,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 +283,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 +299,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 +350,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 +370,28 @@ 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"))
+ port)
+ (unwind-protect
+ (progn
+ (with-current-buffer "package-server-buffer"
+ (should
+ (with-timeout (10 nil)
+ (while (not port)
+ (accept-process-output nil 1)
+ (goto-char (point-min))
+ (if (re-search-forward "Serving HTTP on .* port \\([0-9]+\\) "
+ nil t)
+ (setq port (match-string 1))))
+ port)))
+ (with-package-test (:basedir
+ package-test-data-dir
+ :location (format "http://0.0.0.0:%s/" port))
(list-packages)
(should package--downloads-in-progress)
(should mode-line-process)
@@ -395,8 +405,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 +480,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 +539,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 +563,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 +630,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 a428e4092f1..a428e4092f1 100644
--- a/test/automated/pcase-tests.el
+++ b/test/lisp/emacs-lisp/pcase-tests.el
diff --git a/test/automated/regexp-tests.el b/test/lisp/emacs-lisp/regexp-opt-tests.el
index 01119a3374f..01119a3374f 100644
--- a/test/automated/regexp-tests.el
+++ b/test/lisp/emacs-lisp/regexp-opt-tests.el
diff --git a/test/automated/seq-tests.el b/test/lisp/emacs-lisp/seq-tests.el
index a8ca48b1328..c2065c6718f 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))
@@ -337,5 +366,10 @@ 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"]))))
+
(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 e30b5d8f549..e30b5d8f549 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 0fb8dee7fd1..0fb8dee7fd1 100644
--- a/test/automated/tabulated-list-test.el
+++ b/test/lisp/emacs-lisp/tabulated-list-test.el
diff --git a/test/automated/thunk-tests.el b/test/lisp/emacs-lisp/thunk-tests.el
index f995d362c7d..f995d362c7d 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 e3cdec73232..e3cdec73232 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 0d6095b2c92..2c63b24fae0 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 4a317974ef5..d51ab23f71e 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
@@ -52,9 +53,14 @@
&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)))
+ `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)))
(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")
@@ -78,7 +84,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 +96,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 +114,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 +128,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 +144,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 +159,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..7cf3ef7bb2f
--- /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 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.el
index d5676dd1daf..d5676dd1daf 100644
--- a/test/automated/eshell.el
+++ b/test/lisp/eshell/eshell.el
diff --git a/test/automated/faces-tests.el b/test/lisp/faces-tests.el
index 809ba24d210..809ba24d210 100644
--- a/test/automated/faces-tests.el
+++ b/test/lisp/faces-tests.el
diff --git a/test/automated/file-notify-tests.el b/test/lisp/filenotify-tests.el
index 9f0c0ed0dc1..0e6e58e7b80 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-2016 Free Software Foundation, Inc.
@@ -73,9 +73,46 @@ It is different for local and remote file notification libraries.")
(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)
+ (read-event nil nil file-notify--test-read-event-timeout))))
+
+(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)
@@ -103,9 +140,7 @@ It is different for local and remote file notification libraries.")
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))
(setq password-cache-expiry nil
tramp-verbose 0
@@ -140,7 +175,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.
@@ -176,14 +211,22 @@ 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)))
+ (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,58 +235,66 @@ 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)
+ (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 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)))
+ ;; 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.")
@@ -289,28 +340,25 @@ and the event to `file-notify--test-events'."
(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 +367,25 @@ 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--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
@@ -361,7 +418,7 @@ 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.
@@ -381,23 +438,15 @@ 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)
+ ;; 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)
@@ -414,7 +463,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 raise `deleted' and `stopped'
@@ -429,11 +478,10 @@ longer than timeout seconds for the events to be delivered."
((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))
+ (delete-directory temporary-file-directory 'recursive))
(file-notify-rm-watch file-notify--test-desc))
;; Check copy of files inside a directory.
@@ -445,7 +493,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
@@ -464,7 +512,6 @@ longer than timeout seconds for the events to be delivered."
'(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)
@@ -475,7 +522,7 @@ longer than timeout seconds for the events to be delivered."
(read-event nil nil file-notify--test-read-event-timeout)
(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))
+ (delete-directory temporary-file-directory 'recursive))
(file-notify-rm-watch file-notify--test-desc))
;; Check rename of files inside a directory.
@@ -487,7 +534,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 raise `deleted' and `stopped'
@@ -502,14 +549,13 @@ longer than timeout seconds for the events to be delivered."
((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)
(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))
+ (delete-directory temporary-file-directory 'recursive))
(file-notify-rm-watch file-notify--test-desc))
;; Check attribute change. Does not work for cygwin.
@@ -521,20 +567,22 @@ 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)
@@ -543,7 +591,10 @@ longer than timeout seconds for the events to be delivered."
(set-file-times file-notify--test-tmpfile '(0 0))
(read-event nil nil file-notify--test-read-event-timeout)
(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)))
@@ -559,6 +610,7 @@ longer than timeout seconds for the events to be delivered."
(ert-deftest file-notify-test03-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))
@@ -566,7 +618,6 @@ longer than timeout seconds for the events to be delivered."
(unwind-protect
(progn
(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))
@@ -628,7 +679,10 @@ longer than timeout seconds for the events to be delivered."
(string-match
(format-message "Reverting buffer `%s'." (buffer-name buf))
(buffer-string))))
- (should (string-match "foo bla" (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))
@@ -649,14 +703,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 +726,25 @@ 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)
+ ;; 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)
(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,6 +758,7 @@ 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
@@ -721,15 +773,16 @@ longer than timeout seconds for the events to be delivered."
((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)
(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))
+
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
;; Cleanup.
(file-notify--test-cleanup)))
@@ -743,14 +796,13 @@ longer than timeout seconds for the events to be delivered."
(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 +810,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,7 +835,10 @@ 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))
+
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
;; Cleanup.
(file-notify--test-cleanup)))
@@ -792,16 +850,15 @@ longer than timeout seconds for the events to be delivered."
"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
@@ -831,6 +888,12 @@ 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 '(:random)))
+ (dotimes (_i n r)
+ (setq r (append r '(changed deleted))))))
(t (make-list n 'renamed)))
(let ((source-file-list source-file-list)
(target-file-list target-file-list))
@@ -840,7 +903,11 @@ longer than timeout seconds for the events to be delivered."
(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)))
+ (delete-file file) file-notify--test-read-event-timeout))
+ (delete-directory file-notify--test-tmpfile)
+
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
;; Cleanup.
(file-notify--test-cleanup)))
@@ -863,18 +930,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,40 +944,49 @@ 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)))
@@ -969,58 +1036,45 @@ 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
+ (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)
+ (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))))))
;; 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))
@@ -1050,7 +1104,10 @@ 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))
+
+ ;; The environment shall be cleaned up.
+ (file-notify--test-cleanup-p))
;; Cleanup.
(file-notify--test-cleanup)))
@@ -1058,6 +1115,50 @@ the file watch."
(file-notify--deftest-remote file-notify-test08-watched-file-in-watched-dir
"Check `file-notify-test08-watched-file-in-watched-dir' for remote files.")
+(ert-deftest file-notify-test09-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-test09-sufficient-resources
+ "Check `file-notify-test09-sufficient-resources' for remote files.")
+
(defun file-notify-test-all (&optional interactive)
"Run all tests for \\[file-notify]."
(interactive "p")
@@ -1076,4 +1177,4 @@ the file watch."
;; * Check, why cygwin recognizes only `deleted' and `stopped' events.
(provide 'file-notify-tests)
-;;; file-notify-tests.el ends here
+;;; filenotify-tests.el ends here
diff --git a/test/automated/gnus-tests.el b/test/lisp/gnus/gnus-tests.el
index 6801ce69a3e..6801ce69a3e 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 3afa1569f64..13c15e33b27 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..ba0d8ed8e38
--- /dev/null
+++ b/test/lisp/help-fns-tests.el
@@ -0,0 +1,121 @@
+;;; help-fns.el --- tests for help-fns.el
+
+;; Copyright (C) 2014-2016 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/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el
new file mode 100644
index 00000000000..012e170f4d6
--- /dev/null
+++ b/test/lisp/htmlfontify-tests.el
@@ -0,0 +1,34 @@
+;;; htmlfontify-tests.el --- Test suite. -*- 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 '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))))
+
+(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..de281c03735
--- /dev/null
+++ b/test/lisp/ibuffer-tests.el
@@ -0,0 +1,34 @@
+;;; ibuffer-tests.el --- Test suite. -*- 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 'ert)
+(require 'ibuffer)
+
+(ert-deftest ibuffer-autoload ()
+ "Tests to see whether reftex-auc has been autoloaded"
+ (should
+ (fboundp 'ibuffer-mark-unsaved-buffers))
+ (should
+ (autoloadp
+ (symbol-function
+ 'ibuffer-mark-unsaved-buffers))))
+
+(provide 'ibuffer-tests)
+;; ibuffer-tests.el ends here
diff --git a/test/automated/imenu-test.el b/test/lisp/imenu-tests.el
index b6e0f604d0e..b6e0f604d0e 100644
--- a/test/automated/imenu-test.el
+++ b/test/lisp/imenu-tests.el
diff --git a/test/automated/info-xref.el b/test/lisp/info-xref-tests.el
index bc3115042bc..bc3115042bc 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 9846aa13295..9846aa13295 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..42cf805b778
--- /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-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/>.
+
+;;; 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 48c342403c9..48c342403c9 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..dcb6936e320
--- /dev/null
+++ b/test/lisp/jit-lock-tests.el
@@ -0,0 +1,60 @@
+;;; jit-lock-tests.el --- tests for jit-lock
+
+;; Copyright (C) 2016 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 78cebb45eed..78cebb45eed 100644
--- a/test/automated/json-tests.el
+++ b/test/lisp/json-tests.el
diff --git a/test/automated/bytecomp-tests.el b/test/lisp/legacy/bytecomp-tests.el
index 48211f03ba4..48211f03ba4 100644
--- a/test/automated/bytecomp-tests.el
+++ b/test/lisp/legacy/bytecomp-tests.el
diff --git a/test/automated/coding-tests.el b/test/lisp/legacy/coding-tests.el
index cba8c7bc25f..772c8735519 100644
--- a/test/automated/coding-tests.el
+++ b/test/lisp/legacy/coding-tests.el
@@ -48,3 +48,11 @@
(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)))))
diff --git a/test/automated/core-elisp-tests.el b/test/lisp/legacy/core-elisp-tests.el
index b44bb37cc4f..b44bb37cc4f 100644
--- a/test/automated/core-elisp-tests.el
+++ b/test/lisp/legacy/core-elisp-tests.el
diff --git a/test/automated/decoder-tests.el b/test/lisp/legacy/decoder-tests.el
index 5699fec7d17..5699fec7d17 100644
--- a/test/automated/decoder-tests.el
+++ b/test/lisp/legacy/decoder-tests.el
diff --git a/test/automated/files.el b/test/lisp/legacy/files-tests.el
index 3c6f61b792c..3c6f61b792c 100644
--- a/test/automated/files.el
+++ b/test/lisp/legacy/files-tests.el
diff --git a/test/automated/font-parse-tests.el b/test/lisp/legacy/font-parse-tests.el
index 6274253360f..9f730d3148c 100644
--- a/test/automated/font-parse-tests.el
+++ b/test/lisp/legacy/font-parse-tests.el
@@ -32,6 +32,7 @@
(defvar font-parse-tests--data
`((" " ,(intern " ") nil nil nil nil)
("Monospace" Monospace nil nil nil nil)
+ ("Monospace Serif" ,(intern "Monospace Serif") nil nil nil nil)
("Foo1" Foo1 nil nil nil nil)
("12" nil 12.0 nil nil nil)
("12 " ,(intern "12 ") nil nil nil nil)
diff --git a/test/automated/lexbind-tests.el b/test/lisp/legacy/lexbind-tests.el
index 3bf8c1361ad..3bf8c1361ad 100644
--- a/test/automated/lexbind-tests.el
+++ b/test/lisp/legacy/lexbind-tests.el
diff --git a/test/automated/occur-tests.el b/test/lisp/legacy/occur-tests.el
index da45d5f6502..da45d5f6502 100644
--- a/test/automated/occur-tests.el
+++ b/test/lisp/legacy/occur-tests.el
diff --git a/test/automated/process-tests.el b/test/lisp/legacy/process-tests.el
index 8554a287ccd..8554a287ccd 100644
--- a/test/automated/process-tests.el
+++ b/test/lisp/legacy/process-tests.el
diff --git a/test/automated/syntax-tests.el b/test/lisp/legacy/syntax-tests.el
index d4af80e8ebe..d4af80e8ebe 100644
--- a/test/automated/syntax-tests.el
+++ b/test/lisp/legacy/syntax-tests.el
diff --git a/test/automated/textprop-tests.el b/test/lisp/legacy/textprop-tests.el
index 397ef28c035..397ef28c035 100644
--- a/test/automated/textprop-tests.el
+++ b/test/lisp/legacy/textprop-tests.el
diff --git a/test/automated/undo-tests.el b/test/lisp/legacy/undo-tests.el
index b1c786993e8..b1c786993e8 100644
--- a/test/automated/undo-tests.el
+++ b/test/lisp/legacy/undo-tests.el
diff --git a/test/lisp/mail/rmail-tests.el b/test/lisp/mail/rmail-tests.el
new file mode 100644
index 00000000000..2f18372146a
--- /dev/null
+++ b/test/lisp/mail/rmail-tests.el
@@ -0,0 +1,35 @@
+;;; rmail-tests.el --- Test suite. -*- 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 'ert)
+(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))))
+
+(provide 'rmail-tests)
+;; rmail-tests.el ends here
diff --git a/test/automated/man-tests.el b/test/lisp/man-tests.el
index b1cc4437256..b1cc4437256 100644
--- a/test/automated/man-tests.el
+++ b/test/lisp/man-tests.el
diff --git a/test/automated/completion-tests.el b/test/lisp/minibuffer-tests.el
index 0f2abf45673..0f2abf45673 100644
--- a/test/automated/completion-tests.el
+++ b/test/lisp/minibuffer-tests.el
diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el
new file mode 100644
index 00000000000..204f5d3b8d8
--- /dev/null
+++ b/test/lisp/mouse-tests.el
@@ -0,0 +1,50 @@
+;;; mouse-tests.el --- unit tests for mouse.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 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))))))
+
+;;; mouse-tests.el ends here
diff --git a/test/automated/dbus-tests.el b/test/lisp/net/dbus-tests.el
index 12be1637109..12be1637109 100644
--- a/test/automated/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
diff --git a/test/lisp/net/network-stream-tests.el b/test/lisp/net/network-stream-tests.el
new file mode 100644
index 00000000000..afffeeb1932
--- /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 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))
+ (should-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))
+ (should-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 d8531083e60..d8531083e60 100644
--- a/test/automated/newsticker-tests.el
+++ b/test/lisp/net/newsticker-tests.el
diff --git a/test/automated/sasl-scram-rfc-tests.el b/test/lisp/net/sasl-scram-rfc-tests.el
index 130de240481..130de240481 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..501916fc8bf
--- /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 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/automated/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 34d8d6ad495..e05786fa070 100644
--- a/test/automated/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -115,11 +115,10 @@ being the result.")
(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."
+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-message-show-message t)
(tramp-debug-on-error t)
(debug-ignored-errors
(cons "^make-symbolic-link not supported$" debug-ignored-errors)))
@@ -637,7 +636,26 @@ This checks also `file-name-as-directory', `file-name-directory',
(should
(string-equal (file-name-nondirectory "/method:host:/path/to/file/") ""))
(should-not
- (unhandled-file-name-directory "/method:host:/path/to/file")))
+ (unhandled-file-name-directory "/method:host:/path/to/file"))
+
+ ;; Bug#10085.
+ (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
+ `(,(file-remote-p tramp-test-temporary-file-directory 'method)
+ ,(file-remote-p tramp-test-temporary-file-directory 'host)))
+ (unless (zerop (length file))
+ (setq file (format "/%s:" file))
+ (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'."
@@ -913,7 +931,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(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)
+ (should-error (make-directory tmp-name2))
(make-directory tmp-name2 'parents)
(should (file-directory-p tmp-name2))
(should (file-accessible-directory-p tmp-name2)))
@@ -933,19 +951,16 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(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-error (delete-directory tmp-name) :type 'file-error)
+ (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))
- (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))
@@ -954,6 +969,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
(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.
@@ -972,6 +989,31 @@ This tests also `file-directory-p' and `file-accessible-directory-p'."
;; 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 ()
@@ -1071,12 +1113,12 @@ This tests also `file-readable-p' and `file-regular-p'."
(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.
+ (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.
@@ -1353,25 +1395,85 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
"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/"))))
+ (dolist (n-e '(nil t))
+ (let ((non-essential n-e)
+ (tmp-name (tramp--test-make-temp-name))
+ (method (file-remote-p tramp-test-temporary-file-directory 'method))
+ (host (file-remote-p tramp-test-temporary-file-directory 'host)))
- ;; Cleanup.
- (ignore-errors (delete-directory tmp-name 'recursive)))))
+ (unwind-protect
+ (progn
+ ;; Method and host name in completion mode. This kind of
+ ;; completion does not work on MS Windows.
+ (when (and (tramp-completion-mode-p)
+ (not (memq system-type '(cygwin windows-nt))))
+ (unless (zerop (length method))
+ (should
+ (member
+ (format "%s:" method)
+ (file-name-all-completions (substring method 0 1) "/"))))
+ (unless (zerop (length host))
+ (let ((tramp-default-method (or method tramp-default-method)))
+ (should
+ (member
+ (format "%s:" host)
+ (file-name-all-completions (substring host 0 1) "/")))))
+ (unless (or (zerop (length method)) (zerop (length host)))
+ (should
+ (member
+ (format "%s:" host)
+ (file-name-all-completions
+ (substring host 0 1) (format "/%s:" method))))))
+
+ ;; 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'."
@@ -1420,7 +1522,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(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)
+ (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))
@@ -1430,7 +1533,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(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)
+ (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)))
@@ -1533,7 +1637,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(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)
+ (while (re-search-forward tramp-display-escape-sequence-regexp nil t)
(replace-match "" nil nil))
(should
(string-equal
@@ -1556,7 +1660,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(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)
+ (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))
@@ -1585,7 +1689,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(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)
+ (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))
@@ -1858,6 +1962,12 @@ This does not support globbing characters in file names (yet)."
(string-match
"ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))))
+(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-gvfs-p ()
"Check, whether the remote host runs a GVFS based method.
This requires restrictions of file name syntax."
@@ -2057,6 +2167,7 @@ Several special characters do not work properly there."
(ert-deftest tramp-test32-special-characters ()
"Check special characters in file names."
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(tramp--test-special-characters))
@@ -2065,6 +2176,7 @@ Several special characters do not work properly there."
Use the `stat' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2084,6 +2196,7 @@ Use the `stat' command."
Use the `perl' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2106,6 +2219,7 @@ Use the `perl' command."
Use the `ls' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2141,6 +2255,7 @@ Use the `ls' command."
(ert-deftest tramp-test33-utf8 ()
"Check UTF8 encoding in file names and file contents."
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(tramp--test-utf8))
@@ -2149,6 +2264,7 @@ Use the `ls' command."
Use the `stat' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2168,6 +2284,7 @@ Use the `stat' command."
Use the `perl' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2190,6 +2307,7 @@ Use the `perl' command."
Use the `ls' command."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
+ (skip-unless (not (tramp--test-rsync-p)))
(skip-unless
(eq
(tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2366,8 +2484,8 @@ Since it unloads Tramp, it shall be the last test to run."
;; * 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-test06-directory-file-name' for `ftp'.
+;; * Fix `tramp-test15-copy-directory' for `rsync'.
;; * 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
diff --git a/test/automated/obarray-tests.el b/test/lisp/obarray-tests.el
index 92345b7198e..92345b7198e 100644
--- a/test/automated/obarray-tests.el
+++ b/test/lisp/obarray-tests.el
diff --git a/test/lisp/progmodes/cc-mode.el b/test/lisp/progmodes/cc-mode.el
new file mode 100644
index 00000000000..6cd9fa4bad5
--- /dev/null
+++ b/test/lisp/progmodes/cc-mode.el
@@ -0,0 +1,65 @@
+;;; cc-mode-tests.el --- Test suite for cc-mode. -*- lexical-binning: t -*-
+
+;; Copyright (C) 2016 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/>.
+
+;;; 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>")))))
diff --git a/test/automated/compile-tests.el b/test/lisp/progmodes/compile-tests.el
index 6821a6bfae5..89615760c77 100644
--- a/test/automated/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -79,6 +79,13 @@
1 nil 302 "\\lib\\python\\Products\\PythonScripts\\PythonScript.py")
("File \"/tmp/foo.py\", line 10"
1 nil 10 "/tmp/foo.py")
+ ;; 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")
diff --git a/test/automated/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el
index f3f15ad3dbd..12e61cf8d18 100644
--- a/test/automated/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -244,7 +244,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 +255,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 +347,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 +362,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 +378,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 +396,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 +421,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 +553,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 +586,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 +607,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 +617,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 +640,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 +658,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 +666,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/automated/f90.el b/test/lisp/progmodes/f90.el
index fece86ca1d8..fece86ca1d8 100644
--- a/test/automated/f90.el
+++ b/test/lisp/progmodes/f90.el
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 f3b830d3654..386516190bb 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/automated/python-tests.el b/test/lisp/progmodes/python-tests.el
index 54ed92212b8..54ed92212b8 100644
--- a/test/automated/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
diff --git a/test/automated/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el
index 52126a3bdf1..97f277bff41 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/automated/subword-tests.el b/test/lisp/progmodes/subword-tests.el
index 5a562765bb1..5a562765bb1 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 079b196aa8b..2b745816c62 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/lisp/ps-print-tests.el b/test/lisp/ps-print-tests.el
new file mode 100644
index 00000000000..9ebd31b7460
--- /dev/null
+++ b/test/lisp/ps-print-tests.el
@@ -0,0 +1,36 @@
+;;; ps-print-tests.el --- Test suite for ps-print.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2015-2016 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
+;; 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 'ps-print)
+(require 'ert)
+
+;;; 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/replace-tests.el b/test/lisp/replace-tests.el
index bfaab6c8944..bfaab6c8944 100644
--- a/test/automated/replace-tests.el
+++ b/test/lisp/replace-tests.el
diff --git a/test/automated/simple-test.el b/test/lisp/simple-tests.el
index c41d01075ed..d022240ae5c 100644
--- a/test/automated/simple-test.el
+++ b/test/lisp/simple-tests.el
@@ -204,7 +204,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,11 +219,25 @@
"\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
(ert-deftest undo-auto-boundary-timer ()
diff --git a/test/automated/sort-tests.el b/test/lisp/sort-tests.el
index f3a182cdc14..f3a182cdc14 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 ce212903c9d..ce212903c9d 100644
--- a/test/automated/subr-tests.el
+++ b/test/lisp/subr-tests.el
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
new file mode 100644
index 00000000000..d2817875956
--- /dev/null
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -0,0 +1,188 @@
+;;; css-mode-tests.el --- Test suite for CSS mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 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")) 147)))
+
+(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-complete-selector ()
+ (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-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)))))
+
+(provide 'css-mode-tests)
+;;; css-mode-tests.el ends here
diff --git a/test/automated/reftex-tests.el b/test/lisp/textmodes/reftex-tests.el
index 0f1186d8a82..12ec7f5a394 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 4184e2c3802..4184e2c3802 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 8b50cf72868..8b50cf72868 100644
--- a/test/automated/tildify-tests.el
+++ b/test/lisp/textmodes/tildify-tests.el
diff --git a/test/automated/thingatpt.el b/test/lisp/thingatpt-tests.el
index d3ecbf8c642..d3ecbf8c642 100644
--- a/test/automated/thingatpt.el
+++ b/test/lisp/thingatpt-tests.el
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
new file mode 100644
index 00000000000..bc30f3518e4
--- /dev/null
+++ b/test/lisp/url/url-auth-tests.el
@@ -0,0 +1,255 @@
+;;; url-auth-tests.el --- Test suite for url-auth.
+
+;; Copyright (C) 2015-2016 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-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))
+ ;; url-digest-auth doesn't return these AFAICS.
+;;; (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 6d1d54d4ffc..6d1d54d4ffc 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 87298cc1b96..87298cc1b96 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 77c5320e351..77c5320e351 100644
--- a/test/automated/url-parse-tests.el
+++ b/test/lisp/url/url-parse-tests.el
diff --git a/test/automated/url-util-tests.el b/test/lisp/url/url-util-tests.el
index 2f1de5103d6..2f1de5103d6 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 71be5a9eadc..71be5a9eadc 100644
--- a/test/automated/add-log-tests.el
+++ b/test/lisp/vc/add-log-tests.el
diff --git a/test/automated/vc-bzr.el b/test/lisp/vc/vc-bzr-tests.el
index 82721eeee4e..f27e6588cf2 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.el
index ba966598c4d..ba966598c4d 100644
--- a/test/automated/vc-hg.el
+++ b/test/lisp/vc/vc-hg.el
diff --git a/test/automated/vc-tests.el b/test/lisp/vc/vc-tests.el
index 5042196f425..8dc72cd7c81 100644
--- a/test/automated/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -109,6 +109,8 @@
(require 'ert)
(require 'vc)
+(declare-function w32-application-type "w32proc")
+
;; The working horses.
(defvar vc-test--cleanup-hook nil
@@ -117,7 +119,7 @@ Don't set it globally, the functions shall 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.
@@ -201,19 +203,28 @@ For backends which dont support it, it is emulated."
;; Save exit.
(ignore-errors (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 signalled."
+ ;; 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
@@ -232,32 +243,56 @@ 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 shall still exist.
(should (file-exists-p tmp-name1))
(should (file-exists-p tmp-name2))))
@@ -281,70 +316,42 @@ 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)))
+ (should (null (vc-state tmp-name)))
;; 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")
+ ;; nil: Bzr Git Hg RCS
+ ;; unsupported: CVS Mtn SCCS SRC SVN
+ (message "vc-state5 %s" (vc-state tmp-name))
+ (should (null (vc-state tmp-name))))))
;; Save exit.
(ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
@@ -371,60 +378,51 @@ 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)))))
@@ -451,9 +449,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 +458,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 +470,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,27 +481,25 @@ 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)))))
@@ -605,8 +598,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/automated/xml-parse-tests.el b/test/lisp/xml-tests.el
index 488d2c6f920..488d2c6f920 100644
--- a/test/automated/xml-parse-tests.el
+++ b/test/lisp/xml-tests.el
diff --git a/test/automated/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index c7e835c0311..c7e835c0311 100644
--- a/test/automated/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
new file mode 100644
index 00000000000..9edeef3d2a8
--- /dev/null
+++ b/test/make-test-deps.emacs-lisp
@@ -0,0 +1,98 @@
+;; -*- emacs-lisp -*-
+
+;; 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/>.
+
+;;; Commentary:
+
+;; This file generates dependencies between test files and the files
+;; that they test.
+
+;; It has an .emacs-lisp extension because it makes the Makefile easier!
+
+(require 'seq)
+
+(defun make-test-deps (src-dir)
+ (let ((src-dir (file-truename src-dir)))
+ (message
+ "%s"
+ (concat
+ (make-test-deps-lisp src-dir)
+ (make-test-deps-src src-dir)))))
+
+(defun make-test-deps-lisp (src-dir)
+ (mapconcat
+ (lambda (file-without-suffix)
+ (format "./%s-tests.log: %s/../%s.el\n"
+ file-without-suffix
+ src-dir
+ file-without-suffix))
+ (make-test-test-files src-dir "lisp") ""))
+
+(defun make-test-deps-src (src-dir)
+ (mapconcat
+ (lambda (file-without-suffix)
+ (format "./%s-tests.log: %s/../%s.c\n"
+ file-without-suffix
+ src-dir
+ file-without-suffix))
+ (make-test-test-files src-dir "src") ""))
+
+(defun make-test-test-files (src-dir sub-src-dir)
+ (make-test-munge-files
+ src-dir
+ (directory-files-recursively
+ (concat src-dir "/" sub-src-dir)
+ ".*-tests.el$")))
+
+(defun make-test-munge-files (src-dir files)
+ (make-test-sans-suffix
+ (make-test-de-stem
+ src-dir
+ (make-test-no-legacy
+ (make-test-no-test-dir
+ (make-test-no-resources
+ files))))))
+
+(defun make-test-sans-suffix (files)
+ (mapcar
+ (lambda (file)
+ (substring file 0 -9))
+ files))
+
+(defun make-test-de-stem (stem files)
+ (mapcar
+ (lambda (file)
+ (substring
+ file
+ (+ 1 (length stem))))
+ files))
+
+(defun make-test-no-legacy (list)
+ (make-test-remove list "legacy/"))
+
+(defun make-test-no-resources (list)
+ (make-test-remove list "-resources/"))
+
+(defun make-test-no-test-dir (list)
+ (make-test-remove list "-tests/"))
+
+(defun make-test-remove (list match)
+ (seq-remove
+ (lambda (file)
+ (string-match-p match file))
+ list))
diff --git a/test/BidiCharacterTest.txt b/test/manual/BidiCharacterTest.txt
index 7a460b48afa..7a460b48afa 100644
--- a/test/BidiCharacterTest.txt
+++ b/test/manual/BidiCharacterTest.txt
diff --git a/test/biditest.el b/test/manual/biditest.el
index 3545c50734f..3545c50734f 100644
--- a/test/biditest.el
+++ b/test/manual/biditest.el
diff --git a/test/cedet/cedet-utests.el b/test/manual/cedet/cedet-utests.el
index ae9d576f0f5..ae9d576f0f5 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 32971e441ef..32971e441ef 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 a5b70b8326f..a5b70b8326f 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 179851fafeb..179851fafeb 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 ec09b96211f..ec09b96211f 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 d26d6118d2d..d26d6118d2d 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 18beb9291fa..18beb9291fa 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 0aa8852b8a9..0aa8852b8a9 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 0b8f9dee619..15517da0dc2 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 1eb71f7ccc8..1eb71f7ccc8 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 63c4deedd08..63c4deedd08 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 6d2a0f0755e..6d2a0f0755e 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 f0abfc97b06..f0abfc97b06 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 94ae9d90413..94ae9d90413 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 cfb3996db47..cfb3996db47 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 fbbaa75fee1..fbbaa75fee1 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 8cbe05bd4f7..8cbe05bd4f7 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 2cb9e763888..2cb9e763888 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 7c93f8ec02d..7c93f8ec02d 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 312a77f0058..312a77f0058 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 419361d1dbc..419361d1dbc 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 19bc0bef657..19bc0bef657 100644
--- a/test/etags/CTAGS.good
+++ b/test/manual/etags/CTAGS.good
diff --git a/test/etags/ETAGS.good_1 b/test/manual/etags/ETAGS.good_1
index 58661bbf600..58661bbf600 100644
--- a/test/etags/ETAGS.good_1
+++ b/test/manual/etags/ETAGS.good_1
diff --git a/test/etags/ETAGS.good_2 b/test/manual/etags/ETAGS.good_2
index ecfa7d19885..ecfa7d19885 100644
--- a/test/etags/ETAGS.good_2
+++ b/test/manual/etags/ETAGS.good_2
diff --git a/test/etags/ETAGS.good_3 b/test/manual/etags/ETAGS.good_3
index 5f84aa9a0c6..5f84aa9a0c6 100644
--- a/test/etags/ETAGS.good_3
+++ b/test/manual/etags/ETAGS.good_3
diff --git a/test/etags/ETAGS.good_4 b/test/manual/etags/ETAGS.good_4
index 12e2a6549cf..12e2a6549cf 100644
--- a/test/etags/ETAGS.good_4
+++ b/test/manual/etags/ETAGS.good_4
diff --git a/test/etags/ETAGS.good_5 b/test/manual/etags/ETAGS.good_5
index 98de4f2c2fb..98de4f2c2fb 100644
--- a/test/etags/ETAGS.good_5
+++ b/test/manual/etags/ETAGS.good_5
diff --git a/test/etags/ETAGS.good_6 b/test/manual/etags/ETAGS.good_6
index f5e0ad4407f..f5e0ad4407f 100644
--- a/test/etags/ETAGS.good_6
+++ b/test/manual/etags/ETAGS.good_6
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 b7d137cd9bd..b7d137cd9bd 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 683ee0c9502..683ee0c9502 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 68584ee71fc..68584ee71fc 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 db8722917ea..db8722917ea 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 f97c1cb38c1..f97c1cb38c1 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 453419897bc..453419897bc 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 86afda9ed01..86afda9ed01 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 86afda9ed01..86afda9ed01 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 aa2eb1dc173..aa2eb1dc173 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 6409fcc1e1d..6409fcc1e1d 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
index 38b08a8e7f8..38b08a8e7f8 100644
--- a/test/etags/cp-src/clheir.cpp.gz
+++ b/test/manual/etags/cp-src/clheir.cpp.gz
Binary files differ
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 5d28657e28b..5d28657e28b 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
index 5f22edc86bb..5f22edc86bb 100644
--- a/test/etags/f-src/entry.strange.gz
+++ b/test/manual/etags/f-src/entry.strange.gz
Binary files differ
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..ce4069dfa8f 100644
--- a/test/etags/forth-src/test-forth.fth
+++ b/test/manual/etags/forth-src/test-forth.fth
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..dbf82281993 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.
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/manual/etags/ruby-src/test1.ruby b/test/manual/etags/ruby-src/test1.ruby
new file mode 100644
index 00000000000..26b7d538b64
--- /dev/null
+++ b/test/manual/etags/ruby-src/test1.ruby
@@ -0,0 +1,29 @@
+class A
+ def a()
+ super(" do ")
+ end
+ def b()
+ end
+end
+
+module A
+ class B
+ ABC = 4
+
+ def foo!
+ end
+
+ def self._bar?(abc)
+ end
+
+ class << self
+ def qux=(tee)
+ end
+ end
+ end
+end
+
+A::Constant = 5
+
+# def foo_in_comment
+# end
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 aa745c68471..aa745c68471 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 776e3dad4b0..776e3dad4b0 100644
--- a/test/etags/y-src/cccp.c
+++ b/test/manual/etags/y-src/cccp.c
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 95098674279..95098674279 100644
--- a/test/etags/y-src/parse.c
+++ b/test/manual/etags/y-src/parse.c
diff --git a/test/etags/y-src/parse.y b/test/manual/etags/y-src/parse.y
index 824c98d6245..824c98d6245 100644
--- a/test/etags/y-src/parse.y
+++ b/test/manual/etags/y-src/parse.y
diff --git a/test/indent/Makefile b/test/manual/indent/Makefile
index 83162681d72..83162681d72 100644
--- a/test/indent/Makefile
+++ b/test/manual/indent/Makefile
diff --git a/test/indent/css-mode.css b/test/manual/indent/css-mode.css
index 3a00739bfc4..3a00739bfc4 100644
--- a/test/indent/css-mode.css
+++ b/test/manual/indent/css-mode.css
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..b40d47b3e5d 100644
--- a/test/indent/js.js
+++ b/test/manual/indent/js.js
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 2d09eb775a4..2d09eb775a4 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/indent/scss-mode.scss b/test/manual/indent/scss-mode.scss
index e1ec90a5299..e1ec90a5299 100644
--- a/test/indent/scss-mode.scss
+++ b/test/manual/indent/scss-mode.scss
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 37a5649dc1b..37a5649dc1b 100644
--- a/test/redisplay-testsuite.el
+++ b/test/manual/redisplay-testsuite.el
diff --git a/test/rmailmm.el b/test/manual/rmailmm.el
index 96acbc4735e..96acbc4735e 100644
--- a/test/rmailmm.el
+++ b/test/manual/rmailmm.el
diff --git a/test/automated/finalizer-tests.el b/test/src/alloc-tests.el
index 5aa35f4a2ac..97c6b4f8070 100644
--- a/test/automated/finalizer-tests.el
+++ b/test/src/alloc-tests.el
@@ -1,4 +1,4 @@
-;;; finalizer-tests.el --- Finalizer tests -*- lexical-binding: t -*-
+;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*-
;; Copyright (C) 2015-2016 Free Software Foundation, Inc.
diff --git a/test/automated/buffer-tests.el b/test/src/buffer-tests.el
index 62875216a31..62875216a31 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..46541aba78c
--- /dev/null
+++ b/test/src/callproc-tests.el
@@ -0,0 +1,39 @@
+;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*-
+
+;; Copyright (C) 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 '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/chartab-tests.el b/test/src/chartab-tests.el
new file mode 100644
index 00000000000..016ddcdde61
--- /dev/null
+++ b/test/src/chartab-tests.el
@@ -0,0 +1,51 @@
+;;; chartab-tests.el --- Tests for char-tab.c
+
+;; Copyright (C) 2016 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 4a30d9872a1..4a30d9872a1 100644
--- a/test/automated/cmds-tests.el
+++ b/test/src/cmds-tests.el
diff --git a/test/automated/data-tests.el b/test/src/data-tests.el
index 0a292336f35..0a292336f35 100644
--- a/test/automated/data-tests.el
+++ b/test/src/data-tests.el
diff --git a/test/automated/zlib-tests.el b/test/src/decompress-tests.el
index 7ece58d97c9..f0264ec548d 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-2016 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/editfns-tests.el b/test/src/editfns-tests.el
new file mode 100644
index 00000000000..2f90d1e7495
--- /dev/null
+++ b/test/src/editfns-tests.el
@@ -0,0 +1,136 @@
+;;; editfns-tests.el -- tests for editfns.c
+
+;; Copyright (C) 2016 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)))))
+
+;;; editfns-tests.el ends here
diff --git a/test/automated/fns-tests.el b/test/src/fns-tests.el
index 762f7bdd94f..c533bad3cdc 100644
--- a/test/automated/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -191,3 +191,57 @@
(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))))))
diff --git a/test/automated/inotify-test.el b/test/src/inotify-tests.el
index 54977925f86..54977925f86 100644
--- a/test/automated/inotify-test.el
+++ b/test/src/inotify-tests.el
diff --git a/test/automated/keymap-tests.el b/test/src/keymap-tests.el
index b835fc7530b..b835fc7530b 100644
--- a/test/automated/keymap-tests.el
+++ b/test/src/keymap-tests.el
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
new file mode 100644
index 00000000000..1a82d133a44
--- /dev/null
+++ b/test/src/lread-tests.el
@@ -0,0 +1,107 @@
+;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 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")))
+
+;;; lread-tests.el ends here
diff --git a/test/automated/print-tests.el b/test/src/print-tests.el
index 1abfa53581c..1abfa53581c 100644
--- a/test/automated/print-tests.el
+++ b/test/src/print-tests.el
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..02b357cf2e3
--- /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..6e21088114e
--- /dev/null
+++ b/test/src/regex-tests.el
@@ -0,0 +1,678 @@
+;;; regex-tests.el --- tests for regex.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 '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)
+ (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)))))))
+
+(ert-deftest regex-character-classes ()
+ "Perform sanity test of regexes using character classes.
+
+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'."
+ (let (case-fold-search)
+ (regex--test-cc "alnum" "abcABC012łąka" "-, \t\n")
+ (regex--test-cc "alpha" "abcABCłąka" "-,012 \t\n")
+ (regex--test-cc "digit" "012" "abcABCłąka-, \t\n")
+ (regex--test-cc "xdigit" "0123aBc" "łąk-, \t\n")
+ (regex--test-cc "upper" "ABCÅÄ„KA" "abc012-, \t\n")
+ (regex--test-cc "lower" "abcłąka" "ABC012-, \t\n")
+
+ (regex--test-cc "word" "abcABC012\u2620" "-, \t\n")
+
+ (regex--test-cc "punct" ".,-" "abcABC012\u2620 \t\n")
+ (regex--test-cc "cntrl" "\1\2\t\n" ".,-abcABC012\u2620 ")
+ (regex--test-cc "graph" "abcłąka\u2620-," " \t\n\1")
+ (regex--test-cc "print" "abcłąka\u2620-, " "\t\n\1")
+
+ (regex--test-cc "space" " \t\n\u2001" "abcABCł0123")
+ (regex--test-cc "blank" " \t" "\n\u2001")
+
+ (regex--test-cc "ascii" "abcABC012 \t\n\1" "łą\u2620")
+ (regex--test-cc "nonascii" "łą\u2622" "abcABC012 \t\n\1")
+ (regex--test-cc "unibyte" "abcABC012 \t\n\1" "łą\u2622")
+ (regex--test-cc "multibyte" "łą\u2622" "abcABC012 \t\n\1")))
+
+
+(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/automated/libxml-tests.el b/test/src/xml-tests.el
index dc60197b59e..dc60197b59e 100644
--- a/test/automated/libxml-tests.el
+++ b/test/src/xml-tests.el