summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
Commit message (Collapse)AuthorAgeFilesLines
* Edebug: Overload `edebug-form-spec` even lessStefan Monnier2021-02-122-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `edebug-form-spec` symbol property was used both to map forms's head symbol to the corresponding spec, and to map spec element names to their expansion. This lead to name conflicts which break instrumentation of examples such as (cl-flet ((gate (x) x)) (gate 4)) because of the Edebug spec element `gate`. So introduce a new symbol property `edebug-elem-spec`. * lisp/subr.el (def-edebug-elem-spec): New function. * lisp/emacs-lisp/edebug.el (edebug--get-elem-spec): New function. (edebug-match-symbol): Use it. (Core Edebug elems): Put them on `edebug-elem-spec` instead of `edebug-form-spec`. (ELisp special forms): Set their `edebug-form-spec` via dolist. (Other non-core Edebug elems): Use `def-edebug-elem-spec`. (edebug-\`): Use `declare`. * lisp/emacs-lisp/pcase.el (pcase-PAT, pcase-FUN, pcase-QPAT): * lisp/skeleton.el (skeleton-edebug-spec): * lisp/emacs-lisp/cl-macs.el: Use `def-edebug-elem-spec`. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests--conflicting-internal-names): New test. * test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el (edebug-test-code-cl-flet1): New test case. * doc/lispref/edebug.texi (Specification List): Add `def-edebug-elem-spec`. (Specification Examples): Use it. * doc/lispref/loading.texi (Hooks for Loading): Avoid the use of `def-edebug-spec` in example (better use `debug` declaration).
* * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): Break cyclesStefan Monnier2021-02-101-0/+36
| | | | * test/lisp/emacs-lisp/macroexp-tests.el: New file.
* Fix local defvar scoping error (bug#46387)Mattias Engdegård2021-02-101-0/+31
| | | | | | | | | | | | This bug was introduced by the lexical variable constant propagation mechanism. It was discovered by Michael Heerdegen. * lisp/emacs-lisp/byte-opt.el (byte-optimize-let-form) (byte-optimize-body): Let the effects of a local defvar declaration be scoped by let and let*, not any arbitrary Lisp expression body (such as progn). * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--get-vars) (bytecomp-local-defvar): New test.
* ; Minor license statement fixesStefan Kangas2021-02-0811-99/+103
|
* Constprop of lexical variablesMattias Engdegård2021-02-061-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | Lexical variables bound to a constant value (symbol, number or string) are substituted at their point of use and the variable then eliminated if possible. Example: (let ((x (+ 2 3))) (f x)) => (f 5) This reduces code size, eliminates stack operations, and enables further optimisations. The implementation is conservative, and is strongly curtailed by the presence of variable mutation, conditions and loops. * lisp/emacs-lisp/byte-opt.el (byte-optimize-enable-variable-constprop) (byte-optimize-warn-eliminated-variable): New constants. (byte-optimize--lexvars, byte-optimize--vars-outside-condition) (byte-optimize--vars-outside-loop, byte-optimize--dynamic-vars): New dynamic variables. (byte-optimize--substitutable-p, byte-optimize-let-form): New functions. (byte-optimize-form-code-walker): Adapt clauses for variable constprop, and add clauses for 'setq' and 'defvar'. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-var) (bytecomp-test-get-var, bytecomp-test-identity) (byte-opt-testsuite-arith-data): Add test cases.
* Fix recently uncovered 'make check' failuresBasil L. Contovounesios2021-01-232-21/+11
| | | | | | | | | | | | | | | | | | For discussion, see the following thread: https://lists.gnu.org/r/emacs-devel/2021-01/msg01111.html * test/lisp/autorevert-tests.el (auto-revert-test07-auto-revert-several-buffers): * test/lisp/emacs-lisp/seq-tests.el (test-seq-do-indexed) (test-seq-random-elt-take-all): Fix errors from using add-to-list on lexical variables. * test/lisp/emacs-lisp/cl-lib-tests.el (cl-lib-defstruct-record): Expect test to succeed when byte-compiled following change of 2021-01-23 'Fix missing file&line info in "Unknown defun property" warnings'. (cl-lib-tests--dummy-function): Remove; no longer needed. (old-struct): Silence byte-compiler warning about unused lexical variable.
* Fix spurious "Lexical argument shadows the dynamic variable" due to inliningStefan Monnier2021-01-213-0/+27
| | | | | | | | | | | | | | | | | | | Before this patch doing: rm lisp/calendar/calendar.elc make lisp/calendar/cal-hebrew.elc would spew out lots of spurious such warnings about a `date` argument, pointing to code which has no `date` argument in sight. This was because that code had calls to inlinable functions (taking a `date` argument) defined in `calendar.el`, and while `date` is a normal lexical var at the site of those functions' definitions, it was declared as dynbound at the call site. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Don't impose our local context onto the inlined function. * test/lisp/emacs-lisp/bytecomp-tests.el: Add matching test.
* * lisp/emacs-lisp/pcase.el: Add support for `not` to `pred`Stefan Monnier2021-01-161-0/+4
| | | | | | | | | | | | | (pcase--split-pred, pcase--funcall): Adjust for `not`. (pcase--get-macroexpander): New function. (pcase--edebug-match-macro, pcase--make-docstring) (pcase--macroexpand): Use it. * lisp/emacs-lisp/radix-tree.el (radix-tree-leaf): Use it! * doc/lispref/control.texi (The @code{pcase} macro): Document it. * lisp/emacs-lisp/ert.el (ert--explain-equal-rec): Remove redundant test.
* Fix two testsEli Zaretskii2021-01-161-2/+2
| | | | | | | | | | * test/lisp/progmodes/elisp-mode-tests.el (xref-elisp-test-run): Make sure file names can be compared as strings, by running them through 'file-truename'. Reported by Vin Shelton <acs@alumni.princeton.edu>. * test/lisp/emacs-lisp/bytecomp-tests.el ("warn-obsolete-hook.el") ("warn-obsolete-variable.el"): Use [^z-a] to match a newline as well. Reported by Vin Shelton <acs@alumni.princeton.edu>.
* Prefer skip-unless in more testsStefan Kangas2021-01-131-2/+2
| | | | | | * test/lisp/emacs-lisp/timer-tests.el (timer-tests-debug-timer-check): * test/src/decompress-tests.el (zlib--decompress): * test/src/xml-tests.el (libxml-tests): Prefer skip-unless.
* * lisp/emacs-lisp/cl-macs.el: Optimize self-calls in tail positionStefan Monnier2021-01-081-1/+16
| | | | | | | | | | | | | | | | | | | Implement a limited form of tail-call optimization for the special case of recursive functions defined with `cl-labels`. Only self-recursion is optimized, no attempt is made to handle more complex cases such a mutual recursion. The main benefit is to reduce the use of the stack, tho in my limited tests, this can also improve performance (about half of the way to a hand-written `while` loop). (cl--self-tco): New function. (cl-labels): Use it. * lisp/subr.el (letrec): Optimize single-binding corner case. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Add tests to check that TCO is working.
* * lisp/subr.el (letrec): Optimize some non-recursive bindingsStefan Monnier2021-01-081-0/+8
| | | | | | | | * lisp/emacs-lisp/macroexp.el (macroexp--fgrep): Look inside bytecode objects as well. * test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): * test/lisp/subr-tests.el (subr--tests-letrec): New tests.
* Fix obsolete variable warnings about class namesMichael Heerdegen2021-01-062-0/+10
| | | | | | | | | | | * lisp/emacs-lisp/eieio-core.el (eieio-defclass-autoload): Try to make the wording of the warning about the obsoleted variable less confusing. * lisp/emacs-lisp/bytecomp.el (byte-compile-check-variable): Don't warn for lexical variables (Bug#39169). Fix spurious `or'. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp/warn-obsolete-variable-bound\.el): New test. * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-bound.el: New file.
* Update copyright year to 2021Paul Eggert2021-01-0159-59/+59
| | | | Run "TZ=UTC0 admin/update-copyright".
* Add some tests to find-func.elDaniel Martín2020-12-311-0/+63
|
* Fix package tests for tetris no longer existing as a packageGlenn Morris2020-12-281-3/+3
| | | | | | * test/lisp/emacs-lisp/package-tests.el (package-test-list-filter-by-name, package-test-list-clear-filter): Use ansi-color instead of tetris, which no longer has a version:.
* Make byte-compiler warn about wide docstringsStefan Kangas2020-12-2816-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile--wide-docstring-p): (byte-compile-docstring-length-warn): New defuns. (byte-compile-docstring-max-column): New defcustom. (byte-compile--wide-docstring-substitution-len): New variable. (byte-compile-warning-types, byte-compile-warnings): New value 'docstrings'. (byte-compile-file-form-autoload, byte-compile-file-form-defvar): (byte-compile-file-form-defvar-function, byte-compile-lambda): (byte-compile-defvar, byte-compile-file-form-defalias): Warn about too wide docstrings. (Bug#44858) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wide-docstring/defconst) (bytecomp-warn-wide-docstring/defvar): New tests. (bytecomp--define-warning-file-test): New macro. (bytecomp/warn-wide-docstring-autoload\.el) (bytecomp/warn-wide-docstring-custom-declare-variable\.el) (bytecomp/warn-wide-docstring-defalias\.el) (bytecomp/warn-wide-docstring-defconst\.el) (bytecomp/warn-wide-docstring-define-abbrev-table\.el) (bytecomp/warn-wide-docstring-define-obsolete-function-alias\.el) (bytecomp/warn-wide-docstring-define-obsolete-variable-alias\.el) (bytecomp/warn-wide-docstring-defun\.el) (bytecomp/warn-wide-docstring-defvar\.el) (bytecomp/warn-wide-docstring-defvaralias\.el) (bytecomp/warn-wide-docstring-ignore-fill-column\.el) (bytecomp/warn-wide-docstring-ignore-override\.el) (bytecomp/warn-wide-docstring-ignore\.el) (bytecomp/warn-wide-docstring-multiline-first\.el) (bytecomp/warn-wide-docstring-multiline\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-autoload.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-custom-declare-variable.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defalias.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defconst.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-abbrev-table.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-obsolete-function-alias.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-define-obsolete-variable-alias.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defun.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defvar.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-defvaralias.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-fill-column.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore-override.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-ignore.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-multiline-first.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-wide-docstring-multiline.el: New files.
* Improve "find definition" in *Help* buffersDaniel Martín2020-12-271-0/+10
| | | | | | | | | * lisp/emacs-lisp/find-func.el (find-function-search-for-symbol): If our regexp algorithm could not find a location for the symbol definition, resort to find-function--search-by-expanding-macros. * test/lisp/emacs-lisp/find-func-tests.el: Add a automatic test for a function and variable generated by a macro. * etc/NEWS: Advertise the improved functionality (bug#45443).
* Allow `string-limit' to work on encoded stringsLars Ingebrigtsen2020-12-251-0/+20
| | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/subr-x.el (string-limit): Allow limiting on encoded strings.
* Remove `string-slice' -- it's not very well definedLars Ingebrigtsen2020-12-251-8/+0
| | | | | | * doc/lispref/strings.texi (Creating Strings): Ditto. * lisp/emacs-lisp/subr-x.el (string-slice): Remove.
* Allow string-slice to take zero-length matchesLars Ingebrigtsen2020-12-231-1/+3
| | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Allow zero-length matches. Code adapted from s.el by Magnar Sveen.
* Make string-pad take an optional START parameterLars Ingebrigtsen2020-12-221-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-pad): Alter the calling convention.
* Change the string-limit parameter semanticsLars Ingebrigtsen2020-12-221-3/+4
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Alter the calling convention.
* Further string-clean-whitespace tweaksLars Ingebrigtsen2020-12-221-1/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-clean-whitespace): Put \r back, which was mistakenly removed.
* Add string-chop-newlineLars Ingebrigtsen2020-12-211-0/+5
| | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/subr-x.el (string-chop-newline): Add new function.
* Fix shorter-than-length case for string-limitLars Ingebrigtsen2020-12-211-0/+1
| | | | | * lisp/emacs-lisp/subr-x.el (string-limit): Fix shorter-than-length case.
* Rename slice-string to string-sliceLars Ingebrigtsen2020-12-211-5/+5
| | | | | * lisp/emacs-lisp/subr-x.el (string-slice): Rename from slice-string. * doc/lispref/strings.texi (Creating Strings): Ditto.
* Add `string-pad'Lars Ingebrigtsen2020-12-211-0/+6
| | | | | | | * doc/lispref/strings.texi (Creating Strings): Document it. * lisp/emacs-lisp/shortdoc.el (string): Add example. * lisp/emacs-lisp/subr-x.el (string-pad): New function.
* Beef up the Emacs string utility set a bitLars Ingebrigtsen2020-12-211-0/+26
| | | | | | | | | * doc/lispref/strings.texi (Modifying Strings): Document them. * lisp/emacs-lisp/shortdoc.el (string): Add examples. * lisp/emacs-lisp/subr-x.el (string-clean-whitespace) (string-fill, string-limit, string-lines, slice-string): New functions.
* Ensure that byte compilation works for relative files (Bug#45287).Philipp Stephani2020-12-171-0/+15
| | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don’t fail if target filename doesn’t contain a directory name. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--target-file-no-directory): New unit test.
* Byte compilation: handle case where the output file is a mountpoint.Philipp Stephani2020-12-131-0/+69
| | | | | | | | | | | | | | See Bug#44631. While testing for a readonly output directory has slightly different semantics, in practice they should cover cases where Emacs is sandboxed and can only write to the destination file, not its directory. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Handle the case where the output directory is not writable. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--not-writable-directory) (bytecomp-tests--dest-mountpoint): New unit tests.
* Fix copyright lineLars Ingebrigtsen2020-12-111-2/+5
|
* Add a new command `memory-report'Lars Ingebrigtsen2020-12-111-0/+54
| | | | | * doc/lispref/internals.texi (Garbage Collection): Document it. * lisp/emacs-lisp/memory-report.el: New package.
* Prefer setq-local in testsStefan Kangas2020-12-081-2/+2
| | | | | | | | | | * test/lisp/allout-tests.el (allout-test-resumption-prior-value-resumed) (allout-test-resumption-multiple-holds) (allout-test-resumption-unbinding): * test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el (faceup-test-mode): * test/lisp/epg-tests.el (with-epg-tests): * test/src/data-tests.el (binding-test-buffer-A): Prefer setq-local.
* Fix bug in how ERT invokes its debugger.Philipp Stephani2020-12-071-0/+10
| | | | | | | | | | | | | | | The debugger needs to receive a list of the error symbol and data; cf. the documentation of the `debugger' variable. This bug manifested itself in ERT forms such as (should (integerp (ert-fail "Boo"))), which resulted in an incorrect condition object. Note that forms such as (should (ert-fail "Boo")) weren't affected because they wouldn't use the `ert--should-signal-hook'. * test/emacs-lisp/ert.el (ert--should-signal-hook): Call debugger with the right arguments. * test/lisp/emacs-lisp/ert-tests.el (ert-test-fail-inside-should): Add unit test.
* Unbreak a few unit tests that rely on lack of backtracesPhilipp Stephani2020-12-072-4/+12
| | | | | | | * test/lisp/emacs-lisp/gv-tests.el (gv-dont-define-expander-in-file) (gv-dont-define-expander-other-file): * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-with-default-config): Suppress backtraces in batch mode to unbreak unit tests.
* Add tests for several byte-compiler warningsStefan Kangas2020-12-0317-2/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp/warn-autoload-not-on-top-level\.el) (bytecomp/warn-callargs\.el) (bytecomp/warn-defcustom-nogroup\.el) (bytecomp/warn-defcustom-notype\.el) (bytecomp/warn-defvar-lacks-prefix\.el) (bytecomp/warn-format\.el) (bytecomp/warn-lambda-malformed-interactive-spec\.el) (bytecomp/warn-make-variable-buffer-local\.el) (bytecomp/warn-redefine-defun-as-macro\.el) (bytecomp/warn-redefine-defun\.el) (bytecomp/warn-redefine-macro-as-defun\.el) (bytecomp/warn-save-excursion\.el) (bytecomp/warn-variable-let-bind-constant\.el) (bytecomp/warn-variable-let-bind-nonvariable\.el) (bytecomp/warn-variable-set-constant\.el) (bytecomp/warn-variable-set-nonvariable\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-autoload-not-on-top-level.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-callargs.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-defcustom-nogroup.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-defcustom-notype.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-defvar-lacks-prefix.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-format.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-lambda-malformed-interactive-spec.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-make-variable-buffer-local.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-defun-as-macro.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-defun.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-redefine-macro-as-defun.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-save-excursion.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-let-bind-constant.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-let-bind-nonvariable.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-constant.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-variable-set-nonvariable.el: * test/lisp/emacs-lisp/bytecomp-tests.el: New files.
* Improve sectioning in bytecomp-tests.elStefan Kangas2020-12-021-10/+16
| | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el: Add section comments. (test-eager-load-macro-expansion) (test-eager-load-macro-expansion-eval-and-compile): Move definitions.
* Fix byte-compiler warning for failed uses of lexical varsStefan Kangas2020-12-017-3/+44
| | | | | | | | | | | | | | | | | | | | | * lisp/emacs-lisp/bytecomp.el (byte-compile-form): Fix byte-compiler warning for failed uses of lexical vars. (Bug#44980) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--define-warning-file-test): Don't prefix tests with 'warn'. (bytecomp/error-lexical-var-with-add-hook\.el) (bytecomp/error-lexical-var-with-remove-hook\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-failure\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-success\.el) (bytecomp/error-lexical-var-with-run-hook-with-args\.el) (bytecomp/error-lexical-var-with-symbol-value\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el: New files.
* Add tests for some byte-compiler warningsStefan Kangas2020-12-016-0/+49
| | | | | | | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn/warn-interactive-only\.el) (bytecomp-warn/warn-obsolete-defun\.el) (bytecomp-warn/warn-obsolete-hook\.el) (bytecomp-warn/warn-obsolete-variable-same-file\.el) (bytecomp-warn/warn-obsolete-variable\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-interactive-only.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-defun.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-hook.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable-same-file.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-obsolete-variable.el: New files.
* Test byte-compiler free variable warningStefan Kangas2020-11-303-0/+20
| | | | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (ert-x): Require. (bytecomp--define-warning-file-test): New macro. (bytecomp-warn/warn-free-setq\.el) (bytecomp-warn/warn-free-variable-reference\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el: * test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el: New files.
* Add a (broken) unit test to exemplify Bug#11218.Philipp Stephani2020-11-241-0/+5
| | | | | * test/lisp/emacs-lisp/ert-tests.el (ert-test-with-demoted-errors): New (broken) unit test.
* Test for byte-compiler warning "variable lacks prefix"Stefan Kangas2020-11-221-10/+16
| | | | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--with-warning-test): New macro. (bytecomp-warn-wrong-args, bytecomp-warn-wrong-args-subr): Use above new macro. (bytecomp-warn-variable-lacks-prefix): New test.
* Test interactive-only spec of with-suppressed-warningsStefan Kangas2020-11-221-0/+6
| | | | | | * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test--with-suppressed-warnings): Test suppressing warning with interactive-only.
* Better warning suppression in rx-testsMattias Engdegård2020-11-091-1/+1
| | | | | | * test/lisp/emacs-lisp/rx-tests.el (rx-compat): Use with-no-warnings instead of with-suppressed-warnings which complains when running the test interactively.
* Fix pcase rx form snag with '?' and '??' (bug#44532)Mattias Engdegård2020-11-091-1/+5
| | | | | | | | This is a regression from Emacs 26. Reported by Phillip Stephani. * lisp/emacs-lisp/rx.el (rx--pcase-transform): Process ? and ?? correctly. * test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add test case.
* ; Silence byte-compiler warnings in testsStefan Kangas2020-11-051-12/+13
| | | | | | * test/lisp/emacs-lisp/easy-mmode-tests.el (easy-mmode--minor-mode): * test/lisp/progmodes/cperl-mode-tests.el (cperl-bug30393): Silence byte-compiler.
* Partially revert previous define-minor-mode changeLars Ingebrigtsen2020-11-021-8/+2
| | | | | | | * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Only document the values we want to support, not the ones we actually support. (define-minor-mode): Partially revert to previous behaviour.
* Make minor mode ARG work as documentedLars Ingebrigtsen2020-11-011-0/+21
| | | | | | | | * lisp/emacs-lisp/easy-mmode.el (easy-mmode--arg-docstring): Clarify when minor modes are switched on/off when called from lisp (bug#44341). (define-minor-mode): Make calls from Lisp switch the mode on/off as documented.
* 'assoc' is not side-effect-free; constprop its pure subsetMattias Engdegård2020-10-311-1/+6
| | | | | | | | | | | Since a supplied test function can do anything, assoc is not side-effect-free (bug#44018). However, with only two arguments it is pure and should be optimised accordingly. * lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'. (byte-optimize-assoc): Constant-propagate through 2-arg assoc calls. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases.