2012-11-23 03:26:09 +00:00
|
|
|
;;; ert.el --- Emacs Lisp Regression Testing -*- lexical-binding: t -*-
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2020-01-01 00:19:43 +00:00
|
|
|
;; Copyright (C) 2007-2008, 2010-2020 Free Software Foundation, Inc.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;; Author: Christian Ohler <ohler@gnu.org>
|
|
|
|
;; Keywords: lisp, tools
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2012-09-24 15:58:20 +00:00
|
|
|
;; 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.
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; ERT is a tool for automated testing in Emacs Lisp. Its main
|
|
|
|
;; features are facilities for defining and running test cases and
|
|
|
|
;; reporting the results as well as for debugging test failures
|
|
|
|
;; interactively.
|
|
|
|
;;
|
|
|
|
;; The main entry points are `ert-deftest', which is similar to
|
|
|
|
;; `defun' but defines a test, and `ert-run-tests-interactively',
|
|
|
|
;; which runs tests and offers an interactive interface for inspecting
|
|
|
|
;; results and debugging. There is also
|
|
|
|
;; `ert-run-tests-batch-and-exit' for non-interactive use.
|
|
|
|
;;
|
|
|
|
;; The body of `ert-deftest' forms resembles a function body, but the
|
2013-10-24 07:34:41 +00:00
|
|
|
;; additional operators `should', `should-not', `should-error' and
|
|
|
|
;; `skip-unless' are available. `should' is similar to cl's `assert',
|
|
|
|
;; but signals a different error when its condition is violated that
|
|
|
|
;; is caught and processed by ERT. In addition, it analyzes its
|
|
|
|
;; argument form and records information that helps debugging
|
|
|
|
;; (`assert' tries to do something similar when its second argument
|
|
|
|
;; SHOW-ARGS is true, but `should' is more sophisticated). For
|
|
|
|
;; information on `should-not' and `should-error', see their
|
|
|
|
;; docstrings. `skip-unless' skips the test immediately without
|
|
|
|
;; processing further, this is useful for checking the test
|
|
|
|
;; environment (like availability of features, external binaries, etc).
|
2011-01-12 16:08:24 +00:00
|
|
|
;;
|
|
|
|
;; See ERT's info manual as well as the docstrings for more details.
|
|
|
|
;; To compile the manual, run `makeinfo ert.texinfo' in the ERT
|
|
|
|
;; directory, then C-u M-x info ert.info in Emacs to view it.
|
|
|
|
;;
|
|
|
|
;; To see some examples of tests written in ERT, see its self-tests in
|
|
|
|
;; ert-tests.el. Some of these are tricky due to the bootstrapping
|
|
|
|
;; problem of writing tests for a testing tool, others test simple
|
|
|
|
;; functions and are straightforward.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(require 'cl-lib)
|
2011-01-12 16:08:24 +00:00
|
|
|
(require 'button)
|
|
|
|
(require 'debug)
|
2018-06-19 14:27:41 +00:00
|
|
|
(require 'backtrace)
|
2011-01-12 16:08:24 +00:00
|
|
|
(require 'easymenu)
|
|
|
|
(require 'ewoc)
|
|
|
|
(require 'find-func)
|
|
|
|
(require 'help)
|
2015-10-26 20:27:16 +00:00
|
|
|
(require 'pp)
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;; UI customization options.
|
|
|
|
|
|
|
|
(defgroup ert ()
|
|
|
|
"ERT, the Emacs Lisp regression testing tool."
|
|
|
|
:prefix "ert-"
|
|
|
|
:group 'lisp)
|
|
|
|
|
2017-09-06 00:40:10 +00:00
|
|
|
(defcustom ert-batch-backtrace-right-margin 70
|
|
|
|
"Maximum length of lines in ERT backtraces in batch mode.
|
|
|
|
Use nil for no limit (caution: backtrace lines can be very long)."
|
2017-09-06 00:53:57 +00:00
|
|
|
:type '(choice (const :tag "No truncation" nil) integer))
|
2017-09-06 00:40:10 +00:00
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
(defface ert-test-result-expected '((((class color) (background light))
|
|
|
|
:background "green1")
|
|
|
|
(((class color) (background dark))
|
|
|
|
:background "green3"))
|
|
|
|
"Face used for expected results in the ERT results buffer."
|
|
|
|
:group 'ert)
|
|
|
|
|
|
|
|
(defface ert-test-result-unexpected '((((class color) (background light))
|
|
|
|
:background "red1")
|
|
|
|
(((class color) (background dark))
|
|
|
|
:background "red3"))
|
|
|
|
"Face used for unexpected results in the ERT results buffer."
|
|
|
|
:group 'ert)
|
|
|
|
|
|
|
|
|
|
|
|
;;; Copies/reimplementations of cl functions.
|
|
|
|
|
|
|
|
(defun ert-equal-including-properties (a b)
|
|
|
|
"Return t if A and B have similar structure and contents.
|
|
|
|
|
|
|
|
This is like `equal-including-properties' except that it compares
|
|
|
|
the property values of text properties structurally (by
|
|
|
|
recursing) rather than with `eq'. Perhaps this is what
|
|
|
|
`equal-including-properties' should do in the first place; see
|
2017-09-13 22:52:52 +00:00
|
|
|
Emacs bug 6581 at URL `https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6581'."
|
2011-01-12 16:08:24 +00:00
|
|
|
;; This implementation is inefficient. Rather than making it
|
|
|
|
;; efficient, let's hope bug 6581 gets fixed so that we can delete
|
|
|
|
;; it altogether.
|
2011-03-03 09:01:51 +00:00
|
|
|
(not (ert--explain-equal-including-properties a b)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;; Defining and locating tests.
|
|
|
|
|
|
|
|
;; The data structure that represents a test case.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct ert-test
|
2011-01-12 16:08:24 +00:00
|
|
|
(name nil)
|
|
|
|
(documentation nil)
|
2012-11-23 03:26:09 +00:00
|
|
|
(body (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
(most-recent-result nil)
|
|
|
|
(expected-result-type ':passed)
|
|
|
|
(tags '()))
|
|
|
|
|
|
|
|
(defun ert-test-boundp (symbol)
|
|
|
|
"Return non-nil if SYMBOL names a test."
|
|
|
|
(and (get symbol 'ert--test) t))
|
|
|
|
|
|
|
|
(defun ert-get-test (symbol)
|
|
|
|
"If SYMBOL names a test, return that. Signal an error otherwise."
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(unless (ert-test-boundp symbol) (error "No test named `%S'" symbol))
|
2011-01-12 16:08:24 +00:00
|
|
|
(get symbol 'ert--test))
|
|
|
|
|
|
|
|
(defun ert-set-test (symbol definition)
|
|
|
|
"Make SYMBOL name the test DEFINITION, and return DEFINITION."
|
|
|
|
(when (eq symbol 'nil)
|
|
|
|
;; We disallow nil since `ert-test-at-point' and related functions
|
|
|
|
;; want to return a test name, but also need an out-of-band value
|
|
|
|
;; on failure. Nil is the most natural out-of-band value; using 0
|
2011-11-14 20:23:26 +00:00
|
|
|
;; or "" or signaling an error would be too awkward.
|
2011-01-12 16:08:24 +00:00
|
|
|
;;
|
|
|
|
;; Note that nil is still a valid value for the `name' slot in
|
|
|
|
;; ert-test objects. It designates an anonymous test.
|
|
|
|
(error "Attempt to define a test named nil"))
|
2017-07-28 16:02:01 +00:00
|
|
|
(define-symbol-prop symbol 'ert--test definition)
|
2011-01-12 16:08:24 +00:00
|
|
|
definition)
|
|
|
|
|
|
|
|
(defun ert-make-test-unbound (symbol)
|
|
|
|
"Make SYMBOL name no test. Return SYMBOL."
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(cl-remprop symbol 'ert--test)
|
2011-01-12 16:08:24 +00:00
|
|
|
symbol)
|
|
|
|
|
|
|
|
(defun ert--parse-keys-and-body (keys-and-body)
|
|
|
|
"Split KEYS-AND-BODY into keyword-and-value pairs and the remaining body.
|
|
|
|
|
|
|
|
KEYS-AND-BODY should have the form of a property list, with the
|
|
|
|
exception that only keywords are permitted as keys and that the
|
|
|
|
tail -- the body -- is a list of forms that does not start with a
|
|
|
|
keyword.
|
|
|
|
|
|
|
|
Returns a two-element list containing the keys-and-values plist
|
|
|
|
and the body."
|
|
|
|
(let ((extracted-key-accu '())
|
|
|
|
(remaining keys-and-body))
|
2012-11-23 03:26:09 +00:00
|
|
|
(while (keywordp (car-safe remaining))
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((keyword (pop remaining)))
|
|
|
|
(unless (consp remaining)
|
|
|
|
(error "Value expected after keyword %S in %S"
|
|
|
|
keyword keys-and-body))
|
|
|
|
(when (assoc keyword extracted-key-accu)
|
|
|
|
(warn "Keyword %S appears more than once in %S" keyword
|
|
|
|
keys-and-body))
|
|
|
|
(push (cons keyword (pop remaining)) extracted-key-accu)))
|
|
|
|
(setq extracted-key-accu (nreverse extracted-key-accu))
|
2012-11-23 03:26:09 +00:00
|
|
|
(list (cl-loop for (key . value) in extracted-key-accu
|
|
|
|
collect key
|
|
|
|
collect value)
|
2011-01-12 16:08:24 +00:00
|
|
|
remaining)))
|
|
|
|
|
|
|
|
;;;###autoload
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defmacro ert-deftest (name () &body docstring-keys-and-body)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Define NAME (a symbol) as a test.
|
|
|
|
|
|
|
|
BODY is evaluated as a `progn' when the test is run. It should
|
|
|
|
signal a condition on failure or just return if the test passes.
|
|
|
|
|
2013-10-24 07:34:41 +00:00
|
|
|
`should', `should-not', `should-error' and `skip-unless' are
|
|
|
|
useful for assertions in BODY.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
Use `ert' to run tests interactively.
|
|
|
|
|
|
|
|
Tests that are expected to fail can be marked as such
|
|
|
|
using :expected-result. See `ert-test-result-type-p' for a
|
|
|
|
description of valid values for RESULT-TYPE.
|
|
|
|
|
2019-10-12 19:34:56 +00:00
|
|
|
Macros in BODY are expanded when the test is defined, not when it
|
|
|
|
is run. If a macro (possibly with side effects) is to be tested,
|
|
|
|
it has to be wrapped in `(eval (quote ...))'.
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
\(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] \
|
2015-11-17 23:28:50 +00:00
|
|
|
[:tags \\='(TAG...)] BODY...)"
|
2011-01-12 16:08:24 +00:00
|
|
|
(declare (debug (&define :name test
|
|
|
|
name sexp [&optional stringp]
|
|
|
|
[&rest keywordp sexp] def-body))
|
|
|
|
(doc-string 3)
|
|
|
|
(indent 2))
|
|
|
|
(let ((documentation nil)
|
|
|
|
(documentation-supplied-p nil))
|
2012-11-23 03:26:09 +00:00
|
|
|
(when (stringp (car docstring-keys-and-body))
|
2011-01-12 16:08:24 +00:00
|
|
|
(setq documentation (pop docstring-keys-and-body)
|
|
|
|
documentation-supplied-p t))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind
|
|
|
|
((&key (expected-result nil expected-result-supplied-p)
|
|
|
|
(tags nil tags-supplied-p))
|
|
|
|
body)
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--parse-keys-and-body docstring-keys-and-body)
|
2013-10-24 07:34:41 +00:00
|
|
|
`(cl-macrolet ((skip-unless (form) `(ert--skip-unless ,form)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-set-test ',name
|
|
|
|
(make-ert-test
|
|
|
|
:name ',name
|
|
|
|
,@(when documentation-supplied-p
|
|
|
|
`(:documentation ,documentation))
|
|
|
|
,@(when expected-result-supplied-p
|
|
|
|
`(:expected-result-type ,expected-result))
|
|
|
|
,@(when tags-supplied-p
|
|
|
|
`(:tags ,tags))
|
|
|
|
:body (lambda () ,@body)))
|
|
|
|
',name))))
|
|
|
|
|
|
|
|
;; We use these `put' forms in addition to the (declare (indent)) in
|
|
|
|
;; the defmacro form since the `declare' alone does not lead to
|
|
|
|
;; correct indentation before the .el/.elc file is loaded.
|
|
|
|
;; Autoloading these `put' forms solves this.
|
|
|
|
;;;###autoload
|
|
|
|
(progn
|
|
|
|
;; TODO(ohler): Figure out what these mean and make sure they are correct.
|
|
|
|
(put 'ert-deftest 'lisp-indent-function 2)
|
|
|
|
(put 'ert-info 'lisp-indent-function 1))
|
|
|
|
|
|
|
|
(defvar ert--find-test-regexp
|
|
|
|
(concat "^\\s-*(ert-deftest"
|
|
|
|
find-function-space-re
|
|
|
|
"%s\\(\\s-\\|$\\)")
|
|
|
|
"The regexp the `find-function' mechanisms use for finding test definitions.")
|
|
|
|
|
|
|
|
|
* lisp/subr.el (define-error): New function.
* doc/lispref/control.texi (Signaling Errors): Refer to define-error.
(Error Symbols): Add `define-error'.
* doc/lispref/errors.texi (Standard Errors): Don't refer to `error-conditions'.
* lisp/progmodes/ada-xref.el (ada-error-file-not-found): Rename from
error-file-not-found and define with define-error.
* lisp/emacs-lisp/cl-lib.el (cl-assertion-failed): Move here from subr.el
and define with define-error.
* lisp/userlock.el (file-locked, file-supersession):
* lisp/simple.el (mark-inactive):
* lisp/progmodes/js.el (js-moz-bad-rpc, js-js-error):
* lisp/progmodes/ada-mode.el (ada-mode-errors):
* lisp/play/life.el (life-extinct):
* lisp/nxml/xsd-regexp.el (xsdre-invalid-regexp, xsdre-parse-error):
* lisp/nxml/xmltok.el (xmltok-markup-declaration-parse-error):
* lisp/nxml/rng-util.el (rng-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-cmpct.el (rng-c-incorrect-schema):
* lisp/nxml/nxml-util.el (nxml-error, nxml-file-parse-error):
* lisp/nxml/nxml-rap.el (nxml-scan-error):
* lisp/nxml/nxml-outln.el (nxml-outline-error):
* lisp/net/soap-client.el (soap-error):
* lisp/net/gnutls.el (gnutls-error):
* lisp/net/ange-ftp.el (ftp-error):
* lisp/mpc.el (mpc-proc-error):
* lisp/json.el (json-error, json-readtable-error, json-unknown-keyword)
(json-number-format, json-string-escape, json-string-format)
(json-key-format, json-object-format):
* lisp/jka-compr.el (compression-error):
* lisp/international/quail.el (quail-error):
* lisp/international/kkc.el (kkc-error):
* lisp/emacs-lisp/ert.el (ert-test-failed):
* lisp/calc/calc.el (calc-error, inexact-result, math-overflow)
(math-underflow):
* lisp/bookmark.el (bookmark-error-no-filename):
* lisp/epg.el (epg-error): Define with define-error.
2013-08-09 21:22:44 +00:00
|
|
|
(define-error 'ert-test-failed "Test failed")
|
2013-10-24 07:34:41 +00:00
|
|
|
(define-error 'ert-test-skipped "Test skipped")
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-pass ()
|
|
|
|
"Terminate the current test and mark it passed. Does not return."
|
|
|
|
(throw 'ert--pass nil))
|
|
|
|
|
|
|
|
(defun ert-fail (data)
|
|
|
|
"Terminate the current test and mark it failed. Does not return.
|
|
|
|
DATA is displayed to the user and should state the reason of the failure."
|
|
|
|
(signal 'ert-test-failed (list data)))
|
|
|
|
|
2013-10-24 07:34:41 +00:00
|
|
|
(defun ert-skip (data)
|
|
|
|
"Terminate the current test and mark it skipped. Does not return.
|
|
|
|
DATA is displayed to the user and should state the reason for skipping."
|
|
|
|
(signal 'ert-test-skipped (list data)))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;; The `should' macros.
|
|
|
|
|
|
|
|
(defvar ert--should-execution-observer nil)
|
|
|
|
|
|
|
|
(defun ert--signal-should-execution (form-description)
|
|
|
|
"Tell the current `should' form observer (if any) about FORM-DESCRIPTION."
|
|
|
|
(when ert--should-execution-observer
|
|
|
|
(funcall ert--should-execution-observer form-description)))
|
|
|
|
|
2017-07-13 20:54:35 +00:00
|
|
|
;; See Bug#24402 for why this exists
|
|
|
|
(defun ert--should-signal-hook (error-symbol data)
|
|
|
|
"Stupid hack to stop `condition-case' from catching ert signals.
|
|
|
|
It should only be stopped when ran from inside ert--run-test-internal."
|
|
|
|
(when (and (not (symbolp debugger)) ; only run on anonymous debugger
|
|
|
|
(memq error-symbol '(ert-test-failed ert-test-skipped)))
|
|
|
|
(funcall debugger 'error data)))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
(defun ert--special-operator-p (thing)
|
|
|
|
"Return non-nil if THING is a symbol naming a special operator."
|
|
|
|
(and (symbolp thing)
|
2015-05-01 15:29:18 +00:00
|
|
|
(let ((definition (indirect-function thing)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(and (subrp definition)
|
|
|
|
(eql (cdr (subr-arity definition)) 'unevalled)))))
|
|
|
|
|
2017-07-13 20:54:35 +00:00
|
|
|
;; FIXME: Code inside of here should probably be evaluated like it is
|
|
|
|
;; outside of tests, with the sole exception of error handling
|
2011-01-12 16:08:24 +00:00
|
|
|
(defun ert--expand-should-1 (whole form inner-expander)
|
|
|
|
"Helper function for the `should' macro and its variants."
|
|
|
|
(let ((form
|
2017-07-13 20:54:35 +00:00
|
|
|
;; catch macroexpansion errors
|
|
|
|
(condition-case err
|
|
|
|
(macroexpand-all form
|
|
|
|
(append (bound-and-true-p
|
|
|
|
byte-compile-macro-environment)
|
|
|
|
(cond
|
|
|
|
((boundp 'macroexpand-all-environment)
|
|
|
|
macroexpand-all-environment)
|
|
|
|
((boundp 'cl-macro-environment)
|
|
|
|
cl-macro-environment))))
|
|
|
|
(error `(signal ',(car err) ',(cdr err))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(cond
|
|
|
|
((or (atom form) (ert--special-operator-p (car form)))
|
2017-09-12 15:08:00 +00:00
|
|
|
(let ((value (gensym "value-")))
|
|
|
|
`(let ((,value (gensym "ert-form-evaluation-aborted-")))
|
2011-01-12 16:08:24 +00:00
|
|
|
,(funcall inner-expander
|
|
|
|
`(setq ,value ,form)
|
|
|
|
`(list ',whole :form ',form :value ,value)
|
|
|
|
value)
|
|
|
|
,value)))
|
|
|
|
(t
|
|
|
|
(let ((fn-name (car form))
|
|
|
|
(arg-forms (cdr form)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (or (symbolp fn-name)
|
|
|
|
(and (consp fn-name)
|
|
|
|
(eql (car fn-name) 'lambda)
|
|
|
|
(listp (cdr fn-name)))))
|
2017-09-12 15:08:00 +00:00
|
|
|
(let ((fn (gensym "fn-"))
|
|
|
|
(args (gensym "args-"))
|
|
|
|
(value (gensym "value-"))
|
|
|
|
(default-value (gensym "ert-form-evaluation-aborted-")))
|
2017-07-13 20:54:35 +00:00
|
|
|
`(let* ((,fn (function ,fn-name))
|
|
|
|
(,args (condition-case err
|
|
|
|
(let ((signal-hook-function #'ert--should-signal-hook))
|
|
|
|
(list ,@arg-forms))
|
|
|
|
(error (progn (setq ,fn #'signal)
|
|
|
|
(list (car err)
|
|
|
|
(cdr err)))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((,value ',default-value))
|
|
|
|
,(funcall inner-expander
|
|
|
|
`(setq ,value (apply ,fn ,args))
|
|
|
|
`(nconc (list ',whole)
|
|
|
|
(list :form `(,,fn ,@,args))
|
|
|
|
(unless (eql ,value ',default-value)
|
|
|
|
(list :value ,value))
|
|
|
|
(let ((-explainer-
|
|
|
|
(and (symbolp ',fn-name)
|
|
|
|
(get ',fn-name 'ert-explainer))))
|
|
|
|
(when -explainer-
|
|
|
|
(list :explanation
|
|
|
|
(apply -explainer- ,args)))))
|
|
|
|
value)
|
|
|
|
,value))))))))
|
|
|
|
|
|
|
|
(defun ert--expand-should (whole form inner-expander)
|
|
|
|
"Helper function for the `should' macro and its variants.
|
|
|
|
|
|
|
|
Analyzes FORM and returns an expression that has the same
|
|
|
|
semantics under evaluation but records additional debugging
|
|
|
|
information.
|
|
|
|
|
|
|
|
INNER-EXPANDER should be a function and is called with two
|
|
|
|
arguments: INNER-FORM and FORM-DESCRIPTION-FORM, where INNER-FORM
|
|
|
|
is an expression equivalent to FORM, and FORM-DESCRIPTION-FORM is
|
|
|
|
an expression that returns a description of FORM. INNER-EXPANDER
|
|
|
|
should return code that calls INNER-FORM and performs the checks
|
2011-11-14 20:23:26 +00:00
|
|
|
and error signaling specific to the particular variant of
|
2011-01-12 16:08:24 +00:00
|
|
|
`should'. The code that INNER-EXPANDER returns must not call
|
|
|
|
FORM-DESCRIPTION-FORM before it has called INNER-FORM."
|
2012-11-23 03:26:09 +00:00
|
|
|
(ert--expand-should-1
|
|
|
|
whole form
|
|
|
|
(lambda (inner-form form-description-form value-var)
|
2017-09-12 15:08:00 +00:00
|
|
|
(let ((form-description (gensym "form-description-")))
|
2012-11-23 03:26:09 +00:00
|
|
|
`(let (,form-description)
|
|
|
|
,(funcall inner-expander
|
|
|
|
`(unwind-protect
|
|
|
|
,inner-form
|
|
|
|
(setq ,form-description ,form-description-form)
|
|
|
|
(ert--signal-should-execution ,form-description))
|
|
|
|
`,form-description
|
|
|
|
value-var))))))
|
|
|
|
|
|
|
|
(cl-defmacro should (form)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Evaluate FORM. If it returns nil, abort the current test as failed.
|
|
|
|
|
|
|
|
Returns the value of FORM."
|
2013-04-07 20:42:11 +00:00
|
|
|
(declare (debug t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--expand-should `(should ,form) form
|
2012-11-23 03:26:09 +00:00
|
|
|
(lambda (inner-form form-description-form _value-var)
|
2011-01-12 16:08:24 +00:00
|
|
|
`(unless ,inner-form
|
|
|
|
(ert-fail ,form-description-form)))))
|
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defmacro should-not (form)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Evaluate FORM. If it returns non-nil, abort the current test as failed.
|
|
|
|
|
|
|
|
Returns nil."
|
2013-04-07 20:42:11 +00:00
|
|
|
(declare (debug t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--expand-should `(should-not ,form) form
|
2012-11-23 03:26:09 +00:00
|
|
|
(lambda (inner-form form-description-form _value-var)
|
2011-01-12 16:08:24 +00:00
|
|
|
`(unless (not ,inner-form)
|
|
|
|
(ert-fail ,form-description-form)))))
|
|
|
|
|
|
|
|
(defun ert--should-error-handle-error (form-description-fn
|
|
|
|
condition type exclude-subtypes)
|
|
|
|
"Helper function for `should-error'.
|
|
|
|
|
|
|
|
Determines whether CONDITION matches TYPE and EXCLUDE-SUBTYPES,
|
|
|
|
and aborts the current test as failed if it doesn't."
|
2011-11-14 20:23:26 +00:00
|
|
|
(let ((signaled-conditions (get (car condition) 'error-conditions))
|
2015-12-04 17:59:21 +00:00
|
|
|
(handled-conditions (pcase-exhaustive type
|
|
|
|
((pred listp) type)
|
|
|
|
((pred symbolp) (list type)))))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert signaled-conditions)
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(unless (cl-intersection signaled-conditions handled-conditions)
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-fail (append
|
|
|
|
(funcall form-description-fn)
|
|
|
|
(list
|
|
|
|
:condition condition
|
2011-11-14 20:23:26 +00:00
|
|
|
:fail-reason (concat "the error signaled did not"
|
2011-01-12 16:08:24 +00:00
|
|
|
" have the expected type")))))
|
|
|
|
(when exclude-subtypes
|
|
|
|
(unless (member (car condition) handled-conditions)
|
|
|
|
(ert-fail (append
|
|
|
|
(funcall form-description-fn)
|
|
|
|
(list
|
|
|
|
:condition condition
|
2011-11-14 20:23:26 +00:00
|
|
|
:fail-reason (concat "the error signaled was a subtype"
|
2011-01-12 16:08:24 +00:00
|
|
|
" of the expected type"))))))))
|
|
|
|
|
|
|
|
;; FIXME: The expansion will evaluate the keyword args (if any) in
|
|
|
|
;; nonstandard order.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defmacro should-error (form &rest keys &key type exclude-subtypes)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Evaluate FORM and check that it signals an error.
|
|
|
|
|
2011-11-14 20:23:26 +00:00
|
|
|
The error signaled needs to match TYPE. TYPE should be a list
|
2011-01-12 16:08:24 +00:00
|
|
|
of condition names. (It can also be a non-nil symbol, which is
|
|
|
|
equivalent to a singleton list containing that symbol.) If
|
|
|
|
EXCLUDE-SUBTYPES is nil, the error matches TYPE if one of its
|
|
|
|
condition names is an element of TYPE. If EXCLUDE-SUBTYPES is
|
|
|
|
non-nil, the error matches TYPE if it is an element of TYPE.
|
|
|
|
|
|
|
|
If the error matches, returns (ERROR-SYMBOL . DATA) from the
|
2011-11-14 20:23:26 +00:00
|
|
|
error. If not, or if no error was signaled, abort the test as
|
2011-01-12 16:08:24 +00:00
|
|
|
failed."
|
2013-04-07 18:56:28 +00:00
|
|
|
(declare (debug t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(unless type (setq type ''error))
|
|
|
|
(ert--expand-should
|
|
|
|
`(should-error ,form ,@keys)
|
|
|
|
form
|
|
|
|
(lambda (inner-form form-description-form value-var)
|
2017-09-12 15:08:00 +00:00
|
|
|
(let ((errorp (gensym "errorp"))
|
|
|
|
(form-description-fn (gensym "form-description-fn-")))
|
2011-01-12 16:08:24 +00:00
|
|
|
`(let ((,errorp nil)
|
|
|
|
(,form-description-fn (lambda () ,form-description-form)))
|
|
|
|
(condition-case -condition-
|
|
|
|
,inner-form
|
|
|
|
;; We can't use ,type here because we want to evaluate it.
|
|
|
|
(error
|
|
|
|
(setq ,errorp t)
|
|
|
|
(ert--should-error-handle-error ,form-description-fn
|
|
|
|
-condition-
|
|
|
|
,type ,exclude-subtypes)
|
|
|
|
(setq ,value-var -condition-)))
|
|
|
|
(unless ,errorp
|
|
|
|
(ert-fail (append
|
|
|
|
(funcall ,form-description-fn)
|
|
|
|
(list
|
|
|
|
:fail-reason "did not signal an error")))))))))
|
|
|
|
|
2013-10-24 07:34:41 +00:00
|
|
|
(cl-defmacro ert--skip-unless (form)
|
|
|
|
"Evaluate FORM. If it returns nil, skip the current test.
|
2013-11-05 07:44:14 +00:00
|
|
|
Errors during evaluation are caught and handled like nil."
|
2013-10-24 07:34:41 +00:00
|
|
|
(declare (debug t))
|
|
|
|
(ert--expand-should `(skip-unless ,form) form
|
|
|
|
(lambda (inner-form form-description-form _value-var)
|
|
|
|
`(unless (ignore-errors ,inner-form)
|
|
|
|
(ert-skip ,form-description-form)))))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;; Explanation of `should' failures.
|
|
|
|
|
|
|
|
;; TODO(ohler): Rework explanations so that they are displayed in a
|
|
|
|
;; similar way to `ert-info' messages; in particular, allow text
|
|
|
|
;; buttons in explanations that give more detail or open an ediff
|
|
|
|
;; buffer. Perhaps explanations should be reported through `ert-info'
|
|
|
|
;; rather than as part of the condition.
|
|
|
|
|
|
|
|
(defun ert--explain-format-atom (x)
|
2011-03-03 09:01:51 +00:00
|
|
|
"Format the atom X for `ert--explain-equal'."
|
2015-12-04 17:59:21 +00:00
|
|
|
(pcase x
|
|
|
|
((pred characterp) (list x (format "#x%x" x) (format "?%c" x)))
|
|
|
|
((pred integerp) (list x (format "#x%x" x)))
|
|
|
|
(_ x)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2011-03-03 09:01:51 +00:00
|
|
|
(defun ert--explain-equal-rec (a b)
|
2011-10-15 19:24:14 +00:00
|
|
|
"Return a programmer-readable explanation of why A and B are not `equal'.
|
2011-03-03 09:01:51 +00:00
|
|
|
Returns nil if they are."
|
2018-07-10 01:46:33 +00:00
|
|
|
(if (not (eq (type-of a) (type-of b)))
|
2011-01-12 16:08:24 +00:00
|
|
|
`(different-types ,a ,b)
|
2015-12-04 17:59:21 +00:00
|
|
|
(pcase-exhaustive a
|
|
|
|
((pred consp)
|
2018-07-10 01:46:33 +00:00
|
|
|
(let ((a-length (proper-list-p a))
|
|
|
|
(b-length (proper-list-p b)))
|
|
|
|
(if (not (eq (not a-length) (not b-length)))
|
2011-01-12 16:08:24 +00:00
|
|
|
`(one-list-proper-one-improper ,a ,b)
|
2018-07-10 01:46:33 +00:00
|
|
|
(if a-length
|
|
|
|
(if (/= a-length b-length)
|
|
|
|
`(proper-lists-of-different-length ,a-length ,b-length
|
2011-01-12 16:08:24 +00:00
|
|
|
,a ,b
|
|
|
|
first-mismatch-at
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
,(cl-mismatch a b :test 'equal))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for i from 0
|
|
|
|
for ai in a
|
|
|
|
for bi in b
|
|
|
|
for xi = (ert--explain-equal-rec ai bi)
|
|
|
|
do (when xi (cl-return `(list-elt ,i ,xi)))
|
|
|
|
finally (cl-assert (equal a b) t)))
|
2011-03-03 09:01:51 +00:00
|
|
|
(let ((car-x (ert--explain-equal-rec (car a) (car b))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(if car-x
|
|
|
|
`(car ,car-x)
|
2011-03-03 09:01:51 +00:00
|
|
|
(let ((cdr-x (ert--explain-equal-rec (cdr a) (cdr b))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(if cdr-x
|
|
|
|
`(cdr ,cdr-x)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (equal a b) t)
|
2011-01-12 16:08:24 +00:00
|
|
|
nil))))))))
|
2015-12-04 17:59:21 +00:00
|
|
|
((pred arrayp)
|
2019-10-10 19:20:20 +00:00
|
|
|
;; For mixed unibyte/multibyte string comparisons, make both multibyte.
|
|
|
|
(when (and (stringp a)
|
|
|
|
(xor (multibyte-string-p a) (multibyte-string-p b)))
|
|
|
|
(setq a (string-to-multibyte a))
|
|
|
|
(setq b (string-to-multibyte b)))
|
2018-07-10 01:46:33 +00:00
|
|
|
(if (/= (length a) (length b))
|
2015-12-04 17:59:21 +00:00
|
|
|
`(arrays-of-different-length ,(length a) ,(length b)
|
|
|
|
,a ,b
|
|
|
|
,@(unless (char-table-p a)
|
|
|
|
`(first-mismatch-at
|
|
|
|
,(cl-mismatch a b :test 'equal))))
|
|
|
|
(cl-loop for i from 0
|
|
|
|
for ai across a
|
|
|
|
for bi across b
|
|
|
|
for xi = (ert--explain-equal-rec ai bi)
|
|
|
|
do (when xi (cl-return `(array-elt ,i ,xi)))
|
|
|
|
finally (cl-assert (equal a b) t))))
|
2015-12-07 16:35:53 +00:00
|
|
|
((pred atom)
|
2015-12-04 17:59:21 +00:00
|
|
|
(if (not (equal a b))
|
|
|
|
(if (and (symbolp a) (symbolp b) (string= a b))
|
|
|
|
`(different-symbols-with-the-same-name ,a ,b)
|
|
|
|
`(different-atoms ,(ert--explain-format-atom a)
|
|
|
|
,(ert--explain-format-atom b)))
|
|
|
|
nil)))))
|
2011-03-03 09:01:51 +00:00
|
|
|
|
|
|
|
(defun ert--explain-equal (a b)
|
|
|
|
"Explainer function for `equal'."
|
|
|
|
;; Do a quick comparison in C to avoid running our expensive
|
|
|
|
;; comparison when possible.
|
|
|
|
(if (equal a b)
|
|
|
|
nil
|
|
|
|
(ert--explain-equal-rec a b)))
|
|
|
|
(put 'equal 'ert-explainer 'ert--explain-equal)
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--significant-plist-keys (plist)
|
|
|
|
"Return the keys of PLIST that have non-null values, in order."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (zerop (mod (length plist) 2)) t)
|
|
|
|
(cl-loop for (key value . rest) on plist by #'cddr
|
|
|
|
unless (or (null value) (memq key accu)) collect key into accu
|
|
|
|
finally (cl-return accu)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--plist-difference-explanation (a b)
|
|
|
|
"Return a programmer-readable explanation of why A and B are different plists.
|
|
|
|
|
|
|
|
Returns nil if they are equivalent, i.e., have the same value for
|
|
|
|
each key, where absent values are treated as nil. The order of
|
|
|
|
key/value pairs in each list does not matter."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (zerop (mod (length a) 2)) t)
|
|
|
|
(cl-assert (zerop (mod (length b) 2)) t)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; Normalizing the plists would be another way to do this but it
|
|
|
|
;; requires a total ordering on all lisp objects (since any object
|
|
|
|
;; is valid as a text property key). Perhaps defining such an
|
|
|
|
;; ordering is useful in other contexts, too, but it's a lot of
|
|
|
|
;; work, so let's punt on it for now.
|
|
|
|
(let* ((keys-a (ert--significant-plist-keys a))
|
|
|
|
(keys-b (ert--significant-plist-keys b))
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(keys-in-a-not-in-b (cl-set-difference keys-a keys-b :test 'eq))
|
|
|
|
(keys-in-b-not-in-a (cl-set-difference keys-b keys-a :test 'eq)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-flet ((explain-with-key (key)
|
|
|
|
(let ((value-a (plist-get a key))
|
|
|
|
(value-b (plist-get b key)))
|
|
|
|
(cl-assert (not (equal value-a value-b)) t)
|
|
|
|
`(different-properties-for-key
|
|
|
|
,key ,(ert--explain-equal-including-properties value-a
|
|
|
|
value-b)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(cond (keys-in-a-not-in-b
|
2012-11-23 03:26:09 +00:00
|
|
|
(explain-with-key (car keys-in-a-not-in-b)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(keys-in-b-not-in-a
|
2012-11-23 03:26:09 +00:00
|
|
|
(explain-with-key (car keys-in-b-not-in-a)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(t
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for key in keys-a
|
|
|
|
when (not (equal (plist-get a key) (plist-get b key)))
|
|
|
|
return (explain-with-key key)))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--abbreviate-string (s len suffixp)
|
|
|
|
"Shorten string S to at most LEN chars.
|
|
|
|
|
|
|
|
If SUFFIXP is non-nil, returns a suffix of S, otherwise a prefix."
|
|
|
|
(let ((n (length s)))
|
|
|
|
(cond ((< n len)
|
|
|
|
s)
|
|
|
|
(suffixp
|
|
|
|
(substring s (- n len)))
|
|
|
|
(t
|
|
|
|
(substring s 0 len)))))
|
|
|
|
|
2011-03-03 09:01:51 +00:00
|
|
|
;; TODO(ohler): Once bug 6581 is fixed, rename this to
|
|
|
|
;; `ert--explain-equal-including-properties-rec' and add a fast-path
|
|
|
|
;; wrapper like `ert--explain-equal'.
|
|
|
|
(defun ert--explain-equal-including-properties (a b)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Explainer function for `ert-equal-including-properties'.
|
|
|
|
|
|
|
|
Returns a programmer-readable explanation of why A and B are not
|
|
|
|
`ert-equal-including-properties', or nil if they are."
|
|
|
|
(if (not (equal a b))
|
2011-03-03 09:01:51 +00:00
|
|
|
(ert--explain-equal a b)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (stringp a) t)
|
|
|
|
(cl-assert (stringp b) t)
|
|
|
|
(cl-assert (eql (length a) (length b)) t)
|
|
|
|
(cl-loop for i from 0 to (length a)
|
|
|
|
for props-a = (text-properties-at i a)
|
|
|
|
for props-b = (text-properties-at i b)
|
|
|
|
for difference = (ert--plist-difference-explanation
|
|
|
|
props-a props-b)
|
|
|
|
do (when difference
|
|
|
|
(cl-return `(char ,i ,(substring-no-properties a i (1+ i))
|
|
|
|
,difference
|
|
|
|
context-before
|
|
|
|
,(ert--abbreviate-string
|
|
|
|
(substring-no-properties a 0 i)
|
|
|
|
10 t)
|
|
|
|
context-after
|
|
|
|
,(ert--abbreviate-string
|
|
|
|
(substring-no-properties a (1+ i))
|
|
|
|
10 nil))))
|
|
|
|
;; TODO(ohler): Get `equal-including-properties' fixed in
|
|
|
|
;; Emacs, delete `ert-equal-including-properties', and
|
|
|
|
;; re-enable this assertion.
|
|
|
|
;;finally (cl-assert (equal-including-properties a b) t)
|
|
|
|
)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(put 'ert-equal-including-properties
|
|
|
|
'ert-explainer
|
2011-03-03 09:01:51 +00:00
|
|
|
'ert--explain-equal-including-properties)
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;; Implementation of `ert-info'.
|
|
|
|
|
|
|
|
;; TODO(ohler): The name `info' clashes with
|
|
|
|
;; `ert--test-execution-info'. One or both should be renamed.
|
|
|
|
(defvar ert--infos '()
|
|
|
|
"The stack of `ert-info' infos that currently apply.
|
|
|
|
|
|
|
|
Bound dynamically. This is a list of (PREFIX . MESSAGE) pairs.")
|
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defmacro ert-info ((message-form &key ((:prefix prefix-form) "Info: "))
|
|
|
|
&body body)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Evaluate MESSAGE-FORM and BODY, and report the message if BODY fails.
|
|
|
|
|
|
|
|
To be used within ERT tests. MESSAGE-FORM should evaluate to a
|
|
|
|
string that will be displayed together with the test result if
|
|
|
|
the test fails. PREFIX-FORM should evaluate to a string as well
|
|
|
|
and is displayed in front of the value of MESSAGE-FORM."
|
|
|
|
(declare (debug ((form &rest [sexp form]) body))
|
|
|
|
(indent 1))
|
|
|
|
`(let ((ert--infos (cons (cons ,prefix-form ,message-form) ert--infos)))
|
|
|
|
,@body))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Facilities for running a single test.
|
|
|
|
|
|
|
|
(defvar ert-debug-on-error nil
|
|
|
|
"Non-nil means enter debugger when a test fails or terminates with an error.")
|
|
|
|
|
|
|
|
;; The data structures that represent the result of running a test.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct ert-test-result
|
2011-01-12 16:08:24 +00:00
|
|
|
(messages nil)
|
|
|
|
(should-forms nil)
|
2018-03-14 15:21:06 +00:00
|
|
|
(duration 0)
|
2011-01-12 16:08:24 +00:00
|
|
|
)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct (ert-test-passed (:include ert-test-result)))
|
|
|
|
(cl-defstruct (ert-test-result-with-condition (:include ert-test-result))
|
|
|
|
(condition (cl-assert nil))
|
|
|
|
(backtrace (cl-assert nil))
|
|
|
|
(infos (cl-assert nil)))
|
|
|
|
(cl-defstruct (ert-test-quit (:include ert-test-result-with-condition)))
|
|
|
|
(cl-defstruct (ert-test-failed (:include ert-test-result-with-condition)))
|
2013-10-24 07:34:41 +00:00
|
|
|
(cl-defstruct (ert-test-skipped (:include ert-test-result-with-condition)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct (ert-test-aborted-with-non-local-exit
|
|
|
|
(:include ert-test-result)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;; A container for the state of the execution of a single test and
|
|
|
|
;; environment data needed during its execution.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct ert--test-execution-info
|
|
|
|
(test (cl-assert nil))
|
|
|
|
(result (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; A thunk that may be called when RESULT has been set to its final
|
|
|
|
;; value and test execution should be terminated. Should not
|
|
|
|
;; return.
|
2012-11-23 03:26:09 +00:00
|
|
|
(exit-continuation (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; The binding of `debugger' outside of the execution of the test.
|
|
|
|
next-debugger
|
|
|
|
;; The binding of `ert-debug-on-error' that is in effect for the
|
|
|
|
;; execution of the current test. We store it to avoid being
|
|
|
|
;; affected by any new bindings the test itself may establish. (I
|
|
|
|
;; don't remember whether this feature is important.)
|
|
|
|
ert-debug-on-error)
|
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(defun ert--run-test-debugger (info args)
|
2011-01-12 16:08:24 +00:00
|
|
|
"During a test run, `debugger' is bound to a closure that calls this function.
|
|
|
|
|
|
|
|
This function records failures and errors and either terminates
|
|
|
|
the test silently or calls the interactive debugger, as
|
|
|
|
appropriate.
|
|
|
|
|
|
|
|
INFO is the ert--test-execution-info corresponding to this test
|
2012-11-23 03:26:09 +00:00
|
|
|
run. ARGS are the arguments to `debugger'."
|
|
|
|
(cl-destructuring-bind (first-debugger-arg &rest more-debugger-args)
|
|
|
|
args
|
|
|
|
(cl-ecase first-debugger-arg
|
2011-01-12 16:08:24 +00:00
|
|
|
((lambda debug t exit nil)
|
2012-11-23 03:26:09 +00:00
|
|
|
(apply (ert--test-execution-info-next-debugger info) args))
|
2011-01-12 16:08:24 +00:00
|
|
|
(error
|
2012-11-23 03:26:09 +00:00
|
|
|
(let* ((condition (car more-debugger-args))
|
|
|
|
(type (cl-case (car condition)
|
2011-01-12 16:08:24 +00:00
|
|
|
((quit) 'quit)
|
2013-10-24 07:34:41 +00:00
|
|
|
((ert-test-skipped) 'skipped)
|
2011-01-12 16:08:24 +00:00
|
|
|
(otherwise 'failed)))
|
2017-02-11 22:19:41 +00:00
|
|
|
;; We store the backtrace in the result object for
|
|
|
|
;; `ert-results-pop-to-backtrace-for-test-at-point'.
|
|
|
|
;; This means we have to limit `print-level' and
|
|
|
|
;; `print-length' when printing result objects. That
|
|
|
|
;; might not be worth while when we can also use
|
|
|
|
;; `ert-results-rerun-test-debugging-errors-at-point',
|
|
|
|
;; (i.e., when running interactively) but having the
|
|
|
|
;; backtrace ready for printing is important for batch
|
|
|
|
;; use.
|
|
|
|
;;
|
2017-09-23 15:40:14 +00:00
|
|
|
;; Grab the frames above the debugger.
|
2018-06-19 14:27:41 +00:00
|
|
|
(backtrace (cdr (backtrace-get-frames debugger)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(infos (reverse ert--infos)))
|
|
|
|
(setf (ert--test-execution-info-result info)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-ecase type
|
2011-01-12 16:08:24 +00:00
|
|
|
(quit
|
|
|
|
(make-ert-test-quit :condition condition
|
|
|
|
:backtrace backtrace
|
|
|
|
:infos infos))
|
2013-10-24 07:34:41 +00:00
|
|
|
(skipped
|
|
|
|
(make-ert-test-skipped :condition condition
|
|
|
|
:backtrace backtrace
|
|
|
|
:infos infos))
|
2011-01-12 16:08:24 +00:00
|
|
|
(failed
|
|
|
|
(make-ert-test-failed :condition condition
|
|
|
|
:backtrace backtrace
|
|
|
|
:infos infos))))
|
2012-02-28 08:17:21 +00:00
|
|
|
;; Work around Emacs's heuristic (in eval.c) for detecting
|
2011-01-12 16:08:24 +00:00
|
|
|
;; errors in the debugger.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-incf num-nonmacro-input-events)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; FIXME: We should probably implement more fine-grained
|
|
|
|
;; control a la non-t `debug-on-error' here.
|
|
|
|
(cond
|
|
|
|
((ert--test-execution-info-ert-debug-on-error info)
|
2012-11-23 03:26:09 +00:00
|
|
|
(apply (ert--test-execution-info-next-debugger info) args))
|
2011-01-12 16:08:24 +00:00
|
|
|
(t))
|
|
|
|
(funcall (ert--test-execution-info-exit-continuation info)))))))
|
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(defun ert--run-test-internal (test-execution-info)
|
|
|
|
"Low-level function to run a test according to TEST-EXECUTION-INFO.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
This mainly sets up debugger-related bindings."
|
2012-11-23 03:26:09 +00:00
|
|
|
(setf (ert--test-execution-info-next-debugger test-execution-info) debugger
|
|
|
|
(ert--test-execution-info-ert-debug-on-error test-execution-info)
|
|
|
|
ert-debug-on-error)
|
|
|
|
(catch 'ert--pass
|
|
|
|
;; For now, each test gets its own temp buffer and its own
|
|
|
|
;; window excursion, just to be safe. If this turns out to be
|
|
|
|
;; too expensive, we can remove it.
|
|
|
|
(with-temp-buffer
|
|
|
|
(save-window-excursion
|
2017-07-13 20:54:35 +00:00
|
|
|
;; FIXME: Use `signal-hook-function' instead of `debugger' to
|
|
|
|
;; handle ert errors. Once that's done, remove
|
|
|
|
;; `ert--should-signal-hook'. See Bug#24402 and Bug#11218 for
|
|
|
|
;; details.
|
2012-11-23 03:26:09 +00:00
|
|
|
(let ((debugger (lambda (&rest args)
|
|
|
|
(ert--run-test-debugger test-execution-info
|
|
|
|
args)))
|
|
|
|
(debug-on-error t)
|
|
|
|
(debug-on-quit t)
|
|
|
|
;; FIXME: Do we need to store the old binding of this
|
|
|
|
;; and consider it in `ert--run-test-debugger'?
|
|
|
|
(debug-ignored-errors nil)
|
|
|
|
(ert--infos '()))
|
|
|
|
(funcall (ert-test-body (ert--test-execution-info-test
|
|
|
|
test-execution-info))))))
|
|
|
|
(ert-pass))
|
|
|
|
(setf (ert--test-execution-info-result test-execution-info)
|
|
|
|
(make-ert-test-passed))
|
2011-01-12 16:08:24 +00:00
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun ert--force-message-log-buffer-truncation ()
|
|
|
|
"Immediately truncate *Messages* buffer according to `message-log-max'.
|
|
|
|
|
|
|
|
This can be useful after reducing the value of `message-log-max'."
|
2013-09-17 07:39:54 +00:00
|
|
|
(with-current-buffer (messages-buffer)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; This is a reimplementation of this part of message_dolog() in xdisp.c:
|
2019-06-04 15:29:37 +00:00
|
|
|
;; if (FIXNATP (Vmessage_log_max))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; {
|
|
|
|
;; scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
|
2019-06-04 15:29:37 +00:00
|
|
|
;; -XFIXNAT (Vmessage_log_max) - 1, false);
|
|
|
|
;; del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
|
2011-01-12 16:08:24 +00:00
|
|
|
;; }
|
2019-06-04 15:29:37 +00:00
|
|
|
(when (natnump message-log-max)
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((begin (point-min))
|
|
|
|
(end (save-excursion
|
|
|
|
(goto-char (point-max))
|
|
|
|
(forward-line (- message-log-max))
|
2013-09-17 07:39:54 +00:00
|
|
|
(point)))
|
|
|
|
(inhibit-read-only t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(delete-region begin end)))))
|
|
|
|
|
|
|
|
(defvar ert--running-tests nil
|
|
|
|
"List of tests that are currently in execution.
|
|
|
|
|
|
|
|
This list is empty while no test is running, has one element
|
|
|
|
while a test is running, two elements while a test run from
|
|
|
|
inside a test is running, etc. The list is in order of nesting,
|
|
|
|
innermost test first.
|
|
|
|
|
|
|
|
The elements are of type `ert-test'.")
|
|
|
|
|
|
|
|
(defun ert-run-test (ert-test)
|
|
|
|
"Run ERT-TEST.
|
|
|
|
|
|
|
|
Returns the result and stores it in ERT-TEST's `most-recent-result' slot."
|
|
|
|
(setf (ert-test-most-recent-result ert-test) nil)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-block error
|
|
|
|
(let ((begin-marker
|
2013-09-17 07:39:54 +00:00
|
|
|
(with-current-buffer (messages-buffer)
|
2013-01-11 10:40:54 +00:00
|
|
|
(point-max-marker))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(unwind-protect
|
2012-11-23 03:26:09 +00:00
|
|
|
(let ((info (make-ert--test-execution-info
|
|
|
|
:test ert-test
|
|
|
|
:result
|
|
|
|
(make-ert-test-aborted-with-non-local-exit)
|
|
|
|
:exit-continuation (lambda ()
|
|
|
|
(cl-return-from error nil))))
|
|
|
|
(should-form-accu (list)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(unwind-protect
|
|
|
|
(let ((ert--should-execution-observer
|
|
|
|
(lambda (form-description)
|
|
|
|
(push form-description should-form-accu)))
|
|
|
|
(message-log-max t)
|
|
|
|
(ert--running-tests (cons ert-test ert--running-tests)))
|
|
|
|
(ert--run-test-internal info))
|
|
|
|
(let ((result (ert--test-execution-info-result info)))
|
|
|
|
(setf (ert-test-result-messages result)
|
2013-09-17 07:39:54 +00:00
|
|
|
(with-current-buffer (messages-buffer)
|
2011-01-12 16:08:24 +00:00
|
|
|
(buffer-substring begin-marker (point-max))))
|
|
|
|
(ert--force-message-log-buffer-truncation)
|
|
|
|
(setq should-form-accu (nreverse should-form-accu))
|
|
|
|
(setf (ert-test-result-should-forms result)
|
|
|
|
should-form-accu)
|
|
|
|
(setf (ert-test-most-recent-result ert-test) result))))
|
|
|
|
(set-marker begin-marker nil))))
|
|
|
|
(ert-test-most-recent-result ert-test))
|
|
|
|
|
|
|
|
(defun ert-running-test ()
|
|
|
|
"Return the top-level test currently executing."
|
|
|
|
(car (last ert--running-tests)))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Test selectors.
|
|
|
|
|
|
|
|
(defun ert-test-result-type-p (result result-type)
|
|
|
|
"Return non-nil if RESULT matches type RESULT-TYPE.
|
|
|
|
|
|
|
|
Valid result types:
|
|
|
|
|
|
|
|
nil -- Never matches.
|
|
|
|
t -- Always matches.
|
2013-10-24 07:34:41 +00:00
|
|
|
:failed, :passed, :skipped -- Matches corresponding results.
|
2015-09-17 23:08:20 +00:00
|
|
|
\(and TYPES...) -- Matches if all TYPES match.
|
|
|
|
\(or TYPES...) -- Matches if some TYPES match.
|
|
|
|
\(not TYPE) -- Matches if TYPE does not match.
|
|
|
|
\(satisfies PREDICATE) -- Matches if PREDICATE returns true when called with
|
2011-01-12 16:08:24 +00:00
|
|
|
RESULT."
|
|
|
|
;; It would be easy to add `member' and `eql' types etc., but I
|
|
|
|
;; haven't bothered yet.
|
2015-12-04 17:59:21 +00:00
|
|
|
(pcase-exhaustive result-type
|
|
|
|
('nil nil)
|
|
|
|
('t t)
|
|
|
|
(:failed (ert-test-failed-p result))
|
|
|
|
(:passed (ert-test-passed-p result))
|
|
|
|
(:skipped (ert-test-skipped-p result))
|
|
|
|
(`(,operator . ,operands)
|
|
|
|
(cl-ecase operator
|
|
|
|
(and
|
|
|
|
(cl-case (length operands)
|
|
|
|
(0 t)
|
|
|
|
(t
|
|
|
|
(and (ert-test-result-type-p result (car operands))
|
|
|
|
(ert-test-result-type-p result `(and ,@(cdr operands)))))))
|
|
|
|
(or
|
|
|
|
(cl-case (length operands)
|
|
|
|
(0 nil)
|
|
|
|
(t
|
|
|
|
(or (ert-test-result-type-p result (car operands))
|
|
|
|
(ert-test-result-type-p result `(or ,@(cdr operands)))))))
|
|
|
|
(not
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(not (ert-test-result-type-p result (car operands))))
|
|
|
|
(satisfies
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(funcall (car operands) result))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-test-result-expected-p (test result)
|
|
|
|
"Return non-nil if TEST's expected result type matches RESULT."
|
2013-10-24 07:34:41 +00:00
|
|
|
(or
|
|
|
|
(ert-test-result-type-p result :skipped)
|
|
|
|
(ert-test-result-type-p result (ert-test-expected-result-type test))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-select-tests (selector universe)
|
2011-10-15 19:24:14 +00:00
|
|
|
"Return a list of tests that match SELECTOR.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2011-10-15 19:24:14 +00:00
|
|
|
UNIVERSE specifies the set of tests to select from; it should be a list
|
|
|
|
of tests, or t, which refers to all tests named by symbols in `obarray'.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2011-10-15 19:24:14 +00:00
|
|
|
Valid SELECTORs:
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2011-10-15 19:24:14 +00:00
|
|
|
nil -- Selects the empty set.
|
|
|
|
t -- Selects UNIVERSE.
|
2011-01-12 16:08:24 +00:00
|
|
|
:new -- Selects all tests that have not been run yet.
|
2011-10-15 19:24:14 +00:00
|
|
|
:failed, :passed -- Select tests according to their most recent result.
|
2011-01-12 16:08:24 +00:00
|
|
|
:expected, :unexpected -- Select tests according to their most recent result.
|
2011-10-15 19:24:14 +00:00
|
|
|
a string -- A regular expression selecting all tests with matching names.
|
|
|
|
a test -- (i.e., an object of the ert-test data-type) Selects that test.
|
2011-01-12 16:08:24 +00:00
|
|
|
a symbol -- Selects the test that the symbol names, errors if none.
|
2011-10-15 19:24:14 +00:00
|
|
|
\(member TESTS...) -- Selects the elements of TESTS, a list of tests
|
|
|
|
or symbols naming tests.
|
2015-09-17 23:08:20 +00:00
|
|
|
\(eql TEST) -- Selects TEST, a test or a symbol naming a test.
|
2011-10-15 19:24:14 +00:00
|
|
|
\(and SELECTORS...) -- Selects the tests that match all SELECTORS.
|
|
|
|
\(or SELECTORS...) -- Selects the tests that match any of the SELECTORS.
|
|
|
|
\(not SELECTOR) -- Selects all tests that do not match SELECTOR.
|
2011-01-12 16:08:24 +00:00
|
|
|
\(tag TAG) -- Selects all tests that have TAG on their tags list.
|
2011-10-15 19:24:14 +00:00
|
|
|
A tag is an arbitrary label you can apply when you define a test.
|
|
|
|
\(satisfies PREDICATE) -- Selects all tests that satisfy PREDICATE.
|
|
|
|
PREDICATE is a function that takes an ert-test object as argument,
|
|
|
|
and returns non-nil if it is selected.
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
Only selectors that require a superset of tests, such
|
|
|
|
as (satisfies ...), strings, :new, etc. make use of UNIVERSE.
|
2011-10-15 19:24:14 +00:00
|
|
|
Selectors that do not, such as (member ...), just return the
|
2011-01-12 16:08:24 +00:00
|
|
|
set implied by them without checking whether it is really
|
|
|
|
contained in UNIVERSE."
|
2015-12-04 17:59:21 +00:00
|
|
|
;; This code needs to match the cases in
|
2011-01-12 16:08:24 +00:00
|
|
|
;; `ert-insert-human-readable-selector'.
|
2015-12-04 17:59:21 +00:00
|
|
|
(pcase-exhaustive selector
|
|
|
|
('nil nil)
|
|
|
|
('t (pcase-exhaustive universe
|
|
|
|
((pred listp) universe)
|
|
|
|
(`t (ert-select-tests "" universe))))
|
|
|
|
(:new (ert-select-tests
|
|
|
|
`(satisfies ,(lambda (test)
|
|
|
|
(null (ert-test-most-recent-result test))))
|
|
|
|
universe))
|
|
|
|
(:failed (ert-select-tests
|
|
|
|
`(satisfies ,(lambda (test)
|
|
|
|
(ert-test-result-type-p
|
|
|
|
(ert-test-most-recent-result test)
|
|
|
|
':failed)))
|
|
|
|
universe))
|
|
|
|
(:passed (ert-select-tests
|
|
|
|
`(satisfies ,(lambda (test)
|
|
|
|
(ert-test-result-type-p
|
|
|
|
(ert-test-most-recent-result test)
|
|
|
|
':passed)))
|
|
|
|
universe))
|
|
|
|
(:expected (ert-select-tests
|
|
|
|
`(satisfies
|
|
|
|
,(lambda (test)
|
|
|
|
(ert-test-result-expected-p
|
|
|
|
test
|
|
|
|
(ert-test-most-recent-result test))))
|
|
|
|
universe))
|
2018-11-05 00:22:15 +00:00
|
|
|
(:unexpected (ert-select-tests '(not :expected) universe))
|
2015-12-04 17:59:21 +00:00
|
|
|
((pred stringp)
|
|
|
|
(pcase-exhaustive universe
|
|
|
|
(`t (mapcar #'ert-get-test
|
|
|
|
(apropos-internal selector #'ert-test-boundp)))
|
|
|
|
((pred listp)
|
|
|
|
(cl-remove-if-not (lambda (test)
|
|
|
|
(and (ert-test-name test)
|
|
|
|
(string-match selector
|
|
|
|
(symbol-name
|
|
|
|
(ert-test-name test)))))
|
|
|
|
universe))))
|
|
|
|
((pred ert-test-p) (list selector))
|
|
|
|
((pred symbolp)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (ert-test-boundp selector))
|
2011-01-12 16:08:24 +00:00
|
|
|
(list (ert-get-test selector)))
|
2015-12-04 17:59:21 +00:00
|
|
|
(`(,operator . ,operands)
|
|
|
|
(cl-ecase operator
|
|
|
|
(member
|
|
|
|
(mapcar (lambda (purported-test)
|
|
|
|
(pcase-exhaustive purported-test
|
|
|
|
((pred symbolp)
|
|
|
|
(cl-assert (ert-test-boundp purported-test))
|
|
|
|
(ert-get-test purported-test))
|
|
|
|
((pred ert-test-p) purported-test)))
|
|
|
|
operands))
|
|
|
|
(eql
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(ert-select-tests `(member ,@operands) universe))
|
|
|
|
(and
|
|
|
|
;; Do these definitions of AND, NOT and OR satisfy de
|
|
|
|
;; Morgan's laws? Should they?
|
|
|
|
(cl-case (length operands)
|
|
|
|
(0 (ert-select-tests 't universe))
|
|
|
|
(t (ert-select-tests `(and ,@(cdr operands))
|
|
|
|
(ert-select-tests (car operands)
|
|
|
|
universe)))))
|
|
|
|
(not
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(let ((all-tests (ert-select-tests 't universe)))
|
|
|
|
(cl-set-difference all-tests
|
|
|
|
(ert-select-tests (car operands)
|
|
|
|
all-tests))))
|
|
|
|
(or
|
|
|
|
(cl-case (length operands)
|
|
|
|
(0 (ert-select-tests 'nil universe))
|
|
|
|
(t (cl-union (ert-select-tests (car operands) universe)
|
|
|
|
(ert-select-tests `(or ,@(cdr operands))
|
|
|
|
universe)))))
|
|
|
|
(tag
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(let ((tag (car operands)))
|
|
|
|
(ert-select-tests `(satisfies
|
|
|
|
,(lambda (test)
|
|
|
|
(member tag (ert-test-tags test))))
|
|
|
|
universe)))
|
|
|
|
(satisfies
|
|
|
|
(cl-assert (eql (length operands) 1))
|
|
|
|
(cl-remove-if-not (car operands)
|
|
|
|
(ert-select-tests 't universe)))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--insert-human-readable-selector (selector)
|
|
|
|
"Insert a human-readable presentation of SELECTOR into the current buffer."
|
|
|
|
;; This is needed to avoid printing the (huge) contents of the
|
|
|
|
;; `backtrace' slot of the result objects in the
|
|
|
|
;; `most-recent-result' slots of test case objects in (eql ...) or
|
|
|
|
;; (member ...) selectors.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-labels ((rec (selector)
|
2015-12-04 17:59:21 +00:00
|
|
|
;; This code needs to match the cases in
|
2012-11-23 03:26:09 +00:00
|
|
|
;; `ert-select-tests'.
|
2015-12-04 17:59:21 +00:00
|
|
|
(pcase-exhaustive selector
|
|
|
|
((or
|
|
|
|
;; 'nil 't :new :failed :passed :expected :unexpected
|
|
|
|
(pred stringp)
|
|
|
|
(pred symbolp))
|
2012-11-23 03:26:09 +00:00
|
|
|
selector)
|
2015-12-04 17:59:21 +00:00
|
|
|
((pred ert-test-p)
|
2012-11-23 03:26:09 +00:00
|
|
|
(if (ert-test-name selector)
|
|
|
|
(make-symbol (format "<%S>" (ert-test-name selector)))
|
|
|
|
(make-symbol "<unnamed test>")))
|
2015-12-04 17:59:21 +00:00
|
|
|
(`(,operator . ,operands)
|
|
|
|
(pcase operator
|
2015-12-11 05:46:19 +00:00
|
|
|
((or 'member 'eql 'and 'not 'or)
|
2015-12-04 17:59:21 +00:00
|
|
|
`(,operator ,@(mapcar #'rec operands)))
|
|
|
|
((or 'tag 'satisfies)
|
|
|
|
selector))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert (format "%S" (rec selector)))))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Facilities for running a whole set of tests.
|
|
|
|
|
|
|
|
;; The data structure that contains the set of tests being executed
|
|
|
|
;; during one particular test run, their results, the state of the
|
|
|
|
;; execution, and some statistics.
|
|
|
|
;;
|
|
|
|
;; The data about results and expected results of tests may seem
|
|
|
|
;; redundant here, since the test objects also carry such information.
|
|
|
|
;; However, the information in the test objects may be more recent, it
|
|
|
|
;; may correspond to a different test run. We need the information
|
|
|
|
;; that corresponds to this run in order to be able to update the
|
|
|
|
;; statistics correctly when a test is re-run interactively and has a
|
|
|
|
;; different result than before.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct ert--stats
|
|
|
|
(selector (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; The tests, in order.
|
2012-11-23 03:26:09 +00:00
|
|
|
(tests (cl-assert nil) :type vector)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; A map of test names (or the test objects themselves for unnamed
|
|
|
|
;; tests) to indices into the `tests' vector.
|
2012-11-23 03:26:09 +00:00
|
|
|
(test-map (cl-assert nil) :type hash-table)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; The results of the tests during this run, in order.
|
2012-11-23 03:26:09 +00:00
|
|
|
(test-results (cl-assert nil) :type vector)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; The start times of the tests, in order, as reported by
|
|
|
|
;; `current-time'.
|
2012-11-23 03:26:09 +00:00
|
|
|
(test-start-times (cl-assert nil) :type vector)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; The end times of the tests, in order, as reported by
|
|
|
|
;; `current-time'.
|
2012-11-23 03:26:09 +00:00
|
|
|
(test-end-times (cl-assert nil) :type vector)
|
2011-01-12 16:08:24 +00:00
|
|
|
(passed-expected 0)
|
|
|
|
(passed-unexpected 0)
|
|
|
|
(failed-expected 0)
|
|
|
|
(failed-unexpected 0)
|
2013-10-24 07:34:41 +00:00
|
|
|
(skipped 0)
|
2011-01-12 16:08:24 +00:00
|
|
|
(start-time nil)
|
|
|
|
(end-time nil)
|
|
|
|
(aborted-p nil)
|
|
|
|
(current-test nil)
|
|
|
|
;; The time at or after which the next redisplay should occur, as a
|
|
|
|
;; float.
|
|
|
|
(next-redisplay 0.0))
|
|
|
|
|
|
|
|
(defun ert-stats-completed-expected (stats)
|
|
|
|
"Return the number of tests in STATS that had expected results."
|
|
|
|
(+ (ert--stats-passed-expected stats)
|
|
|
|
(ert--stats-failed-expected stats)))
|
|
|
|
|
|
|
|
(defun ert-stats-completed-unexpected (stats)
|
|
|
|
"Return the number of tests in STATS that had unexpected results."
|
|
|
|
(+ (ert--stats-passed-unexpected stats)
|
|
|
|
(ert--stats-failed-unexpected stats)))
|
|
|
|
|
2013-10-24 07:34:41 +00:00
|
|
|
(defun ert-stats-skipped (stats)
|
|
|
|
"Number of tests in STATS that have skipped."
|
|
|
|
(ert--stats-skipped stats))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
(defun ert-stats-completed (stats)
|
|
|
|
"Number of tests in STATS that have run so far."
|
|
|
|
(+ (ert-stats-completed-expected stats)
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-stats-completed-unexpected stats)
|
|
|
|
(ert-stats-skipped stats)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-stats-total (stats)
|
|
|
|
"Number of tests in STATS, regardless of whether they have run yet."
|
|
|
|
(length (ert--stats-tests stats)))
|
|
|
|
|
|
|
|
;; The stats object of the current run, dynamically bound. This is
|
|
|
|
;; used for the mode line progress indicator.
|
|
|
|
(defvar ert--current-run-stats nil)
|
|
|
|
|
|
|
|
(defun ert--stats-test-key (test)
|
|
|
|
"Return the key used for TEST in the test map of ert--stats objects.
|
|
|
|
|
|
|
|
Returns the name of TEST if it has one, or TEST itself otherwise."
|
|
|
|
(or (ert-test-name test) test))
|
|
|
|
|
|
|
|
(defun ert--stats-set-test-and-result (stats pos test result)
|
|
|
|
"Change STATS by replacing the test at position POS with TEST and RESULT.
|
|
|
|
|
|
|
|
Also changes the counters in STATS to match."
|
|
|
|
(let* ((tests (ert--stats-tests stats))
|
|
|
|
(results (ert--stats-test-results stats))
|
|
|
|
(old-test (aref tests pos))
|
|
|
|
(map (ert--stats-test-map stats)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-flet ((update (d)
|
|
|
|
(if (ert-test-result-expected-p (aref tests pos)
|
|
|
|
(aref results pos))
|
|
|
|
(cl-etypecase (aref results pos)
|
|
|
|
(ert-test-passed
|
|
|
|
(cl-incf (ert--stats-passed-expected stats) d))
|
|
|
|
(ert-test-failed
|
|
|
|
(cl-incf (ert--stats-failed-expected stats) d))
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-test-skipped
|
|
|
|
(cl-incf (ert--stats-skipped stats) d))
|
2012-11-23 03:26:09 +00:00
|
|
|
(null)
|
|
|
|
(ert-test-aborted-with-non-local-exit)
|
|
|
|
(ert-test-quit))
|
|
|
|
(cl-etypecase (aref results pos)
|
|
|
|
(ert-test-passed
|
|
|
|
(cl-incf (ert--stats-passed-unexpected stats) d))
|
|
|
|
(ert-test-failed
|
|
|
|
(cl-incf (ert--stats-failed-unexpected stats) d))
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-test-skipped
|
|
|
|
(cl-incf (ert--stats-skipped stats) d))
|
2012-11-23 03:26:09 +00:00
|
|
|
(null)
|
|
|
|
(ert-test-aborted-with-non-local-exit)
|
|
|
|
(ert-test-quit)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; Adjust counters to remove the result that is currently in stats.
|
|
|
|
(update -1)
|
|
|
|
;; Put new test and result into stats.
|
|
|
|
(setf (aref tests pos) test
|
|
|
|
(aref results pos) result)
|
|
|
|
(remhash (ert--stats-test-key old-test) map)
|
|
|
|
(setf (gethash (ert--stats-test-key test) map) pos)
|
|
|
|
;; Adjust counters to match new result.
|
|
|
|
(update +1)
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun ert--make-stats (tests selector)
|
|
|
|
"Create a new `ert--stats' object for running TESTS.
|
|
|
|
|
|
|
|
SELECTOR is the selector that was used to select TESTS."
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(setq tests (cl-coerce tests 'vector))
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((map (make-hash-table :size (length tests))))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for i from 0
|
|
|
|
for test across tests
|
|
|
|
for key = (ert--stats-test-key test) do
|
|
|
|
(cl-assert (not (gethash key map)))
|
|
|
|
(setf (gethash key map) i))
|
2011-01-12 16:08:24 +00:00
|
|
|
(make-ert--stats :selector selector
|
|
|
|
:tests tests
|
|
|
|
:test-map map
|
|
|
|
:test-results (make-vector (length tests) nil)
|
|
|
|
:test-start-times (make-vector (length tests) nil)
|
|
|
|
:test-end-times (make-vector (length tests) nil))))
|
|
|
|
|
|
|
|
(defun ert-run-or-rerun-test (stats test listener)
|
|
|
|
;; checkdoc-order: nil
|
|
|
|
"Run the single test TEST and record the result using STATS and LISTENER."
|
|
|
|
(let ((ert--current-run-stats stats)
|
|
|
|
(pos (ert--stats-test-pos stats test)))
|
|
|
|
(ert--stats-set-test-and-result stats pos test nil)
|
|
|
|
;; Call listener after setting/before resetting
|
|
|
|
;; (ert--stats-current-test stats); the listener might refresh the
|
|
|
|
;; mode line display, and if the value is not set yet/any more
|
|
|
|
;; during this refresh, the mode line will flicker unnecessarily.
|
|
|
|
(setf (ert--stats-current-test stats) test)
|
|
|
|
(funcall listener 'test-started stats test)
|
|
|
|
(setf (ert-test-most-recent-result test) nil)
|
|
|
|
(setf (aref (ert--stats-test-start-times stats) pos) (current-time))
|
|
|
|
(unwind-protect
|
|
|
|
(ert-run-test test)
|
|
|
|
(setf (aref (ert--stats-test-end-times stats) pos) (current-time))
|
|
|
|
(let ((result (ert-test-most-recent-result test)))
|
2018-03-14 15:21:06 +00:00
|
|
|
(setf (ert-test-result-duration result)
|
|
|
|
(float-time
|
|
|
|
(time-subtract
|
|
|
|
(aref (ert--stats-test-end-times stats) pos)
|
|
|
|
(aref (ert--stats-test-start-times stats) pos))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--stats-set-test-and-result stats pos test result)
|
|
|
|
(funcall listener 'test-ended stats test result))
|
|
|
|
(setf (ert--stats-current-test stats) nil))))
|
|
|
|
|
2017-03-28 13:40:45 +00:00
|
|
|
(defun ert-run-tests (selector listener &optional interactively)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Run the tests specified by SELECTOR, sending progress updates to LISTENER."
|
|
|
|
(let* ((tests (ert-select-tests selector t))
|
|
|
|
(stats (ert--make-stats tests selector)))
|
|
|
|
(setf (ert--stats-start-time stats) (current-time))
|
|
|
|
(funcall listener 'run-started stats)
|
|
|
|
(let ((abortedp t))
|
|
|
|
(unwind-protect
|
|
|
|
(let ((ert--current-run-stats stats))
|
|
|
|
(force-mode-line-update)
|
|
|
|
(unwind-protect
|
2014-03-02 15:35:33 +00:00
|
|
|
(cl-loop for test in tests do
|
|
|
|
(ert-run-or-rerun-test stats test listener)
|
|
|
|
(when (and interactively
|
|
|
|
(ert-test-quit-p
|
|
|
|
(ert-test-most-recent-result test))
|
|
|
|
(y-or-n-p "Abort testing? "))
|
|
|
|
(cl-return))
|
|
|
|
finally (setq abortedp nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
(setf (ert--stats-aborted-p stats) abortedp)
|
|
|
|
(setf (ert--stats-end-time stats) (current-time))
|
|
|
|
(funcall listener 'run-ended stats abortedp)))
|
|
|
|
(force-mode-line-update))
|
|
|
|
stats)))
|
|
|
|
|
|
|
|
(defun ert--stats-test-pos (stats test)
|
|
|
|
;; checkdoc-order: nil
|
|
|
|
"Return the position (index) of TEST in the run represented by STATS."
|
|
|
|
(gethash (ert--stats-test-key test) (ert--stats-test-map stats)))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Formatting functions shared across UIs.
|
|
|
|
|
|
|
|
(defun ert--format-time-iso8601 (time)
|
|
|
|
"Format TIME in the variant of ISO 8601 used for timestamps in ERT."
|
|
|
|
(format-time-string "%Y-%m-%d %T%z" time))
|
|
|
|
|
|
|
|
(defun ert-char-for-test-result (result expectedp)
|
|
|
|
"Return a character that represents the test result RESULT.
|
|
|
|
|
|
|
|
EXPECTEDP specifies whether the result was expected."
|
2012-11-23 03:26:09 +00:00
|
|
|
(let ((s (cl-etypecase result
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-test-passed ".P")
|
|
|
|
(ert-test-failed "fF")
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-test-skipped "sS")
|
2011-01-12 16:08:24 +00:00
|
|
|
(null "--")
|
2011-03-03 08:16:58 +00:00
|
|
|
(ert-test-aborted-with-non-local-exit "aA")
|
|
|
|
(ert-test-quit "qQ"))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(elt s (if expectedp 0 1))))
|
|
|
|
|
|
|
|
(defun ert-string-for-test-result (result expectedp)
|
|
|
|
"Return a string that represents the test result RESULT.
|
|
|
|
|
|
|
|
EXPECTEDP specifies whether the result was expected."
|
2012-11-23 03:26:09 +00:00
|
|
|
(let ((s (cl-etypecase result
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-test-passed '("passed" "PASSED"))
|
|
|
|
(ert-test-failed '("failed" "FAILED"))
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-test-skipped '("skipped" "SKIPPED"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(null '("unknown" "UNKNOWN"))
|
2011-03-03 08:16:58 +00:00
|
|
|
(ert-test-aborted-with-non-local-exit '("aborted" "ABORTED"))
|
|
|
|
(ert-test-quit '("quit" "QUIT")))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(elt s (if expectedp 0 1))))
|
|
|
|
|
|
|
|
(defun ert--pp-with-indentation-and-newline (object)
|
|
|
|
"Pretty-print OBJECT, indenting it to the current column of point.
|
|
|
|
Ensures a final newline is inserted."
|
2015-10-26 20:27:16 +00:00
|
|
|
(let ((begin (point))
|
|
|
|
(pp-escape-newlines nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
(pp object (current-buffer))
|
|
|
|
(unless (bolp) (insert "\n"))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char begin)
|
|
|
|
(indent-sexp))))
|
|
|
|
|
|
|
|
(defun ert--insert-infos (result)
|
|
|
|
"Insert `ert-info' infos from RESULT into current buffer.
|
|
|
|
|
|
|
|
RESULT must be an `ert-test-result-with-condition'."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-check-type result ert-test-result-with-condition)
|
2011-01-12 16:08:24 +00:00
|
|
|
(dolist (info (ert-test-result-with-condition-infos result))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (prefix . message) info
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((begin (point))
|
|
|
|
(indentation (make-string (+ (length prefix) 4) ?\s))
|
|
|
|
(end nil))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(insert message "\n")
|
2014-06-22 05:43:58 +00:00
|
|
|
(setq end (point-marker))
|
2011-01-12 16:08:24 +00:00
|
|
|
(goto-char begin)
|
|
|
|
(insert " " prefix)
|
|
|
|
(forward-line 1)
|
|
|
|
(while (< (point) end)
|
|
|
|
(insert indentation)
|
|
|
|
(forward-line 1)))
|
|
|
|
(when end (set-marker end nil)))))))
|
|
|
|
|
|
|
|
|
|
|
|
;;; Running tests in batch mode.
|
|
|
|
|
2017-10-28 10:46:36 +00:00
|
|
|
(defvar ert-quiet nil
|
|
|
|
"Non-nil makes ERT only print important information in batch mode.")
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun ert-run-tests-batch (&optional selector)
|
|
|
|
"Run the tests specified by SELECTOR, printing results to the terminal.
|
|
|
|
|
|
|
|
SELECTOR works as described in `ert-select-tests', except if
|
|
|
|
SELECTOR is nil, in which case all tests rather than none will be
|
|
|
|
run; this makes the command line \"emacs -batch -l my-tests.el -f
|
|
|
|
ert-run-tests-batch-and-exit\" useful.
|
|
|
|
|
|
|
|
Returns the stats object."
|
|
|
|
(unless selector (setq selector 't))
|
|
|
|
(ert-run-tests
|
|
|
|
selector
|
|
|
|
(lambda (event-type &rest event-args)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-ecase event-type
|
2011-01-12 16:08:24 +00:00
|
|
|
(run-started
|
2017-10-28 10:46:36 +00:00
|
|
|
(unless ert-quiet
|
|
|
|
(cl-destructuring-bind (stats) event-args
|
2018-03-18 09:01:37 +00:00
|
|
|
(message "Running %s tests (%s, selector `%S')"
|
2017-10-28 10:46:36 +00:00
|
|
|
(length (ert--stats-tests stats))
|
2018-03-18 09:01:37 +00:00
|
|
|
(ert--format-time-iso8601 (ert--stats-start-time stats))
|
|
|
|
selector))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(run-ended
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats abortedp) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((unexpected (ert-stats-completed-unexpected stats))
|
2013-10-24 07:34:41 +00:00
|
|
|
(skipped (ert-stats-skipped stats))
|
|
|
|
(expected-failures (ert--stats-failed-expected stats)))
|
2019-07-26 07:08:40 +00:00
|
|
|
(message "\n%sRan %s tests, %s results as expected, %s unexpected%s (%s, %f sec)%s\n"
|
2011-01-12 16:08:24 +00:00
|
|
|
(if (not abortedp)
|
|
|
|
""
|
|
|
|
"Aborted: ")
|
|
|
|
(ert-stats-total stats)
|
|
|
|
(ert-stats-completed-expected stats)
|
2019-07-26 07:08:40 +00:00
|
|
|
unexpected
|
2013-10-24 07:34:41 +00:00
|
|
|
(if (zerop skipped)
|
|
|
|
""
|
|
|
|
(format ", %s skipped" skipped))
|
2018-03-17 09:25:22 +00:00
|
|
|
(ert--format-time-iso8601 (ert--stats-end-time stats))
|
|
|
|
(float-time
|
|
|
|
(time-subtract
|
|
|
|
(ert--stats-end-time stats)
|
|
|
|
(ert--stats-start-time stats)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(if (zerop expected-failures)
|
|
|
|
""
|
|
|
|
(format "\n%s expected failures" expected-failures)))
|
|
|
|
(unless (zerop unexpected)
|
|
|
|
(message "%s unexpected results:" unexpected)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for test across (ert--stats-tests stats)
|
|
|
|
for result = (ert-test-most-recent-result test) do
|
|
|
|
(when (not (ert-test-result-expected-p test result))
|
|
|
|
(message "%9s %S"
|
|
|
|
(ert-string-for-test-result result nil)
|
|
|
|
(ert-test-name test))))
|
2013-10-24 07:34:41 +00:00
|
|
|
(message "%s" ""))
|
|
|
|
(unless (zerop skipped)
|
|
|
|
(message "%s skipped results:" skipped)
|
|
|
|
(cl-loop for test across (ert--stats-tests stats)
|
|
|
|
for result = (ert-test-most-recent-result test) do
|
|
|
|
(when (ert-test-result-type-p result :skipped)
|
|
|
|
(message "%9s %S"
|
|
|
|
(ert-string-for-test-result result nil)
|
|
|
|
(ert-test-name test))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(message "%s" "")))))
|
|
|
|
(test-started
|
|
|
|
)
|
|
|
|
(test-ended
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats test result) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(unless (ert-test-result-expected-p test result)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-etypecase result
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-test-passed
|
|
|
|
(message "Test %S passed unexpectedly" (ert-test-name test)))
|
|
|
|
(ert-test-result-with-condition
|
|
|
|
(message "Test %S backtrace:" (ert-test-name test))
|
|
|
|
(with-temp-buffer
|
2018-06-19 14:27:41 +00:00
|
|
|
(insert (backtrace-to-string
|
|
|
|
(ert-test-result-with-condition-backtrace result)))
|
2017-09-06 00:40:10 +00:00
|
|
|
(if (not ert-batch-backtrace-right-margin)
|
|
|
|
(message "%s"
|
|
|
|
(buffer-substring-no-properties (point-min)
|
|
|
|
(point-max)))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(let ((start (point))
|
|
|
|
(end (line-end-position)))
|
|
|
|
(setq end (min end
|
|
|
|
(+ start
|
|
|
|
ert-batch-backtrace-right-margin)))
|
|
|
|
(message "%s" (buffer-substring-no-properties
|
|
|
|
start end)))
|
|
|
|
(forward-line 1))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(with-temp-buffer
|
|
|
|
(ert--insert-infos result)
|
|
|
|
(insert " ")
|
|
|
|
(let ((print-escape-newlines t)
|
|
|
|
(print-level 5)
|
|
|
|
(print-length 10))
|
2011-03-20 10:17:10 +00:00
|
|
|
(ert--pp-with-indentation-and-newline
|
|
|
|
(ert-test-result-with-condition-condition result)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(goto-char (1- (point-max)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (looking-at "\n"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(delete-char 1)
|
|
|
|
(message "Test %S condition:" (ert-test-name test))
|
|
|
|
(message "%s" (buffer-string))))
|
|
|
|
(ert-test-aborted-with-non-local-exit
|
|
|
|
(message "Test %S aborted with non-local exit"
|
2011-03-03 08:16:58 +00:00
|
|
|
(ert-test-name test)))
|
|
|
|
(ert-test-quit
|
|
|
|
(message "Quit during %S" (ert-test-name test)))))
|
2017-10-28 10:46:36 +00:00
|
|
|
(unless ert-quiet
|
|
|
|
(let* ((max (prin1-to-string (length (ert--stats-tests stats))))
|
|
|
|
(format-string (concat "%9s %"
|
|
|
|
(prin1-to-string (length max))
|
2018-03-17 09:25:22 +00:00
|
|
|
"s/" max " %S (%f sec)")))
|
2017-10-28 10:46:36 +00:00
|
|
|
(message format-string
|
|
|
|
(ert-string-for-test-result result
|
|
|
|
(ert-test-result-expected-p
|
|
|
|
test result))
|
|
|
|
(1+ (ert--stats-test-pos stats test))
|
2018-03-14 15:21:06 +00:00
|
|
|
(ert-test-name test)
|
2018-03-17 09:25:22 +00:00
|
|
|
(ert-test-result-duration result))))))))
|
2014-03-02 15:35:33 +00:00
|
|
|
nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ert-run-tests-batch-and-exit (&optional selector)
|
|
|
|
"Like `ert-run-tests-batch', but exits Emacs when done.
|
|
|
|
|
|
|
|
The exit status will be 0 if all test results were as expected, 1
|
|
|
|
on unexpected results, or 2 if the tool detected an error outside
|
|
|
|
of the tests (e.g. invalid SELECTOR or bug in the code that runs
|
|
|
|
the tests)."
|
2017-05-27 12:39:01 +00:00
|
|
|
(or noninteractive
|
|
|
|
(user-error "This function is only for use in batch mode"))
|
|
|
|
;; Better crash loudly than attempting to recover from undefined
|
|
|
|
;; behavior.
|
|
|
|
(setq attempt-stack-overflow-recovery nil
|
|
|
|
attempt-orderly-shutdown-on-fatal-signal nil)
|
2011-01-12 16:08:24 +00:00
|
|
|
(unwind-protect
|
|
|
|
(let ((stats (ert-run-tests-batch selector)))
|
|
|
|
(kill-emacs (if (zerop (ert-stats-completed-unexpected stats)) 0 1)))
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(message "Error running tests")
|
|
|
|
(backtrace))
|
|
|
|
(kill-emacs 2))))
|
|
|
|
|
|
|
|
|
2018-03-19 11:58:45 +00:00
|
|
|
(defun ert-summarize-tests-batch-and-exit (&optional high)
|
2014-06-26 05:47:10 +00:00
|
|
|
"Summarize the results of testing.
|
|
|
|
Expects to be called in batch mode, with logfiles as command-line arguments.
|
|
|
|
The logfiles should have the `ert-run-tests-batch' format. When finished,
|
2018-03-19 11:58:45 +00:00
|
|
|
this exits Emacs, with status as per `ert-run-tests-batch-and-exit'.
|
|
|
|
|
|
|
|
If HIGH is a natural number, the HIGH long lasting tests are summarized."
|
2014-06-26 05:47:10 +00:00
|
|
|
(or noninteractive
|
|
|
|
(user-error "This function is only for use in batch mode"))
|
2018-03-19 11:58:45 +00:00
|
|
|
(or (natnump high) (setq high 0))
|
2017-05-27 12:39:01 +00:00
|
|
|
;; Better crash loudly than attempting to recover from undefined
|
|
|
|
;; behavior.
|
|
|
|
(setq attempt-stack-overflow-recovery nil
|
|
|
|
attempt-orderly-shutdown-on-fatal-signal nil)
|
2014-06-26 05:47:10 +00:00
|
|
|
(let ((nlogs (length command-line-args-left))
|
|
|
|
(ntests 0) (nrun 0) (nexpected 0) (nunexpected 0) (nskipped 0)
|
2018-03-19 11:58:45 +00:00
|
|
|
nnotrun logfile notests badtests unexpected skipped tests)
|
2014-06-26 05:47:10 +00:00
|
|
|
(with-temp-buffer
|
|
|
|
(while (setq logfile (pop command-line-args-left))
|
|
|
|
(erase-buffer)
|
2017-07-02 02:37:12 +00:00
|
|
|
(when (file-readable-p logfile) (insert-file-contents logfile))
|
2014-06-26 05:47:10 +00:00
|
|
|
(if (not (re-search-forward "^Running \\([0-9]+\\) tests" nil t))
|
|
|
|
(push logfile notests)
|
|
|
|
(setq ntests (+ ntests (string-to-number (match-string 1))))
|
|
|
|
(if (not (re-search-forward "^\\(Aborted: \\)?\
|
|
|
|
Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\
|
|
|
|
\\(?:, \\([0-9]+\\) unexpected\\)?\
|
|
|
|
\\(?:, \\([0-9]+\\) skipped\\)?" nil t))
|
|
|
|
(push logfile badtests)
|
|
|
|
(if (match-string 1) (push logfile badtests))
|
|
|
|
(setq nrun (+ nrun (string-to-number (match-string 2)))
|
|
|
|
nexpected (+ nexpected (string-to-number (match-string 3))))
|
|
|
|
(when (match-string 4)
|
2019-07-26 16:41:30 +00:00
|
|
|
(let ((n (string-to-number (match-string 4))))
|
|
|
|
(unless (zerop n)
|
|
|
|
(push logfile unexpected)
|
|
|
|
(setq nunexpected (+ nunexpected n)))))
|
2016-05-17 00:49:39 +00:00
|
|
|
(when (match-string 5)
|
|
|
|
(push logfile skipped)
|
|
|
|
(setq nskipped (+ nskipped
|
2018-03-19 11:58:45 +00:00
|
|
|
(string-to-number (match-string 5)))))
|
|
|
|
(unless (zerop high)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (< (point) (point-max))
|
|
|
|
(if (looking-at "^\\s-+\\w+\\s-+[[:digit:]]+/[[:digit:]]+\\s-+\\S-+\\s-+(\\([.[:digit:]]+\\)\\s-+sec)$")
|
|
|
|
(push (cons (string-to-number (match-string 1))
|
|
|
|
(match-string 0))
|
|
|
|
tests))
|
|
|
|
(forward-line)))))))
|
2014-06-26 05:47:10 +00:00
|
|
|
(setq nnotrun (- ntests nrun))
|
|
|
|
(message "\nSUMMARY OF TEST RESULTS")
|
|
|
|
(message "-----------------------")
|
|
|
|
(message "Files examined: %d" nlogs)
|
2019-07-12 23:55:25 +00:00
|
|
|
(message "Ran %d tests%s, %d results as expected, %d unexpected, %d skipped"
|
2014-06-26 05:47:10 +00:00
|
|
|
nrun
|
|
|
|
(if (zerop nnotrun) "" (format ", %d failed to run" nnotrun))
|
2019-07-12 23:55:25 +00:00
|
|
|
nexpected nunexpected nskipped)
|
2014-06-26 05:47:10 +00:00
|
|
|
(when notests
|
|
|
|
(message "%d files did not contain any tests:" (length notests))
|
|
|
|
(mapc (lambda (l) (message " %s" l)) notests))
|
|
|
|
(when badtests
|
|
|
|
(message "%d files did not finish:" (length badtests))
|
2018-03-14 18:30:39 +00:00
|
|
|
(mapc (lambda (l) (message " %s" l)) badtests)
|
|
|
|
(if (getenv "EMACS_HYDRA_CI")
|
|
|
|
(with-temp-buffer
|
|
|
|
(dolist (f badtests)
|
|
|
|
(erase-buffer)
|
|
|
|
(insert-file-contents f)
|
|
|
|
(message "Contents of unfinished file %s:" f)
|
|
|
|
(message "-----\n%s\n-----" (buffer-string))))))
|
2014-06-26 05:47:10 +00:00
|
|
|
(when unexpected
|
|
|
|
(message "%d files contained unexpected results:" (length unexpected))
|
|
|
|
(mapc (lambda (l) (message " %s" l)) unexpected))
|
2018-03-19 11:58:45 +00:00
|
|
|
(unless (or (null tests) (zerop high))
|
|
|
|
(message "\nLONG-RUNNING TESTS")
|
|
|
|
(message "------------------")
|
|
|
|
(setq tests (sort tests (lambda (x y) (> (car x) (car y)))))
|
|
|
|
(when (< high (length tests)) (setcdr (nthcdr (1- high) tests) nil))
|
|
|
|
(message "%s" (mapconcat 'cdr tests "\n")))
|
2016-05-17 00:49:39 +00:00
|
|
|
;; More details on hydra, where the logs are harder to get to.
|
2017-07-18 16:53:46 +00:00
|
|
|
(when (and (getenv "EMACS_HYDRA_CI")
|
2016-05-17 00:49:39 +00:00
|
|
|
(not (zerop (+ nunexpected nskipped))))
|
|
|
|
(message "\nDETAILS")
|
|
|
|
(message "-------")
|
|
|
|
(with-temp-buffer
|
|
|
|
(dolist (x (list (list skipped "skipped" "SKIPPED")
|
2018-12-18 06:52:34 +00:00
|
|
|
(list unexpected "unexpected"
|
|
|
|
"\\(?:FAILED\\|PASSED\\)")))
|
2016-05-17 00:49:39 +00:00
|
|
|
(mapc (lambda (l)
|
|
|
|
(erase-buffer)
|
|
|
|
(insert-file-contents l)
|
|
|
|
(message "%s:" l)
|
|
|
|
(when (re-search-forward (format "^[ \t]*[0-9]+ %s results:"
|
|
|
|
(nth 1 x))
|
|
|
|
nil t)
|
|
|
|
(while (and (zerop (forward-line 1))
|
|
|
|
(looking-at (format "^[ \t]*%s" (nth 2 x))))
|
|
|
|
(message "%s" (buffer-substring (line-beginning-position)
|
|
|
|
(line-end-position))))))
|
|
|
|
(car x)))))
|
2014-06-26 05:47:10 +00:00
|
|
|
(kill-emacs (cond ((or notests badtests (not (zerop nnotrun))) 2)
|
|
|
|
(unexpected 1)
|
|
|
|
(t 0)))))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
;;; Utility functions for load/unload actions.
|
|
|
|
|
|
|
|
(defun ert--activate-font-lock-keywords ()
|
|
|
|
"Activate font-lock keywords for some of ERT's symbols."
|
|
|
|
(font-lock-add-keywords
|
|
|
|
nil
|
2014-02-04 17:37:08 +00:00
|
|
|
'(("(\\(\\<ert-deftest\\)\\>\\s *\\(\\(?:\\sw\\|\\s_\\)+\\)?"
|
2011-01-12 16:08:24 +00:00
|
|
|
(1 font-lock-keyword-face nil t)
|
|
|
|
(2 font-lock-function-name-face nil t)))))
|
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defun ert--remove-from-list (list-var element &key key test)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Remove ELEMENT from the value of LIST-VAR if present.
|
|
|
|
|
|
|
|
This can be used as an inverse of `add-to-list'."
|
|
|
|
(unless key (setq key #'identity))
|
|
|
|
(unless test (setq test #'equal))
|
|
|
|
(setf (symbol-value list-var)
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(cl-remove element
|
|
|
|
(symbol-value list-var)
|
|
|
|
:key key
|
|
|
|
:test test)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;; Some basic interactive functions.
|
|
|
|
|
|
|
|
(defun ert-read-test-name (prompt &optional default history
|
|
|
|
add-default-to-prompt)
|
|
|
|
"Read the name of a test and return it as a symbol.
|
|
|
|
|
|
|
|
Prompt with PROMPT. If DEFAULT is a valid test name, use it as a
|
|
|
|
default. HISTORY is the history to use; see `completing-read'.
|
|
|
|
If ADD-DEFAULT-TO-PROMPT is non-nil, PROMPT will be modified to
|
|
|
|
include the default, if any.
|
|
|
|
|
|
|
|
Signals an error if no test name was read."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-etypecase default
|
2011-01-12 16:08:24 +00:00
|
|
|
(string (let ((symbol (intern-soft default)))
|
|
|
|
(unless (and symbol (ert-test-boundp symbol))
|
|
|
|
(setq default nil))))
|
|
|
|
(symbol (setq default
|
|
|
|
(if (ert-test-boundp default)
|
|
|
|
(symbol-name default)
|
|
|
|
nil)))
|
|
|
|
(ert-test (setq default (ert-test-name default))))
|
|
|
|
(when add-default-to-prompt
|
|
|
|
(setq prompt (if (null default)
|
|
|
|
(format "%s: " prompt)
|
|
|
|
(format "%s (default %s): " prompt default))))
|
|
|
|
(let ((input (completing-read prompt obarray #'ert-test-boundp
|
|
|
|
t nil history default nil)))
|
|
|
|
;; completing-read returns an empty string if default was nil and
|
|
|
|
;; the user just hit enter.
|
|
|
|
(let ((sym (intern-soft input)))
|
|
|
|
(if (ert-test-boundp sym)
|
|
|
|
sym
|
2017-04-14 01:17:09 +00:00
|
|
|
(user-error "Input does not name a test")))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-read-test-name-at-point (prompt)
|
|
|
|
"Read the name of a test and return it as a symbol.
|
|
|
|
As a default, use the symbol at point, or the test at point if in
|
|
|
|
the ERT results buffer. Prompt with PROMPT, augmented with the
|
|
|
|
default (if any)."
|
|
|
|
(ert-read-test-name prompt (ert-test-at-point) nil t))
|
|
|
|
|
|
|
|
(defun ert-find-test-other-window (test-name)
|
|
|
|
"Find, in another window, the definition of TEST-NAME."
|
|
|
|
(interactive (list (ert-read-test-name-at-point "Find test definition: ")))
|
2017-10-15 15:38:21 +00:00
|
|
|
(find-function-do-it test-name 'ert--test 'switch-to-buffer-other-window))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-delete-test (test-name)
|
|
|
|
"Make the test TEST-NAME unbound.
|
|
|
|
|
|
|
|
Nothing more than an interactive interface to `ert-make-test-unbound'."
|
|
|
|
(interactive (list (ert-read-test-name-at-point "Delete test")))
|
|
|
|
(ert-make-test-unbound test-name))
|
|
|
|
|
|
|
|
(defun ert-delete-all-tests ()
|
|
|
|
"Make all symbols in `obarray' name no test."
|
|
|
|
(interactive)
|
2011-03-20 10:17:10 +00:00
|
|
|
(when (called-interactively-p 'any)
|
2011-01-12 16:08:24 +00:00
|
|
|
(unless (y-or-n-p "Delete all tests? ")
|
2017-04-14 01:17:09 +00:00
|
|
|
(user-error "Aborted")))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; We can't use `ert-select-tests' here since that gives us only
|
|
|
|
;; test objects, and going from them back to the test name symbols
|
|
|
|
;; can fail if the `ert-test' defstruct has been redefined.
|
|
|
|
(mapc #'ert-make-test-unbound (apropos-internal "" #'ert-test-boundp))
|
|
|
|
t)
|
|
|
|
|
|
|
|
|
|
|
|
;;; Display of test progress and results.
|
|
|
|
|
|
|
|
;; An entry in the results buffer ewoc. There is one entry per test.
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-defstruct ert--ewoc-entry
|
|
|
|
(test (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; If the result of this test was expected, its ewoc entry is hidden
|
|
|
|
;; initially.
|
2012-11-23 03:26:09 +00:00
|
|
|
(hidden-p (cl-assert nil))
|
2011-01-12 16:08:24 +00:00
|
|
|
;; An ewoc entry may be collapsed to hide details such as the error
|
|
|
|
;; condition.
|
|
|
|
;;
|
|
|
|
;; I'm not sure the ability to expand and collapse entries is still
|
|
|
|
;; a useful feature.
|
|
|
|
(expanded-p t)
|
|
|
|
;; By default, the ewoc entry presents the error condition with
|
|
|
|
;; certain limits on how much to print (`print-level',
|
|
|
|
;; `print-length'). The user can interactively switch to a set of
|
|
|
|
;; higher limits.
|
|
|
|
(extended-printer-limits-p nil))
|
|
|
|
|
|
|
|
;; Variables local to the results buffer.
|
|
|
|
|
|
|
|
;; The ewoc.
|
|
|
|
(defvar ert--results-ewoc)
|
|
|
|
;; The stats object.
|
|
|
|
(defvar ert--results-stats)
|
|
|
|
;; A string with one character per test. Each character represents
|
|
|
|
;; the result of the corresponding test. The string is displayed near
|
|
|
|
;; the top of the buffer and serves as a progress bar.
|
|
|
|
(defvar ert--results-progress-bar-string)
|
|
|
|
;; The position where the progress bar button begins.
|
|
|
|
(defvar ert--results-progress-bar-button-begin)
|
|
|
|
;; The test result listener that updates the buffer when tests are run.
|
|
|
|
(defvar ert--results-listener)
|
|
|
|
|
|
|
|
(defun ert-insert-test-name-button (test-name)
|
|
|
|
"Insert a button that links to TEST-NAME."
|
|
|
|
(insert-text-button (format "%S" test-name)
|
|
|
|
:type 'ert--test-name-button
|
|
|
|
'ert-test-name test-name))
|
|
|
|
|
|
|
|
(defun ert--results-format-expected-unexpected (expected unexpected)
|
|
|
|
"Return a string indicating EXPECTED expected results, UNEXPECTED unexpected."
|
|
|
|
(if (zerop unexpected)
|
|
|
|
(format "%s" expected)
|
|
|
|
(format "%s (%s unexpected)" (+ expected unexpected) unexpected)))
|
|
|
|
|
|
|
|
(defun ert--results-update-ewoc-hf (ewoc stats)
|
|
|
|
"Update the header and footer of EWOC to show certain information from STATS.
|
|
|
|
|
|
|
|
Also sets `ert--results-progress-bar-button-begin'."
|
|
|
|
(let ((run-count (ert-stats-completed stats))
|
|
|
|
(results-buffer (current-buffer))
|
|
|
|
;; Need to save buffer-local value.
|
|
|
|
(font-lock font-lock-mode))
|
|
|
|
(ewoc-set-hf
|
|
|
|
ewoc
|
|
|
|
;; header
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert "Selector: ")
|
|
|
|
(ert--insert-human-readable-selector (ert--stats-selector stats))
|
|
|
|
(insert "\n")
|
|
|
|
(insert
|
2013-10-24 07:34:41 +00:00
|
|
|
(format (concat "Passed: %s\n"
|
|
|
|
"Failed: %s\n"
|
|
|
|
"Skipped: %s\n"
|
|
|
|
"Total: %s/%s\n\n")
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--results-format-expected-unexpected
|
|
|
|
(ert--stats-passed-expected stats)
|
|
|
|
(ert--stats-passed-unexpected stats))
|
|
|
|
(ert--results-format-expected-unexpected
|
|
|
|
(ert--stats-failed-expected stats)
|
|
|
|
(ert--stats-failed-unexpected stats))
|
2013-10-24 07:34:41 +00:00
|
|
|
(ert-stats-skipped stats)
|
2011-01-12 16:08:24 +00:00
|
|
|
run-count
|
|
|
|
(ert-stats-total stats)))
|
|
|
|
(insert
|
|
|
|
(format "Started at: %s\n"
|
|
|
|
(ert--format-time-iso8601 (ert--stats-start-time stats))))
|
|
|
|
;; FIXME: This is ugly. Need to properly define invariants of
|
|
|
|
;; the `stats' data structure.
|
|
|
|
(let ((state (cond ((ert--stats-aborted-p stats) 'aborted)
|
|
|
|
((ert--stats-current-test stats) 'running)
|
|
|
|
((ert--stats-end-time stats) 'finished)
|
|
|
|
(t 'preparing))))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-ecase state
|
2011-01-12 16:08:24 +00:00
|
|
|
(preparing
|
|
|
|
(insert ""))
|
|
|
|
(aborted
|
|
|
|
(cond ((ert--stats-current-test stats)
|
|
|
|
(insert "Aborted during test: ")
|
|
|
|
(ert-insert-test-name-button
|
|
|
|
(ert-test-name (ert--stats-current-test stats))))
|
|
|
|
(t
|
|
|
|
(insert "Aborted."))))
|
|
|
|
(running
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (ert--stats-current-test stats))
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert "Running test: ")
|
|
|
|
(ert-insert-test-name-button (ert-test-name
|
|
|
|
(ert--stats-current-test stats))))
|
|
|
|
(finished
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (not (ert--stats-current-test stats)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert "Finished.")))
|
|
|
|
(insert "\n")
|
|
|
|
(if (ert--stats-end-time stats)
|
|
|
|
(insert
|
|
|
|
(format "%s%s\n"
|
|
|
|
(if (ert--stats-aborted-p stats)
|
|
|
|
"Aborted at: "
|
|
|
|
"Finished at: ")
|
|
|
|
(ert--format-time-iso8601 (ert--stats-end-time stats))))
|
|
|
|
(insert "\n"))
|
|
|
|
(insert "\n"))
|
|
|
|
(let ((progress-bar-string (with-current-buffer results-buffer
|
|
|
|
ert--results-progress-bar-string)))
|
|
|
|
(let ((progress-bar-button-begin
|
|
|
|
(insert-text-button progress-bar-string
|
|
|
|
:type 'ert--results-progress-bar-button
|
|
|
|
'face (or (and font-lock
|
|
|
|
(ert-face-for-stats stats))
|
|
|
|
'button))))
|
|
|
|
;; The header gets copied verbatim to the results buffer,
|
|
|
|
;; and all positions remain the same, so
|
|
|
|
;; `progress-bar-button-begin' will be the right position
|
|
|
|
;; even in the results buffer.
|
|
|
|
(with-current-buffer results-buffer
|
|
|
|
(set (make-local-variable 'ert--results-progress-bar-button-begin)
|
|
|
|
progress-bar-button-begin))))
|
|
|
|
(insert "\n\n")
|
|
|
|
(buffer-string))
|
|
|
|
;; footer
|
|
|
|
;;
|
|
|
|
;; We actually want an empty footer, but that would trigger a bug
|
|
|
|
;; in ewoc, sometimes clearing the entire buffer. (It's possible
|
|
|
|
;; that this bug has been fixed since this has been tested; we
|
|
|
|
;; should test it again.)
|
|
|
|
"\n")))
|
|
|
|
|
|
|
|
|
|
|
|
(defvar ert-test-run-redisplay-interval-secs .1
|
|
|
|
"How many seconds ERT should wait between redisplays while running tests.
|
|
|
|
|
|
|
|
While running tests, ERT shows the current progress, and this variable
|
|
|
|
determines how frequently the progress display is updated.")
|
|
|
|
|
|
|
|
(defun ert--results-update-stats-display (ewoc stats)
|
|
|
|
"Update EWOC and the mode line to show data from STATS."
|
|
|
|
;; TODO(ohler): investigate using `make-progress-reporter'.
|
|
|
|
(ert--results-update-ewoc-hf ewoc stats)
|
|
|
|
(force-mode-line-update)
|
|
|
|
(redisplay t)
|
|
|
|
(setf (ert--stats-next-redisplay stats)
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-23 02:32:31 +00:00
|
|
|
(float-time (time-add nil ert-test-run-redisplay-interval-secs))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--results-update-stats-display-maybe (ewoc stats)
|
|
|
|
"Call `ert--results-update-stats-display' if not called recently.
|
|
|
|
|
|
|
|
EWOC and STATS are arguments for `ert--results-update-stats-display'."
|
Avoid some double-rounding of Lisp timestamps
Also, simplify some time-related Lisp timestamp code
while we’re in the neighborhood.
* lisp/battery.el (battery-linux-proc-acpi)
(battery-linux-sysfs, battery-upower, battery-bsd-apm):
* lisp/calendar/timeclock.el (timeclock-seconds-to-string)
(timeclock-log, timeclock-last-period)
(timeclock-entry-length, timeclock-entry-list-span)
(timeclock-find-discrep, timeclock-generate-report):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-decay-1):
* lisp/emacs-lisp/ert.el (ert--results-update-stats-display)
(ert--results-update-stats-display-maybe):
* lisp/emacs-lisp/timer-list.el (list-timers):
* lisp/emacs-lisp/timer.el (timer-until)
(timer-event-handler):
* lisp/erc/erc-backend.el (erc-server-send-ping)
(erc-server-send-queue, erc-handle-parsed-server-response)
(erc-handle-unknown-server-response):
* lisp/erc/erc-track.el (erc-buffer-visible):
* lisp/erc/erc.el (erc-lurker-cleanup, erc-lurker-p)
(erc-cmd-PING, erc-send-current-line):
* lisp/eshell/em-pred.el (eshell-pred-file-time):
* lisp/eshell/em-unix.el (eshell-show-elapsed-time):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event:org-timestamp):
* lisp/gnus/gnus-int.el (gnus-backend-trace):
* lisp/gnus/gnus-sum.el (gnus-user-date):
* lisp/gnus/mail-source.el (mail-source-delete-crash-box):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/ibuf-ext.el (ibuffer-mark-old-buffers):
* lisp/gnus/nnmaildir.el (nnmaildir--scan):
* lisp/mouse.el (mouse--down-1-maybe-follows-link)
(mouse--click-1-maybe-follows-link):
* lisp/mpc.el (mpc--faster-toggle):
* lisp/net/rcirc.el (rcirc-handler-ctcp-KEEPALIVE)
(rcirc-sentinel):
* lisp/net/tramp-cache.el (tramp-get-file-property):
* lisp/net/tramp-sh.el (tramp-sh-handle-file-newer-than-file-p)
(tramp-maybe-open-connection):
* lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
* lisp/org/org-clock.el (org-clock-resolve):
(org-resolve-clocks, org-clock-in, org-clock-out, org-clock-sum):
* lisp/org/org-timer.el (org-timer-start)
(org-timer-pause-or-continue, org-timer-seconds):
* lisp/org/org.el (org-evaluate-time-range):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/pixel-scroll.el (pixel-scroll-in-rush-p):
* lisp/play/hanoi.el (hanoi-move-ring):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cpp.el (cpp-progress-message):
* lisp/progmodes/flymake.el (flymake--handle-report):
* lisp/progmodes/js.el (js--wait-for-matching-output):
* lisp/subr.el (progress-reporter-do-update):
* lisp/term/xterm.el (xterm--read-event-for-query):
* lisp/time.el (display-time-update, emacs-uptime):
* lisp/tooltip.el (tooltip-delay):
* lisp/url/url-cookie.el (url-cookie-parse-file-netscape):
* lisp/url/url-queue.el (url-queue-prune-old-entries):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/xt-mouse.el (xterm-mouse-event):
Avoid double-rounding of time-related values. Simplify.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
When hoping for the best (unlikely), use a better decoded time.
(icalendar--convert-sexp-to-ical): Avoid unnecessary encode-time.
* lisp/calendar/timeclock.el (timeclock-when-to-leave):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/desktop.el (desktop-create-buffer):
* lisp/emacs-lisp/benchmark.el (benchmark-elapse):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nnmail.el (nnmail-expired-article-p):
* lisp/gnus/nnmaildir.el (nnmaildir-request-expire-articles):
* lisp/nxml/rng-maint.el (rng-time-function):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-resolve-clocks-if-idle):
* lisp/org/org-habit.el (org-habit-insert-consistency-graphs):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
Use time-since instead of open-coding most of it.
* lisp/erc/erc-dcc.el (erc-dcc-get-sentinel):
* lisp/erc/erc.el (erc-string-to-emacs-time, erc-time-gt):
Now obsolete. All uses changed.
(erc-time-diff): Accept all Lisp time values.
All uses changed.
* lisp/gnus/gnus-demon.el (gnus-demon-idle-since):
* lisp/gnus/gnus-score.el (gnus-score-headers):
* lisp/gnus/nneething.el (nneething-make-head):
* lisp/gnus/nnheader.el (nnheader-message-maybe):
* lisp/gnus/nnimap.el (nnimap-keepalive):
* lisp/image.el (image-animate-timeout):
* lisp/mail/feedmail.el (feedmail-rfc822-date):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/net/rcirc.el (rcirc-handler-317, rcirc-handler-333):
* lisp/obsolete/xesam.el (xesam-refresh-entry):
* lisp/org/org-agenda.el (org-agenda-show-clocking-issues)
(org-agenda-check-clock-gap, org-agenda-to-appt):
* lisp/org/org-capture.el (org-capture-set-target-location):
* lisp/org/org-clock.el (org-clock-resolve-clock)
(org-clocktable-steps):
* lisp/org/org-colview.el (org-columns-edit-value)
(org-columns, org-agenda-columns):
* lisp/org/org-duration.el (org-duration-from-minutes):
* lisp/org/org-element.el (org-element-cache-sync-duration)
(org-element-cache-sync-break)
(org-element--cache-interrupt-p, org-element--cache-sync):
* lisp/org/org-habit.el (org-habit-get-faces)
* lisp/org/org-indent.el (org-indent-add-properties):
* lisp/org/org-table.el (org-table-sum):
* lisp/org/org-timer.el (org-timer-show-remaining-time)
(org-timer-set-timer):
* lisp/org/org.el (org-babel-load-file, org-today)
(org-auto-repeat-maybe, org-2ft, org-time-stamp)
(org-read-date-analyze, org-time-stamp-to-now)
(org-small-year-to-year, org-goto-calendar):
* lisp/org/ox.el (org-export-insert-default-template):
* lisp/ses.el (ses--time-check):
* lisp/type-break.el (type-break-time-warning)
(type-break-statistics, type-break-demo-boring):
* lisp/url/url-cache.el (url-cache-expired)
(url-cache-prune-cache):
* lisp/vc/vc-git.el (vc-git-stash-snapshot):
* lisp/erc/erc-match.el (erc-log-matches-come-back):
Simplify.
2019-02-23 02:32:31 +00:00
|
|
|
(unless (time-less-p nil (ert--stats-next-redisplay stats))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--results-update-stats-display ewoc stats)))
|
|
|
|
|
|
|
|
(defun ert--tests-running-mode-line-indicator ()
|
|
|
|
"Return a string for the mode line that shows the test run progress."
|
|
|
|
(let* ((stats ert--current-run-stats)
|
|
|
|
(tests-total (ert-stats-total stats))
|
|
|
|
(tests-completed (ert-stats-completed stats)))
|
|
|
|
(if (>= tests-completed tests-total)
|
|
|
|
(format " ERT(%s/%s,finished)" tests-completed tests-total)
|
|
|
|
(format " ERT(%s/%s):%s"
|
|
|
|
(1+ tests-completed)
|
|
|
|
tests-total
|
|
|
|
(if (null (ert--stats-current-test stats))
|
|
|
|
"?"
|
|
|
|
(format "%S"
|
|
|
|
(ert-test-name (ert--stats-current-test stats))))))))
|
|
|
|
|
|
|
|
(defun ert--make-xrefs-region (begin end)
|
|
|
|
"Attach cross-references to function names between BEGIN and END.
|
|
|
|
|
|
|
|
BEGIN and END specify a region in the current buffer."
|
|
|
|
(save-excursion
|
2017-02-11 22:19:41 +00:00
|
|
|
(goto-char begin)
|
|
|
|
(while (progn
|
|
|
|
(goto-char (+ (point) 2))
|
|
|
|
(skip-syntax-forward "^w_")
|
|
|
|
(< (point) end))
|
|
|
|
(let* ((beg (point))
|
|
|
|
(end (progn (skip-syntax-forward "w_") (point)))
|
|
|
|
(sym (intern-soft (buffer-substring-no-properties
|
|
|
|
beg end)))
|
|
|
|
(file (and sym (symbol-file sym 'defun))))
|
|
|
|
(when file
|
|
|
|
(goto-char beg)
|
|
|
|
;; help-xref-button needs to operate on something matched
|
|
|
|
;; by a regexp, so set that up for it.
|
|
|
|
(re-search-forward "\\(\\sw\\|\\s_\\)+")
|
|
|
|
(help-xref-button 0 'help-function-def sym file)))
|
|
|
|
(forward-line 1))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--string-first-line (s)
|
|
|
|
"Return the first line of S, or S if it contains no newlines.
|
|
|
|
|
|
|
|
The return value does not include the line terminator."
|
Stop reimplementing a bunch of cl- functions in ert
* lisp/emacs-lisp/ert.el: Require cl-lib at runtime too.
(ert--cl-do-remf, ert--remprop, ert--remove-if-not)
(ert--intersection, ert--set-difference, ert--set-difference-eq)
(ert--union, ert--gensym-counter, ert--gensym-counter)
(ert--coerce-to-vector, ert--remove*, ert--string-position)
(ert--mismatch, ert--subseq): Remove reimplementations of cl funcs.
(ert-make-test-unbound, ert--expand-should-1)
(ert--expand-should, ert--should-error-handle-error)
(should-error, ert--explain-equal-rec)
(ert--plist-difference-explanation, ert-select-tests)
(ert--make-stats, ert--remove-from-list, ert--string-first-line):
Use cl-lib functions rather than reimplementations.
* test/automated/ert-tests.el: Require cl-lib at runtime too.
(ert-test-special-operator-p): Use cl-gensym rather than ert-- version.
(ert-test-remprop, ert-test-remove-if-not, ert-test-remove*)
(ert-test-set-functions, ert-test-gensym)
(ert-test-coerce-to-vector, ert-test-string-position)
(ert-test-mismatch): Remove tests.
* test/automated/cl-lib.el: New, split from ert-tests.el.
2013-07-11 16:13:38 +00:00
|
|
|
(substring s 0 (cl-position ?\n s)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-face-for-test-result (expectedp)
|
|
|
|
"Return a face that shows whether a test result was expected or unexpected.
|
|
|
|
|
|
|
|
If EXPECTEDP is nil, returns the face for unexpected results; if
|
|
|
|
non-nil, returns the face for expected results.."
|
|
|
|
(if expectedp 'ert-test-result-expected 'ert-test-result-unexpected))
|
|
|
|
|
|
|
|
(defun ert-face-for-stats (stats)
|
|
|
|
"Return a face that represents STATS."
|
|
|
|
(cond ((ert--stats-aborted-p stats) 'nil)
|
2012-11-23 03:26:09 +00:00
|
|
|
((cl-plusp (ert-stats-completed-unexpected stats))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-face-for-test-result nil))
|
|
|
|
((eql (ert-stats-completed-expected stats) (ert-stats-total stats))
|
|
|
|
(ert-face-for-test-result t))
|
|
|
|
(t 'nil)))
|
|
|
|
|
|
|
|
(defun ert--print-test-for-ewoc (entry)
|
|
|
|
"The ewoc print function for ewoc test entries. ENTRY is the entry to print."
|
|
|
|
(let* ((test (ert--ewoc-entry-test entry))
|
|
|
|
(stats ert--results-stats)
|
|
|
|
(result (let ((pos (ert--stats-test-pos stats test)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert pos)
|
2011-01-12 16:08:24 +00:00
|
|
|
(aref (ert--stats-test-results stats) pos)))
|
|
|
|
(hiddenp (ert--ewoc-entry-hidden-p entry))
|
|
|
|
(expandedp (ert--ewoc-entry-expanded-p entry))
|
|
|
|
(extended-printer-limits-p (ert--ewoc-entry-extended-printer-limits-p
|
|
|
|
entry)))
|
|
|
|
(cond (hiddenp)
|
|
|
|
(t
|
|
|
|
(let ((expectedp (ert-test-result-expected-p test result)))
|
|
|
|
(insert-text-button (format "%c" (ert-char-for-test-result
|
|
|
|
result expectedp))
|
|
|
|
:type 'ert--results-expand-collapse-button
|
|
|
|
'face (or (and font-lock-mode
|
|
|
|
(ert-face-for-test-result
|
|
|
|
expectedp))
|
|
|
|
'button)))
|
|
|
|
(insert " ")
|
|
|
|
(ert-insert-test-name-button (ert-test-name test))
|
|
|
|
(insert "\n")
|
|
|
|
(when (and expandedp (not (eql result 'nil)))
|
|
|
|
(when (ert-test-documentation test)
|
|
|
|
(insert " "
|
|
|
|
(propertize
|
2015-06-02 14:31:06 +00:00
|
|
|
(ert--string-first-line
|
|
|
|
(substitute-command-keys
|
|
|
|
(ert-test-documentation test)))
|
2011-01-12 16:08:24 +00:00
|
|
|
'font-lock-face 'font-lock-doc-face)
|
|
|
|
"\n"))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-etypecase result
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-test-passed
|
|
|
|
(if (ert-test-result-expected-p test result)
|
|
|
|
(insert " passed\n")
|
|
|
|
(insert " passed unexpectedly\n"))
|
|
|
|
(insert ""))
|
|
|
|
(ert-test-result-with-condition
|
|
|
|
(ert--insert-infos result)
|
|
|
|
(let ((print-escape-newlines t)
|
|
|
|
(print-level (if extended-printer-limits-p 12 6))
|
|
|
|
(print-length (if extended-printer-limits-p 100 10)))
|
|
|
|
(insert " ")
|
|
|
|
(let ((begin (point)))
|
|
|
|
(ert--pp-with-indentation-and-newline
|
|
|
|
(ert-test-result-with-condition-condition result))
|
|
|
|
(ert--make-xrefs-region begin (point)))))
|
|
|
|
(ert-test-aborted-with-non-local-exit
|
2011-03-03 08:16:58 +00:00
|
|
|
(insert " aborted\n"))
|
|
|
|
(ert-test-quit
|
|
|
|
(insert " quit\n")))
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert "\n")))))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun ert--results-font-lock-function (enabledp)
|
|
|
|
"Redraw the ERT results buffer after font-lock-mode was switched on or off.
|
|
|
|
|
|
|
|
ENABLEDP is true if font-lock-mode is switched on, false
|
|
|
|
otherwise."
|
|
|
|
(ert--results-update-ewoc-hf ert--results-ewoc ert--results-stats)
|
|
|
|
(ewoc-refresh ert--results-ewoc)
|
|
|
|
(font-lock-default-function enabledp))
|
|
|
|
|
|
|
|
(defun ert--setup-results-buffer (stats listener buffer-name)
|
|
|
|
"Set up a test results buffer.
|
|
|
|
|
|
|
|
STATS is the stats object; LISTENER is the results listener;
|
|
|
|
BUFFER-NAME, if non-nil, is the buffer name to use."
|
|
|
|
(unless buffer-name (setq buffer-name "*ert*"))
|
|
|
|
(let ((buffer (get-buffer-create buffer-name)))
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(erase-buffer)
|
2011-02-18 04:20:36 +00:00
|
|
|
(ert-results-mode)
|
2011-01-12 16:08:24 +00:00
|
|
|
;; Erase buffer again in case switching out of the previous
|
|
|
|
;; mode inserted anything. (This happens e.g. when switching
|
|
|
|
;; from ert-results-mode to ert-results-mode when
|
|
|
|
;; font-lock-mode turns itself off in change-major-mode-hook.)
|
|
|
|
(erase-buffer)
|
|
|
|
(set (make-local-variable 'font-lock-function)
|
|
|
|
'ert--results-font-lock-function)
|
|
|
|
(let ((ewoc (ewoc-create 'ert--print-test-for-ewoc nil nil t)))
|
|
|
|
(set (make-local-variable 'ert--results-ewoc) ewoc)
|
|
|
|
(set (make-local-variable 'ert--results-stats) stats)
|
|
|
|
(set (make-local-variable 'ert--results-progress-bar-string)
|
|
|
|
(make-string (ert-stats-total stats)
|
|
|
|
(ert-char-for-test-result nil t)))
|
|
|
|
(set (make-local-variable 'ert--results-listener) listener)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for test across (ert--stats-tests stats) do
|
|
|
|
(ewoc-enter-last ewoc
|
|
|
|
(make-ert--ewoc-entry :test test
|
|
|
|
:hidden-p t)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--results-update-ewoc-hf ert--results-ewoc ert--results-stats)
|
2011-02-18 04:20:36 +00:00
|
|
|
(goto-char (1- (point-max)))
|
|
|
|
buffer)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defvar ert--selector-history nil
|
|
|
|
"List of recent test selectors read from terminal.")
|
|
|
|
|
|
|
|
;; Should OUTPUT-BUFFER-NAME and MESSAGE-FN really be arguments here?
|
|
|
|
;; They are needed only for our automated self-tests at the moment.
|
|
|
|
;; Or should there be some other mechanism?
|
|
|
|
;;;###autoload
|
|
|
|
(defun ert-run-tests-interactively (selector
|
|
|
|
&optional output-buffer-name message-fn)
|
|
|
|
"Run the tests specified by SELECTOR and display the results in a buffer.
|
|
|
|
|
|
|
|
SELECTOR works as described in `ert-select-tests'.
|
|
|
|
OUTPUT-BUFFER-NAME and MESSAGE-FN should normally be nil; they
|
|
|
|
are used for automated self-tests and specify which buffer to use
|
|
|
|
and how to display message."
|
|
|
|
(interactive
|
|
|
|
(list (let ((default (if ert--selector-history
|
|
|
|
;; Can't use `first' here as this form is
|
|
|
|
;; not compiled, and `first' is not
|
|
|
|
;; defined without cl.
|
|
|
|
(car ert--selector-history)
|
|
|
|
"t")))
|
2014-02-26 02:02:21 +00:00
|
|
|
(read
|
|
|
|
(completing-read (if (null default)
|
|
|
|
"Run tests: "
|
|
|
|
(format "Run tests (default %s): " default))
|
|
|
|
obarray #'ert-test-boundp nil nil
|
|
|
|
'ert--selector-history default nil)))
|
2011-01-12 16:08:24 +00:00
|
|
|
nil))
|
|
|
|
(unless message-fn (setq message-fn 'message))
|
2012-11-23 03:26:09 +00:00
|
|
|
(let ((output-buffer-name output-buffer-name)
|
|
|
|
buffer
|
|
|
|
listener
|
|
|
|
(message-fn message-fn))
|
2011-01-12 16:08:24 +00:00
|
|
|
(setq listener
|
|
|
|
(lambda (event-type &rest event-args)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-ecase event-type
|
2011-01-12 16:08:24 +00:00
|
|
|
(run-started
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(setq buffer (ert--setup-results-buffer stats
|
|
|
|
listener
|
|
|
|
output-buffer-name))
|
|
|
|
(pop-to-buffer buffer)))
|
|
|
|
(run-ended
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats abortedp) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(funcall message-fn
|
2013-10-24 07:34:41 +00:00
|
|
|
"%sRan %s tests, %s results were as expected%s%s"
|
2011-01-12 16:08:24 +00:00
|
|
|
(if (not abortedp)
|
|
|
|
""
|
|
|
|
"Aborted: ")
|
|
|
|
(ert-stats-total stats)
|
|
|
|
(ert-stats-completed-expected stats)
|
|
|
|
(let ((unexpected
|
|
|
|
(ert-stats-completed-unexpected stats)))
|
|
|
|
(if (zerop unexpected)
|
|
|
|
""
|
2013-10-24 07:34:41 +00:00
|
|
|
(format ", %s unexpected" unexpected)))
|
|
|
|
(let ((skipped
|
|
|
|
(ert-stats-skipped stats)))
|
|
|
|
(if (zerop skipped)
|
|
|
|
""
|
|
|
|
(format ", %s skipped" skipped))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--results-update-stats-display (with-current-buffer buffer
|
|
|
|
ert--results-ewoc)
|
|
|
|
stats)))
|
|
|
|
(test-started
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats test) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(with-current-buffer buffer
|
|
|
|
(let* ((ewoc ert--results-ewoc)
|
|
|
|
(pos (ert--stats-test-pos stats test))
|
|
|
|
(node (ewoc-nth ewoc pos)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert node)
|
2011-01-12 16:08:24 +00:00
|
|
|
(setf (ert--ewoc-entry-test (ewoc-data node)) test)
|
|
|
|
(aset ert--results-progress-bar-string pos
|
|
|
|
(ert-char-for-test-result nil t))
|
|
|
|
(ert--results-update-stats-display-maybe ewoc stats)
|
|
|
|
(ewoc-invalidate ewoc node)))))
|
|
|
|
(test-ended
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (stats test result) event-args
|
2011-01-12 16:08:24 +00:00
|
|
|
(with-current-buffer buffer
|
|
|
|
(let* ((ewoc ert--results-ewoc)
|
|
|
|
(pos (ert--stats-test-pos stats test))
|
|
|
|
(node (ewoc-nth ewoc pos)))
|
|
|
|
(when (ert--ewoc-entry-hidden-p (ewoc-data node))
|
|
|
|
(setf (ert--ewoc-entry-hidden-p (ewoc-data node))
|
|
|
|
(ert-test-result-expected-p test result)))
|
|
|
|
(aset ert--results-progress-bar-string pos
|
|
|
|
(ert-char-for-test-result result
|
|
|
|
(ert-test-result-expected-p
|
|
|
|
test result)))
|
|
|
|
(ert--results-update-stats-display-maybe ewoc stats)
|
|
|
|
(ewoc-invalidate ewoc node))))))))
|
2014-03-02 15:35:33 +00:00
|
|
|
(ert-run-tests selector listener t)))
|
|
|
|
|
2011-01-12 16:08:24 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defalias 'ert 'ert-run-tests-interactively)
|
|
|
|
|
|
|
|
|
|
|
|
;;; Simple view mode for auxiliary information like stack traces or
|
|
|
|
;;; messages. Mainly binds "q" for quit.
|
|
|
|
|
2011-02-01 21:22:21 +00:00
|
|
|
(define-derived-mode ert-simple-view-mode special-mode "ERT-View"
|
2011-01-12 16:08:24 +00:00
|
|
|
"Major mode for viewing auxiliary information in ERT.")
|
|
|
|
|
|
|
|
;;; Commands and button actions for the results buffer.
|
|
|
|
|
2011-02-01 21:22:21 +00:00
|
|
|
(define-derived-mode ert-results-mode special-mode "ERT-Results"
|
2019-07-11 13:22:23 +00:00
|
|
|
"Major mode for viewing results of ERT test runs."
|
|
|
|
(setq-local revert-buffer-function
|
|
|
|
(lambda (&rest _) (ert-results-rerun-all-tests))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for (key binding) in
|
|
|
|
'( ;; Stuff that's not in the menu.
|
|
|
|
("\t" forward-button)
|
|
|
|
([backtab] backward-button)
|
|
|
|
("j" ert-results-jump-between-summary-and-result)
|
|
|
|
("L" ert-results-toggle-printer-limits-for-test-at-point)
|
|
|
|
("n" ert-results-next-test)
|
|
|
|
("p" ert-results-previous-test)
|
|
|
|
;; Stuff that is in the menu.
|
|
|
|
("R" ert-results-rerun-all-tests)
|
|
|
|
("r" ert-results-rerun-test-at-point)
|
|
|
|
("d" ert-results-rerun-test-at-point-debugging-errors)
|
|
|
|
("." ert-results-find-test-at-point-other-window)
|
|
|
|
("b" ert-results-pop-to-backtrace-for-test-at-point)
|
|
|
|
("m" ert-results-pop-to-messages-for-test-at-point)
|
|
|
|
("l" ert-results-pop-to-should-forms-for-test-at-point)
|
|
|
|
("h" ert-results-describe-test-at-point)
|
|
|
|
("D" ert-delete-test)
|
|
|
|
("T" ert-results-pop-to-timings)
|
|
|
|
)
|
|
|
|
do
|
|
|
|
(define-key ert-results-mode-map key binding))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(easy-menu-define ert-results-mode-menu ert-results-mode-map
|
|
|
|
"Menu for `ert-results-mode'."
|
|
|
|
'("ERT Results"
|
|
|
|
["Re-run all tests" ert-results-rerun-all-tests]
|
|
|
|
"--"
|
2017-03-02 20:40:15 +00:00
|
|
|
;; FIXME? Why are there (at least) 3 different ways to decide if
|
|
|
|
;; there is a test at point?
|
|
|
|
["Re-run test" ert-results-rerun-test-at-point
|
|
|
|
:active (car (ert--results-test-at-point-allow-redefinition))]
|
|
|
|
["Debug test" ert-results-rerun-test-at-point-debugging-errors
|
|
|
|
:active (car (ert--results-test-at-point-allow-redefinition))]
|
|
|
|
["Show test definition" ert-results-find-test-at-point-other-window
|
|
|
|
:active (ert-test-at-point)]
|
2011-01-12 16:08:24 +00:00
|
|
|
"--"
|
2017-03-02 20:40:15 +00:00
|
|
|
["Show backtrace" ert-results-pop-to-backtrace-for-test-at-point
|
|
|
|
:active (ert--results-test-at-point-no-redefinition)]
|
|
|
|
["Show messages" ert-results-pop-to-messages-for-test-at-point
|
|
|
|
:active (ert--results-test-at-point-no-redefinition)]
|
|
|
|
["Show `should' forms" ert-results-pop-to-should-forms-for-test-at-point
|
|
|
|
:active (ert--results-test-at-point-no-redefinition)]
|
|
|
|
["Describe test" ert-results-describe-test-at-point
|
|
|
|
:active (ert--results-test-at-point-no-redefinition)]
|
2011-01-12 16:08:24 +00:00
|
|
|
"--"
|
|
|
|
["Delete test" ert-delete-test]
|
|
|
|
"--"
|
|
|
|
["Show execution time of each test" ert-results-pop-to-timings]
|
|
|
|
))
|
|
|
|
|
|
|
|
(define-button-type 'ert--results-progress-bar-button
|
|
|
|
'action #'ert--results-progress-bar-button-action
|
|
|
|
'help-echo "mouse-2, RET: Reveal test result")
|
|
|
|
|
|
|
|
(define-button-type 'ert--test-name-button
|
|
|
|
'action #'ert--test-name-button-action
|
|
|
|
'help-echo "mouse-2, RET: Find test definition")
|
|
|
|
|
|
|
|
(define-button-type 'ert--results-expand-collapse-button
|
|
|
|
'action #'ert--results-expand-collapse-button-action
|
|
|
|
'help-echo "mouse-2, RET: Expand/collapse test result")
|
|
|
|
|
|
|
|
(defun ert--results-test-node-or-null-at-point ()
|
|
|
|
"If point is on a valid ewoc node, return it; return nil otherwise.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(let* ((ewoc ert--results-ewoc)
|
|
|
|
(node (ewoc-locate ewoc)))
|
|
|
|
;; `ewoc-locate' will return an arbitrary node when point is on
|
|
|
|
;; header or footer, or when all nodes are invisible. So we need
|
|
|
|
;; to validate its return value here.
|
|
|
|
;;
|
|
|
|
;; Update: I'm seeing nil being returned in some cases now,
|
|
|
|
;; perhaps this has been changed?
|
|
|
|
(if (and node
|
|
|
|
(>= (point) (ewoc-location node))
|
|
|
|
(not (ert--ewoc-entry-hidden-p (ewoc-data node))))
|
|
|
|
node
|
|
|
|
nil)))
|
|
|
|
|
|
|
|
(defun ert--results-test-node-at-point ()
|
|
|
|
"If point is on a valid ewoc node, return it; signal an error otherwise.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(or (ert--results-test-node-or-null-at-point)
|
2017-04-14 01:17:09 +00:00
|
|
|
(user-error "No test at point")))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-next-test ()
|
|
|
|
"Move point to the next test.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(ert--results-move (ewoc-locate ert--results-ewoc) 'ewoc-next
|
|
|
|
"No tests below"))
|
|
|
|
|
|
|
|
(defun ert-results-previous-test ()
|
|
|
|
"Move point to the previous test.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(ert--results-move (ewoc-locate ert--results-ewoc) 'ewoc-prev
|
|
|
|
"No tests above"))
|
|
|
|
|
|
|
|
(defun ert--results-move (node ewoc-fn error-message)
|
|
|
|
"Move point from NODE to the previous or next node.
|
|
|
|
|
|
|
|
EWOC-FN specifies the direction and should be either `ewoc-prev'
|
2016-01-25 08:54:34 +00:00
|
|
|
or `ewoc-next'. If there are no more nodes in that direction, a
|
|
|
|
user-error is signaled with the message ERROR-MESSAGE."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop
|
2011-01-12 16:08:24 +00:00
|
|
|
(setq node (funcall ewoc-fn ert--results-ewoc node))
|
|
|
|
(when (null node)
|
2016-01-25 08:54:34 +00:00
|
|
|
(user-error "%s" error-message))
|
2011-01-12 16:08:24 +00:00
|
|
|
(unless (ert--ewoc-entry-hidden-p (ewoc-data node))
|
|
|
|
(goto-char (ewoc-location node))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-return))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(defun ert--results-expand-collapse-button-action (_button)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Expand or collapse the test node BUTTON belongs to."
|
|
|
|
(let* ((ewoc ert--results-ewoc)
|
|
|
|
(node (save-excursion
|
|
|
|
(goto-char (ert--button-action-position))
|
|
|
|
(ert--results-test-node-at-point)))
|
|
|
|
(entry (ewoc-data node)))
|
|
|
|
(setf (ert--ewoc-entry-expanded-p entry)
|
|
|
|
(not (ert--ewoc-entry-expanded-p entry)))
|
|
|
|
(ewoc-invalidate ewoc node)))
|
|
|
|
|
|
|
|
(defun ert-results-find-test-at-point-other-window ()
|
|
|
|
"Find the definition of the test at point in another window.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(let ((name (ert-test-at-point)))
|
|
|
|
(unless name
|
2017-04-14 01:17:09 +00:00
|
|
|
(user-error "No test at point"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-find-test-other-window name)))
|
|
|
|
|
|
|
|
(defun ert--test-name-button-action (button)
|
|
|
|
"Find the definition of the test BUTTON belongs to, in another window."
|
|
|
|
(let ((name (button-get button 'ert-test-name)))
|
|
|
|
(ert-find-test-other-window name)))
|
|
|
|
|
|
|
|
(defun ert--ewoc-position (ewoc node)
|
|
|
|
;; checkdoc-order: nil
|
|
|
|
"Return the position of NODE in EWOC, or nil if NODE is not in EWOC."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for i from 0
|
|
|
|
for node-here = (ewoc-nth ewoc 0) then (ewoc-next ewoc node-here)
|
|
|
|
do (when (eql node node-here)
|
|
|
|
(cl-return i))
|
|
|
|
finally (cl-return nil)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-jump-between-summary-and-result ()
|
|
|
|
"Jump back and forth between the test run summary and individual test results.
|
|
|
|
|
|
|
|
From an ewoc node, jumps to the character that represents the
|
|
|
|
same test in the progress bar, and vice versa.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
;; Maybe this command isn't actually needed much, but if it is, it
|
|
|
|
;; seems like an indication that the UI design is not optimal. If
|
|
|
|
;; jumping back and forth between a summary at the top of the buffer
|
|
|
|
;; and the error log in the remainder of the buffer is useful, then
|
|
|
|
;; the summary apparently needs to be easily accessible from the
|
|
|
|
;; error log, and perhaps it would be better to have it in a
|
|
|
|
;; separate buffer to keep it visible.
|
|
|
|
(interactive)
|
|
|
|
(let ((ewoc ert--results-ewoc)
|
|
|
|
(progress-bar-begin ert--results-progress-bar-button-begin))
|
|
|
|
(cond ((ert--results-test-node-or-null-at-point)
|
|
|
|
(let* ((node (ert--results-test-node-at-point))
|
|
|
|
(pos (ert--ewoc-position ewoc node)))
|
|
|
|
(goto-char (+ progress-bar-begin pos))))
|
|
|
|
((and (<= progress-bar-begin (point))
|
|
|
|
(< (point) (button-end (button-at progress-bar-begin))))
|
|
|
|
(let* ((node (ewoc-nth ewoc (- (point) progress-bar-begin)))
|
|
|
|
(entry (ewoc-data node)))
|
|
|
|
(when (ert--ewoc-entry-hidden-p entry)
|
|
|
|
(setf (ert--ewoc-entry-hidden-p entry) nil)
|
|
|
|
(ewoc-invalidate ewoc node))
|
|
|
|
(ewoc-goto-node ewoc node)))
|
|
|
|
(t
|
|
|
|
(goto-char progress-bar-begin)))))
|
|
|
|
|
|
|
|
(defun ert-test-at-point ()
|
|
|
|
"Return the name of the test at point as a symbol, or nil if none."
|
|
|
|
(or (and (eql major-mode 'ert-results-mode)
|
|
|
|
(let ((test (ert--results-test-at-point-no-redefinition)))
|
|
|
|
(and test (ert-test-name test))))
|
|
|
|
(let* ((thing (thing-at-point 'symbol))
|
|
|
|
(sym (intern-soft thing)))
|
|
|
|
(and (ert-test-boundp sym)
|
|
|
|
sym))))
|
|
|
|
|
2017-03-02 20:40:15 +00:00
|
|
|
(defun ert--results-test-at-point-no-redefinition (&optional error)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Return the test at point, or nil.
|
2017-03-02 20:40:15 +00:00
|
|
|
If optional argument ERROR is non-nil, signal an error rather than return nil.
|
2011-01-12 16:08:24 +00:00
|
|
|
To be used in the ERT results buffer."
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (eql major-mode 'ert-results-mode))
|
2017-03-02 20:40:15 +00:00
|
|
|
(or
|
|
|
|
(if (ert--results-test-node-or-null-at-point)
|
|
|
|
(let* ((node (ert--results-test-node-at-point))
|
|
|
|
(test (ert--ewoc-entry-test (ewoc-data node))))
|
|
|
|
test)
|
|
|
|
(let ((progress-bar-begin ert--results-progress-bar-button-begin))
|
|
|
|
(when (and (<= progress-bar-begin (point))
|
|
|
|
(< (point) (button-end (button-at progress-bar-begin))))
|
|
|
|
(let* ((test-index (- (point) progress-bar-begin))
|
|
|
|
(test (aref (ert--stats-tests ert--results-stats)
|
2011-01-12 16:08:24 +00:00
|
|
|
test-index)))
|
2017-03-02 20:40:15 +00:00
|
|
|
test))))
|
|
|
|
(if error (user-error "No test at point"))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--results-test-at-point-allow-redefinition ()
|
|
|
|
"Look up the test at point, and check whether it has been redefined.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer.
|
|
|
|
|
|
|
|
Returns a list of two elements: the test (or nil) and a symbol
|
|
|
|
specifying whether the test has been redefined.
|
|
|
|
|
|
|
|
If a new test has been defined with the same name as the test at
|
|
|
|
point, replaces the test at point with the new test, and returns
|
|
|
|
the new test and the symbol `redefined'.
|
|
|
|
|
|
|
|
If the test has been deleted, returns the old test and the symbol
|
|
|
|
`deleted'.
|
|
|
|
|
|
|
|
If the test is still current, returns the test and the symbol nil.
|
|
|
|
|
|
|
|
If there is no test at point, returns a list with two nils."
|
|
|
|
(let ((test (ert--results-test-at-point-no-redefinition)))
|
|
|
|
(cond ((null test)
|
|
|
|
`(nil nil))
|
|
|
|
((null (ert-test-name test))
|
|
|
|
`(,test nil))
|
|
|
|
(t
|
|
|
|
(let* ((name (ert-test-name test))
|
|
|
|
(new-test (and (ert-test-boundp name)
|
|
|
|
(ert-get-test name))))
|
|
|
|
(cond ((eql test new-test)
|
|
|
|
`(,test nil))
|
|
|
|
((null new-test)
|
|
|
|
`(,test deleted))
|
|
|
|
(t
|
|
|
|
(ert--results-update-after-test-redefinition
|
|
|
|
(ert--stats-test-pos ert--results-stats test)
|
|
|
|
new-test)
|
|
|
|
`(,new-test redefined))))))))
|
|
|
|
|
|
|
|
(defun ert--results-update-after-test-redefinition (pos new-test)
|
|
|
|
"Update results buffer after the test at pos POS has been redefined.
|
|
|
|
|
|
|
|
Also updates the stats object. NEW-TEST is the new test
|
|
|
|
definition."
|
|
|
|
(let* ((stats ert--results-stats)
|
|
|
|
(ewoc ert--results-ewoc)
|
|
|
|
(node (ewoc-nth ewoc pos))
|
|
|
|
(entry (ewoc-data node)))
|
|
|
|
(ert--stats-set-test-and-result stats pos new-test nil)
|
|
|
|
(setf (ert--ewoc-entry-test entry) new-test
|
|
|
|
(aref ert--results-progress-bar-string pos) (ert-char-for-test-result
|
|
|
|
nil t))
|
|
|
|
(ewoc-invalidate ewoc node))
|
|
|
|
nil)
|
|
|
|
|
|
|
|
(defun ert--button-action-position ()
|
|
|
|
"The buffer position where the last button action was triggered."
|
|
|
|
(cond ((integerp last-command-event)
|
|
|
|
(point))
|
|
|
|
((eventp last-command-event)
|
|
|
|
(posn-point (event-start last-command-event)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(t (cl-assert nil))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
2012-11-23 03:26:09 +00:00
|
|
|
(defun ert--results-progress-bar-button-action (_button)
|
2011-01-12 16:08:24 +00:00
|
|
|
"Jump to details for the test represented by the character clicked in BUTTON."
|
|
|
|
(goto-char (ert--button-action-position))
|
|
|
|
(ert-results-jump-between-summary-and-result))
|
|
|
|
|
|
|
|
(defun ert-results-rerun-all-tests ()
|
|
|
|
"Re-run all tests, using the same selector.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-assert (eql major-mode 'ert-results-mode))
|
2011-01-12 16:08:24 +00:00
|
|
|
(let ((selector (ert--stats-selector ert--results-stats)))
|
|
|
|
(ert-run-tests-interactively selector (buffer-name))))
|
|
|
|
|
|
|
|
(defun ert-results-rerun-test-at-point ()
|
|
|
|
"Re-run the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-destructuring-bind (test redefinition-state)
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert--results-test-at-point-allow-redefinition)
|
|
|
|
(when (null test)
|
2017-04-14 01:17:09 +00:00
|
|
|
(user-error "No test at point"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(let* ((stats ert--results-stats)
|
|
|
|
(progress-message (format "Running %stest %S"
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-ecase redefinition-state
|
2011-01-12 16:08:24 +00:00
|
|
|
((nil) "")
|
|
|
|
(redefined "new definition of ")
|
|
|
|
(deleted "deleted "))
|
|
|
|
(ert-test-name test))))
|
|
|
|
;; Need to save and restore point manually here: When point is on
|
|
|
|
;; the first visible ewoc entry while the header is updated, point
|
|
|
|
;; moves to the top of the buffer. This is undesirable, and a
|
|
|
|
;; simple `save-excursion' doesn't prevent it.
|
|
|
|
(let ((point (point)))
|
|
|
|
(unwind-protect
|
|
|
|
(unwind-protect
|
|
|
|
(progn
|
|
|
|
(message "%s..." progress-message)
|
|
|
|
(ert-run-or-rerun-test stats test
|
|
|
|
ert--results-listener))
|
|
|
|
(ert--results-update-stats-display ert--results-ewoc stats)
|
|
|
|
(message "%s...%s"
|
|
|
|
progress-message
|
|
|
|
(let ((result (ert-test-most-recent-result test)))
|
|
|
|
(ert-string-for-test-result
|
|
|
|
result (ert-test-result-expected-p test result)))))
|
|
|
|
(goto-char point))))))
|
|
|
|
|
|
|
|
(defun ert-results-rerun-test-at-point-debugging-errors ()
|
|
|
|
"Re-run the test at point with `ert-debug-on-error' bound to t.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(let ((ert-debug-on-error t))
|
|
|
|
(ert-results-rerun-test-at-point)))
|
|
|
|
|
|
|
|
(defun ert-results-pop-to-backtrace-for-test-at-point ()
|
|
|
|
"Display the backtrace for the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2017-03-02 20:40:15 +00:00
|
|
|
(let* ((test (ert--results-test-at-point-no-redefinition t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(stats ert--results-stats)
|
|
|
|
(pos (ert--stats-test-pos stats test))
|
|
|
|
(result (aref (ert--stats-test-results stats) pos)))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-etypecase result
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-test-passed (error "Test passed, no backtrace available"))
|
|
|
|
(ert-test-result-with-condition
|
2018-06-19 14:27:41 +00:00
|
|
|
(let ((buffer (get-buffer-create "*ERT Backtrace*")))
|
2011-01-12 16:08:24 +00:00
|
|
|
(pop-to-buffer buffer)
|
2018-06-19 14:27:41 +00:00
|
|
|
(unless (derived-mode-p 'backtrace-mode)
|
|
|
|
(backtrace-mode))
|
|
|
|
(setq backtrace-insert-header-function
|
|
|
|
(lambda () (ert--insert-backtrace-header (ert-test-name test)))
|
2018-06-24 14:17:47 +00:00
|
|
|
backtrace-frames (ert-test-result-with-condition-backtrace result))
|
2018-06-19 14:27:41 +00:00
|
|
|
(backtrace-print)
|
|
|
|
(goto-char (point-min)))))))
|
|
|
|
|
|
|
|
(defun ert--insert-backtrace-header (name)
|
|
|
|
(insert (substitute-command-keys "Backtrace for test `"))
|
|
|
|
(ert-insert-test-name-button name)
|
|
|
|
(insert (substitute-command-keys "':\n")))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-pop-to-messages-for-test-at-point ()
|
|
|
|
"Display the part of the *Messages* buffer generated during the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2017-03-02 20:40:15 +00:00
|
|
|
(let* ((test (ert--results-test-at-point-no-redefinition t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(stats ert--results-stats)
|
|
|
|
(pos (ert--stats-test-pos stats test))
|
|
|
|
(result (aref (ert--stats-test-results stats) pos)))
|
|
|
|
(let ((buffer (get-buffer-create "*ERT Messages*")))
|
|
|
|
(pop-to-buffer buffer)
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(erase-buffer)
|
2011-02-18 04:20:36 +00:00
|
|
|
(ert-simple-view-mode)
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert (ert-test-result-messages result))
|
|
|
|
(goto-char (point-min))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(insert (substitute-command-keys "Messages for test `"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-insert-test-name-button (ert-test-name test))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(insert (substitute-command-keys "':\n"))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-pop-to-should-forms-for-test-at-point ()
|
|
|
|
"Display the list of `should' forms executed during the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2017-03-02 20:40:15 +00:00
|
|
|
(let* ((test (ert--results-test-at-point-no-redefinition t))
|
2011-01-12 16:08:24 +00:00
|
|
|
(stats ert--results-stats)
|
|
|
|
(pos (ert--stats-test-pos stats test))
|
|
|
|
(result (aref (ert--stats-test-results stats) pos)))
|
|
|
|
(let ((buffer (get-buffer-create "*ERT list of should forms*")))
|
|
|
|
(pop-to-buffer buffer)
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(erase-buffer)
|
2011-02-18 04:20:36 +00:00
|
|
|
(ert-simple-view-mode)
|
2011-01-12 16:08:24 +00:00
|
|
|
(if (null (ert-test-result-should-forms result))
|
|
|
|
(insert "\n(No should forms during this test.)\n")
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for form-description
|
|
|
|
in (ert-test-result-should-forms result)
|
|
|
|
for i from 1 do
|
|
|
|
(insert "\n")
|
|
|
|
(insert (format "%s: " i))
|
|
|
|
(let ((begin (point)))
|
|
|
|
(ert--pp-with-indentation-and-newline form-description)
|
|
|
|
(ert--make-xrefs-region begin (point)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(goto-char (point-min))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(insert (substitute-command-keys
|
|
|
|
"`should' forms executed during test `"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(ert-insert-test-name-button (ert-test-name test))
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(insert (substitute-command-keys "':\n"))
|
2011-01-12 16:08:24 +00:00
|
|
|
(insert "\n")
|
|
|
|
(insert (concat "(Values are shallow copies and may have "
|
|
|
|
"looked different during the test if they\n"
|
|
|
|
"have been modified destructively.)\n"))
|
2011-02-18 04:20:36 +00:00
|
|
|
(forward-line 1)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-toggle-printer-limits-for-test-at-point ()
|
|
|
|
"Toggle how much of the condition to print for the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(let* ((ewoc ert--results-ewoc)
|
|
|
|
(node (ert--results-test-node-at-point))
|
|
|
|
(entry (ewoc-data node)))
|
|
|
|
(setf (ert--ewoc-entry-extended-printer-limits-p entry)
|
|
|
|
(not (ert--ewoc-entry-extended-printer-limits-p entry)))
|
|
|
|
(ewoc-invalidate ewoc node)))
|
|
|
|
|
|
|
|
(defun ert-results-pop-to-timings ()
|
|
|
|
"Display test timings for the last run.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
|
|
|
(let* ((stats ert--results-stats)
|
|
|
|
(buffer (get-buffer-create "*ERT timings*"))
|
2012-11-23 03:26:09 +00:00
|
|
|
(data (cl-loop for test across (ert--stats-tests stats)
|
|
|
|
for start-time across (ert--stats-test-start-times
|
|
|
|
stats)
|
|
|
|
for end-time across (ert--stats-test-end-times stats)
|
|
|
|
collect (list test
|
Simplify now that float-time etc. are built-in
This was prompted by warnings about calls to now-obsolete functions.
* lisp/calendar/time-date.el (encode-time-value):
Use setq rather than a recursive call, to avoid a warning
about calling this obsolete function.
* lisp/calendar/time-date.el (encode-time-value)
(with-decoded-time-value, time-to-seconds, time-to-number-of-days):
* lisp/erc/erc.el (erc-emacs-time-to-erc-time):
* lisp/net/rcirc.el (rcirc-float-time):
* lisp/org/org-compat.el (org-float-time):
Simplify now that time-add and float-time are now built-in.
* lisp/calendar/time-date.el (time-add, time-subtract, time-less-p):
* lisp/net/newst-backend.el (time-add):
* lisp/org/org.el (time-subtract):
Remove backward-compatibility definitions; they are now built-in.
* lisp/calendar/timeclock.el (timeclock-time-to-seconds)
(timeclock-seconds-to-time):
* lisp/net/rcirc.el (rcirc-float-time):
* lisp/org/org-compat.el (org-float-time):
Now obsolete, since callers can just use float-time and
seconds-to-time. All uses changed.
* lisp/emacs-lisp/ert.el (ert-results-pop-to-timings):
* lisp/gnus/gnus-art.el (article-lapsed-string):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/gnus-group.el (gnus-group-timestamp-delta):
* lisp/gnus/nndiary.el (nndiary-compute-reminders):
* lisp/net/tramp.el (tramp-time-diff):
* lisp/org/org-clock.el (org-clock-timestamps-change):
Prefer the time-subtract builtin to the subtract-time alias.
* lisp/files.el (dir-locals-find-file, dir-locals-read-from-dir):
* test/lisp/character-fold-tests.el (character-fold--speed-test):
Prefer the float-time builtin to the time-to-seconds alias.
* lisp/org/org-agenda.el, lisp/org/org-clock.el, lisp/org/org-list.el:
* lisp/org/org-timer.el, lisp/org/org.el:
Adjust to org-float-time deprecation.
2016-05-08 19:46:00 +00:00
|
|
|
(float-time (time-subtract
|
2012-11-23 03:26:09 +00:00
|
|
|
end-time start-time))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(setq data (sort data (lambda (a b)
|
2012-11-23 03:26:09 +00:00
|
|
|
(> (cl-second a) (cl-second b)))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(pop-to-buffer buffer)
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(erase-buffer)
|
2011-02-18 04:20:36 +00:00
|
|
|
(ert-simple-view-mode)
|
2011-01-12 16:08:24 +00:00
|
|
|
(if (null data)
|
|
|
|
(insert "(No data)\n")
|
|
|
|
(insert (format "%-3s %8s %8s\n" "" "time" "cumul"))
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-loop for (test time) in data
|
|
|
|
for cumul-time = time then (+ cumul-time time)
|
|
|
|
for i from 1 do
|
|
|
|
(progn
|
|
|
|
(insert (format "%3s: %8.3f %8.3f " i time cumul-time))
|
|
|
|
(ert-insert-test-name-button (ert-test-name test))
|
|
|
|
(insert "\n"))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(insert "Tests by run time (seconds):\n\n")
|
2011-02-18 04:20:36 +00:00
|
|
|
(forward-line 1))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun ert-describe-test (test-or-test-name)
|
|
|
|
"Display the documentation for TEST-OR-TEST-NAME (a symbol or ert-test)."
|
|
|
|
(interactive (list (ert-read-test-name-at-point "Describe test")))
|
|
|
|
(let (test-name
|
|
|
|
test-definition)
|
2012-11-23 03:26:09 +00:00
|
|
|
(cl-etypecase test-or-test-name
|
2011-01-12 16:08:24 +00:00
|
|
|
(symbol (setq test-name test-or-test-name
|
|
|
|
test-definition (ert-get-test test-or-test-name)))
|
|
|
|
(ert-test (setq test-name (ert-test-name test-or-test-name)
|
|
|
|
test-definition test-or-test-name)))
|
|
|
|
(help-setup-xref (list #'ert-describe-test test-or-test-name)
|
|
|
|
(called-interactively-p 'interactive))
|
|
|
|
(save-excursion
|
|
|
|
(with-help-window (help-buffer)
|
|
|
|
(with-current-buffer (help-buffer)
|
|
|
|
(insert (if test-name (format "%S" test-name) "<anonymous test>"))
|
|
|
|
(insert " is a test")
|
|
|
|
(let ((file-name (and test-name
|
2017-07-28 16:02:01 +00:00
|
|
|
(symbol-file test-name 'ert--test))))
|
2011-01-12 16:08:24 +00:00
|
|
|
(when file-name
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(insert (format-message " defined in `%s'"
|
|
|
|
(file-name-nondirectory file-name)))
|
2011-01-12 16:08:24 +00:00
|
|
|
(save-excursion
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(re-search-backward (substitute-command-keys "`\\([^`']+\\)'")
|
|
|
|
nil t)
|
2011-01-12 16:08:24 +00:00
|
|
|
(help-xref-button 1 'help-function-def test-name file-name)))
|
|
|
|
(insert ".")
|
|
|
|
(fill-region-as-paragraph (point-min) (point))
|
|
|
|
(insert "\n\n")
|
|
|
|
(unless (and (ert-test-boundp test-name)
|
|
|
|
(eql (ert-get-test test-name) test-definition))
|
|
|
|
(let ((begin (point)))
|
|
|
|
(insert "Note: This test has been redefined or deleted, "
|
|
|
|
"this documentation refers to an old definition.")
|
|
|
|
(fill-region-as-paragraph begin (point)))
|
|
|
|
(insert "\n\n"))
|
2015-06-02 14:31:06 +00:00
|
|
|
(insert (substitute-command-keys
|
|
|
|
(or (ert-test-documentation test-definition)
|
|
|
|
"It is not documented."))
|
2018-01-23 03:00:55 +00:00
|
|
|
"\n")
|
|
|
|
;; For describe-symbol-backends.
|
|
|
|
(buffer-string)))))))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert-results-describe-test-at-point ()
|
|
|
|
"Display the documentation of the test at point.
|
|
|
|
|
|
|
|
To be used in the ERT results buffer."
|
|
|
|
(interactive)
|
2017-03-02 20:40:15 +00:00
|
|
|
(ert-describe-test (ert--results-test-at-point-no-redefinition t)))
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
;;; Actions on load/unload.
|
|
|
|
|
2018-01-23 03:00:55 +00:00
|
|
|
(require 'help-mode)
|
|
|
|
(add-to-list 'describe-symbol-backends
|
|
|
|
`("ERT test" ,#'ert-test-boundp
|
|
|
|
,(lambda (s _b _f) (ert-describe-test s))))
|
|
|
|
|
2017-10-15 15:38:21 +00:00
|
|
|
(add-to-list 'find-function-regexp-alist '(ert--test . ert--find-test-regexp))
|
2011-01-12 16:08:24 +00:00
|
|
|
(add-to-list 'minor-mode-alist '(ert--current-run-stats
|
|
|
|
(:eval
|
|
|
|
(ert--tests-running-mode-line-indicator))))
|
2015-05-13 22:39:49 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-hook #'ert--activate-font-lock-keywords)
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
(defun ert--unload-function ()
|
|
|
|
"Unload function to undo the side-effects of loading ert.el."
|
|
|
|
(ert--remove-from-list 'find-function-regexp-alist 'ert-deftest :key #'car)
|
|
|
|
(ert--remove-from-list 'minor-mode-alist 'ert--current-run-stats :key #'car)
|
|
|
|
(ert--remove-from-list 'emacs-lisp-mode-hook
|
|
|
|
'ert--activate-font-lock-keywords)
|
|
|
|
nil)
|
|
|
|
|
2018-01-23 03:00:55 +00:00
|
|
|
(defvar ert-unload-hook ())
|
2015-05-13 22:39:49 +00:00
|
|
|
(add-hook 'ert-unload-hook #'ert--unload-function)
|
2011-01-12 16:08:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
(provide 'ert)
|
|
|
|
|
|
|
|
;;; ert.el ends here
|