summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/ert.el
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* ; Fix typosStefan Kangas2023-12-031-1/+1
|
* Suggest alternative reason for ERT test duplication errorMattias Engdegård2023-11-041-1/+1
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-set-test): Amend error message; maybe the redefinition was caused by a file loaded twice. (Bug#66782) Suggested by Xiyue Deng. (cherry picked from commit 425d23fbeaede81ab4f50b4073949cc1c8a3fbd0)
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* Improve robustness of server.el testsJim Porter2022-11-261-2/+7
| | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert--insert-infos): Allow 'message' to be a function that is called when inserting the info. (ert-info): Update docstring to describe using a function for MESSAGE-FORM. * lisp/server.el (server-start): Log when the server is starting. * test/lisp/server-tests.el (server-tests/can-create-frames-p): New constant. Use it to skip tests that need to create frames. (server-tests/start-emacsclient): Rename to... (server-tests/start-client): ... this, and set the process's buffer. (server-tests/with-server): Put the server file in a temporary directory so we don't conflict with real Emacs servers. (server-tests/with-client): New macro... (server-tests/server-start/stop-prompt-with-client) (server-tests/emacsclient/server-edit) (server-tests/emacsclient/create-frame) (server-tests/emacsclient/create-frame): ... use it. (server-tests/server-start/stop-prompt-with-client): Simplify.
* ; Fix typos (prefer US spelling)Stefan Kangas2022-11-181-1/+1
|
* Simplify code using take, ntake and butlastMattias Engdegård2022-08-141-2/+1
| | | | | | | * lisp/calc/calc-vec.el (calcFunc-rhead): * lisp/calc/calc.el (calc-top-list, calc-pop): * lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit): Simplify.
* Omit some (current-time) callsPaul Eggert2022-08-011-1/+1
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-write-junit-test-summary-report): * lisp/emacs-lisp/shortdoc.el (file): * lisp/find-lisp.el (find-lisp-find-dired-insert-file): * lisp/progmodes/hideif.el (hide-ifdefs): * lisp/tar-mode.el (tar-subfile-save-buffer): Prefer nil or omitted arg to (current-time) where this is better or more-efficient.
* Improve ert-test-erts-file documentationStefan Kangas2022-07-091-2/+8
| | | | | * lisp/emacs-lisp/ert.el (ert-test-erts-file): Improve docstring. * doc/misc/ert.texi (erts files): Fix typo.
* * lisp/emacs-lisp/ert.el (Commentary): Refer to the Info manual.Stefan Kangas2022-07-071-7/+5
|
* ; * lisp/emacs-lisp/ert.el: Remove installation instructions.Stefan Kangas2022-07-061-2/+0
|
* Fix ert-run-tests-batch-and-exit doc string typoLars Ingebrigtsen2022-05-251-1/+1
| | | | | * lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit): Fix doc string typo.
* Make the nativecomp test eln directory more reliably be removedLars Ingebrigtsen2022-05-241-12/+22
| | | | | | | | | | * lisp/startup.el (startup-redirect-eln-cache, normal-top-level): Don't create the nativecomp directory here, because this led to brittle deletions of the directory -- there would be several instances of the directory left over after a test run. * lisp/emacs-lisp/ert.el (ert-run-tests-batch-and-exit): Create the nativecomp directory.
* Allow jumping to ert failure definitionsLars Ingebrigtsen2022-01-241-4/+25
| | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-test): (ert-deftest): Store the file name. (ert-test-location): New function. (ert-run-tests-batch): Use it. * lisp/emacs-lisp/find-func.el (find-ert-deftest-regexp): New variable. (find-function-regexp-alist): Add ert-deftest (bug#22471). Based on code by Phillip Lord <phillip.lord@russet.org.uk>.
* Interpret a "" value of EMACS_TEST_VERBOSE as "off"Lars Ingebrigtsen2022-01-211-2/+4
| | | | | | * doc/misc/ert.texi (Running Tests in Batch Mode): Adjust doc. * lisp/emacs-lisp/ert.el (ert-run-tests-batch): Allow overriding the EMACS_TEST_VERBOSE variable by setting it to "" (bug#53313).
* Make ert explainers work on function aliasesLars Ingebrigtsen2022-01-131-6/+11
| | | | | * lisp/emacs-lisp/ert.el: New function. (ert--expand-should-1): Use it (bug#53178).
* Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | * lisp/emacs-lisp/ert.el (ert-select-tests): Document new error.Philipp Stephani2021-12-301-1/+2
| |
* | * lisp/emacs-lisp/ert.el (ert-select-tests): Simplify nested switchPhilipp Stephani2021-12-301-46/+36
| |
* | Properly report errors about unbound ERT test symbols.Philipp Stephani2021-12-301-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Assertions should only be used to check internal consistency within a package, not to check arguments passed by callers. Instead, define and use a new error symbol. * lisp/emacs-lisp/ert.el (ert-test-unbound): New error symbol. (ert-select-tests): Use it. * test/lisp/emacs-lisp/ert-tests.el (ert-test-select-undefined): New unit test. * etc/NEWS: Document new behavior.
* | ; * lisp/emacs-lisp/ert.el: Update reference to 'cl-assert'Philipp Stephani2021-12-301-1/+1
| |
* | Make generation of JUnit test reports more robust.Michael Albinus2021-12-181-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-load-file-name): New defvar. (ert-write-junit-test-report): Use it. Make detection of selector more robust. Protect calls of `xml-escape-string' with 'noerror. * test/infra/Makefile.in (subdir_template): Use "make -k ...". * test/infra/gitlab-ci.yml (test-filenotify-gio): Adapt make_params in order to get a JUnit test report. (test-native-comp-speed0): Use "make -k ...". * test/infra/test-jobs.yml: Regenerate. * test/lisp/progmodes/perl-mode-tests.el (top): Set `ert-load-file-name'.
* | Handle missing JUnit test reportsMichael Albinus2021-12-171-114/+118
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-write-junit-test-report) (ert-write-junit-test-summary-report): Handle missing JUnit test reports.
* | Add errors in ert JUnit test reportsMichael Albinus2021-12-151-49/+85
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-write-junit-test-report) (ert-write-junit-test-summary-report): Handle errors.
* | ERT can generate JUnit test reportsMichael Albinus2021-12-131-5/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * .gitignore: Add test/**/*.xml. * admin/notes/emba: Mention JUnit test report. * etc/NEWS: ERT can generate JUnit test reports. * lisp/emacs-lisp/ert.el (xml-escape-string): Autoload. (ert-write-junit-test-report) (ert-write-junit-test-summary-report): New defuns. (ert-run-tests-batch, ert-summarize-tests-batch-and-exit): Call them. * test/Makefile.in (clean): Remove *.xml. * test/README: Mention $EMACS_TEST_JUNIT_REPORT environment variable. * test/infra/Makefile.in ($(FILE)): Generate header commentary. (clean): Remove. * test/infra/gitlab-ci.yml (variables): Set EMACS_TEST_JUNIT_REPORT. (.job-template): Use it in script and after_script. (.build-template, .gnustep-template, .filenotify-gio-template) (.native-comp-template): Adapt rules. (.test-template): Trigger JUnit test report. * test/infra/test-jobs.yml: Regenerate.
* | Fixup for bug#51037Filipp Gunbin2021-11-181-15/+8
| | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-batch-backtrace-line-length): Fix docstring. (ert-run-tests-batch): Remove redundand let-binding. (ert-run-tests-interactively): Fix interactive spec.
* | Signal an error for duplicated ERT tests (bug#51941)Mattias Engdegård2021-11-181-0/+7
| | | | | | | | | | | | | | | | | | Make `ert-deftest` fail with an error (in batch mode only) if an existing test is redefined, because that is an easy mistake to make and which leads to a test being discarded silently. lisp/emacs-lisp/ert.el (ert-set-test, ert-deftest): Add check. etc/NEWS: Announce.
* | Make results details in ert-run-tests-batch configurableMichael Herstine2021-11-161-30/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-batch-print-length) (ert-batch-print-level,.ert-batch-backtrace-line-length) (ert-batch-test, ert-run-tests-interactively): Added the three variables, bound them to these settings when formatting batch test results including backtraces. Removed the optional parameters output-buffer & message-fn from ert-run-tests-interactively. * test/lisp/emacs-lisp/ert-tests.el (ert-test-run-tests-interactively, ert-test-run-tests-batch): use cl-letf to capture output, new tests resp. * test/lisp/ert-x-tests.el (ert-test-run-tests-interactively-2): Changed to use cl-letf to capture output instead of using message-fn. * lisp/emacs-lisp/backtrace.el (backtrace--line-length-or-nil) (backtrace--print-func-and-args): Fixed a bug when setting backtrace-line-length to nil by adding a new function to check for that case & having backtrace--print-func-and-args use it. * doc/misc/ert.texi: document the new variables & their usage (bug#51037).
* | Make debugging ert--erts-specifications easierLars Ingebrigtsen2021-11-071-1/+1
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert--erts-specifications): Strip text properties from specs to make debugging easier.
* | Remove workaround for fixed Bug#6581 from ertStefan Kangas2021-10-311-35/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-equal-including-properties): Make into obsolete function alias for 'equal-including-properties'. * test/src/editfns-tests.el (format-properties): * test/lisp/emacs-lisp/ert-x-tests.el (ert-propertized-string) (ert-test-run-tests-interactively-2): Don't use above obsolete name. (ert--explain-equal-including-properties-rec): New function. (ert--explain-equal-including-properties): Use as an explainer for 'equal-including-properties' now that Bug#6581 is fixed. * test/lisp/emacs-lisp/ert-tests.el (ert-test-explain-equal-string-properties): Expand test. (ert-test-equal-including-properties): Merge test into above expanded test.
* | Fix bug with string values in equal-including-propertiesStefan Kangas2021-10-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/intervals.c (intervals_equal_1): Factor out from intervals_equal. Optionally use Fequal for comparison of string values in property lists. (intervals_equal): Update for the above. (compare_string_intervals): Use the above optional Fequal comparison to fix a bug where 'equal-including-properties' compared strings with eq, instead of equal. (Bug#6581) * test/src/fns-tests.el (fns-tests-equal-including-properties) (fns-tests-equal-including-properties/string-prop-vals): New tests. * test/lisp/emacs-lisp/ert-tests.el (ert-test-equal-including-properties): Remove parts testing 'equal-including-properties'. * lisp/emacs-lisp/ert.el (ert-equal-including-properties): Add FIXME that this should be removed.
* | Fix parsing of erts filesLars Ingebrigtsen2021-10-271-3/+4
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-test-erts-file): Fix progress through a test file (bug#51409).
* | Merge from origin/emacs-28Glenn Morris2021-10-111-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1a1b206a8b Adapt the recent 'num_processors' change to MS-Windows 7cb4637923 Minor fix to clarify a sentence in emacs-lisp-intro ab60144ea3 ; Pacify recent shorthand unused lexarg warnings. e9df86004f Make tty-run-terminal-initialization load the .elc file (i... 07edc28bdb Fix ert errors when there's a test that binds `debug-on-er... 96278de8ac New function num-processors 575e626105 Add symbol property 'save-some-buffers-function' (bug#46374) a3e10af95c Keep reading when typed RET in read-char-from-minibuffer a... 013e3be832 * lisp/userlock.el (ask-user-about-supersession-threat): A... ae61d7a57d Fix point positioning on mouse clicks with non-zero line-h... 4c7e74c386 Complete shorthands to longhands for symbol-completing tables c2513c5d0d Add new failing test for bug#51089 1d1e96377c ; * lisp/emacs-lisp/shortdoc.el: Fix typo. 6bf29072e9 Avoid mapping file names through 'substring' bcce93f04c Update to Org 9.5-46-gb71474 5d408f1a24 Expanded testing of MH-E with multiple MH variants b497add971 Fix Seccomp filter for newer GNU/Linux systems (Bug#51073). 75d9fbec88 Tramp code cleanup # Conflicts: # etc/NEWS # test/lisp/progmodes/elisp-mode-tests.el
| * Fix ert errors when there's a test that binds `debug-on-error'Lars Ingebrigtsen2021-10-111-0/+4
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert--run-test-internal): Don't infloop on errors when signalling errors (bug#51131).
* | Merge from origin/emacs-28Glenn Morris2021-10-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 63abe976ce (origin/emacs-28) Document minibuffer-default-prompt-forma... b5afbedc90 Backward compatibility option for 'nobreak-char-display' ea1b728a06 ; * lisp/dired.el: Fix typo. 984eafeb98 Unbreak the build after Gnulib update 5946370cd1 Check, whether an FUSE mount has been broken in Tramp 90575a6c0c Disable 'nobreak-char-display' in Eldoc buffers 570e2c9a17 Fix small error in comint-send-input fd7bb31412 Update documentation of search-whitespace-regexp 1f4ced47a1 Fix cc-compat.el syntax error b431f54c1b Mention `seq-uniq' in `delete-dups' documentation 0a7bab689c ; Minor stylistic fixes found by checkdoc e2861e2d08 ; * etc/NEWS: Fix typo. 1a65d49931 Port recent Gnulib changes to MS-Windows 68a256c892 Update from Gnulib 63cb65dcce * Fix mh tests for native comp builds (bug#50975) e606cc6f40 * Fix `batch-native-compile' not to spawn a subprocess 894dfe70da Fix native-compilation build from tarball on Cygwin 2ce5e08058 Remove U+FE0F from script-representative-chars # Conflicts: # etc/NEWS
| * ; Minor stylistic fixes found by checkdocStefan Kangas2021-10-051-1/+1
| |
* | Run ERT tests with `lexical-binding` bound to `t`Mattias Engdegård2021-10-041-6/+3
| | | | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-deftest, ert--run-test-internal): Use t rather than the ambient file value for `lexical-binding` to avoid bad lexbind coverage by mistake.
* | Refactor out ert-test--erts-testLars Ingebrigtsen2021-10-011-77/+82
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-test--erts-test): Refactor out the bulk of the function for easier reuse.
* | Allow skipping erts testsLars Ingebrigtsen2021-10-011-56/+67
| | | | | | | | | | | | * doc/misc/ert.texi (erts files): Document it. * lisp/emacs-lisp/ert.el (ert-test-erts-file): Allow skipping tests.
* | Add new functionality to write buffer-based testsLars Ingebrigtsen2021-10-011-0/+104
|/ | | | | | | | | | | | | * doc/misc/ert.texi (erts files): New node. * lisp/files.el (auto-mode-alist): Map .erts to erts-mode. * lisp/emacs-lisp/ert.el (ert-test-erts-file): New function. * lisp/emacs-lisp/ert.el (ert--erts-specifications) (ert--erts-unquote): Helper functions. * lisp/progmodes/erts-mode.el: New mode and file.
* Add fast-path to ert--explain-string-equalStefan Kangas2021-09-261-3/+5
| | | | | | * lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add fast-path to avoid doing extra work. Problem reported by Mattias Engdegård <mattiase@acm.org>.
* ert: Add basic explainer for string-equalStefan Kangas2021-09-261-0/+8
| | | | | * lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add basic explainer for 'string-equal' based on 'ert--explain-equal'.
* Use ambient lexical-binding value in ert-deftest body (bug#50738)Mattias Engdegård2021-09-251-1/+5
| | | | | | | | | | * lisp/emacs-lisp/ert.el (ert-deftest): Evaluate the body of `ert-deftest` with the `lexical-binding` value of the source file (or more precisely the value in force when the definition is evaluated), which is what everyone expected, instead of always using dynamic binding which is what they got until now. * test/lisp/emacs-lisp/ert-tests.el (ert-test-deftest-lexical-binding-t): New test.
* ; More stylistic docfixes in emacs-lisp/*.el found by checkdocStefan Kangas2021-09-181-2/+2
|
* Handle test environment variablesMichael Albinus2021-07-011-3/+3
| | | | | | | | | * lisp/emacs-lisp/ert.el (ert-summarize-tests-batch-and-exit): Check also for EMACS_EMBA_CI. * test/README (SELECTOR): Mention EMACS_TEST_VERBOSE. * test/infra/gitlab-ci.yml (variables): Set EMACS_TEST_VERBOSE.
* Print newlines as \n instead of \12 in ERT resultsMattias Engdegård2021-06-251-1/+1
| | | | | | | | This makes test errors unquestionably more readable. The change also makes FF print as \f; other controls still use octal escapes. * lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline): Run `pp` with `pp-escape-newlines` set to `t`.
* Don't call ERT explainer on errorMattias Engdegård2021-06-241-6/+7
| | | | | | | * lisp/emacs-lisp/ert.el (ert--expand-should-1): If the predicate form signals an error, don't call an explainer because the arguments passed (the error and error argument, respectively) do not make any sense to the explainer at all.
* Allow ERT tests to output the failure reasons, tooJulian Scheid2021-06-151-4/+27
| | | | | * lisp/emacs-lisp/ert.el (ert-reason-for-test-result): New function. (ert-run-tests-batch): Output failure or skip reason (bug#47071).
* Fix duplicate ":" in ert-find-test-other-window promptStefan Kangas2021-03-101-1/+1
| | | | | * lisp/emacs-lisp/ert.el (ert-find-test-other-window): Don't insert duplicate ":" in prompt.